From 7482cfefabe482bef0c1e74c6766088d5c0d3847 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Sun, 18 Oct 2026 19:51:03 +0200 Subject: [PATCH] fix: index the standalone layout for regions GC/EUR/IPL.bin fell through to its bare name and the union of five regions, so a Batocera or standalone Dolphin pack never reduced it. The GameCube IPLs of four Dolphin-family profiles now name their system, as the MMJR profiles do. --- emulators/dolphin.yml | 3 +++ emulators/ishiiruka.yml | 3 +++ emulators/primehack.yml | 3 +++ emulators/triforce.yml | 3 +++ scripts/region.py | 6 ++++-- scripts/slot.py | 3 ++- tests/test_region.py | 19 +++++++++++++++++++ 7 files changed, 37 insertions(+), 3 deletions(-) diff --git a/emulators/dolphin.yml b/emulators/dolphin.yml index c0d1ed70..10876858 100644 --- a/emulators/dolphin.yml +++ b/emulators/dolphin.yml @@ -38,6 +38,7 @@ files: - name: "IPL.bin" path: "dolphin-emu/Sys/GC/USA/IPL.bin" standalone_path: "GC/USA/IPL.bin" + system: nintendo-gamecube region: [north-america] size: 2097152 required: false @@ -48,6 +49,7 @@ files: - name: "IPL.bin" path: "dolphin-emu/Sys/GC/EUR/IPL.bin" standalone_path: "GC/EUR/IPL.bin" + system: nintendo-gamecube region: [europe, oceania] size: 2097152 required: false @@ -58,6 +60,7 @@ files: - name: "IPL.bin" path: "dolphin-emu/Sys/GC/JAP/IPL.bin" standalone_path: "GC/JAP/IPL.bin" + system: nintendo-gamecube region: [japan, south-korea] size: 2097152 required: false diff --git a/emulators/ishiiruka.yml b/emulators/ishiiruka.yml index 9bde54d2..b5ab5533 100644 --- a/emulators/ishiiruka.yml +++ b/emulators/ishiiruka.yml @@ -35,6 +35,7 @@ files: - name: "IPL.bin" path: "dolphin-emu/Sys/GC/USA/IPL.bin" standalone_path: "GC/USA/IPL.bin" + system: nintendo-gamecube region: [north-america] size: 2097152 required: false @@ -45,6 +46,7 @@ files: - name: "IPL.bin" path: "dolphin-emu/Sys/GC/EUR/IPL.bin" standalone_path: "GC/EUR/IPL.bin" + system: nintendo-gamecube region: [europe, oceania] size: 2097152 required: false @@ -55,6 +57,7 @@ files: - name: "IPL.bin" path: "dolphin-emu/Sys/GC/JAP/IPL.bin" standalone_path: "GC/JAP/IPL.bin" + system: nintendo-gamecube region: [japan, south-korea] size: 2097152 required: false diff --git a/emulators/primehack.yml b/emulators/primehack.yml index d1451314..2bc4c87e 100644 --- a/emulators/primehack.yml +++ b/emulators/primehack.yml @@ -34,6 +34,7 @@ files: # Checked in User/GC// then Sys/GC// - name: "IPL.bin" path: "GC/USA/IPL.bin" + system: nintendo-gamecube region: [north-america] size: 2097152 required: false @@ -43,6 +44,7 @@ files: - name: "IPL.bin" path: "GC/EUR/IPL.bin" + system: nintendo-gamecube region: [europe, oceania] size: 2097152 required: false @@ -52,6 +54,7 @@ files: - name: "IPL.bin" path: "GC/JAP/IPL.bin" + system: nintendo-gamecube region: [japan, south-korea] size: 2097152 required: false diff --git a/emulators/triforce.yml b/emulators/triforce.yml index 7377e103..844b425a 100644 --- a/emulators/triforce.yml +++ b/emulators/triforce.yml @@ -195,6 +195,7 @@ files: - name: "IPL.bin" path: "GC/USA/IPL.bin" description: "GameCube NTSC-U boot ROM" + system: nintendo-gamecube region: [north-america] size: 2097152 required: false @@ -205,6 +206,7 @@ files: - name: "IPL.bin" path: "GC/EUR/IPL.bin" description: "GameCube PAL boot ROM" + system: nintendo-gamecube region: [europe, oceania] size: 2097152 required: false @@ -214,6 +216,7 @@ files: - name: "IPL.bin" path: "GC/JAP/IPL.bin" description: "GameCube NTSC-J boot ROM" + system: nintendo-gamecube region: [japan, south-korea] size: 2097152 required: false diff --git a/scripts/region.py b/scripts/region.py index 94ee061e..399a750d 100644 --- a/scripts/region.py +++ b/scripts/region.py @@ -181,9 +181,11 @@ def build_region_index(profiles: dict) -> dict[str, dict]: path = f.get("path") or "" # Path-keyed so same-named entries stay separate (Dolphin declares # three IPL.bin), name-keyed so a candidate identified by name alone - # sees the union and is never dropped on ambiguity. + # sees the union and is never dropped on ambiguity. The standalone + # layout is a path of its own: GC/EUR/IPL.bin fell through to the + # bare name and its five-region union, and was never reduced. priority = f.get("priority") - for key in {path, name} - {""}: + for key in {path, f.get("standalone_path") or "", name} - {""}: entry = index.setdefault( key, {"regions": set(), "has_untagged": False, "emulators": [], diff --git a/scripts/slot.py b/scripts/slot.py index 5d16840a..e1fdda8f 100644 --- a/scripts/slot.py +++ b/scripts/slot.py @@ -60,7 +60,8 @@ def build_slot_index(profiles: dict) -> dict[str, dict]: continue name = f.get("name", "") path = f.get("path") or "" - for key in {path, name} - {""}: + # Keyed by the standalone layout too, as build_region_index is. + for key in {path, f.get("standalone_path") or "", name} - {""}: entry = index.setdefault( key, {"rank": None, "conflict": False, "regions": set(), diff --git a/tests/test_region.py b/tests/test_region.py index f5c9662b..2fe0d063 100644 --- a/tests/test_region.py +++ b/tests/test_region.py @@ -246,6 +246,25 @@ class TestRegionIndex(unittest.TestCase): self.assertIn("x.bin", str(ctx.exception)) +class TestStandaloneLayoutIsIndexed(unittest.TestCase): + """GC/EUR/IPL.bin, Dolphin's standalone path, was looked up by its bare + name and got the union of five regions: never reduced in a Batocera + pack nor in --emulator dolphin --standalone.""" + + def test_the_standalone_path_carries_its_own_regions(self): + import slot + + profiles = {"dolphin": {"files": [ + {"name": "IPL.bin", "path": "dolphin-emu/Sys/GC/USA/IPL.bin", + "standalone_path": "GC/USA/IPL.bin", "region": ["north-america"]}, + {"name": "IPL.bin", "path": "dolphin-emu/Sys/GC/EUR/IPL.bin", + "standalone_path": "GC/EUR/IPL.bin", "region": ["europe"]}, + ]}} + index = region.build_region_index(profiles) + self.assertEqual(region.lookup_regions(index, "GC/EUR/IPL.bin", "IPL.bin"), {"europe"}) + self.assertIn("GC/EUR/IPL.bin", slot.build_slot_index(profiles)) + + class TestResolveRegionDrops(unittest.TestCase): def setUp(self): self.index = region.build_region_index(