mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 21:06:09 +00:00
fix(proton-run): follow a removed DroidDeck-Proton build to the newest one (#2223)
Battle.net, store games and desktop programs start through droiddeck-proton-run without the Steam client. When the Proton auto-update replaced the DroidDeck-Proton build that Steam's default or a title's mapping named, the name no longer matched an installed tool and the run fell back to Valve's Proton Experimental ARM64, which lacks DroidDeck-Proton's patches. World of Warcraft then hung at launch. A removed DroidDeck-Proton build now resolves to the newest installed one, the same successor steam-compatibility moves Steam's mappings to.
This commit is contained in:
1 parent
4cb3a89483
commit
d5f3d1a0d5
2 files changed
+31
-2
No files matched your search
@@ -98,13 +98,25 @@ def state_default():
|
||||
return None
|
||||
|
||||
|
||||
def newest_own(available):
|
||||
c = compat()
|
||||
builds = c["own_builds"]([{"name": name, "dir": os.path.basename(folder)} for name, (folder, _) in available.items()])
|
||||
return max(builds, key=lambda t: (c["build_key"](t["dir"]), t["dir"]))["name"] if builds else None
|
||||
|
||||
|
||||
def choose_tool(appid, current, available):
|
||||
c = compat()
|
||||
newest = newest_own(available)
|
||||
for key, why in ((appid, "Steam's choice for this title"), ("0", "Steam's default")):
|
||||
name = current.get(key)
|
||||
if name in available:
|
||||
return name, why
|
||||
c = compat()
|
||||
for name in (state_default(), c["TOOL"], c["TOOL_11"]):
|
||||
if newest and isinstance(name, str) and name.startswith(c["OWN_PROTON"]):
|
||||
return newest, "%s, replacing the removed %s" % (why, name)
|
||||
default = state_default()
|
||||
if newest and isinstance(default, str) and default.startswith(c["OWN_PROTON"]) and default not in available:
|
||||
return newest, "the default, replacing the removed %s" % default
|
||||
for name in (default, c["TOOL"], c["TOOL_11"]):
|
||||
if name in available:
|
||||
return name, "the default ARM64 Proton"
|
||||
return (sorted(available)[0], "the only one installed") if available else (None, None)
|
||||
|
||||
@@ -428,6 +428,23 @@ class ProtonRunTest(Temp):
|
||||
self.assertEqual(RUN["choose_tool"]("70", {"0": "GE-Proton"}, available), ("droiddeck-proton-arm64", "the default ARM64 Proton"))
|
||||
self.assertEqual(RUN["choose_tool"]("70", {}, {}), (None, None))
|
||||
|
||||
def test_a_removed_droiddeck_proton_build_is_replaced_by_the_newest_one(self):
|
||||
for version in ("11-12.2", "11-12.3"):
|
||||
folder = "compatibilitytools.d/DroidDeck-Proton %s" % version
|
||||
self.write("Steam/%s/compatibilitytool.vdf" % folder, TOOL_VDF % ("DroidDeck-Proton-" + version, version, "windows"))
|
||||
self.write("Steam/%s/toolmanifest.vdf" % folder, '"manifest"\n{\n "commandline" "/proton %verb%"\n}\n')
|
||||
self.write("Steam/%s/proton" % folder, b"#!/bin/sh\n", 0o755)
|
||||
available = RUN["tools"](str(self.root))
|
||||
newest = "DroidDeck-Proton-11-12.3"
|
||||
self.assertEqual(RUN["choose_tool"]("70", {"0": "DroidDeck-Proton-11-12.1"}, available)[0], newest)
|
||||
self.assertEqual(RUN["choose_tool"]("70", {"70": "DroidDeck-Proton-11-12.1", "0": "droiddeck-proton-arm64"}, available)[0], newest)
|
||||
self.assertEqual(RUN["choose_tool"]("70", {"0": "DroidDeck-Proton-11-12.2"}, available), ("DroidDeck-Proton-11-12.2", "Steam's default"))
|
||||
self.assertEqual(RUN["choose_tool"]("70", {"0": "GE-Proton"}, available), ("droiddeck-proton-arm64", "the default ARM64 Proton"))
|
||||
(self.tmp / "state.json").write_text('{"default": "DroidDeck-Proton-11-12.1"}')
|
||||
self.assertEqual(RUN["choose_tool"]("70", {}, available)[0], newest)
|
||||
(self.tmp / "state.json").write_text('{"default": "droiddeck-proton-11-arm64"}')
|
||||
self.assertEqual(RUN["choose_tool"]("70", {}, available), ("droiddeck-proton-11-arm64", "the default ARM64 Proton"))
|
||||
|
||||
def test_a_steam_games_program_uses_its_prefix(self):
|
||||
program = self.game("413150", "Stardew Valley", "Stardew Valley.exe")
|
||||
target = RUN["locate"](str(program), str(self.root))
|
||||
|
||||
Reference in new issue
Block a user