modified: README.md

new file:   battlenet-diagnose.sh
	modified:   battlenet-umu-setup.sh
	new file:   battlenet-update-proton.sh
This commit is contained in:
funman300
2026-04-16 12:59:47 -07:00
parent 28b1f0f824
commit 6f36e503fd
4 changed files with 877 additions and 58 deletions
+268
View File
@@ -0,0 +1,268 @@
#!/usr/bin/env bash
#
# battlenet-diagnose.sh
#
# Checks the health of your Battle.net / umu-launcher setup and reports
# anything that looks wrong. Safe to run at any time — read-only, no changes.
#
# Usage:
# ./battlenet-diagnose.sh
# ./battlenet-diagnose.sh --prefix-dir=PATH # check a non-default prefix
set -uo pipefail
# ---------- config ----------
PREFIX_DIR="${BATTLENET_PREFIX:-$HOME/Games/battlenet-umu}"
LAUNCH_SCRIPT="${HOME}/.local/bin/battlenet"
PROTON_COMPAT_DIR="${HOME}/.local/share/Steam/compatibilitytools.d"
LAUNCHER_EXE_REL="drive_c/Program Files (x86)/Battle.net/Battle.net Launcher.exe"
for arg in "$@"; do
case "$arg" in
--prefix-dir=*) PREFIX_DIR="${arg#*=}" ;;
-h|--help) grep '^#' "$0" | grep -v '^#!/' | sed 's/^# \{0,1\}//'; exit 0 ;;
*) echo "Unknown argument: $arg" >&2; exit 1 ;;
esac
done
# ---------- helpers ----------
c_reset=$'\033[0m'
c_green=$'\033[1;32m'; c_yellow=$'\033[1;33m'; c_red=$'\033[1;31m'
c_blue=$'\033[1;34m'; c_dim=$'\033[2m'; c_bold=$'\033[1m'
pass() { printf ' %s✓%s %s\n' "$c_green" "$c_reset" "$*"; }
fail() { printf ' %s✗%s %s\n' "$c_red" "$c_reset" "$*"; ISSUES=$(( ISSUES + 1 )); }
warn() { printf ' %s!%s %s\n' "$c_yellow" "$c_reset" "$*"; WARNINGS=$(( WARNINGS + 1 )); }
info() { printf ' %s·%s %s\n' "$c_dim" "$c_reset" "$*"; }
section() { printf '\n%s%s%s\n' "$c_bold$c_blue" "$*" "$c_reset"; }
ISSUES=0
WARNINGS=0
# ---------- system ----------
section "System"
info "Kernel: $(uname -r)"
info "Date: $(date)"
if [[ $EUID -eq 0 ]]; then
fail "Running as root — Wine/Proton must run as a regular user"
else
pass "Not running as root"
fi
if pacman -Sl multilib >/dev/null 2>&1; then
pass "[multilib] enabled"
else
fail "[multilib] not enabled — required for 32-bit libraries"
fi
# ---------- GPU & drivers ----------
section "GPU & Drivers"
GPU_LINE=""
if command -v lspci >/dev/null 2>&1; then
GPU_LINE=$(lspci | grep -i "VGA\|3D\|Display" | head -1 || true)
if [[ -n "$GPU_LINE" ]]; then
info "GPU: $GPU_LINE"
else
warn "No VGA/3D/Display device found via lspci"
fi
else
warn "lspci not found (install pciutils) — GPU detection skipped"
fi
# Vulkan
if command -v vulkaninfo >/dev/null 2>&1; then
if vulkaninfo 2>/dev/null | grep -q "apiVersion"; then
VK_VER=$(vulkaninfo 2>/dev/null | grep "apiVersion" | head -1 | sed 's/.*= *//')
pass "Vulkan available (apiVersion: $VK_VER)"
else
fail "vulkaninfo ran but reported no Vulkan devices"
fi
else
warn "vulkaninfo not found — install vulkan-tools to verify Vulkan support"
fi
# 32-bit Vulkan ICD loader
if pacman -Qi lib32-vulkan-icd-loader >/dev/null 2>&1; then
pass "lib32-vulkan-icd-loader installed"
else
fail "lib32-vulkan-icd-loader missing — install with: sudo pacman -S lib32-vulkan-icd-loader"
fi
# ---------- umu-launcher ----------
section "umu-launcher"
if command -v umu-run >/dev/null 2>&1; then
UMU_PATH=$(command -v umu-run)
UMU_VER=$(umu-run --version 2>/dev/null | head -1 || echo "unknown")
pass "umu-run found: $UMU_PATH ($UMU_VER)"
else
fail "umu-run not on PATH — install with: sudo pacman -S umu-launcher"
fi
# ---------- GE-Proton ----------
section "GE-Proton"
if [[ -d "$PROTON_COMPAT_DIR" ]]; then
mapfile -t PROTON_VERSIONS < <(find "$PROTON_COMPAT_DIR" -maxdepth 1 -type d -name "GE-Proton*" | sort -rV)
if [[ ${#PROTON_VERSIONS[@]} -gt 0 ]]; then
pass "${#PROTON_VERSIONS[@]} GE-Proton version(s) installed:"
for v in "${PROTON_VERSIONS[@]}"; do
info " $(basename "$v")"
done
else
warn "No GE-Proton versions found in $PROTON_COMPAT_DIR"
warn "umu-run will download GE-Proton automatically on first launch"
fi
else
warn "Proton compat dir not found: $PROTON_COMPAT_DIR"
warn "It will be created when umu-run downloads GE-Proton"
fi
# Check what the launch script is pinned to
if [[ -f "$LAUNCH_SCRIPT" ]]; then
PINNED=$(grep '^export PROTONPATH=' "$LAUNCH_SCRIPT" 2>/dev/null | head -1 \
| sed 's/.*="\?\([^"]*\)"\?.*/\1/' || echo "")
if [[ -n "$PINNED" ]]; then
info "Launch script pinned to: $PINNED"
if [[ "$PINNED" == "GE-Proton" ]]; then
info "(tracking latest — will auto-download if not present)"
elif [[ -d "$PROTON_COMPAT_DIR/$PINNED" ]]; then
pass "Pinned version is installed"
else
fail "Pinned version '$PINNED' not found in $PROTON_COMPAT_DIR"
fail "Run: ./battlenet-update-proton.sh --version=$PINNED"
fi
fi
fi
# ---------- prefix ----------
section "Wine Prefix ($PREFIX_DIR)"
if [[ -d "$PREFIX_DIR" ]]; then
pass "Prefix directory exists"
LAUNCHER_PATH="$PREFIX_DIR/$LAUNCHER_EXE_REL"
if [[ -f "$LAUNCHER_PATH" ]]; then
pass "Battle.net Launcher.exe present"
else
fail "Battle.net Launcher.exe NOT found at expected path"
fail " Expected: $LAUNCHER_PATH"
fail "Re-run battlenet-umu-setup.sh (or use --reinstall)"
fi
# Check for common stuck-agent cache
AGENT_LOCK="$PREFIX_DIR/drive_c/ProgramData/Battle.net/Agent/agent.lock"
if [[ -f "$AGENT_LOCK" ]]; then
LOCK_AGE=$(( $(date +%s) - $(stat -c%Y "$AGENT_LOCK") ))
if (( LOCK_AGE > 300 )); then
warn "Stale agent.lock found (${LOCK_AGE}s old) — may cause BLZBNTBNA00000005"
warn "Fix: battlenetkill && rm -f \"$AGENT_LOCK\""
else
info "agent.lock exists but is fresh (${LOCK_AGE}s) — launcher may be running"
fi
fi
# Check prefix ownership
if [[ -O "$PREFIX_DIR" ]]; then
pass "Prefix is owned by current user"
else
fail "Prefix is NOT owned by current user — Wine will misbehave"
fail "Fix: sudo chown -R $(whoami): \"$PREFIX_DIR\""
fi
else
fail "Prefix directory does not exist: $PREFIX_DIR"
fail "Run battlenet-umu-setup.sh to create it"
fi
# ---------- launch scripts ----------
section "Launch Scripts"
if [[ -f "$LAUNCH_SCRIPT" ]]; then
pass "Launch script exists: $LAUNCH_SCRIPT"
if [[ -x "$LAUNCH_SCRIPT" ]]; then
pass "Launch script is executable"
else
fail "Launch script is NOT executable — run: chmod +x $LAUNCH_SCRIPT"
fi
# Verify env vars are present
for var in WINEPREFIX GAMEID PROTONPATH; do
if grep -q "^export $var=" "$LAUNCH_SCRIPT"; then
VAL=$(grep "^export $var=" "$LAUNCH_SCRIPT" | head -1 | sed 's/.*="\?\([^"]*\)"\?.*/\1/')
info "$var=$VAL"
else
fail "Launch script missing: export $var=..."
fi
done
else
fail "Launch script not found: $LAUNCH_SCRIPT"
fail "Run battlenet-umu-setup.sh to create it"
fi
KILL_SCRIPT="$HOME/.local/bin/battlenetkill"
if [[ -f "$KILL_SCRIPT" && -x "$KILL_SCRIPT" ]]; then
pass "Kill script exists and is executable: $KILL_SCRIPT"
else
warn "Kill script missing or not executable: $KILL_SCRIPT"
fi
# ---------- display / Wayland ----------
section "Display"
if [[ -n "${WAYLAND_DISPLAY:-}" ]]; then
info "Wayland session detected (WAYLAND_DISPLAY=$WAYLAND_DISPLAY)"
if [[ -n "${DISPLAY:-}" ]]; then
pass "XWayland is available (DISPLAY=$DISPLAY)"
info "Battle.net will run via XWayland — this is correct"
else
fail "No DISPLAY set — XWayland does not appear to be running"
fail "Battle.net requires XWayland under Wayland"
fail "Make sure your compositor starts XWayland (most do by default)"
fi
elif [[ -n "${DISPLAY:-}" ]]; then
pass "X11 session (DISPLAY=$DISPLAY)"
else
warn "Neither DISPLAY nor WAYLAND_DISPLAY is set — running headless?"
fi
# ---------- running processes ----------
section "Running Processes"
BN_PROCS=$(pgrep -fl 'Battle\.net\|battle\.net\|bnet' 2>/dev/null || true)
AGENT_PROCS=$(pgrep -fl 'Agent\.exe' 2>/dev/null || true)
WINE_PROCS=$(pgrep -fl 'wine\|wineserver\|proton' 2>/dev/null | grep -v 'grep' || true)
if [[ -n "$BN_PROCS" ]]; then
info "Battle.net process(es) running:"
while IFS= read -r line; do info " $line"; done <<< "$BN_PROCS"
else
info "No Battle.net processes running"
fi
if [[ -n "$AGENT_PROCS" ]]; then
info "Agent process(es) running:"
while IFS= read -r line; do info " $line"; done <<< "$AGENT_PROCS"
fi
if [[ -n "$WINE_PROCS" ]]; then
info "Wine/Proton process(es) running:"
while IFS= read -r line; do info " $line"; done <<< "$WINE_PROCS"
fi
# ---------- summary ----------
echo
printf '%s%s%s\n' "$c_bold$c_blue" "=== Summary ===" "$c_reset"
if [[ $ISSUES -eq 0 && $WARNINGS -eq 0 ]]; then
printf '%s✓ Everything looks good.%s\n' "$c_green" "$c_reset"
elif [[ $ISSUES -eq 0 ]]; then
printf '%s! %d warning(s). Battle.net should work, but check the items above.%s\n' \
"$c_yellow" "$WARNINGS" "$c_reset"
else
printf '%s✗ %d issue(s), %d warning(s). See items marked ✗ above.%s\n' \
"$c_red" "$ISSUES" "$WARNINGS" "$c_reset"
fi
echo