diff --git a/scripts/common.py b/scripts/common.py index 5a656e75..63c1c4da 100644 --- a/scripts/common.py +++ b/scripts/common.py @@ -2250,6 +2250,17 @@ def resolve_platform_cores( for c in core_set if (profile := preferred_profile(index, c)) is not None } + # A name the platform launches both ways designates its libretro + # build too. Batocera, Recalbox and RetroBat run pcsx2 standalone and + # as LRPS2, two profiles: the key match kept the standalone one and + # LRPS2's files never reached their packs. + result |= { + profile + for c in config.get("dual_mode_cores") or [] + for profile in index.get(str(c), set()) + if "libretro" in str(profiles[profile].get("type", "")) + and not profiles[profile].get("built_by") + } # Support "all_libretro" as a list element: combines all libretro # profiles with explicitly listed standalone cores (e.g. RetroDECK # ships RetroArch + standalone emulators) diff --git a/tests/test_batocera_cores.py b/tests/test_batocera_cores.py index 1746ab4e..a7325078 100644 --- a/tests/test_batocera_cores.py +++ b/tests/test_batocera_cores.py @@ -122,5 +122,24 @@ class AnEmulatorLaunchedBothWaysGetsBothLayouts(unittest.TestCase): ) +class DualModeNameReachesTheLibretroBuild(unittest.TestCase): + """Batocera runs pcsx2 standalone and as LRPS2. The name matched the + standalone profile's key and lrps2, which lists pcsx2 in cores:, was + left out of the platform.""" + + def test_both_builds_of_a_dual_mode_name_resolve(self): + from common import resolve_platform_cores + + profiles = { + "pcsx2": {"type": "standalone", "cores": ["pcsx2"]}, + "lrps2": {"type": "libretro", "cores": ["lrps2", "pcsx2"]}, + "mame0278": {"type": "libretro", "cores": ["pcsx2"], "built_by": ["x"]}, + } + config = {"cores": ["pcsx2"], "standalone_cores": ["pcsx2"]} + self.assertEqual(resolve_platform_cores(config, profiles), {"pcsx2"}) + config["dual_mode_cores"] = ["pcsx2"] + self.assertEqual(resolve_platform_cores(config, profiles), {"pcsx2", "lrps2"}) + + if __name__ == "__main__": unittest.main()