Files
DroidDeck/tools/dirt-ws2/build.sh
T
The412Banner 268dcef559 fix(dual-screen): DiRT 3 and DiRT Showdown telemetry no longer stops the game (error 10038)
DiRT 3 and DiRT Showdown keep sending motion telemetry on the UDP socket they
closed at the end of a race (and when leaving Joyride); sendto() fails with
WSAENOTSOCK and the game stops with "sendto failed with error 10038".

- tools/dirt-ws2: a 32-bit ws2_32.dll stand-in. Every export jumps to the
  same-ordinal export of Wine's own ws2_32.dll; only a sendto() failing with
  10038 reports 0 bytes sent. Built in CI (components recipe dirt-ws2, clang +
  lld) with its exports checked against Wine 11's list, staged to
  /usr/local/lib/droiddeck-dirt.
- droiddeck-game-env: for dirt3_game.exe / showdown.exe / showdown_avx.exe
  with the game's UDP/motion output on, and a Proton whose own ws2_32.dll lacks
  the fix, the stand-in replaces the prefix's syswow64/ws2_32.dll (Wine loads
  ws2_32 as a KnownDLL from there, so a copy beside the game is ignored) with
  WINEDLLOVERRIDES=ws2_32=n,b; the launch waits for the game and puts the
  prefix's own file back. A copy left by a killed launch is put back at the
  next launch in that prefix.
- Automatic turns DiRT 3 and DiRT Showdown on like the other games again; the
  crash warning and the switched-on-by-hand memory from the previous build
  are gone.

Same behaviour as DiRTTelemetryErrorFix by RoccoC (MIT), based on the fix by
Carsten Gottschling. DroidDeck-Proton gets the same rule in its own ws2_32
(branch fix/dirt-telemetry-sendto); the swap is skipped there.
2026-10-31 21:55:36 +00:00

27 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# Builds the 32-bit ws2_32.dll stand-in for DiRT 3 and DiRT Showdown into the given folder.
set -euo pipefail
here=$(cd "$(dirname "$0")" && pwd)
mkdir -p "$1"
out=$(cd "$1" && pwd)
work=$(mktemp -d)
trap 'rm -rf "$work"' EXIT
tool() {
local found
found=$(command -v "$1" || ls /usr/lib/llvm-*/bin/"$1" 2>/dev/null | sort -V | tail -n1 || true)
[ -n "$found" ] || { echo "dirt-ws2: $1 not found" >&2; exit 1; }
echo "$found"
}
clang=$(tool clang)
dlltool=$(tool llvm-dlltool)
tool ld.lld > /dev/null
python3 "$here/gen.py" generate "$here" "$work"
"$dlltool" -m i386 -k -d "$here/kernel32.def" -l "$work/libkernel32.a"
"$clang" --target=i686-w64-mingw32 -O2 -Wall -Wextra -Werror -ffreestanding -fno-stack-protector -fno-builtin \
-nostdlib -shared -fuse-ld=lld -o "$work/ws2_32.dll" "$here/ws2_32.c" "$work/thunks.c" "$work/ws2_32.def" \
-L"$work" -lkernel32 -Wl,--entry,DllMain@12 -Wl,--no-insert-timestamp
python3 "$here/gen.py" verify "$here" "$work/ws2_32.dll"
install -m 644 "$work/ws2_32.dll" "$out/ws2_32.dll"