mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-01 18:45:42 +00:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0157a727bb | ||
|
|
2d13d0770a |
No files matched your search
@@ -984,10 +984,15 @@ def valve_picks(steam_root):
|
||||
return sorted(picks, key=int)
|
||||
|
||||
|
||||
def launch_platforms(entry):
|
||||
return {part.strip() for option in entry.get("launch_options", ())
|
||||
for part in option["oslist"].split(",") if part.strip()}
|
||||
|
||||
|
||||
def tool_platforms(steam_root):
|
||||
entries = appinfo_entries(os.path.join(steam_root, "appcache", "appinfo.vdf"))
|
||||
return {app: entry["oslist"] for app, entry in entries.items()
|
||||
if entry["type"] == "tool" and entry["oslist"] & {"linux", "windows"}}
|
||||
platforms = {app: entry["oslist"] | launch_platforms(entry) for app, entry in entries.items() if entry["type"] == "tool"}
|
||||
return {app: found for app, found in platforms.items() if found & {"linux", "windows"}}
|
||||
|
||||
|
||||
def native_targets(steam_root, apps):
|
||||
@@ -1227,8 +1232,16 @@ def plan_mapping(current, installed, runnable, default, auto, native=None, picks
|
||||
changes["0"] = default
|
||||
for app in sorted((set(current) | installed | picks | set(auto) | set(overrides) | native_choices | set(tools)) - {"0"}, key=app_order):
|
||||
name = current.get(app, "")
|
||||
if app in tools and "linux" in tools[app] and "windows" not in tools[app]:
|
||||
if name and (name.lower() in runnable or "proton" in name.lower()):
|
||||
if app in tools and "linux" in tools[app]:
|
||||
if "windows" not in tools[app]:
|
||||
if name and (name.lower() in runnable or "proton" in name.lower()):
|
||||
changes[app] = None
|
||||
continue
|
||||
if app in overrides:
|
||||
target = overrides[app]
|
||||
if target is not DEFERRED_GAME_TOOL and (target or None) != (name or None):
|
||||
changes[app] = target or None
|
||||
elif name and (name == auto.get(app) or unrunnable(name, runnable) or name.lower() in removed):
|
||||
changes[app] = None
|
||||
continue
|
||||
if app in overrides:
|
||||
|
||||
@@ -73,6 +73,56 @@ class ToolPlatformsTest(unittest.TestCase):
|
||||
self.assertEqual(auto["900001"], TOOL)
|
||||
self.assertEqual(auto["976730"], TOOL)
|
||||
|
||||
def add_launch_only_linux_tool(self):
|
||||
self.entries[900007] = {"common": {"type": "Tool", "oslist": "windows"}, "config": {"launch": {
|
||||
"0": {"executable": "bin\\win64\\start.exe", "config": {"oslist": "windows"}},
|
||||
"1": {"executable": "bin\\start.sh", "config": {"oslist": "linux", "osarch": "64"}},
|
||||
}}}
|
||||
self.write_appinfo()
|
||||
|
||||
def test_linux_launch_entry_counts_as_a_linux_platform(self):
|
||||
self.add_launch_only_linux_tool()
|
||||
self.assertEqual(self.platforms()["900007"], {"windows", "linux"})
|
||||
self.assertEqual(self.platforms()["900001"], {"windows"})
|
||||
|
||||
def test_tool_with_a_linux_build_is_not_given_proton_before_install(self):
|
||||
self.add_launch_only_linux_tool()
|
||||
changes, auto = self.plan({"0": TOOL})
|
||||
self.assertNotIn("900007", changes)
|
||||
self.assertNotIn("900007", auto)
|
||||
self.assertEqual(changes["900001"], TOOL)
|
||||
|
||||
def test_own_proton_mapping_on_a_tool_with_a_linux_build_is_cleared(self):
|
||||
self.add_launch_only_linux_tool()
|
||||
changes, auto = self.plan({"0": TOOL, "900007": TOOL}, {"900007": TOOL})
|
||||
self.assertIsNone(changes["900007"])
|
||||
self.assertNotIn("900007", auto)
|
||||
|
||||
def test_user_selection_on_a_tool_with_a_linux_build_survives(self):
|
||||
self.add_launch_only_linux_tool()
|
||||
for name in (TOOL, "custom-windows"):
|
||||
with self.subTest(name=name):
|
||||
changes, auto = self.plan({"0": TOOL, "900007": name}, {"976730": TOOL})
|
||||
self.assertNotIn("900007", changes)
|
||||
|
||||
def test_stale_tool_on_a_tool_with_a_linux_build_is_cleared(self):
|
||||
self.add_launch_only_linux_tool()
|
||||
for name, removed in (("GE-Proton11-7", ("GE-Proton11-7",)), ("proton_9", ())):
|
||||
with self.subTest(name=name):
|
||||
changes, auto = self.plan({"0": TOOL, "900007": name}, removed=removed)
|
||||
self.assertIsNone(changes["900007"])
|
||||
self.assertNotIn("900007", auto)
|
||||
|
||||
def test_explicit_request_on_a_tool_with_a_linux_build_is_applied(self):
|
||||
self.add_launch_only_linux_tool()
|
||||
changes, auto = self.plan({"0": TOOL}, overrides={"900007": TOOL})
|
||||
self.assertEqual(changes["900007"], TOOL)
|
||||
changes, auto = self.plan({"0": TOOL, "900007": TOOL}, overrides={"900007": None})
|
||||
self.assertIsNone(changes["900007"])
|
||||
changes, auto = self.plan({"0": TOOL, "900007": TOOL}, overrides={"900007": TOOL})
|
||||
self.assertNotIn("900007", changes)
|
||||
self.assertNotIn("900007", auto)
|
||||
|
||||
def test_removed_ge_proton_is_cleared_with_or_without_saved_ownership(self):
|
||||
for saved in ({}, {"1826330": "GE-Proton11-7"}):
|
||||
with self.subTest(saved=saved):
|
||||
|
||||
Reference in new issue
Block a user