Add Settings.IsPatched to know if ROM was patched.

This commit is contained in:
Brandon Wright 2019-04-10 14:43:20 -05:00
parent c6facbdf4a
commit ac4d458f7b
9 changed files with 1774 additions and 1730 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1342,7 +1342,7 @@ Snes9xWindow::show_rom_info ()
"<i>Video:</i> %s\n"
"<i>CRC32:</i> %08X\n"
"<i>Revision:</i> %s"
"<b><i>%s</i></b>"),
"<b><i>%s%s</i></b>"),
Memory.ROMFilename,
Memory.ROMName,
Memory.ROMSpeed,
@ -1363,10 +1363,15 @@ Snes9xWindow::show_rom_info ()
"NTSC 60Hz" : "PAL 50Hz",
Memory.ROMCRC32,
Memory.Revision (),
(Settings.IsPatched) ? _("\n\nThis ROM has been patched with ") :
(Memory.ROMChecksum !=
Memory.CalculatedChecksum) ?
_("\n\nThis ROM has been modified or damaged")
: "");
: "",
Settings.IsPatched == 1 ? "IPS" :
Settings.IsPatched == 2 ? "BPS" :
Settings.IsPatched == 3 ? "UPS" :
"");
gtk_window_set_title (GTK_WINDOW (msg), _("File Information"));
gtk_dialog_run (GTK_DIALOG (msg));

View File

@ -1401,7 +1401,6 @@ bool8 CMemory::LoadROM (const char *filename)
if (!totalFileSize)
return (FALSE);
if (!Settings.NoPatch)
CheckForAnyPatch(filename, HeaderCount != 0, totalFileSize);
}
while(!LoadROMInt(totalFileSize));
@ -1678,7 +1677,6 @@ bool8 CMemory::LoadMultiCart (const char *cartA, const char *cartB)
if (Multi.cartSizeB) {
strcpy(Multi.fileNameB, cartB);
if(!Settings.NoPatch)
CheckForAnyPatch(cartB, HeaderCount != 0, Multi.cartSizeB);
Multi.cartOffsetB = 0x400000;
@ -1691,7 +1689,6 @@ bool8 CMemory::LoadMultiCart (const char *cartA, const char *cartB)
if (Multi.cartSizeA) {
strcpy(Multi.fileNameA, cartA);
if(!Settings.NoPatch)
CheckForAnyPatch(cartA, HeaderCount != 0, Multi.cartSizeA);
}
@ -2572,6 +2569,13 @@ void CMemory::InitROM (void)
SET_UI_COLOR(255, 255, 0);
}
// Use slight blue tint to indicate ROM was patched.
if (Settings.IsPatched)
{
Settings.DisplayColor = BUILD_PIXEL(26, 26, 31);
SET_UI_COLOR(216, 216, 255);
}
if (Multi.cartType == 4)
{
Settings.DisplayColor = BUILD_PIXEL(0, 16, 31);
@ -3806,6 +3810,7 @@ static bool8 ReadUPSPatch (Stream *r, long, int32 &rom_size)
|| ((rom_crc32 == px_crc32) && (out_crc32 == py_crc32))
|| ((rom_crc32 == py_crc32) && (out_crc32 == px_crc32))
) {
Settings.IsPatched = 3;
return true;
} else {
//technically, reaching here means that patching has failed.
@ -3913,6 +3918,7 @@ static bool8 ReadBPSPatch (Stream *r, long, int32 &rom_size)
memcpy(Memory.ROM, patched_rom, target_size);
rom_size = target_size;
delete[] patched_rom;
Settings.IsPatched = 2;
return true;
} else {
delete[] patched_rom;
@ -4013,6 +4019,7 @@ static bool8 ReadIPSPatch (Stream *r, long offset, int32 &rom_size)
if (ofs != -1 && ofs - offset < rom_size)
rom_size = ofs - offset;
Settings.IsPatched = 1;
return (1);
}
@ -4052,6 +4059,8 @@ static int unzFindExtension (unzFile &file, const char *ext, bool restart, bool
void CMemory::CheckForAnyPatch (const char *rom_filename, bool8 header, int32 &rom_size)
{
Settings.IsPatched = false;
if (Settings.NoPatch)
return;

View File

@ -297,6 +297,7 @@ struct SSettings
bool8 ApplyCheats;
bool8 NoPatch;
bool8 IgnorePatchChecksum;
bool8 IsPatched;
int32 AutoSaveDelay;
bool8 DontSaveOopsSnapshot;
bool8 UpAndDown;