diff --git a/tools/linuxfs/overlay/usr/local/bin/droiddeck-game-env b/tools/linuxfs/overlay/usr/local/bin/droiddeck-game-env index a854bb1d7b..c9f37a3612 100755 --- a/tools/linuxfs/overlay/usr/local/bin/droiddeck-game-env +++ b/tools/linuxfs/overlay/usr/local/bin/droiddeck-game-env @@ -107,6 +107,15 @@ def godot_sentry(game): return {"WINEDLLOVERRIDES": ";".join(n + "=d" for n in sentry)}, [], "Godot: Sentry crash handler off" +@fix +def d3dgear_hook(game): + """D3DGear's capture DLL left beside a game (The Crew 2) is loaded by it and hooks the DXGI swapchain; + under Wine the hook faults over a thousand times within seconds and the game never presents again: + black screen while the sound keeps playing.""" + if "d3dgear64.dll" in game.files: + return {"WINEDLLOVERRIDES": "d3dgear64=d"}, [], "D3DGear capture hook off (it stops the game drawing)" + + @fix def deep_rock_gdk_raytracing(game): if game.stem == "fsd-wingdk-shipping" and not any(game.has_arg(arg) for arg in ("-raytracing", "-noraytracing")): @@ -254,7 +263,10 @@ def engine_fixes(exe, args): for check in FIXES: found = check(game) if found: - env.update(found[0]) + for name, value in found[0].items(): + if name == "WINEDLLOVERRIDES" and env.get(name): + value = env[name] + ";" + value + env[name] = value extra += found[1] notes.append(found[2]) return env, extra, notes diff --git a/tools/tests/test_game_environment.py b/tools/tests/test_game_environment.py index b4bc05aada..0bb794517c 100644 --- a/tools/tests/test_game_environment.py +++ b/tools/tests/test_game_environment.py @@ -402,6 +402,27 @@ class GameEnvironmentTest(unittest.TestCase): (asylum / name).touch() self.assertEqual(MODULE["engine_fixes"](str(asylum / "BmLauncher.exe"), []), ({}, [], [])) + def test_d3dgear_capture_hook_beside_the_game_is_turned_off(self): + with tempfile.TemporaryDirectory() as tmp: + game = Path(tmp) / "The Crew 2" + game.mkdir() + for name in ("TheCrew2.exe", "TheCrew2_BE.exe", "d3dgear64.dll"): + (game / name).touch() + env, extra, notes = MODULE["engine_fixes"](str(game / "TheCrew2.exe"), []) + self.assertEqual((env, extra), ({"WINEDLLOVERRIDES": "d3dgear64=d"}, [])) + self.assertTrue(notes) + (game / "d3dgear64.dll").rename(game / "D3DGear64.DLL") + self.assertEqual(MODULE["engine_fixes"](str(game / "TheCrew2.exe"), [])[0], {"WINEDLLOVERRIDES": "d3dgear64=d"}) + (game / "D3DGear64.DLL").unlink() + self.assertEqual(MODULE["engine_fixes"](str(game / "TheCrew2.exe"), []), ({}, [], [])) + + def test_dll_overrides_from_several_fixes_are_all_kept(self): + with tempfile.TemporaryDirectory() as tmp: + for name in ("Game.exe", "Game.pck", "GodotSharp.dll", "libsentry.windows.release.x86_64.dll", "d3dgear64.dll"): + (Path(tmp) / name).touch() + env = MODULE["engine_fixes"](str(Path(tmp) / "Game.exe"), [])[0] + self.assertEqual(env["WINEDLLOVERRIDES"], "libsentry.windows.release.x86_64=d;d3dgear64=d") + def test_black_ops_iii_and_dark_souls_remastered_skip_protonfixes(self): for exe in ("/game/Call of Duty Black Ops III/BlackOps3.exe", "/game/DARK SOULS REMASTERED/DarkSoulsRemastered.exe"): env, extra, notes = MODULE["engine_fixes"](exe, [])