mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-06 13:05:47 +00:00
fix(proton): set the anti-cheat runtime when the x86-64 tool is chosen directly
This commit is contained in:
1 parent
98f14f4005
commit
63dbb01185
3 files changed
+105
-27
No files matched your search
@@ -24,7 +24,9 @@ every tool in `compatibilitytools.d`) check each `run` and `waitforexitandrun` b
|
||||
|
||||
Without the x86-64 tool or the runtime files the launch stays on ARM64 and the launcher logs why.
|
||||
`DROIDDECK_ANTICHEAT=off` in the game's launch options keeps it on ARM64. Picking the x86-64 tool for a
|
||||
game in Steam always runs it under FEX.
|
||||
game in Steam always runs it under FEX. When that game has anti-cheat files, the wrapper sets the runtime the
|
||||
same way as routing does. Proton's own lookup cannot set it here: the x86-64 `lsteamclient` cannot reach the
|
||||
ARM64 Steam client (`steamclient_init_registry Failed to connect to Steam`).
|
||||
|
||||
## Why the x86-64 build needs its own Wine patches
|
||||
|
||||
|
||||
@@ -335,53 +335,72 @@ dd_x86_64_proton() {
|
||||
[ -d "$1/files/lib/wine/x86_64-unix" ] && [ ! -d "$1/files/bin-arm64" ]
|
||||
}
|
||||
|
||||
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 markers eac battleye tool runtime=
|
||||
[ -d "$game" ] || return 0
|
||||
markers=$(find "$game" -maxdepth 5 \\( -ipath '*/easyanticheat/settings.json' -o -iname 'easyanticheat_x64.so' \\
|
||||
dd_anticheat_files() {
|
||||
case ${verb:-} in waitforexitandrun | run) ;; *) return 1 ;; esac
|
||||
local markers
|
||||
DD_AC_GAME=${STEAM_COMPAT_INSTALL_PATH:-}
|
||||
DD_AC_ROOT=${STEAM_COMPAT_CLIENT_INSTALL_PATH:-${XDG_DATA_HOME:-$HOME/.local/share}/Steam}
|
||||
[ -d "$DD_AC_GAME" ] || return 1
|
||||
markers=$(find "$DD_AC_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
|
||||
DD_AC_EAC=$(printf '%s\\n' "$markers" | grep -i easyanticheat | head -n 1)
|
||||
DD_AC_BATTLEYE=$(printf '%s\\n' "$markers" | grep -iv easyanticheat | grep . | head -n 1)
|
||||
DD_AC_FOUND=${DD_AC_EAC:-$DD_AC_BATTLEYE}
|
||||
[ -n "$DD_AC_FOUND" ]
|
||||
}
|
||||
|
||||
dd_anticheat_bridge() {
|
||||
local runtime
|
||||
if [ -n "$DD_AC_EAC" ] && runtime=$(dd_anticheat_runtime "${PROTON_EAC_RUNTIME:-}" "Proton EasyAntiCheat Runtime" easyanticheat_x64.so); then
|
||||
export PROTON_EAC_RUNTIME="$runtime"
|
||||
DD_AC_FOUND=$DD_AC_EAC
|
||||
elif [ -n "$DD_AC_BATTLEYE" ] && runtime=$(dd_anticheat_runtime "${PROTON_BATTLEYE_RUNTIME:-}" "Proton BattlEye Runtime" beclient_x64.so); then
|
||||
export PROTON_BATTLEYE_RUNTIME="$runtime"
|
||||
DD_AC_FOUND=$DD_AC_BATTLEYE
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
dd_anticheat_x86_64() {
|
||||
dd_anticheat_files || return 0
|
||||
if dd_anticheat_bridge; then
|
||||
echo "droiddeck-proton: anti-cheat files in ${DD_AC_FOUND#$DD_AC_GAME/}; this x86-64 tool runs with its Proton runtime" >&2
|
||||
else
|
||||
echo "droiddeck-proton: anti-cheat files in ${DD_AC_FOUND#$DD_AC_GAME/}; its Proton runtime is not installed" >&2
|
||||
fi
|
||||
}
|
||||
|
||||
dd_anticheat() {
|
||||
case ${DROIDDECK_ANTICHEAT:-auto} in off | 0 | false) return 0 ;; esac
|
||||
dd_anticheat_files || return 0
|
||||
local game=$DD_AC_GAME tool
|
||||
case ${DD_AC_TOOL:-DroidDeck-Proton} in
|
||||
DroidDeck-Proton*) ;;
|
||||
*)
|
||||
echo "droiddeck-proton: anti-cheat files in ${found#$game/}; ${DD_AC_TOOL} was chosen for this game, so it runs as chosen" >&2
|
||||
echo "droiddeck-proton: anti-cheat files in ${DD_AC_FOUND#$game/}; ${DD_AC_TOOL} was chosen for this game, so it runs as chosen" >&2
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
/usr/local/bin/droiddeck-fex update || true
|
||||
if ! grep -qx fixed-guest-memory-above-host-address-limit /usr/local/share/fex-emu/.droiddeck-patches 2>/dev/null; then
|
||||
echo "droiddeck-proton: anti-cheat files in ${found#$game/}; the installed FEX build cannot run anti-cheat, so this launch stays on ARM64" >&2
|
||||
echo "droiddeck-proton: anti-cheat files in ${DD_AC_FOUND#$game/}; the installed FEX build cannot run anti-cheat, so this launch stays on ARM64" >&2
|
||||
return 0
|
||||
fi
|
||||
DD_AC_ROOT=${STEAM_COMPAT_CLIENT_INSTALL_PATH:-${XDG_DATA_HOME:-$HOME/.local/share}/Steam}
|
||||
tool=$(cd "$DD_AC_ROOT/compatibilitytools.d" 2>/dev/null && for d in DroidDeck-Proton*; do
|
||||
[ -x "$d/proton" ] && dd_x86_64_proton "$d" && printf '%s/%s\\n' "$PWD" "$d"
|
||||
done | sort -V | tail -n 1)
|
||||
if [ -z "$tool" ]; then
|
||||
echo "droiddeck-proton: anti-cheat files in ${found#$game/}; no x86-64 DroidDeck-Proton is installed, so this launch stays on ARM64" >&2
|
||||
echo "droiddeck-proton: anti-cheat files in ${DD_AC_FOUND#$game/}; no x86-64 DroidDeck-Proton is installed, so this launch stays on ARM64" >&2
|
||||
return 0
|
||||
fi
|
||||
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
|
||||
if ! dd_anticheat_bridge; then
|
||||
echo "droiddeck-proton: anti-cheat files in ${DD_AC_FOUND#$game/}; its Proton runtime is not installed, so this launch stays on ARM64" >&2
|
||||
return 0
|
||||
fi
|
||||
dd_game_cpus
|
||||
declare -F dd_components >/dev/null && dd_components "$tool"
|
||||
echo "droiddeck-proton: anti-cheat files in ${found#$game/}; running ${tool##*/} under FEX" >&2
|
||||
echo "droiddeck-proton: anti-cheat files in ${DD_AC_FOUND#$game/}; running ${tool##*/} under FEX" >&2
|
||||
exec ${DD_TASKSET:-} /usr/local/bin/droiddeck-fex proton "$tool/proton" "$verb" "$@"
|
||||
}
|
||||
"""
|
||||
@@ -586,6 +605,7 @@ if [ -n "${PROOT_FP_KEY:-}" ] && [ -f "$audit" ]; then
|
||||
esac
|
||||
fi
|
||||
if dd_x86_64_proton "$here"; then
|
||||
dd_anticheat_x86_64
|
||||
dd_game_cpus
|
||||
exec ${DD_TASKSET:-} /usr/local/bin/droiddeck-fex proton "$here/%s" "$verb" "$@"
|
||||
fi
|
||||
|
||||
@@ -69,6 +69,62 @@ class AntiCheatRoutingTest(unittest.TestCase):
|
||||
routed = json.loads(self.record.read_text()) if self.record.exists() else None
|
||||
return result, routed
|
||||
|
||||
def chosen_x86_64(self, verb="waitforexitandrun", extra=None):
|
||||
tool = self.tool("DroidDeck-Proton-11.0-1-x86_64")
|
||||
wrapper = tool / "droiddeck-proton-wrap"
|
||||
wrapper.write_text(COMPAT["extra_wrapper_sh"]("proton").replace("/usr/local/bin/droiddeck-fex", str(self.fex)))
|
||||
wrapper.chmod(0o755)
|
||||
env = {"PATH": os.environ["PATH"], "HOME": str(self.root), "DD_RECORD": str(self.record),
|
||||
"STEAM_COMPAT_INSTALL_PATH": str(self.game), "STEAM_COMPAT_CLIENT_INSTALL_PATH": str(self.steam)}
|
||||
env.update(extra or {})
|
||||
result = subprocess.run([str(wrapper), verb, str(self.game / "game.exe")], env=env, capture_output=True, text=True, timeout=30)
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
routed = json.loads(self.record.read_text())
|
||||
self.assertEqual(routed["argv"], ["proton", str(tool / "proton"), verb, str(self.game / "game.exe")])
|
||||
return result, routed
|
||||
|
||||
def test_a_chosen_x86_64_tool_gets_the_eac_runtime(self):
|
||||
self.file("Binaries/Win64/EasyAntiCheat/Settings.json")
|
||||
runtime = self.runtime("Proton EasyAntiCheat Runtime", "easyanticheat_x64.so")
|
||||
result, routed = self.chosen_x86_64()
|
||||
self.assertEqual((routed["eac"], routed["be"]), (str(runtime), None))
|
||||
self.assertIn("anti-cheat files in Binaries/Win64/EasyAntiCheat/Settings.json; this x86-64 tool runs with its Proton runtime",
|
||||
result.stderr)
|
||||
|
||||
def test_a_chosen_x86_64_tool_gets_the_battleye_runtime(self):
|
||||
self.file("BattlEye/BEService_x64.exe")
|
||||
runtime = self.runtime("Proton BattlEye Runtime", "beclient_x64.so")
|
||||
_, routed = self.chosen_x86_64()
|
||||
self.assertEqual((routed["eac"], routed["be"]), (None, str(runtime)))
|
||||
|
||||
def test_a_chosen_x86_64_tool_keeps_a_runtime_already_set(self):
|
||||
self.file("EasyAntiCheat/Settings.json")
|
||||
self.runtime("Proton EasyAntiCheat Runtime", "easyanticheat_x64.so")
|
||||
own = self.root / "own-eac"
|
||||
(own / "v2").mkdir(parents=True)
|
||||
(own / "v2" / "easyanticheat_x64.so").write_text("")
|
||||
_, routed = self.chosen_x86_64(extra={"PROTON_EAC_RUNTIME": str(own)})
|
||||
self.assertEqual(routed["eac"], str(own))
|
||||
|
||||
def test_a_chosen_x86_64_tool_without_the_runtime_still_runs_under_fex(self):
|
||||
self.file("EasyAntiCheat/Settings.json")
|
||||
(self.common / "Proton EasyAntiCheat Runtime").mkdir(parents=True)
|
||||
result, routed = self.chosen_x86_64()
|
||||
self.assertEqual((routed["eac"], routed["be"]), (None, None))
|
||||
self.assertIn("its Proton runtime is not installed", result.stderr)
|
||||
|
||||
def test_a_chosen_x86_64_tool_leaves_games_without_anti_cheat_and_other_verbs_alone(self):
|
||||
self.runtime("Proton EasyAntiCheat Runtime", "easyanticheat_x64.so")
|
||||
self.runtime("Proton BattlEye Runtime", "beclient_x64.so")
|
||||
self.file("Data/Settings.json")
|
||||
result, routed = self.chosen_x86_64()
|
||||
self.assertEqual((routed["eac"], routed["be"]), (None, None))
|
||||
self.assertNotIn("anti-cheat", result.stderr)
|
||||
self.file("EasyAntiCheat/Settings.json")
|
||||
result, routed = self.chosen_x86_64(verb="getcompatpath")
|
||||
self.assertEqual((routed["eac"], routed["be"]), (None, None))
|
||||
self.assertNotIn("anti-cheat", result.stderr)
|
||||
|
||||
def test_eos_easy_anti_cheat_runs_the_newest_x86_64_build_under_fex(self):
|
||||
self.file("EasyAntiCheat/Settings.json")
|
||||
self.tool("DroidDeck-Proton-11.0-1-x86_64")
|
||||
|
||||
Reference in new issue
Block a user