diff --git a/emulators/higan_sfc.yml b/emulators/higan_sfc.yml index 476243f59..5aa3c6a20 100644 --- a/emulators/higan_sfc.yml +++ b/emulators/higan_sfc.yml @@ -228,3 +228,18 @@ files: required: false note: "Falls back to sgb2.boot.rom at the system directory root." source_ref: "higan/gb/system/system.cpp:54-65, icarus/heuristics/super-famicom.cpp:243, icarus/heuristics/super-famicom.cpp:614" + + - name: "program.rom" + path: "Super GameBoy.sfc/program.rom" + system: nintendo-sgb + required: false + note: "Last folder tried, after the option's folder and SGB.sfc/." + source_ref: "higan/target-libretro/libretro-sfc.cpp:209-225, higan/sfc/cartridge/load.cpp:77-80" + + - name: "sgb1.boot.rom" + path: "Super GameBoy.sfc/sgb1.boot.rom" + system: nintendo-sgb + size: 256 + required: false + note: "Read from the folder program.rom was found in, then from the system directory root. The name follows the Super GAMEBOY header of an SGB1 program.rom." + source_ref: "higan/target-libretro/libretro-sfc.cpp:229, higan/gb/system/system.cpp:54-65, icarus/heuristics/super-famicom.cpp:232, icarus/heuristics/super-famicom.cpp:618" diff --git a/emulators/higan_sfc_balanced.yml b/emulators/higan_sfc_balanced.yml index 6c88faec8..fac0f9151 100644 --- a/emulators/higan_sfc_balanced.yml +++ b/emulators/higan_sfc_balanced.yml @@ -227,3 +227,19 @@ files: required: false note: "Falls back to lr35902.boot.rom at the system directory root." source_ref: "source nSide/gb/system/system.cpp:54-65, source nSide/emulator/game.hpp:101-104, source icarus/heuristics/super-famicom.cpp:103, source icarus/heuristics/super-famicom.cpp:523-527" + + - name: "program.rom" + path: "Super GameBoy.sfc/program.rom" + system: nintendo-sgb + required: false + note: "Last folder tried, after the option's folder and SGB.sfc/." + source_ref: "source nSide/target-libretro/libretro-sfc.cpp:184-199, source nSide/sfc-balanced/cartridge/load.cpp:159-162" + + - name: "lr35902.boot.rom" + path: "Super GameBoy.sfc/lr35902.boot.rom" + system: nintendo-sgb + size: 256 + sha1: "aa2f50a77dfb4823da96ba99309085a3c6278515" + required: false + note: "Read from the folder program.rom was found in, then from the system directory root." + source_ref: "source nSide/target-libretro/libretro-sfc.cpp:201, source nSide/gb/system/system.cpp:54-65, source nSide/target-libretro/program.cpp:59-72, source icarus/heuristics/super-famicom.cpp:103" diff --git a/tests/test_audit_regressions.py b/tests/test_audit_regressions.py index 4f18a8ca8..39330ab7c 100644 --- a/tests/test_audit_regressions.py +++ b/tests/test_audit_regressions.py @@ -6821,5 +6821,39 @@ class PipelineChildrenSkipNodeCompileCache(unittest.TestCase): self.assertIn('"NODE_DISABLE_COMPILE_CACHE": "1"', source) +class HiganSuperGameBoyFolderIsFree(unittest.TestCase): + """higan reads program.rom in the option's folder, SGB.sfc/, then Super + GameBoy.sfc/. bsnes, Mesen-S and ares read SGB1.sfc and SGB2.sfc as files + in the same system directory, and SuperSnes9x sgb.sfc, so a pack that only + had the first two folders never gave the higan cores a Super Game Boy.""" + + def test_each_higan_core_has_a_folder_no_core_reads_as_a_file(self): + import yaml + + file_names: set[str] = set() + for path in (ROOT / "emulators").glob("*.yml"): + document = yaml.safe_load(path.read_text(encoding="utf-8")) or {} + for entry in document.get("files") or []: + for name in [entry.get("name"), *(entry.get("aliases") or [])]: + if name: + file_names.add(str(name).casefold()) + if entry.get("path"): + file_names.add(str(entry["path"]).casefold()) + for profile in ("higan_sfc", "higan_sfc_balanced"): + document = yaml.safe_load( + (ROOT / "emulators" / f"{profile}.yml").read_text(encoding="utf-8") + ) + folders = { + str(entry["path"]).split("/", 1)[0] + for entry in document["files"] + if str(entry.get("path") or "").endswith("/program.rom") + and entry.get("system") == "nintendo-sgb" + } + with self.subTest(profile=profile): + self.assertTrue( + [f for f in folders if f.casefold() not in file_names], folders + ) + + if __name__ == "__main__": unittest.main()