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.
This commit is contained in:
Abdessamad Derraz committed 2026-10-20 10:29:47 +02:00
1 parent cd777848aa
commit 0938c30b65
2 files changed
+30 -1

No files matched your search

+13 -1
View File
@@ -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
+17
View File
@@ -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()