#!/usr/bin/env bash # Revert every change made by install.sh, restoring the *.orig backups. set -euo pipefail GAME_ROOT="${1:?usage: ./uninstall.sh }" D="$GAME_ROOT/data" APPID=2326780 restore() { # if [ -f "$1.orig" ]; then mv -f "$1.orig" "$1"; echo "restored $(basename "$1")" else echo "no backup for $(basename "$1") (skipped)" fi } # kill only this prefix's wineserver, matched via WINEPREFIX in its # environment; a blanket pkill would lose unflushed registry changes in # unrelated Wine prefixes kill_prefix_wineserver() { # local pfx pid env_pfx pfx="$(cd "$1" 2>/dev/null && pwd)" || return 0 for pid in $(pgrep -x wineserver 2>/dev/null || true); do env_pfx="$(tr '\0' '\n' < "/proc/$pid/environ" 2>/dev/null \ | sed -n 's/^WINEPREFIX=//p' | head -1 || true)" if [ -n "$env_pfx" ] && [ "${env_pfx%/}" = "$pfx" ]; then kill -9 "$pid" 2>/dev/null || true fi done } restore "$D/kmyCore.dll" restore "$D/bakinplayer.exe" restore "$D/lib/sysresource/shader/include/v2_vpcommon.cgh" # fix 5 added a single registry value, so remove just that line; restoring a # whole user.reg backup would wipe every registry change made since install PFX="$GAME_ROOT/../../compatdata/$APPID/pfx" REG="$PFX/user.reg" if [ -f "$REG" ] && grep -qaxF '"UseTakeFocus"="N"' "$REG"; then kill_prefix_wineserver "$PFX" # so wineserver can't flush over our edit tmp="$(mktemp)" grep -vaxF '"UseTakeFocus"="N"' "$REG" > "$tmp" cp "$tmp" "$REG"; rm -f "$tmp" echo "removed UseTakeFocus=N from user.reg (.bak-* backups kept as fallback)" else echo "UseTakeFocus=N not present in user.reg (nothing to revert)" fi echo "Done. Also clear the game's Steam Launch Options if you set them."