diff --git a/emulators/beetle_gba.yml b/emulators/beetle_gba.yml index 07c7e9c0..84c23e42 100644 --- a/emulators/beetle_gba.yml +++ b/emulators/beetle_gba.yml @@ -1,14 +1,22 @@ # Beetle GBA (Mednafen) — Game Boy Advance (libretro) # ref: beetle-gba-libretro/mednafen/gba, docs.libretro.com/library/beetle_gba -# Same BIOS as mGBA/VBA-M. Optional, no HLE fallback documented. +# Same BIOS as mGBA/VBA-M. Read only with the gba_hle core option disabled. emulator: Beetle GBA (Mednafen) type: libretro cores: [mednafen_gba] source: "https://github.com/libretro/beetle-gba-libretro" +source_commit: "b158166237b17253188cfdbe73a8a0b9fe4b3a8c" systems: - nintendo-gba files: - name: gba_bios.bin system: nintendo-gba required: false - md5: a860e8c0b6d573d191e4ec7db1b1e4f6 + hle_fallback: true + size: 16384 + validation: [size] + source_ref: "mednafen/gba/GBA.cpp:2639-2673, mednafen/settings.cpp:81-82, libretro.cpp:223-230" + note: > + Read only when the gba_hle core option is disabled; it is enabled by + default and the core then uses its built-in HLE BIOS. A file of any size + other than 16384 bytes is ignored and the core falls back to HLE. diff --git a/tests/test_profile_checks.py b/tests/test_profile_checks.py index 7cb54661..31239214 100644 --- a/tests/test_profile_checks.py +++ b/tests/test_profile_checks.py @@ -99,5 +99,17 @@ class BeetleLynxBootRom(_Probe): self.assertTrue(self.accepts("beetle_lynx", "lynxboot.img", b"\0" * 1024)) +class BeetleGbaBios(_Probe): + """CPUInit copies the BIOS only when it is exactly 0x4000 bytes and + otherwise falls back to HLE (mednafen/gba/GBA.cpp:2639-2673 at + b158166).""" + + def test_only_16k_is_used(self): + self.assertTrue(self.accepts("beetle_gba", "gba_bios.bin", b"\0" * 16384)) + for size in (1000, 32768): + with self.subTest(size=size): + self.assertFalse(self.accepts("beetle_gba", "gba_bios.bin", b"\0" * size)) + + if __name__ == "__main__": unittest.main()