Run Windows games on Apple Silicon — free, open source, with an open compatibility database that tells you what actually works.
Swift apple-silicond3dmetaldxmtdxvkfexgame-porting-toolkitgamingmac-gamingmacosmetalmoltenvksteamswiftuivkd3d-protonwhisky-alternativewindows-gameswinewine-wrapper
Game smoke: every installed verified title must launch, show its window and keep drawing
Gauthier Piarrette736a0f7b1569
diff --git a/.gitignore b/.gitignoreindex 34c798e..0cc6177 100644--- a/.gitignore+++ b/.gitignore@@ -11,3 +11,4 @@ private/*.o*.d*.swiftdeps+Scripts/winlistdiff --git a/Scripts/build-winlist.sh b/Scripts/build-winlist.shnew file mode 100755index 0000000..e10b477--- /dev/null+++ b/Scripts/build-winlist.sh@@ -0,0 +1,8 @@+#!/bin/zsh+# Builds Scripts/winlist, the CGWindowList helper the smoke scripts use to find a game window+# (id, owner pid, title, frame, on-screen). Wine windows are invisible to AppleScript, so the+# screen tests key off the window server instead.+set -euo pipefail+cd "$(dirname "$0")"+swiftc -O -o winlist winlist.swift -framework CoreGraphics -framework Foundation 2>&1 | grep -v warning || true+[ -x winlist ] && echo "built Scripts/winlist"diff --git a/Scripts/game-smoke.sh b/Scripts/game-smoke.shnew file mode 100755index 0000000..6d7a4c6--- /dev/null+++ b/Scripts/game-smoke.sh@@ -0,0 +1,71 @@+#!/bin/zsh+# Game smoke: every verified title that is installed in the Gaming environment must still+# launch, show its window, and keep drawing. The "never regress" gate for games, the way+# render-smoke.sh is for renderers and upgrade-smoke.sh is for the app.+#+# For each entry in GAMES (appid, renderer, window regex, name, optional extra args): restart+# Steam under the row's renderer (a game inherits the running client's renderer), launch, wait+# for a window, then take three captures ten seconds apart and require that they differ (a+# frozen or blank window fails) and that no Wine crash dialog appeared. Records+# private/game-smoke/latest.json {passed, epoch, date, results[]}, which Scripts/release.sh+# reads (warn-only, 14-day window). Captures land in private/game-smoke/.+#+# Titles that are not installed are skipped (reported as "not installed"), so the gate only+# ever measures what this machine has; the release note says what was covered.+#+# Usage: Scripts/game-smoke.sh (the whole table)+# Scripts/game-smoke.sh 730 4465480 (only these appids)+set -u+ROOT="$(cd "$(dirname "$0")/.." && pwd)"+HB="$ROOT/.build/debug/highball"; [ -x "$HB" ] || swift build --package-path "$ROOT" >/dev/null+H="$HOME/Library/Application Support/Highball"+ST="$H/bottles/Gaming/drive_c/Program Files (x86)/Steam/steamapps"+OUT="$ROOT/private/game-smoke"; mkdir -p "$OUT"+WINLIST="$ROOT/Scripts/winlist" # CGWindowList helper built by Scripts/build-winlist.sh+[ -x "$WINLIST" ] || { echo "missing $WINLIST (run Scripts/build-winlist.sh)"; exit 2; }++# appid | renderer | window regex | name | extra launch args (map load etc.)+GAMES=(+ "730|dxmt|Counter-Strike 2|cs2|"+ "4465480|dxvk|Counter-Strike: Global|csgo-legacy|-novid +map de_dust2"+ "620|dxvk|PORTAL 2|portal2|"+ "400|dxvk|Portal|portal|"+ "1902490|dxvk|Aperture Desk Job|aperture|"+ "244210|d3dmetal|Assetto|assetto|"+ "230410|dxmt|Warframe|warframe|"+ "3314060|dxvk|Sims|sims|"+)+only=("$@")+results=(); passed=true+for row in "${GAMES[@]}"; do+ IFS='|' read -r appid renderer winre name extra <<< "$row"+ if [ ${#only[@]} -gt 0 ] && ! printf '%s\n' "${only[@]}" | grep -qx "$appid"; then continue; fi+ st=$(grep -E '"StateFlags"' "$ST/appmanifest_$appid.acf" 2>/dev/null | grep -oE '[0-9]+' | tail -1)+ if [ "$st" != "4" ]; then echo "[$name] not installed"; results+=("{\"appid\":$appid,\"name\":\"$name\",\"result\":\"not installed\"}"); continue; fi+ echo "[$(date +%H:%M:%S)] $name ($appid) under $renderer"+ pkill -9 -f 'Steam/steam.exe' 2>/dev/null; pkill -9 -f steamwebhelper 2>/dev/null; sleep 3+ ($HB run Gaming 'C:\Program Files (x86)\Steam\steam.exe' --renderer $renderer -- -silent > /dev/null 2>&1 &); sleep 35+ ($HB run Gaming 'C:\Program Files (x86)\Steam\steam.exe' -- -applaunch $appid $extra > "$OUT/$name.log" 2>&1 &)+ n=0; until "$WINLIST" 2>/dev/null | grep -iE "wine.*($winre)" | grep -q 'on=true' || [ $n -ge 60 ]; do sleep 3; n=$((n+1)); done+ id=$("$WINLIST" 2>/dev/null | grep -iE "wine.*($winre)" | grep on=true | head -1 | awk '{print $1}')+ if [ -z "$id" ]; then echo " FAIL: no window within $((n*3))s"; results+=("{\"appid\":$appid,\"name\":\"$name\",\"result\":\"no window\"}"); passed=false+ else+ sleep 40; h=(); for k in 1 2 3; do screencapture -x -l "$id" "$OUT/$name-$k.png" 2>/dev/null; h+=("$(md5 -q "$OUT/$name-$k.png" 2>/dev/null)"); sleep 10; done+ crash=$("$WINLIST" 2>/dev/null | grep -iE 'Program Error|Wine Debugger' | grep -c on=true)+ if [ "$crash" -gt 0 ]; then echo " FAIL: crash dialog"; results+=("{\"appid\":$appid,\"name\":\"$name\",\"result\":\"crash dialog\"}"); passed=false+ elif [ "${h[1]}" = "${h[2]}" ] && [ "${h[2]}" = "${h[3]}" ]; then echo " FAIL: window frozen or blank (3 identical captures)"; results+=("{\"appid\":$appid,\"name\":\"$name\",\"result\":\"frozen\"}"); passed=false+ else echo " ok: window after ~$((n*3))s, drawing"; results+=("{\"appid\":$appid,\"name\":\"$name\",\"result\":\"ok\",\"windowAfter\":$((n*3))}"); fi+ fi+ pkill -9 -f -iE "steamapps/common/[^ ]*($winre|$name)" 2>/dev/null; pkill -9 -f winedbg 2>/dev/null; sleep 2+ # kill the game by its window-owning wine process if still up (generic)+ for p in $(ps -axo pid,command | grep -E 'steamapps/common' | grep -vE 'grep|steam\.exe|steamwebhelper|gameoverlayui' | awk '{print $1}'); do kill -9 $p 2>/dev/null; done+done+pkill -9 -f 'Steam/steam.exe' 2>/dev/null; pkill -9 -f steamwebhelper 2>/dev/null+python3 - "$OUT/latest.json" "$passed" "$(IFS=,; echo "${results[*]}")" <<'PY'+import json,sys,time+out, passed, res = sys.argv[1], sys.argv[2]=="true", sys.argv[3]+json.dump({"passed": passed, "epoch": int(time.time()), "date": time.strftime("%Y-%m-%d"),+ "engine": "shipped", "results": json.loads("["+res+"]")}, open(out,"w"), indent=2)+print("GAME SMOKE", "PASSED" if passed else "FAILED", "->", out)+PY+$passeddiff --git a/Scripts/release.sh b/Scripts/release.shindex 82dd5e8..9486b2b 100755--- a/Scripts/release.sh+++ b/Scripts/release.sh@@ -43,6 +43,22 @@ thensleep 5fi+# Game regressions (a launcher going silent, a map load freezing) ship via engine, app and OS+# changes alike, so a release wants a recent Scripts/game-smoke.sh result: every verified title+# installed here launched, showed its window and kept drawing. Same rule: warn, don't block.+if ! python3 - <<'PY'+import json, sys, time+d = json.load(open("private/game-smoke/latest.json"))+sys.exit(0 if d.get("passed") and time.time() - d.get("epoch", 0) < 14*86400 else 1)+PY+then+ echo "" >&2+ echo "WARNING: no passing game-smoke result from the last 14 days." >&2+ echo " Run Scripts/game-smoke.sh: a verified game going silent ships unnoticed without it." >&2+ echo " Continuing in 5s…" >&2+ sleep 5+fi+Scripts/make-app.sh release "$VERSION"ZIP="dist/Highball-$VERSION.zip"ditto -c -k --keepParent dist/Highball.app "$ZIP"diff --git a/Scripts/winlist.swift b/Scripts/winlist.swiftnew file mode 100644index 0000000..64c7cdc--- /dev/null+++ b/Scripts/winlist.swift@@ -0,0 +1,18 @@+import CoreGraphics+import Foundation+let opts: CGWindowListOption = [.optionAll, .excludeDesktopElements]+let list = CGWindowListCopyWindowInfo(opts, kCGNullWindowID) as? [[String: Any]] ?? []+let filter = CommandLine.arguments.count > 1 ? CommandLine.arguments[1].lowercased() : ""+for w in list {+ let owner = w["kCGWindowOwnerName"] as? String ?? ""+ let name = w["kCGWindowName"] as? String ?? ""+ let pid = w["kCGWindowOwnerPID"] as? Int ?? 0+ let id = w["kCGWindowNumber"] as? Int ?? 0+ let layer = w["kCGWindowLayer"] as? Int ?? 0+ let on = (w["kCGWindowIsOnscreen"] as? Bool) ?? false+ let b = w["kCGWindowBounds"] as? [String: Any] ?? [:]+ let bounds = "\(b["X"] ?? 0),\(b["Y"] ?? 0) \(b["Width"] ?? 0)x\(b["Height"] ?? 0)"+ if filter.isEmpty || (owner + " " + name).lowercased().contains(filter) {+ print("\(id)\tpid=\(pid)\t\(owner)\t|\(name)|\t\(bounds)\tlayer=\(layer)\ton=\(on)")+ }+}