diff --git a/memmap.cpp b/memmap.cpp index b33fe335..291487a3 100644 --- a/memmap.cpp +++ b/memmap.cpp @@ -3950,7 +3950,7 @@ static bool8 ReadUPSPatch (Stream *r, long, int32 &rom_size) uint32 py_crc32 = (data[size - 8] << 0) + (data[size - 7] << 8) + (data[size - 6] << 16) + (data[size - 5] << 24); uint32 pp_crc32 = (data[size - 4] << 0) + (data[size - 3] << 8) + (data[size - 2] << 16) + (data[size - 1] << 24); if(patch_crc32 != pp_crc32) { delete[] data; return false; } //patch is corrupted - if((rom_crc32 != px_crc32) && (rom_crc32 != py_crc32)) { delete[] data; return false; } //patch is for a different ROM + if(!Settings.IgnorePatchChecksum && (rom_crc32 != px_crc32) && (rom_crc32 != py_crc32)) { delete[] data; return false; } //patch is for a different ROM uint32 px_size = XPSdecode(data, addr, size); uint32 py_size = XPSdecode(data, addr, size); @@ -3977,7 +3977,8 @@ static bool8 ReadUPSPatch (Stream *r, long, int32 &rom_size) delete[] data; uint32 out_crc32 = caCRC32(Memory.ROM, rom_size); - if(((rom_crc32 == px_crc32) && (out_crc32 == py_crc32)) + if(Settings.IgnorePatchChecksum + || ((rom_crc32 == px_crc32) && (out_crc32 == py_crc32)) || ((rom_crc32 == py_crc32) && (out_crc32 == px_crc32)) ) { return true; @@ -4032,7 +4033,7 @@ static bool8 ReadBPSPatch (Stream *r, long, int32 &rom_size) uint32 target_crc32 = (data[size - 8] << 0) + (data[size - 7] << 8) + (data[size - 6] << 16) + (data[size - 5] << 24); uint32 pp_crc32 = (data[size - 4] << 0) + (data[size - 3] << 8) + (data[size - 2] << 16) + (data[size - 1] << 24); if(patch_crc32 != pp_crc32) { delete[] data; return false; } //patch is corrupted - if(rom_crc32 != source_crc32) { delete[] data; return false; } //patch is for a different ROM + if(!Settings.IgnorePatchChecksum && rom_crc32 != source_crc32) { delete[] data; return false; } //patch is for a different ROM uint32 source_size = XPSdecode(data, addr, size); uint32 target_size = XPSdecode(data, addr, size); @@ -4083,7 +4084,7 @@ static bool8 ReadBPSPatch (Stream *r, long, int32 &rom_size) delete[] data; uint32 out_crc32 = caCRC32(patched_rom, target_size); - if(out_crc32 == target_crc32) { + if(Settings.IgnorePatchChecksum || out_crc32 == target_crc32) { memcpy(Memory.ROM, patched_rom, target_size); rom_size = target_size; delete[] patched_rom; diff --git a/snes9x.h b/snes9x.h index 10f57ec2..bb846f6a 100644 --- a/snes9x.h +++ b/snes9x.h @@ -456,6 +456,7 @@ struct SSettings bool8 ApplyCheats; bool8 NoPatch; + bool8 IgnorePatchChecksum; int32 AutoSaveDelay; bool8 DontSaveOopsSnapshot; bool8 UpAndDown; diff --git a/win32/wconfig.cpp b/win32/wconfig.cpp index 6855e10f..ca442ae4 100644 --- a/win32/wconfig.cpp +++ b/win32/wconfig.cpp @@ -986,6 +986,7 @@ void WinRegisterConfigItems() #define CATEGORY "ROM" AddBoolC("Cheat", Settings.ApplyCheats, true, "true to allow enabled cheats to be applied"); AddInvBoolC("Patch", Settings.NoPatch, true, "true to allow IPS/UPS patches to be applied (\"soft patching\")"); + AddBoolC("IgnorePatchChecksum", Settings.IgnorePatchChecksum, false, "true to allow BPS patches to be applied even if the checksum fails"); AddBoolC("BS", Settings.BS, false, "Broadcast Satellaview emulation"); #undef CATEGORY #ifdef NETPLAY_SUPPORT