refactor: carry platform launches as a dataclass

standalone_set returned one string set mixing standalone names with ten
JSON-tagged record kinds that every reader re-decoded. platform_launches
now returns a frozen PlatformLaunches (resolve/launches.py) with typed
fields, runs_standalone, is_dual, system_file_index and merged, which
_build_layouts and packprobe share.
This commit is contained in:
Abdessamad Derraz committed 2026-11-24 02:18:53 +01:00
1 parent d3b741e423
commit 6e44a93156
34 files changed
+493 -467

No files matched your search

+10 -8
View File
@@ -6872,18 +6872,20 @@ class StandaloneModeRequiresAStandaloneBuild(unittest.TestCase):
profile loses every ``path:`` and drops its files at the root."""
def test_libretro_only_profile_keeps_its_layout(self):
from resolve.layout import runs_standalone
from resolve.launches import PlatformLaunches
libretro_only = {"type": "libretro", "cores": ["scummvm"]}
dual = {"type": "standalone + libretro", "cores": ["dolphin"]}
standalone = {"type": "standalone", "cores": ["xemu"]}
named = {"scummvm", "dolphin", "xemu", "hatari"}
self.assertFalse(runs_standalone("scummvm", libretro_only, named))
self.assertTrue(runs_standalone("dolphin", dual, named))
self.assertTrue(runs_standalone("xemu", standalone, named))
self.assertTrue(runs_standalone("other-key", {"type": "standalone", "cores": ["hatari"]}, named))
self.assertFalse(runs_standalone("dolphin", dual, set()))
self.assertFalse(runs_standalone("dolphin", dual, {"pcsx2"}))
named = PlatformLaunches(standalone=frozenset({"scummvm", "dolphin", "xemu", "hatari"}))
self.assertFalse(named.runs_standalone("scummvm", libretro_only))
self.assertTrue(named.runs_standalone("dolphin", dual))
self.assertTrue(named.runs_standalone("xemu", standalone))
self.assertTrue(named.runs_standalone("other-key", {"type": "standalone", "cores": ["hatari"]}))
self.assertFalse(PlatformLaunches().runs_standalone("dolphin", dual))
self.assertFalse(
PlatformLaunches(standalone=frozenset({"pcsx2"})).runs_standalone("dolphin", dual)
)