mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-21 22:05:59 +00:00
Match Proton tools across clients by their arm64 and a64 names
This commit is contained in:
1 parent
c866bb90db
commit
5f0e6a8b7e
2 files changed
+21
-5
No files matched your search
@@ -203,7 +203,7 @@ def set_tools(config, wanted):
|
||||
if m:
|
||||
name = re.search(r'"name"\s*"([^"]*)"', m.group(1))
|
||||
name = name.group(1) if name else ""
|
||||
if name == tool or not (name in AUTOMATIC or name.startswith("proton_")):
|
||||
if name == tool or not (canonical(name) in map(canonical, AUTOMATIC) or name.startswith("proton_")):
|
||||
continue
|
||||
inner = inner[:m.start()] + inner[m.end():]
|
||||
inner = ('\n\t\t\t\t\t"%s"\n\t\t\t\t\t{\n\t\t\t\t\t\t"name"\t\t"%s"\n\t\t\t\t\t\t"config"\t\t""\n'
|
||||
@@ -214,12 +214,16 @@ def set_tools(config, wanted):
|
||||
return changed
|
||||
|
||||
|
||||
def canonical(name):
|
||||
return re.sub(r"arm64|aarch64", "a64", name)
|
||||
|
||||
|
||||
def translate(name, here, available):
|
||||
if name == "droiddeck-fex" and here == "x86-64":
|
||||
return "droiddeck-direct"
|
||||
if name == "droiddeck-direct" and here == "arm64":
|
||||
return "droiddeck-fex"
|
||||
return name if name in available else None
|
||||
return {canonical(a): a for a in available}.get(canonical(name))
|
||||
|
||||
|
||||
def library_helper():
|
||||
|
||||
@@ -35,12 +35,12 @@ class SteamShareTest(unittest.TestCase):
|
||||
self.x64 = home / 'x64/Steam'
|
||||
self.card = home / 'card'
|
||||
self.shared = home / 'x64/shared'
|
||||
for root in (self.arm, self.x64):
|
||||
for root, tool in ((self.arm, 'droiddeck-proton-arm64'), (self.x64, 'droiddeck-proton-a64')):
|
||||
(root / 'steamapps/common').mkdir(parents=True)
|
||||
(root / 'config').mkdir()
|
||||
(root / 'compatibilitytools.d/proton').mkdir(parents=True)
|
||||
(root / 'compatibilitytools.d/proton/compatibilitytool.vdf').write_text(
|
||||
'"compatibilitytools"\n{\n\t"compat_tools"\n\t{\n\t\t"droiddeck-proton-arm64"\n\t\t{\n\t\t}\n\t}\n}\n')
|
||||
'"compatibilitytools"\n{\n\t"compat_tools"\n\t{\n\t\t"%s"\n\t\t{\n\t\t}\n\t}\n}\n' % tool)
|
||||
(self.arm / 'config/config.vdf').write_text(CONFIG % mapping(_0='droiddeck-proton-arm64', _413150='droiddeck-fex'))
|
||||
(self.x64 / 'config/config.vdf').write_text(CONFIG % '')
|
||||
self.install(self.arm, '413150', 'Stardew Valley')
|
||||
@@ -73,7 +73,19 @@ class SteamShareTest(unittest.TestCase):
|
||||
self.run_share('x86-64')
|
||||
tools = SHARE['entries']((self.x64 / 'config/config.vdf').read_text())
|
||||
self.assertEqual(tools['413150'], 'droiddeck-direct')
|
||||
self.assertEqual(tools['13210'], 'droiddeck-proton-arm64')
|
||||
self.assertEqual(tools['13210'], 'droiddeck-proton-a64')
|
||||
|
||||
def test_an_automatic_x64_proton_is_replaced(self):
|
||||
(self.x64 / 'config/config.vdf').write_text(CONFIG % mapping(_13210='droiddeck-proton-11-a64'))
|
||||
(self.arm / 'config/config.vdf').write_text(CONFIG % mapping(_0='droiddeck-proton-arm64'))
|
||||
self.run_share('x86-64')
|
||||
self.assertEqual(SHARE['entries']((self.x64 / 'config/config.vdf').read_text())['13210'], 'droiddeck-proton-a64')
|
||||
|
||||
def test_an_x64_proton_pick_reaches_the_arm64_client(self):
|
||||
self.install(self.x64, '550', 'Left 4 Dead 2')
|
||||
(self.x64 / 'config/config.vdf').write_text(CONFIG % mapping(_550='droiddeck-proton-a64'))
|
||||
self.run_share('arm64')
|
||||
self.assertEqual(SHARE['entries']((self.arm / 'config/config.vdf').read_text())['550'], 'droiddeck-proton-arm64')
|
||||
|
||||
def test_a_tool_the_user_chose_is_kept(self):
|
||||
(self.x64 / 'config/config.vdf').write_text(CONFIG % mapping(_13210='my-proton'))
|
||||
|
||||
Reference in new issue
Block a user