From 7301c8605c8d58a2b77de9b20b1f1feb2b582357 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Fri, 16 Oct 2026 07:02:18 +0200 Subject: [PATCH] fix: check mgba boot roms against its crc table --- emulators/mgba.yml | 9 ++++++--- tests/test_profile_checks.py | 13 +++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/emulators/mgba.yml b/emulators/mgba.yml index a6a3f2d3..bf6b2732 100644 --- a/emulators/mgba.yml +++ b/emulators/mgba.yml @@ -66,9 +66,10 @@ files: system: nintendo-gb required: false size: 256 # 256 B (0x100) + crc32: ["59c8598e", "c2f5cc97", "e6920754", "ec8a83b9", "53d0dd63", "66cc6d94", "908ba8de", "783e69c2"] validation: [crc32] note: "DMG/MGB boot ROM. Scrolling Nintendo logo. Skipped if absent." - source_ref: "src/platform/libretro/libretro.c:2104" + source_ref: "src/platform/libretro/libretro.c:2104, src/platform/libretro/libretro.c:2111-2116, src/gb/gb.c:50-63, src/gb/gb.c:605-628, src/gb/gb.c:661-665" # ------------------------------------------------------- # Game Boy Color - boot ROM (optional, skip fallback) @@ -77,9 +78,10 @@ files: system: nintendo-gbc required: false size: 2304 # 2304 B (0x900) + crc32: ["41884e46", "e8ef5318", "e95dc95d", "ffd6b0f1", "570337ea", "69236128"] validation: [crc32] note: "CGB boot ROM. Used for CGB, AGB (GBA in GB mode), and SCGB models." - source_ref: "src/platform/libretro/libretro.c:2097" + source_ref: "src/platform/libretro/libretro.c:2097, src/platform/libretro/libretro.c:2111-2116, src/gb/gb.c:50-63, src/gb/gb.c:605-628, src/gb/gb.c:661-665" # ------------------------------------------------------- # Super Game Boy - boot ROM (optional, skip fallback) @@ -88,9 +90,10 @@ files: system: nintendo-sgb required: false size: 256 # 256 B (0x100) + crc32: ["ec8a83b9", "53d0dd63", "59c8598e", "c2f5cc97", "e6920754", "66cc6d94", "908ba8de", "783e69c2"] validation: [crc32] note: "SGB boot ROM. SGB2 maps here in standalone (src/gb/core.c:655) but falls to gb_bios.bin in libretro." - source_ref: "src/platform/libretro/libretro.c:2100" + source_ref: "src/platform/libretro/libretro.c:2100, src/platform/libretro/libretro.c:2111-2116, src/gb/gb.c:50-63, src/gb/gb.c:605-628, src/gb/gb.c:661-665" platform_details: gba: diff --git a/tests/test_profile_checks.py b/tests/test_profile_checks.py index 713c19d5..44dd125c 100644 --- a/tests/test_profile_checks.py +++ b/tests/test_profile_checks.py @@ -278,5 +278,18 @@ class GeargrafxCards(_Probe): self.assertFalse(self.accepts("geargrafx", name, b"\1" * (size - 1))) +class MgbaGameBoyBootRoms(_Probe): + """The libretro port hands the boot ROM to the core and GBReset drops one + whose CRC32 GBIsCompatibleBIOS does not list for the model + (src/gb/gb.c:50-63, 605-628, 661-665 at 7a12d6d). The profile declared + the crc32 check with no value.""" + + def test_an_unknown_boot_rom_is_dropped(self): + for name, size in (("gb_bios.bin", 256), ("sgb_bios.bin", 256), + ("gbc_bios.bin", 2304)): + with self.subTest(name=name): + self.assertFalse(self.accepts("mgba", name, b"\0" * size)) + + if __name__ == "__main__": unittest.main()