Skip to content

Run Windows games on Apple Silicon — free, open source, with an open compatibility database that tells you what actually works.

The gate probes the Wine 11 engine it ships, and the probe makes a display call

Gauthier Piarrette2099d18a2ad9
diff --git a/Scripts/engine-probe-smoke.sh b/Scripts/engine-probe-smoke.sh
index 9711bd3..67f327d 100755
--- a/Scripts/engine-probe-smoke.sh
+++ b/Scripts/engine-probe-smoke.sh
@@ -1,17 +1,26 @@
#!/bin/zsh
# Engine probes: small Windows programs that measure one Wine-on-macOS fact an engine patch
-# exists for, run through the CLI in an environment on that engine. A rebuilt engine that
-# quietly loses a patch fails here in seconds, where a game would fail an hour into a test.
+# exists for, run through the CLI in an environment on the newest Wine 11 engine this build
+# ships. A rebuilt engine that quietly loses a patch, or a patch that breaks something a game
+# reads, fails here in seconds, where a game would fail an hour into a test.
#
-# lasterr (patch 0011, engine x64-crossover26.3-r11 and later): after DeleteFileW on a missing
-# file, GetLastError(), TEB->LastErrorValue and %gs:0x68 must all read 2, and 1234 after
-# SetLastError(1234). Before 0011, %gs:0x68 on macOS was libc's TSD slot and held a heap pointer,
-# which MSVC-built code (Unity's Mono) read as the error: The Last Flame's Start did nothing
-# (highball#99). The probe source is spike/lasterr/lasterr.c; it is built here with mingw when
-# the binary is missing.
+# lasterr (patches 0011 and 0016, engine x64-crossover26.3-r11 and later): after DeleteFileW on
+# a missing file, GetLastError(), TEB->LastErrorValue and %gs:0x68 must all read 2, and 1234
+# after SetLastError(1234). Before 0011, %gs:0x68 on macOS was libc's TSD slot and held a heap
+# pointer, which MSVC-built code (Unity's Mono) read as the error: The Last Flame's Start did
+# nothing (highball#99). Then after a display call, a window and a message to it, GetLastError()
+# must still be an error code, never a pointer: 0011 as shipped in r11 to r14 wrote the error
+# back a second time on every user-mode callback return, and the Rockstar Games Launcher
+# installer refused to install on those engines (highball-db#272; fixed by 0016 in r15). The gate
+# passed on r12 for two weeks because the probe made no display call. Now it does.
#
-# Exit 0 when every applicable probe passes, 1 on a wrong value, 3 (skipped) when no environment
-# sits on an engine the probe applies to or mingw is absent. Needs no screen and no sign-in.
+# The probe runs on the newest x64-crossover26.3 manifest under spike/engines: the engine is
+# installed when it is missing, in a throwaway environment named after it, so what is probed is
+# what ships, not whatever environment happens to exist. The probe source is spike/lasterr/
+# lasterr.c; it is built here with mingw when the binary is missing.
+#
+# Exit 0 when every probe passes, 1 on a wrong value, 3 (skipped) when mingw is absent or the
+# engine cannot be installed. Needs no screen and no sign-in.
set -u
HB=${HB:-.build/debug/highball}
OUT=private/engine-probe; mkdir -p "$OUT"
@@ -20,26 +29,44 @@ if [ ! -x "$PROBE" ] && [ ! -f "$PROBE" ]; then
command -v x86_64-w64-mingw32-gcc >/dev/null || { echo "engine-probe: no mingw to build $PROBE"; exit 3; }
x86_64-w64-mingw32-gcc -O1 -o "$PROBE" spike/lasterr/lasterr.c || { echo "engine-probe: build of $PROBE failed"; exit 1; }
fi
-# The first environment on a CrossOver-tree engine at revision 11 or later.
-bottle=""
-while IFS=$'\t' read -r name engine rest; do
- id=${engine#engine=}
- case "$id" in
- x64-crossover26.3-r*) rev=${id##*-r}; [ "$rev" -ge 11 ] 2>/dev/null && { bottle=$name; engine_id=$id; break; } ;;
- esac
+# The newest Wine 11 manifest this build ships.
+manifest=$(for f in spike/engines/x64-crossover26.3-r*.json; do n=${f##*-r}; printf '%s\t%s\n' "${n%.json}" "$f"; done | sort -n | tail -1 | cut -f2)
+engine_id=$(python3 -c "import json,sys; print(json.load(open(sys.argv[1]))['id'])" "$manifest")
+rev=${engine_id##*-r}
+[ "$rev" -ge 11 ] 2>/dev/null || { echo "engine-probe: $engine_id predates patch 0011 (lasterr not applicable)"; exit 3; }
+if ! $HB engine list 2>/dev/null | cut -f1 | grep -qx "$engine_id"; then
+ echo "engine-probe: installing $engine_id from $manifest"
+ $HB engine install "$manifest" > "$OUT/install.txt" 2>&1 || { tail -3 "$OUT/install.txt"; echo "engine-probe: could not install $engine_id"; exit 3; }
+fi
+bottle="probe-$engine_id"
+# One probe environment per shipped revision; the ones for earlier revisions go.
+while IFS=$'\t' read -r name rest; do
+ case "$name" in probe-x64-crossover26.3-r*) [ "$name" = "$bottle" ] || $HB bottle delete "$name" >/dev/null 2>&1 ;; esac
done < <($HB bottle list 2>/dev/null)
-[ -n "$bottle" ] || { echo "engine-probe: no environment on a Wine 11 engine at r11 or later (lasterr not applicable)"; exit 3; }
+if ! $HB bottle list 2>/dev/null | cut -f1 | grep -qx "$bottle"; then
+ echo "engine-probe: creating $bottle (the Windows setup takes about 90 s)"
+ $HB bottle create "$bottle" --engine "$engine_id" --renderer dxmt > "$OUT/create.txt" 2>&1 || { tail -3 "$OUT/create.txt"; echo "engine-probe: could not create $bottle"; exit 1; }
+fi
$HB run "$bottle" "$PWD/$PROBE" --verbose > "$OUT/lasterr.txt" 2>&1
-cat "$OUT/lasterr.txt" | grep -v "^exit=\|^# exit="
+grep -E "^(DeleteFileW|after )" "$OUT/lasterr.txt"
python3 - "$OUT/lasterr.txt" "$bottle" "$engine_id" <<'PY'
import re, sys
text = open(sys.argv[1]).read()
+where = f"{sys.argv[2]} ({sys.argv[3]})"
m1 = re.search(r'DeleteFileW ok=(\d+) GetLastError=(\d+) \(0x[0-9a-f]+\) TEB->LastErrorValue=(\d+) %gs:0x68=(\d+)', text)
m2 = re.search(r'after SetLastError\(1234\): GetLastError=(\d+) %gs:0x68=(\d+)', text)
if not (m1 and m2):
- print(f"ENGINE PROBE FAILED on {sys.argv[2]} ({sys.argv[3]}): lasterr printed nothing usable"); sys.exit(1)
+ print(f"ENGINE PROBE FAILED on {where}: lasterr printed nothing usable"); sys.exit(1)
ok, api, teb, gs = m1.groups(); api2, gs2 = m2.groups()
if (ok, api, teb, gs) != ('0', '2', '2', '2') or (api2, gs2) != ('1234', '1234'):
- print(f"ENGINE PROBE FAILED on {sys.argv[2]} ({sys.argv[3]}): expected 2/2/2 then 1234/1234, got {api}/{teb}/{gs} then {api2}/{gs2} (patch 0011 missing?)"); sys.exit(1)
-print(f"ENGINE PROBE PASSED on {sys.argv[2]} ({sys.argv[3]}): lasterr 2/2/2 and 1234/1234")
+ print(f"ENGINE PROBE FAILED on {where}: expected 2/2/2 then 1234/1234, got {api}/{teb}/{gs} then {api2}/{gs2} (patch 0011 missing?)"); sys.exit(1)
+# After a callback the value may be a code Wine set on the way (0, 1400, 5 are all seen), never
+# a pointer: patch 0011 without 0016 put the thread's libc slot there, a number in the millions.
+after = dict(re.findall(r'after (GetSystemMetrics|CreateWindowExW|SendMessageW): GetLastError=(\d+)', text))
+if set(after) != {'GetSystemMetrics', 'CreateWindowExW', 'SendMessageW'}:
+ print(f"ENGINE PROBE FAILED on {where}: the callback lines are missing ({sorted(after)})"); sys.exit(1)
+bad = {k: v for k, v in after.items() if int(v) > 0xFFFF}
+if bad:
+ print(f"ENGINE PROBE FAILED on {where}: GetLastError returned a pointer after a window callback: {bad} (patch 0016 missing? the Rockstar installer refuses to install on this engine)"); sys.exit(1)
+print(f"ENGINE PROBE PASSED on {where}: lasterr 2/2/2 and 1234/1234, after callbacks {after}")
PY
diff --git a/Scripts/gate.sh b/Scripts/gate.sh
index 7fd5430..0ee1fd4 100755
--- a/Scripts/gate.sh
+++ b/Scripts/gate.sh
@@ -55,14 +55,17 @@ run unit swift test
run upgrade Scripts/upgrade-smoke.sh --screen
run firstrun Scripts/firstrun-smoke.sh --screen
run launch-window Scripts/launch-window-smoke.sh
+# Engine probes (Scripts/engine-probe-smoke.sh): one Windows program per Wine-on-macOS patch,
+# run in a throwaway environment on the newest Wine 11 engine this build ships. Required since
+# 2026-10-02: engines r11 to r14 shipped with GetLastError returning a pointer after any window
+# callback, the Rockstar Games Launcher refused to install on them for two weeks, and the probe
+# of the day made no display call, so the gate never saw it (highball-db#272).
+run engine-probe Scripts/engine-probe-smoke.sh
echo "gate: advisory checks"
run game Scripts/game-smoke.sh
# Advisory until its false-fail rate is zero, like every new check: the process-environment
# invariant behind the 2026-09-18 launcher fixes (see Scripts/env-invariant-smoke.sh).
run env-invariant Scripts/env-invariant-smoke.sh
-# Engine probes (Scripts/engine-probe-smoke.sh): one Windows program per Wine-on-macOS patch,
-# run in an environment on the engine that carries it. lasterr covers patch 0011 (r11+).
-run engine-probe Scripts/engine-probe-smoke.sh
[ $WITH_RENDER = 1 ] && run render Scripts/render-smoke.sh
passed=true
diff --git a/Scripts/make-app.sh b/Scripts/make-app.sh
index 617e442..7818207 100755
--- a/Scripts/make-app.sh
+++ b/Scripts/make-app.sh
@@ -28,6 +28,11 @@ for f in glob.glob("Sources/HighballApp/*.swift"):
missing = sorted(used - set(keys))
if missing: print(f"warning: {len(missing)} L() strings without a French line (English shows instead):", missing)
PY
+# SwiftPM's Bundle.module accessor looks for the resource bundle next to the executable or at the
+# absolute build path of the machine that compiled it, never under Contents/Resources, so an app
+# that reads it runs on the builder's Mac and crashes at launch everywhere else (PR #230,
+# 2026-10-01). App resources go through Bundle.main, from the files this script copies.
+if grep -rq "Bundle\.module" Sources/HighballApp; then echo "error: Sources/HighballApp reads Bundle.module; use Bundle.main and copy the file here" >&2; exit 1; fi
swift build -c "$CONFIG" --product HighballApp
APP=dist/Highball.app
rm -rf "$APP"; mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources" "$APP/Contents/Frameworks"
diff --git a/spike/lasterr/lasterr.c b/spike/lasterr/lasterr.c
index d08f67a..9a87dd7 100644
--- a/spike/lasterr/lasterr.c
+++ b/spike/lasterr/lasterr.c
@@ -2,6 +2,14 @@
// Unity's Mono threw IOException "Unknown error (0xd6305a70)" from File.Delete on Wine/macOS
// (The Last Flame, 2026-09-20). Reads the value three ways: the API, the TEB via NtCurrentTeb(),
// and %gs:0x68 directly (what code compiled against the Windows layout may do).
+//
+// Then the same after a display call, a window and a message to it. Each of those runs a
+// user-mode callback (the driver load, the window procedure), and engine patch 0011 as shipped
+// in r11 to r14 wrote the error back to the TEB a second time on that callback's return, so
+// GetLastError() came back as a heap pointer afterwards. The Rockstar Games Launcher installer
+// reads it right after it measures the display and refused to install (highball-db#272,
+// 2026-10-02). Patch 0016 (r15) removed the second write. A value above 0xFFFF is never a
+// Windows error code, so that is what the engine probe checks.
#include <windows.h>
#include <stdio.h>
int main(void) {
@@ -13,5 +21,18 @@ int main(void) {
printf("DeleteFileW ok=%d GetLastError=%lu (0x%lx) TEB->LastErrorValue=%lu %%gs:0x68=%lu (0x%lx)\n", ok, api, api, teb, gs, gs);
SetLastError(1234);
printf("after SetLastError(1234): GetLastError=%lu %%gs:0x68=%lu (0x%lx) TEB self=%p\n", GetLastError(), __readgsdword(0x68), __readgsdword(0x68), (void*)NtCurrentTeb());
+ SetLastError(21);
+ GetSystemMetrics(SM_CXSCREEN);
+ api = GetLastError();
+ printf("after GetSystemMetrics: GetLastError=%lu (0x%lx)\n", api, api);
+ SetLastError(35);
+ HWND w = CreateWindowExW(0, L"STATIC", L"lasterr", WS_POPUP, 0, 0, 8, 8, NULL, NULL, GetModuleHandleW(NULL), NULL);
+ api = GetLastError();
+ printf("after CreateWindowExW: GetLastError=%lu (0x%lx)\n", api, api);
+ SetLastError(55);
+ SendMessageW(w, WM_NULL, 0, 0);
+ api = GetLastError();
+ printf("after SendMessageW: GetLastError=%lu (0x%lx)\n", api, api);
+ DestroyWindow(w);
return 0;
}