#!/usr/bin/env bash set -euo pipefail # Bannerlord Runtime Verification — Apple Silicon # Issue #720: Verify the local Windows game runtime for Bannerlord # # Usage: ./scripts/bannerlord_verify_runtime.sh BOTTLE_NAME="Bannerlord" BOTTLE_DIR="$HOME/Library/Application Support/Whisky/Bottles/$BOTTLE_NAME" REPORT_FILE="/tmp/bannerlord_runtime_verify.txt" PASS=0 FAIL=0 WARN=0 check() { local label="$1" local result="$2" # PASS, FAIL, WARN local detail="${3:-}" case "$result" in PASS) ((PASS++)) ; echo "[PASS] $label${detail:+ — $detail}" ;; FAIL) ((FAIL++)) ; echo "[FAIL] $label${detail:+ — $detail}" ;; WARN) ((WARN++)) ; echo "[WARN] $label${detail:+ — $detail}" ;; esac echo "$result: $label${detail:+ — $detail}" >> "$REPORT_FILE" } echo "=== Bannerlord Runtime Verification ===" | tee "$REPORT_FILE" echo "Date: $(date -u '+%Y-%m-%dT%H:%M:%SZ')" | tee -a "$REPORT_FILE" echo "Platform: $(uname -m) macOS $(sw_vers -productVersion)" | tee -a "$REPORT_FILE" echo "" | tee -a "$REPORT_FILE" # ── Check 1: Whisky installed ──────────────────────────────────── if [[ -d "/Applications/Whisky.app" ]]; then VER=$(defaults read "/Applications/Whisky.app/Contents/Info.plist" CFBundleShortVersionString 2>/dev/null || echo "?") check "Whisky installed" "PASS" "v$VER at /Applications/Whisky.app" else check "Whisky installed" "FAIL" "not found at /Applications/Whisky.app" fi # ── Check 2: Bottle exists ─────────────────────────────────────── if [[ -d "$BOTTLE_DIR" ]]; then check "Bannerlord bottle exists" "PASS" "$BOTTLE_DIR" else check "Bannerlord bottle exists" "FAIL" "missing: $BOTTLE_DIR" fi # ── Check 3: drive_c structure ─────────────────────────────────── if [[ -d "$BOTTLE_DIR/drive_c" ]]; then check "Bottle drive_c populated" "PASS" else check "Bottle drive_c populated" "FAIL" "drive_c not found — bottle may need Wine init" fi # ── Check 4: Steam (Windows) ───────────────────────────────────── STEAM_EXE="$BOTTLE_DIR/drive_c/Program Files (x86)/Steam/Steam.exe" if [[ -f "$STEAM_EXE" ]]; then check "Steam (Windows) installed" "PASS" "$STEAM_EXE" else check "Steam (Windows) installed" "FAIL" "not found at expected path" fi # ── Check 5: Bannerlord executable ─────────────────────────────── BANNERLORD_EXE="$BOTTLE_DIR/drive_c/Program Files (x86)/Steam/steamapps/common/Mount & Blade II Bannerlord/bin/Win64_Shipping_Client/Bannerlord.exe" if [[ -f "$BANNERLORD_EXE" ]]; then EXE_SIZE=$(stat -f%z "$BANNERLORD_EXE" 2>/dev/null || echo "?") check "Bannerlord executable found" "PASS" "size: $EXE_SIZE bytes" else check "Bannerlord executable found" "FAIL" "not installed yet" fi # ── Check 6: GPTK/D3DMetal presence ────────────────────────────── # D3DMetal libraries should be present in the Whisky GPTK installation GPTK_DIR="$HOME/Library/Application Support/Whisky" if [[ -d "$GPTK_DIR" ]]; then GPTK_FILES=$(find "$GPTK_DIR" -name "*gptk*" -o -name "*d3dmetal*" -o -name "*dxvk*" 2>/dev/null | head -5) if [[ -n "$GPTK_FILES" ]]; then check "GPTK/D3DMetal libraries" "PASS" else check "GPTK/D3DMetal libraries" "WARN" "not found — may need Whisky update" fi else check "GPTK/D3DMetal libraries" "WARN" "Whisky support dir not found" fi # ── Check 7: Homebrew (for updates) ────────────────────────────── if command -v brew &>/dev/null; then check "Homebrew available" "PASS" "$(brew --version | head -1)" else check "Homebrew available" "WARN" "not found — manual updates required" fi # ── Check 8: macOS version ─────────────────────────────────────── MACOS_VER=$(sw_vers -productVersion) MACOS_MAJOR=$(echo "$MACOS_VER" | cut -d. -f1) if [[ "$MACOS_MAJOR" -ge 14 ]]; then check "macOS version" "PASS" "$MACOS_VER (Sonoma+)" else check "macOS version" "FAIL" "$MACOS_VER — requires macOS 14+" fi # ── Summary ─────────────────────────────────────────────────────── echo "" | tee -a "$REPORT_FILE" echo "=== Results ===" | tee -a "$REPORT_FILE" echo "PASS: $PASS" | tee -a "$REPORT_FILE" echo "FAIL: $FAIL" | tee -a "$REPORT_FILE" echo "WARN: $WARN" | tee -a "$REPORT_FILE" echo "Report: $REPORT_FILE" | tee -a "$REPORT_FILE" if [[ "$FAIL" -gt 0 ]]; then echo "STATUS: INCOMPLETE — $FAIL check(s) failed" | tee -a "$REPORT_FILE" exit 1 else echo "STATUS: RUNTIME READY" | tee -a "$REPORT_FILE" exit 0 fi