From b47c74744e1708a22f369992646a9cdb1698b5fe Mon Sep 17 00:00:00 2001 From: bladeoner Date: Sun, 7 Feb 2021 18:17:05 +0100 Subject: [PATCH 1/2] Snes9x - memmap: Add heuristic to detect Earthbound hack. (#962) --- source/snes9x/memmap.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/snes9x/memmap.cpp b/source/snes9x/memmap.cpp index 96167bd..bfaae86 100644 --- a/source/snes9x/memmap.cpp +++ b/source/snes9x/memmap.cpp @@ -1126,6 +1126,9 @@ int CMemory::ScoreHiROM (bool8 skip_header, int32 romoff) uint8 *buf = ROM + 0xff00 + romoff + (skip_header ? 0x200 : 0); int score = 0; + if (buf[0xd7] == 13 && CalculatedSize > 1024 * 1024 * 4) + score += 5; + if (buf[0xd5] & 0x1) score += 2; From ff20f95258a23d9428f5f0ada4d222da306bdcf5 Mon Sep 17 00:00:00 2001 From: bladeoner Date: Mon, 8 Feb 2021 16:47:39 +0100 Subject: [PATCH 2/2] Snes9x - memmap: Add a comment about the new hack detection. (#963) --- source/snes9x/memmap.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/snes9x/memmap.cpp b/source/snes9x/memmap.cpp index bfaae86..46540f0 100644 --- a/source/snes9x/memmap.cpp +++ b/source/snes9x/memmap.cpp @@ -1126,6 +1126,8 @@ int CMemory::ScoreHiROM (bool8 skip_header, int32 romoff) uint8 *buf = ROM + 0xff00 + romoff + (skip_header ? 0x200 : 0); int score = 0; + // Check for extended HiROM expansion used in Mother 2 Deluxe et al. + // Looks for size byte 13 (8MB) and an actual ROM size greater than 4MB if (buf[0xd7] == 13 && CalculatedSize > 1024 * 1024 * 4) score += 5;