From c35bf93f3daf5fed4e9f63e1da8c00426abcf2e0 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 10 Nov 2015 04:07:03 +0100 Subject: Remove some unused variables --- src/gfx16.c | 59 +--------------------------- src/memmap.c | 117 +------------------------------------------------------- src/mode7.c | 5 --- src/mode7_t.h | 1 - src/mode7new.c | 4 -- src/mode7prio.c | 5 --- src/snapshot.c | 5 --- 7 files changed, 3 insertions(+), 193 deletions(-) diff --git a/src/gfx16.c b/src/gfx16.c index 86e653d..3bea6c6 100644 --- a/src/gfx16.c +++ b/src/gfx16.c @@ -104,8 +104,6 @@ const int tx_table[16] = #define M8 19 void ComputeClipWindows(); -static void S9xDisplayFrameRate(); -static void S9xDisplayString(const char* string); extern uint8 BitShifts[8][4]; extern uint8 TileShifts[8][4]; @@ -1589,19 +1587,10 @@ void DrawBackgroundMode5(uint32 BGMODE, uint32 bg, uint8 Z1, uint8 Z2) if (((uint8*)SC3 - Memory.VRAM) >= 0x10000) SC3 -= 0x08000; int Lines; - int VOffsetMask; - int VOffsetShift; + int VOffsetShift = 3; if (BG.TileSize == 16) - { - VOffsetMask = 0x3ff; VOffsetShift = 4; - } - else - { - VOffsetMask = 0x1ff; - VOffsetShift = 3; - } int endy = GFX.EndY; int Y; @@ -2538,52 +2527,6 @@ void DisplayChar(uint8* Screen, uint8 c) } } -static void S9xDisplayFrameRate() -{ - uint8* Screen = GFX.Screen + 2 + - (IPPU.RenderedScreenHeight - font_height - 1) * GFX_PITCH; - char string [10]; - int len = 5; - - sprintf(string, "%02d/%02d", IPPU.DisplayedRenderedFrameCount, - (int) Memory.ROMFramesPerSecond); - - int i; - for (i = 0; i < len; i++) - { - DisplayChar(Screen, string [i]); - Screen += (font_width - 1) * sizeof(uint16); - } -} - -static void S9xDisplayString(const char* string) -{ - uint8* Screen = GFX.Screen + 2 + - (IPPU.RenderedScreenHeight - font_height * 5) * GFX_PITCH; - int len = strlen(string); - int max_chars = IPPU.RenderedScreenWidth / (font_width - 1); - int char_count = 0; - int i; - - for (i = 0; i < len; i++, char_count++) - { - if (char_count >= max_chars || string [i] < 32) - { - Screen -= (font_width - 1) * sizeof(uint16) * max_chars; - Screen += font_height * GFX_PITCH; - if (Screen >= GFX.Screen + GFX_PITCH * IPPU.RenderedScreenHeight) - break; - char_count -= max_chars; - } - if (string [i] < 32) - continue; - DisplayChar(Screen, string [i]); - Screen += (font_width - 1) * sizeof(uint16); - } -} - -// -x- - static void S9xUpdateScreenTransparency() // ~30-50ms! (called from FLUSH_REDRAW()) { uint32 starty = GFX.StartY; diff --git a/src/memmap.c b/src/memmap.c index eecb7bb..4861510 100644 --- a/src/memmap.c +++ b/src/memmap.c @@ -418,12 +418,8 @@ again: "Found multiple ROM file headers (and ignored them)."); } - CheckForIPSPatch (filename, Memory.HeaderCount != 0, &TotalFileSize); - int orig_hi_score, orig_lo_score; - int hi_score, lo_score; - - orig_hi_score = hi_score = ScoreHiROM (FALSE); - orig_lo_score = lo_score = ScoreLoROM (FALSE); + int hi_score = ScoreHiROM (FALSE); + int lo_score = ScoreLoROM (FALSE); if (Memory.HeaderCount == 0 && !Settings.ForceNoHeader && ((hi_score > lo_score && ScoreHiROM (TRUE) > hi_score) || @@ -2601,115 +2597,6 @@ if (ROM [adr] == ov) \ } -// Read variable size MSB int from a file -static long ReadInt (FILE *f, unsigned nbytes) -{ - long v = 0; - while (nbytes--) - { - int c = fgetc(f); - if (c == EOF) - return -1; - v = (v << 8) | (c & 0xFF); - } - return (v); -} - -#define IPS_EOF 0x00454F46l - -void CheckForIPSPatch (const char *rom_filename, bool8_32 header, - int32* rom_size) -{ - char dir [_MAX_DIR + 1]; - char drive [_MAX_DRIVE + 1]; - char name [_MAX_FNAME + 1]; - char ext [_MAX_EXT + 1]; - char fname [_MAX_PATH + 1]; - FILE *patch_file = NULL; - long offset = header ? 512 : 0; - - if (!(patch_file = fopen(S9xGetFilename (".ips"), "rb"))) return; - - if (fread (fname, 1, 5, patch_file) != 5 || strncmp (fname, "PATCH", 5) != 0) - { - fclose (patch_file); - return; - } - - int32 ofs; - - for (;;) - { - long len; - long rlen; - int rchar; - - ofs = ReadInt (patch_file, 3); - if (ofs == -1) - goto err_eof; - - if (ofs == IPS_EOF) - break; - - ofs -= offset; - - len = ReadInt (patch_file, 2); - if (len == -1) - goto err_eof; - - /* Apply patch block */ - if (len) - { - if (ofs + len > MAX_ROM_SIZE) - goto err_eof; - - while (len--) - { - rchar = fgetc (patch_file); - if (rchar == EOF) - goto err_eof; - Memory.ROM [ofs++] = (uint8) rchar; - } - if (ofs > *rom_size) - *rom_size = ofs; - } - else - { - rlen = ReadInt (patch_file, 2); - if (rlen == -1) - goto err_eof; - - - rchar = fgetc (patch_file); - if (rchar == EOF) - goto err_eof; - - if (ofs + rlen > MAX_ROM_SIZE) - goto err_eof; - - while (rlen--) - Memory.ROM [ofs++] = (uint8) rchar; - - if (ofs > *rom_size) - *rom_size = ofs; - } - } - - // Check if ROM image needs to be truncated - ofs = ReadInt (patch_file, 3); - if (ofs != -1 && ofs - offset < *rom_size) - { - // Need to truncate ROM image - *rom_size = ofs - offset; - } - fclose (patch_file); - return; - -err_eof: - if (patch_file) - fclose (patch_file); -} - const uint32 crc32Table[256] = { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, diff --git a/src/mode7.c b/src/mode7.c index 85ab084..48918df 100644 --- a/src/mode7.c +++ b/src/mode7.c @@ -60,8 +60,6 @@ void DrawBGMode7Background16(uint8* Screen, int bg, int depth) void DrawBGMode7Background16R3(uint8* Screen, int bg, int depth) { - - uint8* VRAM1 = Memory.VRAM + 1; int aa, cc; int startx; uint32 Left = 0; @@ -83,7 +81,6 @@ void DrawBGMode7Background16R3(uint8* Screen, int bg, int depth) int DD; uint32 Line; uint32 clip; - uint8 b; uint8* Depth; if (!ClipCount) ClipCount = 1; @@ -324,7 +321,6 @@ void DrawBGMode7Background16R1R2(uint8* Screen, int bg, int depth) int DD; uint32 Line; uint32 clip; - uint8 b; uint32 AndByY; uint32 AndByX = 0xffffffff; if (Settings.Dezaemon && PPU.Mode7Repeat == 2) AndByX = 0x7ff; @@ -448,7 +444,6 @@ void DrawBGMode7Background16R1R2(uint8* Screen, int bg, int depth) void DrawBGMode7Background16R0(uint8* Screen, int bg, int depth) { - uint8* VRAM1 = Memory.VRAM + 1; int aa, cc; int startx; uint32 Left; diff --git a/src/mode7_t.h b/src/mode7_t.h index 33552aa..cc36915 100644 --- a/src/mode7_t.h +++ b/src/mode7_t.h @@ -230,7 +230,6 @@ static void DrawBGMode7Background16R1R2(uint8* Screen, int bg, int depth) int DD; uint32 Line; uint32 clip; - uint8 b; uint32 AndByY; uint32 AndByX = 0xffffffff; if (Settings.Dezaemon && PPU.Mode7Repeat == 2) AndByX = 0x7ff; diff --git a/src/mode7new.c b/src/mode7new.c index 0ae5c34..af493d2 100644 --- a/src/mode7new.c +++ b/src/mode7new.c @@ -53,7 +53,6 @@ void DrawBGMode7Background16New(uint8* Screen) void DrawBGMode7Background16NewR3(uint8* Screen) { - uint8* VRAM1 = Memory.VRAM + 1; int aa, cc; int startx; uint32 Left = 0; @@ -287,7 +286,6 @@ void DrawBGMode7Background16NewR1R2(uint8* Screen) int DD; uint32 Line; uint32 clip; - uint8 b; uint32 AndByY; uint32 AndByX = 0xffffffff; if (Settings.Dezaemon && PPU.Mode7Repeat == 2) AndByX = 0x7ff; @@ -397,7 +395,6 @@ void DrawBGMode7Background16NewR1R2(uint8* Screen) void DrawBGMode7Background16NewR0(uint8* Screen) { - uint8* VRAM1 = Memory.VRAM + 1; int aa, cc; int startx; uint32 Left; @@ -409,7 +406,6 @@ void DrawBGMode7Background16NewR0(uint8* Screen) int32 CentreX; int32 CentreY; uint16* p; - uint8* z; int yy; int xx; int BB; diff --git a/src/mode7prio.c b/src/mode7prio.c index ef5b0c1..56f171b 100644 --- a/src/mode7prio.c +++ b/src/mode7prio.c @@ -61,8 +61,6 @@ void DrawBGMode7Background16Prio(uint8* Screen, int bg) void DrawBGMode7Background16PrioR3(uint8* Screen, int bg) { - - uint8* VRAM1 = Memory.VRAM + 1; int aa, cc; int startx; uint32 Left = 0; @@ -82,7 +80,6 @@ void DrawBGMode7Background16PrioR3(uint8* Screen, int bg) int DD; uint32 Line; uint32 clip; - uint8 b; uint8* Depth; uint32 depth = Mode7Depths[0] | (Mode7Depths[1] << 8); @@ -351,7 +348,6 @@ void DrawBGMode7Background16PrioR1R2(uint8* Screen, int bg) int DD; uint32 Line; uint32 clip; - uint8 b; uint32 AndByY; uint32 AndByX = 0xffffffff; if (Settings.Dezaemon && PPU.Mode7Repeat == 2) AndByX = 0x7ff; @@ -480,7 +476,6 @@ void DrawBGMode7Background16PrioR1R2(uint8* Screen, int bg) void DrawBGMode7Background16PrioR0(uint8* Screen, int bg) { - uint8* VRAM1 = Memory.VRAM + 1; int aa, cc; int startx; uint32 Left; diff --git a/src/snapshot.c b/src/snapshot.c index f9cb9c4..2b03383 100644 --- a/src/snapshot.c +++ b/src/snapshot.c @@ -39,11 +39,6 @@ * Nintendo Co., Limited and its subsidiary companies. */ -#ifndef __GP32__ -#include -#include -#include -#endif #if defined(__unix) || defined(__linux) || defined(__sun) || defined(__DJGPP) #include #include -- cgit v1.2.3