diff --git a/emulators/gambatte.yml b/emulators/gambatte.yml index aceb9b4e..cbfdd09a 100644 --- a/emulators/gambatte.yml +++ b/emulators/gambatte.yml @@ -40,9 +40,9 @@ files: description: "Original Game Boy (DMG-01) boot ROM" required: false hle_fallback: true - size: 256 - validation: {core: [size], upstream: [size, crc32]} - source_ref: "libgambatte/libretro/libretro.cpp:1303-1363 (get_bootloader_from_file), libgambatte/src/bootloader.cpp:20-55 (load)" + min_size: 256 + validation: [size] + source_ref: "libgambatte/libretro/libretro.cpp:1426-1486 (get_bootloader_from_file), libgambatte/libretro/libretro.cpp:1734-1742, libgambatte/src/bootloader.cpp:30-65 (load)" note: "Mapped at 0x0000-0x00FF, swapped out when register 0xFF50 is written." - name: "gbc_bios.bin" @@ -50,7 +50,7 @@ files: description: "Game Boy Color (CGB-001) boot ROM" required: false hle_fallback: true - size: 2304 - validation: {core: [size], upstream: [size, crc32]} - source_ref: "libgambatte/libretro/libretro.cpp:1303-1363 (get_bootloader_from_file), libgambatte/src/bootloader.cpp:20-55 (load)" + min_size: 2304 + validation: [size] + source_ref: "libgambatte/libretro/libretro.cpp:1426-1486 (get_bootloader_from_file), libgambatte/libretro/libretro.cpp:1734-1742, libgambatte/src/bootloader.cpp:30-65 (load)" note: "Mapped at 0x0000-0x08FF with cartridge data preserved at 0x0100-0x01FF. Also used for GBA mode with a patch at 0xF2. Presence required for FORCE_CGB flag when hw mode is GBC or GBA." diff --git a/tests/test_profile_checks.py b/tests/test_profile_checks.py index d4f93575..8fb7aae6 100644 --- a/tests/test_profile_checks.py +++ b/tests/test_profile_checks.py @@ -250,5 +250,18 @@ class DolphinForksIplDumps(_Probe): self.assertFalse(self.accepts(emulator, "IPL.bin", data, strict=True)) +class GambatteBootRoms(_Probe): + """get_bootloader_from_file reads 0x100 or 0x900 bytes and gives up on a + short read; it never reads past them (libgambatte/libretro/libretro.cpp + 1426-1486 at d9d6cd0). The upstream crc32 check the profile claimed has + no code behind it: sinamas/gambatte was reset to a README in 2021.""" + + def test_short_is_refused_and_longer_is_read(self): + for name, size in (("gb_bios.bin", 256), ("gbc_bios.bin", 2304)): + with self.subTest(name=name): + self.assertFalse(self.accepts("gambatte", name, b"\0" * (size - 1))) + self.assertTrue(self.accepts("gambatte", name, b"\0" * (size + 512))) + + if __name__ == "__main__": unittest.main()