From d3d83d0116d3bd421e69f252bee9b9d50df0a9cb Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Fri, 16 Oct 2026 07:04:48 +0200 Subject: [PATCH] fix: give the apple iigs rom checks their sizes --- emulators/gsplus.yml | 1 + emulators/kegs.yml | 1 + tests/test_profile_checks.py | 14 ++++++++++++++ 3 files changed, 16 insertions(+) diff --git a/emulators/gsplus.yml b/emulators/gsplus.yml index 46a0adff..af0cc93b 100644 --- a/emulators/gsplus.yml +++ b/emulators/gsplus.yml @@ -33,6 +33,7 @@ files: description: "Apple IIGS system ROM" source_ref: "gsplus/src/config.c:136, gsplus/src/config.c:477-480, gsplus/src/config.c:1260-1317" note: "Accepted sizes: 32768 (Apple //e), 131072 (ROM 01), 262144 (ROM 03)" + size: [32768, 131072, 262144] validation: [size] - name: c600.rom diff --git a/emulators/kegs.yml b/emulators/kegs.yml index a922370e..f16b82b8 100644 --- a/emulators/kegs.yml +++ b/emulators/kegs.yml @@ -46,6 +46,7 @@ files: aliases: [ROM.01, ROM.03, APPLE2GS.ROM, APPLE2GS.ROM2, xgs.rom, XGS.ROM, Rom03gd, 342-0077-b] required: true description: "Apple IIGS system ROM" + size: [32768, 131072, 262144] validation: [size] source_ref: "config.c:135,407-410,1096-1161" note: > diff --git a/tests/test_profile_checks.py b/tests/test_profile_checks.py index 7b3d1881..8fbca2b0 100644 --- a/tests/test_profile_checks.py +++ b/tests/test_profile_checks.py @@ -301,5 +301,19 @@ class NestopiaFdsBios(_Probe): self.assertFalse(self.accepts("nestopia", "disksys.rom", b"\0" * 8192, strict=True)) +class AppleIIgsRomSizes(_Probe): + """GSplus and KEGS read a 32, 128 or 256 KB ROM and refuse any other size + ("The ROM size should be 128K or 256K", gsplus/src/config.c:1297-1316 at + 41e7103). The profiles declared the size check with no size.""" + + def test_three_sizes_and_nothing_else(self): + for emulator in ("gsplus", "kegs"): + for size in (32768, 131072, 262144): + with self.subTest(emulator=emulator, size=size): + self.assertTrue(self.accepts(emulator, "ROM", b"\0" * size)) + with self.subTest(emulator=emulator, size=65536): + self.assertFalse(self.accepts(emulator, "ROM", b"\0" * 65536)) + + if __name__ == "__main__": unittest.main()