From 0938c30b65add59b48925a40f8f7e0dd712ad678 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Tue, 20 Oct 2026 10:29:47 +0200 Subject: [PATCH] fix: a platform's own build answers its core name Recalbox compiles uae4all from Chips-fr/uae4all-rpi, a libretro core, while RetroPie's uae4all package is the standalone uae4all2. A profile whose built_by names the platform now wins the name there, and a bare key match still decides everywhere else. --- scripts/common.py | 14 +++++++++++++- tests/test_batocera_cores.py | 17 +++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/scripts/common.py b/scripts/common.py index 63c1c4da..8c21fb64 100644 --- a/scripts/common.py +++ b/scripts/common.py @@ -2245,10 +2245,22 @@ def resolve_platform_cores( elif isinstance(cores_config, list): core_set = {str(c) for c in cores_config} index = upstream_profile_index(profiles) + platform = str(config.get("_key") or "") + + def designated(name: str) -> str | None: + # A build the platform compiles itself (built_by) is what its + # name means there: Recalbox's uae4all is Chips-fr/uae4all-rpi, + # RetroPie's the standalone uae4all2 under the same name. + own = sorted( + p for p in index.get(name, ()) + if platform and platform in (profiles[p].get("built_by") or []) + ) + return own[0] if own else preferred_profile(index, name) + result = { profile for c in core_set - if (profile := preferred_profile(index, c)) is not None + if (profile := designated(c)) is not None } # A name the platform launches both ways designates its libretro # build too. Batocera, Recalbox and RetroBat run pcsx2 standalone and diff --git a/tests/test_batocera_cores.py b/tests/test_batocera_cores.py index a7325078..159912e0 100644 --- a/tests/test_batocera_cores.py +++ b/tests/test_batocera_cores.py @@ -141,5 +141,22 @@ class DualModeNameReachesTheLibretroBuild(unittest.TestCase): self.assertEqual(resolve_platform_cores(config, profiles), {"pcsx2", "lrps2"}) +class APlatformsOwnBuildWinsItsName(unittest.TestCase): + """Recalbox's uae4all is the libretro uae4all-rpi it compiles, RetroPie's + the standalone uae4all2: one name, two programs.""" + + def test_built_by_beats_the_key_match_for_that_platform_only(self): + from common import resolve_platform_cores + + profiles = { + "uae4all": {"type": "standalone", "cores": ["uae4all"]}, + "uae4all-rpi": {"type": "libretro", "cores": ["uae4all"], "built_by": ["recalbox"]}, + } + recalbox = {"_key": "recalbox", "cores": ["uae4all"]} + retropie = {"_key": "retropie", "cores": ["uae4all"]} + self.assertEqual(resolve_platform_cores(recalbox, profiles), {"uae4all-rpi"}) + self.assertEqual(resolve_platform_cores(retropie, profiles), {"uae4all"}) + + if __name__ == "__main__": unittest.main()