#!/usr/bin/env bash # ============================================================================ # Gundam Breaker 4 - UltraWide Fix installer (Linux / Proton) # Installs SUWSF + Ultimate ASI Loader + our GB4 SUWSF.ini next to the # shipping exe. Idempotent. Use ./install.sh uninstall to remove. # ============================================================================ set -euo pipefail HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" LOADER_NAME="${LOADER_NAME:-dsound.dll}" # override: LOADER_NAME=version.dll ./install.sh # --- locate GB4 shipping exe dir across Steam libraries ----------------------- find_gamedir() { local cand for base in \ "$HOME/.steam/steam" "$HOME/.local/share/Steam" \ "/media/$USER/Data/steam" "/media/$USER"/*/steam \ "$HOME/.var/app/com.valvesoftware.Steam/.local/share/Steam"; do cand="$base/steamapps/common/GBBBB/GB4/Binaries/Win64" [ -f "$cand/GB4-Win64-Shipping.exe" ] && { echo "$cand"; return 0; } done # brute-force fallback cand=$(find /home /media /mnt -maxdepth 8 -name GB4-Win64-Shipping.exe 2>/dev/null | head -1) [ -n "$cand" ] && { dirname "$cand"; return 0; } return 1 } GAMEDIR="${GB4_WIN64_DIR:-$(find_gamedir || true)}" if [ -z "${GAMEDIR:-}" ] || [ ! -f "$GAMEDIR/GB4-Win64-Shipping.exe" ]; then echo "[!] Could not find GB4-Win64-Shipping.exe." echo " Set it manually: GB4_WIN64_DIR=/path/to/GB4/Binaries/Win64 ./install.sh" exit 1 fi echo "[+] Game dir: $GAMEDIR" ASI="$HERE/vendor/SUWSF-x64/SUWSF.asi" LOADER_SRC="$HERE/vendor/SUWSF-x64/dsound.dll" # Ultimate ASI Loader (adapts by filename) INI="$HERE/patch/SUWSF.ini" for f in "$ASI" "$LOADER_SRC" "$INI"; do [ -f "$f" ] || { echo "[!] missing $f"; exit 1; } done # --- locate the Proton prefix Engine.ini (for the immediate menu/lobby win) --- find_engine_ini() { local cand for base in \ "/media/$USER/Data/steam" "$HOME/.local/share/Steam" \ "$HOME/.steam/steam" "/media/$USER"/*/steam; do cand="$base/steamapps/compatdata/1672500/pfx/drive_c/users/steamuser/AppData/Local/GB4/Saved/Config/WindowsNoEditor/Engine.ini" [ -f "$cand" ] && { echo "$cand"; return 0; } done return 1 } MARK_BEGIN="; >>> BG4 UltraWide Fix (MaintainYFOV) >>>" MARK_END="; <<< BG4 UltraWide Fix <<<" apply_engine_ini() { local ini; ini="$(find_engine_ini || true)" [ -z "$ini" ] && { echo "[i] Engine.ini not found (launch the game once first); skipping menu-level win."; return; } if grep -qF "$MARK_BEGIN" "$ini"; then echo "[i] Engine.ini tweak already present."; return; fi cp -v "$ini" "$ini.bak-bg4uw" { echo ""; echo "$MARK_BEGIN"; echo "[/Script/Engine.LocalPlayer]"; echo "AspectRatioAxisConstraint=AspectRatio_MaintainYFOV"; echo "$MARK_END"; } >> "$ini" echo "[+] Engine.ini: added MaintainYFOV (fixes menus/lobby immediately; SUWSF covers missions)." } remove_engine_ini() { local ini; ini="$(find_engine_ini || true)" [ -z "$ini" ] && return if grep -qF "$MARK_BEGIN" "$ini"; then sed -i "/$(printf '%s' "$MARK_BEGIN" | sed 's/[][\/.*^$]/\\&/g')/,/$(printf '%s' "$MARK_END" | sed 's/[][\/.*^$]/\\&/g')/d" "$ini" echo "[+] Engine.ini: removed BG4 UltraWide block." fi } uninstall() { echo "[+] Uninstalling..." for f in SUWSF.asi SUWSF.ini dsound.dll dinput8.dll version.dll winmm.dll; do [ -f "$GAMEDIR/$f" ] && { rm -v "$GAMEDIR/$f"; } done remove_engine_ini echo "[+] Done. (game files untouched; nothing was ever modified in the exe)" } if [ "${1:-}" = "uninstall" ]; then uninstall; exit 0; fi # --- install ------------------------------------------------------------------ cp -v "$ASI" "$GAMEDIR/SUWSF.asi" cp -v "$INI" "$GAMEDIR/SUWSF.ini" cp -v "$LOADER_SRC" "$GAMEDIR/$LOADER_NAME" apply_engine_ini echo echo "[+] Installed: SUWSF.asi, SUWSF.ini, $LOADER_NAME" echo echo "NEXT (Steam):" echo " 1. If the game does not apply the fix, add this to GB4's Steam" echo " Launch Options (right-click game > Properties > Launch Options):" echo " WINEDLLOVERRIDES=\"${LOADER_NAME%.dll}=n,b\" %command%" echo " 2. Set the in-game resolution to 5120x1440 (fullscreen)." echo " 3. Launch. Camera should widen (Hor+) instead of zooming in." echo echo "If nothing changes, the runtime AOB may differ for GB4. Run:" echo " python3 tools/dump_decrypted.py (while game is at main menu)" echo " python3 tools/aob.py (reports which patterns matched)" echo echo "To try a different loader name: LOADER_NAME=version.dll ./install.sh" echo "To remove everything: ./install.sh uninstall"