From dcc12e62b79c6a54a2505b6263e6530502de005a Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Tue, 6 Oct 2026 09:37:44 +0200 Subject: [PATCH] fix: tag regions only where the code picks by area --- emulators/beetle_psx.yml | 3 --- emulators/mednafen.yml | 4 ++-- emulators/mednafen_pce_fast.yml | 6 ------ tests/test_region.py | 30 ++++++++++++++++++++++++++++++ 4 files changed, 32 insertions(+), 11 deletions(-) diff --git a/emulators/beetle_psx.yml b/emulators/beetle_psx.yml index 5f70c933..9e27f549 100644 --- a/emulators/beetle_psx.yml +++ b/emulators/beetle_psx.yml @@ -101,7 +101,6 @@ files: - name: "psxonpsp660.bin" description: "PSP embedded PS1 BIOS (region-free override)" - region: [world] required: false size: 524288 sha1: "96880d1ca92a016ff054be5159bb06fe03cb4e14" @@ -114,7 +113,6 @@ files: - name: "ps1_rom.bin" description: "PS3 embedded PS1 BIOS, first 512KB extracted (region-free override)" - region: [world] required: false sha1: "c40146361eb8cf670b19fdc9759190257803cab7" md5: "81bbe60ba7a3d1cea1d48c14cbcc647b" @@ -126,7 +124,6 @@ files: - name: "openbios.bin" description: "OpenBIOS (open-source PS1 HLE BIOS, region-free override)" - region: [world] required: false size: 524288 mode: libretro diff --git a/emulators/mednafen.yml b/emulators/mednafen.yml index 2806e577..08c07a70 100644 --- a/emulators/mednafen.yml +++ b/emulators/mednafen.yml @@ -292,7 +292,7 @@ files: - name: "scph5502.bin" system: sony-playstation description: "SCPH-5502 / v3.0E BIOS" - region: [europe] + region: [europe, oceania] required: true size: 524288 sha256: "1faaa18fa820a0225e488d9f086296b8e6c46df739666093987ff7d8fd352c09" @@ -376,7 +376,7 @@ files: - name: "epr-17952a.ic8" system: sega-stv description: "ST-V BIOS (North America)" - region: [north-america] + region: [north-america, south-korea, asia-pal, brazil, latin-america] required: true size: 524288 validation: [size] diff --git a/emulators/mednafen_pce_fast.yml b/emulators/mednafen_pce_fast.yml index 83608629..fb9e1a85 100644 --- a/emulators/mednafen_pce_fast.yml +++ b/emulators/mednafen_pce_fast.yml @@ -23,28 +23,24 @@ notes: > files: - name: "syscard3.pce" description: "CD-ROM System Card 3.0 (Japan)" - region: [japan] required: true source_ref: "libretro.c:65, libretro.c:1896-1901" note: "Default value for pce_fast_cdbios option." - name: "syscard2.pce" description: "CD-ROM System Card 2.0 (Japan)" - region: [japan] required: false source_ref: "libretro.c:1903" note: "pce_fast_cdbios = 'System Card 2'." - name: "syscard1.pce" description: "CD-ROM System Card 1.0 (Japan)" - region: [japan] required: false source_ref: "libretro.c:1905" note: "pce_fast_cdbios = 'System Card 1'." - name: "gexpress.pce" description: "Games Express CD Card" - region: [japan] required: false aliases: ["gecard.pce"] source_ref: "libretro.c:1906-1907" @@ -52,14 +48,12 @@ files: - name: "syscard3u.pce" description: "CD-ROM System Card 3.0 (US / TurboGrafx-CD)" - region: [north-america] required: false source_ref: "libretro.c:1908-1909" note: "pce_fast_cdbios = 'System Card 3 US'. Not in .info." - name: "syscard2u.pce" description: "CD-ROM System Card 2.0 (US / TurboGrafx-CD)" - region: [north-america] required: false source_ref: "libretro.c:1910-1911" note: "pce_fast_cdbios = 'System Card 2 US'. Not in .info." diff --git a/tests/test_region.py b/tests/test_region.py index fe9e9bb2..c915d14c 100644 --- a/tests/test_region.py +++ b/tests/test_region.py @@ -630,5 +630,35 @@ class TestReportAndBuilderNarrowTogether(unittest.TestCase): self.assertIn("oceania", regions) + +class RegionalRequestsKeepWhatTheCodeLoads(unittest.TestCase): + """A --region request never drops the file the core opens for it. + + mednafen_pce_fast tagged option-selected cards with territories, beetle_psx + tagged its override BIOS [world], mednafen tagged the ST-V NA BIOS for + America alone and the PAL PSX BIOS for Europe alone. + """ + + CASES = ( + ("mednafen_pce_fast", ["north-america"], "syscard3.pce"), + ("beetle_psx", ["brazil"], "scph5501.bin"), + ("mednafen", ["south-korea", "europe"], "epr-17952a.ic8"), + ("mednafen", ["australia", "north-america"], "scph5502.bin"), + ) + + def test_each_request_keeps_its_file(self): + sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "scripts")) + import common + from packextras import emulator_region_drops + + profiles = common.load_emulator_profiles( + os.path.join(os.path.dirname(__file__), "..", "emulators") + ) + for name, regions, kept in self.CASES: + with self.subTest(profile=name, regions=regions): + drops = emulator_region_drops([(name, profiles[name])], False, regions) + self.assertNotIn(kept, drops) + + if __name__ == "__main__": unittest.main()