diff --git a/scripts/exporter/retrodeck_exporter.py b/scripts/exporter/retrodeck_exporter.py index 9794781c..157b077d 100644 --- a/scripts/exporter/retrodeck_exporter.py +++ b/scripts/exporter/retrodeck_exporter.py @@ -104,8 +104,11 @@ class Exporter(BaseExporter): A component is one emulator's manifest, and only the platform's entries name it. A system whose entries all sit in one component - takes the addition there. One spread over several, or with none of - its own, cannot say which manifest is meant, and the addition is + takes the addition there, when a core reading the file is that + component's emulator: armsx2's flash.dat is no file PCSX2 opens, and + beetle_psx's scph5903.bin none DuckStation's manifest should ask for. + One spread over several, with none of its own, or of another + emulator cannot say which manifest is meant, and the addition is left out and counted as such. """ for system in systems.values(): @@ -118,7 +121,10 @@ class Exporter(BaseExporter): continue component = components.pop() for fe in system.files: - if fe.platform is None and fe.truth is not None: + if fe.platform is None and fe.truth is not None and any( + name == component if standalone else component == "retroarch" + for standalone, name in fe.runners + ): fe.truth = {**fe.truth, "component": component} @staticmethod diff --git a/tests/test_exporters.py b/tests/test_exporters.py index e661ecf3..9834f56f 100644 --- a/tests/test_exporters.py +++ b/tests/test_exporters.py @@ -1724,5 +1724,25 @@ class RocknixRunnersFollowTheBuild(unittest.TestCase): self.assertTrue(EMULATORS_MK) +class RetroDeckAdditionsFollowTheirCore(unittest.TestCase): + """Every RetroDECK ps2 entry sits in the pcsx2 component, so every ps2 + addition went into PCSX2's manifest, armsx2's flash.dat included: a file + PCSX2 never opens, asked of PCSX2 users and counted as added.""" + + def test_only_the_components_emulator_places_a_file(self): + exporter = discover_exporters()["retrodeck"]() + own = NativeFile("scph39001.bin", "bios/scph39001.bin", "ps2", + platform={"md5": "0" * 32, "component": "pcsx2"}) + read_by_pcsx2 = NativeFile("rom1.bin", "bios/rom1.bin", "ps2", + truth={"md5": "1" * 32}, runners=[(True, "pcsx2")]) + read_by_armsx2 = NativeFile("flash.dat", "bios/flash.dat", "ps2", + truth={"md5": "2" * 32}, runners=[(False, "armsx2")]) + system = NativeSystem("ps2", "PS2", from_platform=True, + files=[own, read_by_pcsx2, read_by_armsx2]) + exporter._place_additions({"ps2": system}) + self.assertEqual(read_by_pcsx2.native("component", ""), "pcsx2") + self.assertEqual(read_by_armsx2.native("component", ""), "") + + if __name__ == "__main__": unittest.main()