fix(proton): hand steam:// links to Steam and route anti-cheat in Unreal binary folders (#3754)

* Hand steam:// links to Steam and find anti-cheat files in Unreal binary folders

The link helper skipped itself by comparing resolved paths. Without proot the same
file is reachable under two paths, so the helper ran itself forever and a launch
whose Proton fix asks Steam to install a runtime never started. It now compares the
files themselves and passes steam:// links to the Steam client.

Anti-cheat routing looked only three folders deep, which misses the
<Project>/Binaries/Win64/<anti-cheat> layout Unreal games use; it now looks five deep.

* Use whichever anti-cheat runtime is installed when a game ships both kinds
This commit is contained in:
MaxsTechReview authored and GitHub committed 2026-12-05 10:11:48 -05:00
1 parent 8d34be4b0d
commit b9f149b3c9
4 files changed
+89 -9

No files matched your search

@@ -3,6 +3,7 @@
import json
import os
LAUNCH_DIR_FILE = "/tmp/droiddeck-browser/launch-dir"
STEAM = "/usr/local/bin/droiddeck-steam-shim"
import sys
import time
from pathlib import Path
@@ -17,6 +18,13 @@ def hand_over(url, launch_dir):
os.rename(tmp, req / (rid + ".json"))
def same_file(a, b):
try:
return os.path.samefile(a, b)
except OSError:
return os.path.realpath(a) == os.path.realpath(b)
def where(url):
from urllib.parse import urlsplit
try:
@@ -40,10 +48,11 @@ def main(argv):
if url.startswith(("https://", "http://")) and launch_dir:
hand_over(url, launch_dir)
return 0
here = os.path.dirname(os.path.realpath(sys.argv[0]))
if url.startswith("steam://") and os.access(STEAM, os.X_OK):
os.execv(STEAM, [STEAM, url])
for d in os.environ.get("PATH", "").split(os.pathsep):
candidate = os.path.join(d, "xdg-open")
if os.access(candidate, os.X_OK) and os.path.realpath(candidate) != os.path.realpath(__file__) and os.path.abspath(d) != here:
if os.access(candidate, os.X_OK) and not same_file(candidate, __file__):
os.execv(candidate, [candidate] + argv)
return 1
@@ -338,10 +338,13 @@ dd_x86_64_proton() {
dd_anticheat() {
case ${verb:-} in waitforexitandrun | run) ;; *) return 0 ;; esac
case ${DROIDDECK_ANTICHEAT:-auto} in off | 0 | false) return 0 ;; esac
local game=${STEAM_COMPAT_INSTALL_PATH:-} found tool runtime
local game=${STEAM_COMPAT_INSTALL_PATH:-} found markers eac battleye tool runtime=
[ -d "$game" ] || return 0
found=$(find "$game" -maxdepth 3 \\( -ipath '*/easyanticheat/settings.json' -o -iname 'easyanticheat_x64.so' \\
-o -iname 'beclient_x64.so' -o -iname 'beservice_x64.exe' \\) -print -quit 2>/dev/null)
markers=$(find "$game" -maxdepth 5 \\( -ipath '*/easyanticheat/settings.json' -o -iname 'easyanticheat_x64.so' \\
-o -iname 'beclient_x64.so' -o -iname 'beservice_x64.exe' \\) -print 2>/dev/null)
eac=$(printf '%s\\n' "$markers" | grep -i easyanticheat | head -n 1)
battleye=$(printf '%s\\n' "$markers" | grep -iv easyanticheat | grep . | head -n 1)
found=${eac:-$battleye}
[ -n "$found" ] || return 0
case ${DD_AC_TOOL:-DroidDeck-Proton} in
DroidDeck-Proton*) ;;
@@ -363,10 +366,15 @@ dd_anticheat() {
echo "droiddeck-proton: anti-cheat files in ${found#$game/}; no x86-64 DroidDeck-Proton is installed, so this launch stays on ARM64" >&2
return 0
fi
case ${found,,} in
*easyanticheat*) runtime=$(dd_anticheat_runtime "${PROTON_EAC_RUNTIME:-}" "Proton EasyAntiCheat Runtime" easyanticheat_x64.so) && export PROTON_EAC_RUNTIME="$runtime" ;;
*) runtime=$(dd_anticheat_runtime "${PROTON_BATTLEYE_RUNTIME:-}" "Proton BattlEye Runtime" beclient_x64.so) && export PROTON_BATTLEYE_RUNTIME="$runtime" ;;
esac
if [ -n "$eac" ] && runtime=$(dd_anticheat_runtime "${PROTON_EAC_RUNTIME:-}" "Proton EasyAntiCheat Runtime" easyanticheat_x64.so); then
export PROTON_EAC_RUNTIME="$runtime"
found=$eac
elif [ -n "$battleye" ] && runtime=$(dd_anticheat_runtime "${PROTON_BATTLEYE_RUNTIME:-}" "Proton BattlEye Runtime" beclient_x64.so); then
export PROTON_BATTLEYE_RUNTIME="$runtime"
found=$battleye
else
runtime=
fi
if [ -z "$runtime" ]; then
echo "droiddeck-proton: anti-cheat files in ${found#$game/}; its Proton runtime is not installed, so this launch stays on ARM64" >&2
return 0
+22
View File
@@ -88,6 +88,28 @@ class AntiCheatRoutingTest(unittest.TestCase):
_, routed = self.launch()
self.assertEqual((routed["argv"][1], routed["be"], routed["eac"]), (str(tool / "proton"), str(runtime), None))
def test_anti_cheat_in_an_unreal_binaries_folder_is_found(self):
for found in ("Project/Binaries/Win64/BattlEye/BEService_x64.exe", "Project/Binaries/Win64/EasyAntiCheat/Settings.json"):
with self.subTest(found=found):
self.setUp()
self.file(found)
tool = self.tool("DroidDeck-Proton-11.0-1-x86_64")
self.runtime("Proton BattlEye Runtime", "beclient_x64.so")
self.runtime("Proton EasyAntiCheat Runtime", "easyanticheat_x64.so")
_, routed = self.launch()
self.assertEqual(routed["argv"][1], str(tool / "proton"))
def test_a_game_with_both_kinds_uses_whichever_runtime_is_installed(self):
for installed, key in (("Proton BattlEye Runtime", "be"), ("Proton EasyAntiCheat Runtime", "eac")):
with self.subTest(installed=installed):
self.setUp()
self.file("BattlEye/BEService_x64.exe")
self.file("Project/Binaries/Win64/EasyAntiCheat/Settings.json")
tool = self.tool("DroidDeck-Proton-11.0-1-x86_64")
runtime = self.runtime(installed, "beclient_x64.so" if key == "be" else "easyanticheat_x64.so")
_, routed = self.launch()
self.assertEqual((routed["argv"][1], routed[key]), (str(tool / "proton"), str(runtime)))
def test_a_runtime_already_set_with_files_is_kept(self):
self.file("EasyAntiCheat/Settings.json")
self.tool("DroidDeck-Proton-11.0-1-x86_64")
+41
View File
@@ -247,6 +247,47 @@ class Browser(unittest.TestCase):
self.assertEqual({'op': 'open-url', 'url': 'https://www.epicgames.com/activate'}, json.loads(reqs[0].read_text()))
self.assertEqual('https://www.epicgames.com', xdg.where('https://www.epicgames.com/activate?code=SECRET'))
def run_open(self, xdg, url, path):
calls = []
saved_exec, saved_path = os.execv, os.environ.get('PATH')
os.execv = lambda prog, args: calls.append((prog, args))
os.environ['PATH'] = path
try:
result = xdg.main([url])
finally:
os.execv = saved_exec
if saved_path is None:
del os.environ['PATH']
else:
os.environ['PATH'] = saved_path
return result, calls
def test_a_steam_link_goes_to_the_steam_client(self):
xdg = load_path(BIN / 'droiddeck-open-url', 'open_url_steam')
with tempfile.TemporaryDirectory() as root:
steam = Path(root) / 'steam'
steam.write_text('#!/bin/sh\n')
steam.chmod(0o755)
xdg.STEAM = str(steam)
result, calls = self.run_open(xdg, 'steam://install/1161040', root)
self.assertEqual([(str(steam), [str(steam), 'steam://install/1161040'])], calls)
def test_another_path_to_this_helper_is_never_run_again(self):
xdg = load_path(BIN / 'droiddeck-open-url', 'open_url_alias')
with tempfile.TemporaryDirectory() as root:
own, alias, real = (Path(root) / d for d in ('own', 'alias', 'real'))
for d in (own, alias, real):
d.mkdir()
(own / 'xdg-open').write_text((BIN / 'droiddeck-open-url').read_text())
(own / 'xdg-open').chmod(0o755)
os.link(own / 'xdg-open', alias / 'xdg-open')
(real / 'xdg-open').write_text('#!/bin/sh\n')
(real / 'xdg-open').chmod(0o755)
xdg.__file__ = str(own / 'xdg-open')
xdg.STEAM = str(Path(root) / 'missing')
result, calls = self.run_open(xdg, 'mailto:someone', os.pathsep.join(map(str, (alias, own, real))))
self.assertEqual([(str(real / 'xdg-open'), [str(real / 'xdg-open'), 'mailto:someone'])], calls)
class ExeTarget(unittest.TestCase):
def test_a_game_started_by_its_exe_is_found_from_a_subfolder(self):