From b6f6798c1587217cc97cb13686fea610867dbd96 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Sun, 18 Oct 2026 04:01:02 +0200 Subject: [PATCH] fix: place a standalone build's gaps at its path The gap report took a file's libretro path even where the platform runs the standalone build, so it named Cemu/keys.txt for Batocera while verify named keys.txt, and settled the declaration on a slot the platform never fills. Both now read standalone_path there. --- scripts/cross_reference.py | 9 ++++++++- tests/test_gap_settlement.py | 25 +++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/scripts/cross_reference.py b/scripts/cross_reference.py index 95eb4aa0..766fb4d8 100644 --- a/scripts/cross_reference.py +++ b/scripts/cross_reference.py @@ -504,7 +504,14 @@ def _cross_reference_profile( for f in emu_files: fname = f.get("name", "") - effective_path = f.get("path") or fname + # The destination the running build reads, as find_undeclared_files + # takes it: Batocera's standalone Cemu reads keys.txt at + # standalone_path, and the libretro Cemu/keys.txt reported here + # settled the declaration on a slot the platform never fills. + if is_standalone: + effective_path = f.get("standalone_path") or f.get("path") or fname + else: + effective_path = f.get("path") or fname seen_key = slot_key(f) if not fname or seen_key in seen_files: continue diff --git a/tests/test_gap_settlement.py b/tests/test_gap_settlement.py index 2d7b0953..a985f01c 100644 --- a/tests/test_gap_settlement.py +++ b/tests/test_gap_settlement.py @@ -46,5 +46,30 @@ class OneRule(unittest.TestCase): self.assertIn("declaration_settles(", source, module) +class TheRunningBuildPlacesTheGap(unittest.TestCase): + """Batocera runs Cemu standalone, which reads keys.txt at its + standalone_path. The gap report gave the libretro Cemu/keys.txt while + verify gave keys.txt: 163 entries told apart, and the declaration was + settled on a slot the platform never fills.""" + + KEYS = {"name": "keys.txt", "path": "Cemu/keys.txt", + "standalone_path": "keys.txt", "required": True} + + def _gap_paths(self, standalone: set[str]) -> list[str]: + profiles = {"cemu": {"emulator": "Cemu", "type": "standalone + libretro", + "systems": ["nintendo-wiiu"], "files": [self.KEYS]}} + report = cross_reference( + profiles, {}, {"files": {}, "indexes": {}}, all_declared={}, + standalone_cores=standalone, + ) + return [g["path"] for g in report["cemu"]["gap_details"]] + + def test_a_standalone_build_reads_its_own_path(self): + self.assertEqual(self._gap_paths({"cemu"}), ["keys.txt"]) + + def test_the_core_reads_the_libretro_path(self): + self.assertEqual(self._gap_paths(set()), ["Cemu/keys.txt"]) + + if __name__ == "__main__": unittest.main()