fix(dual-screen): DiRT stand-in put back for the Proton the game ran on

When a DiRT 3 / DiRT Showdown game was switched to another Proton, the first
launch swapped the stand-in in for the old Proton's ws2_32.dll link; Proton
then relinked the prefix's other DLLs to itself but left the stand-in, and
the old link went back after the game. With telemetry off the game would then
load the old Proton's ws2_32.dll under the new Wine. The launch now links the
running Proton's ws2_32.dll back instead when the saved link belongs to
another Proton (compared by real path, so esync packs that reach the stock
files through a linked folder count as the same Proton).
This commit is contained in:
The412Banner committed 2026-10-31 23:39:19 +00:00
1 parent e6e3673709
commit f8fb1db3c8
2 files changed
+32 -6

No files matched your search

@@ -811,17 +811,23 @@ def swap_dirt_ws2(prefix):
def restore_dirt_ws2(prefix, proton):
"""Puts the prefix's own syswow64/ws2_32.dll back if the stand-in is still there; true when it changed something."""
"""Puts a Wine syswow64/ws2_32.dll back if the stand-in is still there; true when it changed something.
That is the prefix's own one, unless the game ran on another Proton since the swap: Proton then relinked the
prefix's other DLLs to itself but left the stand-in, so the running Proton's ws2_32.dll goes back instead."""
target = prefix_ws2(prefix)
saved = target.with_name(target.name + DIRT_SAVED)
if os.path.lexists(saved):
if is_dirt_stand_in(target) or not os.path.lexists(target):
own = proton_ws2(proton)
had_saved = os.path.lexists(saved)
if had_saved:
if os.path.lexists(target) and not is_dirt_stand_in(target):
os.unlink(saved)
return False
if not own.is_file() or os.path.realpath(saved) == os.path.realpath(own):
os.replace(saved, target)
return True
os.unlink(saved)
return False
own = proton_ws2(proton)
if is_dirt_stand_in(target) and own.is_file():
if own.is_file() and (is_dirt_stand_in(target) or (had_saved and not os.path.lexists(target))):
link = target.with_name(target.name + ".droiddeck-tmp")
if os.path.lexists(link):
os.unlink(link)