mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-21 05:46:03 +00:00
feat: launch Easy Anti-Cheat games offline when they support it (#1039)
This commit is contained in:
1 parent
8ca389149b
commit
2a8618ab5c
6 files changed
+93
No files matched your search
@@ -201,6 +201,64 @@ class GameEnvironmentTest(unittest.TestCase):
|
||||
(other / "Other.exe").touch()
|
||||
self.assertEqual(MODULE["engine_fixes"](str(other / "Other.exe"), []), ({}, [], []))
|
||||
|
||||
def test_easy_anti_cheat_games_start_offline_only_when_opted_in(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
game = Path(tmp) / "ELDEN RING/Game"
|
||||
(game / "EasyAntiCheat").mkdir(parents=True)
|
||||
for name in ("start_protected_game.exe", "eldenring.exe"):
|
||||
(game / name).touch()
|
||||
(game / "EasyAntiCheat/settings.json").write_text('\ufeff{ "executable" : "eldenring.exe" }', encoding="utf-8")
|
||||
command = ["proton", "waitforexitandrun", str(game / "start_protected_game.exe"), "-arg"]
|
||||
offline = MODULE["offline_without_anticheat"]
|
||||
self.assertEqual(offline(command, {}), command)
|
||||
self.assertEqual(offline(command, {"DROIDDECK_ANTICHEAT_OFFLINE": "0"}), command)
|
||||
self.assertEqual(offline(command, {"DROIDDECK_ANTICHEAT_OFFLINE": "1"}),
|
||||
["proton", "waitforexitandrun", str(game / "eldenring.exe"), "-arg"])
|
||||
(game / "EasyAntiCheat/settings.json").write_text('{ "executable" : "../../escape.exe" }')
|
||||
(Path(tmp) / "escape.exe").touch()
|
||||
self.assertEqual(offline(command, {"DROIDDECK_ANTICHEAT_OFFLINE": "1"}), command)
|
||||
(game / "EasyAntiCheat/settings.json").write_text('{ "executable" : "missing.exe" }')
|
||||
self.assertEqual(offline(command, {"DROIDDECK_ANTICHEAT_OFFLINE": "1"}), command)
|
||||
(game / "EasyAntiCheat/settings.json").write_text('{ "executable" : "link/escape.exe" }')
|
||||
outside = Path(tmp) / "outside"
|
||||
outside.mkdir()
|
||||
(outside / "escape.exe").touch()
|
||||
(game / "link").symlink_to(outside, target_is_directory=True)
|
||||
self.assertEqual(offline(command, {"DROIDDECK_ANTICHEAT_OFFLINE": "1"}), command)
|
||||
(game / "EasyAntiCheat/settings.json").write_text('{ "executable" : "eldenring.exe" }')
|
||||
plain = ["proton", "waitforexitandrun", str(game / "eldenring.exe")]
|
||||
self.assertEqual(offline(plain, {"DROIDDECK_ANTICHEAT_OFFLINE": "1"}), plain)
|
||||
self.assertEqual(offline(["proton", "run", command[2]],
|
||||
{"DROIDDECK_ANTICHEAT_OFFLINE": "1"}),
|
||||
["proton", "run", command[2]])
|
||||
|
||||
def test_easy_anti_cheat_forwarding_through_entrypoint(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
home = Path(tmp)
|
||||
game = home / "ELDEN RING/Game"
|
||||
(game / "EasyAntiCheat").mkdir(parents=True)
|
||||
bootstrapper = game / "start_protected_game.exe"
|
||||
target = game / "eldenring.exe"
|
||||
bootstrapper.touch()
|
||||
target.touch()
|
||||
(game / "EasyAntiCheat/settings.json").write_text(json.dumps({"executable": "eldenring.exe"}))
|
||||
proton = home / "fake-proton"
|
||||
proton.write_text("#!" + sys.executable + "\nimport json, sys\nprint(json.dumps(sys.argv[1:]))\n")
|
||||
proton.chmod(0o755)
|
||||
config = home / ".config/droiddeck/game-environment.json"
|
||||
config.parent.mkdir(parents=True)
|
||||
env = dict(os.environ, HOME=tmp, STEAM_COMPAT_DATA_PATH="/compatdata/42")
|
||||
env.pop("DROIDDECK_ANTICHEAT_OFFLINE", None)
|
||||
for setting, expected in (("1", target), ("0", bootstrapper), (None, bootstrapper)):
|
||||
with self.subTest(setting=setting):
|
||||
values = {} if setting is None else {"DROIDDECK_ANTICHEAT_OFFLINE": setting}
|
||||
config.write_text(json.dumps({"version": 1, "games": {"42": values}}))
|
||||
result = subprocess.run([sys.executable, str(BIN / "droiddeck-game-env"),
|
||||
str(proton), "waitforexitandrun", str(bootstrapper), "-arg"],
|
||||
env=env, text=True, capture_output=True, check=True)
|
||||
self.assertEqual(json.loads(result.stdout.strip()),
|
||||
["waitforexitandrun", str(expected), "-arg"])
|
||||
|
||||
def test_deep_rock_gdk_avoids_the_raytracing_pipeline_crash(self):
|
||||
game = "/game/FSD/Binaries/WinGDK/FSD-WinGDK-Shipping.exe"
|
||||
env, extra, notes = MODULE["engine_fixes"](game, [])
|
||||
|
||||
Reference in new issue
Block a user