summaryrefslogtreecommitdiff
path: root/src/memmap.c
diff options
context:
space:
mode:
authortwinaphex2015-11-10 04:07:03 +0100
committertwinaphex2015-11-10 04:07:03 +0100
commitc35bf93f3daf5fed4e9f63e1da8c00426abcf2e0 (patch)
treedd18d79c9c1cacaf901c961df558fc0979de2c40 /src/memmap.c
parentc58c0dc40c1288b5fd5d9e06667e40afd6465a1d (diff)
downloadsnes9x2002-c35bf93f3daf5fed4e9f63e1da8c00426abcf2e0.tar.gz
snes9x2002-c35bf93f3daf5fed4e9f63e1da8c00426abcf2e0.tar.bz2
snes9x2002-c35bf93f3daf5fed4e9f63e1da8c00426abcf2e0.zip
Remove some unused variables
Diffstat (limited to 'src/memmap.c')
-rw-r--r--src/memmap.c117
1 files changed, 2 insertions, 115 deletions
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,