diff --git a/docs/development/anti-cheat.md b/docs/development/anti-cheat.md index f7507f2b7c..e99bb9698c 100644 --- a/docs/development/anti-cheat.md +++ b/docs/development/anti-cheat.md @@ -12,6 +12,9 @@ every tool in `compatibilitytools.d`) check each `run` and `waitforexitandrun` b - **Condition.** The game folder (`STEAM_COMPAT_INSTALL_PATH`, three levels deep) holds one of `EasyAntiCheat/Settings.json`, `easyanticheat_x64.so`, `BEClient_x64.so` or `BEService_x64.exe`. No title, app ID or device list is involved. +- **Chosen tool.** Only launches through DroidDeck's own Proton (the built-in launcher or a `DroidDeck-Proton*` + folder) are moved. A game set to any other tool, such as GE-Proton, Bionic or Valve's Proton, in DroidDeck or + in Steam's Properties, runs on that tool and the launcher logs that it was chosen. - **Tool.** The newest `compatibilitytools.d/DroidDeck-Proton*` whose layout is x86-64 (`files/lib/wine/x86_64-unix`, no `files/bin-arm64`). - **Runtime.** `PROTON_EAC_RUNTIME` or `PROTON_BATTLEYE_RUNTIME` when it already points at a folder with the diff --git a/tools/linuxfs/overlay/usr/local/bin/steam-compatibility b/tools/linuxfs/overlay/usr/local/bin/steam-compatibility index 6b1a8d8346..ae6564bc4b 100755 --- a/tools/linuxfs/overlay/usr/local/bin/steam-compatibility +++ b/tools/linuxfs/overlay/usr/local/bin/steam-compatibility @@ -343,6 +343,13 @@ dd_anticheat() { 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) [ -n "$found" ] || return 0 + 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 + return 0 + ;; + esac 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" @@ -568,7 +575,7 @@ if dd_x86_64_proton "$here"; then dd_game_cpus exec ${DD_TASKSET:-} /usr/local/bin/droiddeck-fex proton "$here/%s" "$verb" "$@" fi -dd_anticheat "$@" +DD_AC_TOOL=$(basename "$(cd "$here" && pwd -P)") dd_anticheat "$@" dd_components "$here" dd_directaudio "$here" "$@" dd_game_cpus diff --git a/tools/tests/test_anticheat_routing.py b/tools/tests/test_anticheat_routing.py index c5edbf098a..d2e50bd4b2 100644 --- a/tools/tests/test_anticheat_routing.py +++ b/tools/tests/test_anticheat_routing.py @@ -126,6 +126,30 @@ class AntiCheatRoutingTest(unittest.TestCase): self.assertIsNone(routed) self.assertIn("stayed", result.stdout) + def test_a_tool_the_user_chose_is_kept(self): + self.file("EasyAntiCheat/Settings.json") + self.tool("DroidDeck-Proton-11.0-1-x86_64") + self.runtime("Proton EasyAntiCheat Runtime", "easyanticheat_x64.so") + for chosen in ("GE-Proton11-15-aarch64", "DroidDeck-Bionic-14.1-r85", "proton_experimental"): + result, routed = self.launch(extra={"DD_AC_TOOL": chosen}) + self.assertIsNone(routed) + self.assertIn("stayed", result.stdout) + self.assertIn("%s was chosen for this game, so it runs as chosen" % chosen, result.stderr) + + def test_droiddeck_proton_builds_still_route(self): + self.file("EasyAntiCheat/Settings.json") + newest = self.tool("DroidDeck-Proton-11.0-1-x86_64") + self.runtime("Proton EasyAntiCheat Runtime", "easyanticheat_x64.so") + for own in ("DroidDeck-Proton 11-14.1", "DroidDeck-Proton-11-14.2"): + self.record.unlink(missing_ok=True) + result, routed = self.launch(extra={"DD_AC_TOOL": own}) + self.assertEqual(routed["argv"][1], str(newest / "proton")) + + def test_adopted_tools_pass_their_own_folder_name(self): + wrapper = COMPAT["extra_wrapper_sh"]("proton") + self.assertIn('DD_AC_TOOL=$(basename "$(cd "$here" && pwd -P)") dd_anticheat "$@"', wrapper) + self.assertNotIn("DD_AC_TOOL=", COMPAT["LAUNCHER_SH"]) + def test_other_verbs_are_left_alone(self): self.file("EasyAntiCheat/Settings.json") self.tool("DroidDeck-Proton-11.0-1-x86_64")