mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-11-01 08:25:18 +01:00
Snes9x - Add Settings.IsPatched to know if ROM was patched. (#840)
This commit is contained in:
parent
11093a7e1a
commit
6fc9c9f96d
@ -492,6 +492,8 @@ DefaultSettings ()
|
|||||||
Settings.HDMATimingHack = 100;
|
Settings.HDMATimingHack = 100;
|
||||||
Settings.BlockInvalidVRAMAccessMaster = true;
|
Settings.BlockInvalidVRAMAccessMaster = true;
|
||||||
|
|
||||||
|
Settings.IsPatched = 0;
|
||||||
|
|
||||||
// Sound
|
// Sound
|
||||||
Settings.SoundSync = true;
|
Settings.SoundSync = true;
|
||||||
Settings.SixteenBitSound = true;
|
Settings.SixteenBitSound = true;
|
||||||
|
@ -1428,7 +1428,6 @@ bool8 CMemory::LoadROM (const char *filename)
|
|||||||
if (!totalFileSize)
|
if (!totalFileSize)
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
|
|
||||||
if (!Settings.NoPatch)
|
|
||||||
CheckForAnyPatch(filename, HeaderCount != 0, totalFileSize);
|
CheckForAnyPatch(filename, HeaderCount != 0, totalFileSize);
|
||||||
}
|
}
|
||||||
while(!LoadROMInt(totalFileSize));
|
while(!LoadROMInt(totalFileSize));
|
||||||
@ -1709,7 +1708,6 @@ bool8 CMemory::LoadMultiCart (const char *cartA, const char *cartB)
|
|||||||
if (Multi.cartSizeB) {
|
if (Multi.cartSizeB) {
|
||||||
strcpy(Multi.fileNameB, cartB);
|
strcpy(Multi.fileNameB, cartB);
|
||||||
|
|
||||||
if(!Settings.NoPatch)
|
|
||||||
CheckForAnyPatch(cartB, HeaderCount != 0, Multi.cartSizeB);
|
CheckForAnyPatch(cartB, HeaderCount != 0, Multi.cartSizeB);
|
||||||
|
|
||||||
Multi.cartOffsetB = 0x400000;
|
Multi.cartOffsetB = 0x400000;
|
||||||
@ -1722,7 +1720,6 @@ bool8 CMemory::LoadMultiCart (const char *cartA, const char *cartB)
|
|||||||
if (Multi.cartSizeA) {
|
if (Multi.cartSizeA) {
|
||||||
strcpy(Multi.fileNameA, cartA);
|
strcpy(Multi.fileNameA, cartA);
|
||||||
|
|
||||||
if(!Settings.NoPatch)
|
|
||||||
CheckForAnyPatch(cartA, HeaderCount != 0, Multi.cartSizeA);
|
CheckForAnyPatch(cartA, HeaderCount != 0, Multi.cartSizeA);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2603,6 +2600,13 @@ void CMemory::InitROM (void)
|
|||||||
SET_UI_COLOR(255, 255, 0);
|
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)
|
if (Multi.cartType == 4)
|
||||||
{
|
{
|
||||||
Settings.DisplayColor = BUILD_PIXEL(0, 16, 31);
|
Settings.DisplayColor = BUILD_PIXEL(0, 16, 31);
|
||||||
@ -3864,6 +3868,7 @@ static bool8 ReadUPSPatch (Stream *r, long, int32 &rom_size)
|
|||||||
|| ((rom_crc32 == px_crc32) && (out_crc32 == py_crc32))
|
|| ((rom_crc32 == px_crc32) && (out_crc32 == py_crc32))
|
||||||
|| ((rom_crc32 == py_crc32) && (out_crc32 == px_crc32))
|
|| ((rom_crc32 == py_crc32) && (out_crc32 == px_crc32))
|
||||||
) {
|
) {
|
||||||
|
Settings.IsPatched = 3;
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
//technically, reaching here means that patching has failed.
|
//technically, reaching here means that patching has failed.
|
||||||
@ -3971,6 +3976,7 @@ static bool8 ReadBPSPatch (Stream *r, long, int32 &rom_size)
|
|||||||
memcpy(Memory.ROM, patched_rom, target_size);
|
memcpy(Memory.ROM, patched_rom, target_size);
|
||||||
rom_size = target_size;
|
rom_size = target_size;
|
||||||
delete[] patched_rom;
|
delete[] patched_rom;
|
||||||
|
Settings.IsPatched = 2;
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
delete[] patched_rom;
|
delete[] patched_rom;
|
||||||
@ -4071,6 +4077,7 @@ static bool8 ReadIPSPatch (Stream *r, long offset, int32 &rom_size)
|
|||||||
if (ofs != -1 && ofs - offset < rom_size)
|
if (ofs != -1 && ofs - offset < rom_size)
|
||||||
rom_size = ofs - offset;
|
rom_size = ofs - offset;
|
||||||
|
|
||||||
|
Settings.IsPatched = 1;
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4110,6 +4117,8 @@ static int unzFindExtension (unzFile &file, const char *ext, bool restart, bool
|
|||||||
|
|
||||||
void CMemory::CheckForAnyPatch (const char *rom_filename, bool8 header, int32 &rom_size)
|
void CMemory::CheckForAnyPatch (const char *rom_filename, bool8 header, int32 &rom_size)
|
||||||
{
|
{
|
||||||
|
Settings.IsPatched = false;
|
||||||
|
|
||||||
if (Settings.NoPatch)
|
if (Settings.NoPatch)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -293,6 +293,7 @@ struct SSettings
|
|||||||
bool8 ApplyCheats;
|
bool8 ApplyCheats;
|
||||||
bool8 NoPatch;
|
bool8 NoPatch;
|
||||||
bool8 IgnorePatchChecksum;
|
bool8 IgnorePatchChecksum;
|
||||||
|
bool8 IsPatched;
|
||||||
int32 AutoSaveDelay;
|
int32 AutoSaveDelay;
|
||||||
bool8 DontSaveOopsSnapshot;
|
bool8 DontSaveOopsSnapshot;
|
||||||
bool8 UpAndDown;
|
bool8 UpAndDown;
|
||||||
|
Loading…
Reference in New Issue
Block a user