From 4902a1e07dc58ea121a54954a8c9cf523737d1a2 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Fri, 16 Oct 2026 06:39:17 +0200 Subject: [PATCH] fix: check atari800 roms the way sysrom.c finds them --- emulators/atari800.yml | 16 +++++++++------- tests/test_profile_checks.py | 21 +++++++++++++++++++++ 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/emulators/atari800.yml b/emulators/atari800.yml index 3c952027..dc8a0e85 100644 --- a/emulators/atari800.yml +++ b/emulators/atari800.yml @@ -40,7 +40,7 @@ files: size: 2048 md5: 281f20ea4320404ec820fb7ec0693b38 aliases: [atari5200.rom, atar5200.rom, 5200.bin, atari_5200.rom] - validation: [crc32] + validation: [size] note: > Atari 5200 BIOS (original). Mapped at $F800-$FFFF. Altirra 5200 OS is used when this file is absent. @@ -60,7 +60,7 @@ files: size: 8192 md5: 0bac0c6a50104045d902df4503a4c30b aliases: [ataribasic.rom, basic.rom, atari_basic.rom] - validation: [crc32] + validation: [size] note: > Atari BASIC Rev C. Required for 400/800 software that needs BASIC. Altirra BASIC is used as fallback. Enable via core option atari800_opt2. @@ -78,7 +78,7 @@ files: size: 10240 md5: eb1f32f5d9f382db1bbfb8d7f9cb343a aliases: [atari_osa.rom, atari_os_a.rom] - validation: [crc32] + validation: [size] note: > Atari 400/800 OS Rev A. Altirra OS 800 is used as fallback. Auto-select order: OS B NTSC, OS A NTSC, OS A PAL, custom, Altirra. @@ -96,7 +96,7 @@ files: md5: 4177f386a3bac989a981d3fe3388cb6c crc32: 0e86d61d aliases: [atari_osb.rom, atari_os_b.rom] - validation: [crc32] + validation: [size] note: > Atari 400/800 OS Rev B (NTSC). CRC32 0x0e86d61d matches sysrom.c SYSROM_B_NTSC. Preferred over Rev A for 400/800 mode. @@ -120,7 +120,7 @@ files: size: 16384 md5: 06daac977823773a3eea3422fd26a703 aliases: [atarixlxe.rom, atari_xlxe.rom, atari_xl_xe.rom] - validation: [crc32] + validation: [size] note: > Atari XL/XE OS. Used for 800XL, 130XE, and XEGS modes. Altirra XL OS is used as fallback. @@ -136,7 +136,8 @@ files: hle_fallback: true size: 16384 md5: b7a2a04677d34f069eeb643d5238bf86 - validation: [crc32] + crc32: "1eaf4002" + validation: [size, crc32] note: > Atari XEGS OS Rev 4 (BB01R4). Preferred OS for XEGS machine mode. source_ref: "atari800/src/sysrom.c:100" @@ -150,7 +151,8 @@ files: required: false size: 8192 md5: d7eb37aec6960cba36bc500e0e5d00bc - validation: [crc32] + crc32: "bdca01fb" + validation: [size, crc32] note: > XEGS built-in Missile Command ROM. Only used in XEGS machine mode. No built-in replacement exists for this ROM. diff --git a/tests/test_profile_checks.py b/tests/test_profile_checks.py index 31239214..b74e3787 100644 --- a/tests/test_profile_checks.py +++ b/tests/test_profile_checks.py @@ -111,5 +111,26 @@ class BeetleGbaBios(_Probe): self.assertFalse(self.accepts("beetle_gba", "gba_bios.bin", b"\0" * size)) +class Atari800SystemRoms(_Probe): + """SYSROM_FindInDir takes a file of an allowed length whose CRC32 is in + SYSROM_roms, else, by its lowercased name, any file of that length as a + custom ROM (atari800/src/sysrom.c:88-112, 281-315, 387-416 at 4e7fbc7). + BB01R4_OS.ROM and XEGAME.ROM are on no name list: only their CRC32 makes + them that ROM.""" + + def test_named_roms_need_only_the_length(self): + for name, size in (("ATARIOSA.ROM", 10240), ("ATARIOSB.ROM", 10240), + ("ATARIXL.ROM", 16384), ("5200.rom", 2048), + ("ATARIBAS.ROM", 8192)): + with self.subTest(name=name): + self.assertTrue(self.accepts("atari800", name, b"\1" * size)) + self.assertFalse(self.accepts("atari800", name, b"\1" * (size + 1))) + + def test_unlisted_names_need_their_crc(self): + for name, size in (("BB01R4_OS.ROM", 16384), ("XEGAME.ROM", 8192)): + with self.subTest(name=name): + self.assertFalse(self.accepts("atari800", name, b"\1" * size)) + + if __name__ == "__main__": unittest.main()