From 9bcfa049ba4b36760b242a36a20b2f9e71529341 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Tue, 20 Oct 2026 14:24:05 +0200 Subject: [PATCH] fix: carry a profile destination into the truth A profile states where the code reads a file as path: or destination:, and the resolver reads both. The truth copied path only: redream's dc_bios.bin, read at dc/boot.bin, reached the export with no path, so System.dat's dc/boot.bin was not seen and a dc_bios.bin line was added, and Batocera got bios/dc_bios.bin instead of bios/dc/boot.bin. --- scripts/truth.py | 5 +++++ tests/test_truth_diff.py | 15 +++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/scripts/truth.py b/scripts/truth.py index 13577ea8..9217a618 100644 --- a/scripts/truth.py +++ b/scripts/truth.py @@ -155,6 +155,11 @@ def _merge_file_into_system( Dolphin's three IPL.bin differ only by GC/USA, GC/EUR, GC/JAP. Under one path or none, its declarations are revisions of one file. """ + # A profile states where the code reads a file as `path:` or as + # `destination:` (redream's dc_bios.bin at dc/boot.bin), as the resolver + # reads them. + if not file_entry.get("path") and file_entry.get("destination"): + file_entry = {**file_entry, "path": file_entry["destination"]} files = system.setdefault("files", []) existing = _same_file(files, file_entry, emu_name) if existing is None: diff --git a/tests/test_truth_diff.py b/tests/test_truth_diff.py index dd1c677a..beaefbbe 100644 --- a/tests/test_truth_diff.py +++ b/tests/test_truth_diff.py @@ -120,6 +120,21 @@ class OneNameSeveralFiles(unittest.TestCase): self.assertEqual(_diff_system(self._system(), scraped), {}) +class ADestinationIsThePath(unittest.TestCase): + def test_a_profile_destination_reaches_the_truth(self): + """redream names its BIOS dc_bios.bin and reads it at dc/boot.bin. + The truth dropped `destination:`, so the export never saw that + System.dat declares dc/boot.bin and added a dc_bios.bin line.""" + system: dict = {} + _merge_file_into_system(system, {"name": "dc_bios.bin", + "destination": "dc/boot.bin", + "md5": "a" * 32}, "redream", None) + self.assertEqual(system["files"][0]["path"], "dc/boot.bin") + scraped = {"files": [{"name": "dc/boot.bin", "destination": "dc/boot.bin", + "md5": "a" * 32}]} + self.assertEqual(_diff_system(system, scraped), {}) + + class DifferentContentsStayApart(unittest.TestCase): def test_two_cores_same_name_different_contents(self): """beebem's BBC BIOS.rom and np2kai's PC-98 bios.rom merged into one."""