Play Windows games on Apple Silicon Macs. Free, open-source app that installs the official Battle.net, Steam, Epic and GOG launchers and lists your games in one library.
HTML apple-siliconbattle-netcrossover-alternatived3dmetaldiablo-ii-resurrecteddxmtea-appepic-gamesgame-porting-toolkitgogmac-gamingmacosmacos-gamingrockstar-gamessteamubisoft-connectwhisky-alternativewindows-gameswinewine-wrapper
Battle.net games start from Play when Battle.net was closed; a game that never appeared says whether its store was open (#174)
Mikekb812d908a7f2
diff --git a/scripts/play-stats.py b/scripts/play-stats.pyindex f97ce5a6aa7..c5984111a5f 100755--- a/scripts/play-stats.py+++ b/scripts/play-stats.py@@ -6,7 +6,8 @@game, its store and the minutes, with the Mac model, chip, macOS and Soju version.Also sends how the start went: ran, quick_exit (closed within a minute) or no_start.For a start that did not run, a short reason read on this Mac from Soju's own launch log:- one word (crash, missing_dll, graphics, memory, dotnet), at most one name with it (the+ one word (crash, missing_dll, graphics, memory, dotnet, or whether the store was still+ open when the game never appeared), at most one name with it (themissing file, or the error number), and which anti-cheat the game folder carries.The log itself is never sent.soju stats watch@@ -219,11 +220,27 @@ def why(text, found=()):return "", ""-def reason(started, minutes, marks, found, path):+LAUNCHER_EXE = {"battlenet": "battle.net.exe", "steam": "\\steam.exe", "epic": "epicgameslauncher.exe", "gog": "galaxyclient.exe",+ "ea": "eadesktop.exe", "rockstar": "launcher.exe", "ubisoft": "upc.exe"}+++def launcher_state(launcher, table=None):+ """For a game that never appeared: was its store still open (waiting at a sign-in, an update or a dialog),+ or gone as well?"""+ exe = LAUNCHER_EXE.get(launcher)+ if not exe:+ return ""+ text = table if table is not None else run("ps", "-axww", "-o", "command=").lower()+ return "launcher_open" if exe in text else "launcher_closed"+++def reason(started, minutes, marks, found, path, launcher=""):"""What to add to a start that did not run; nothing for one that ran."""if outcome(started, minutes) == "ran":return {}word, name = why(log_since(marks), found)+ if not word and not started:+ word = launcher_state(launcher)out = {"why": word, "detail": name, "ac": anticheat(path)}return {k: v for k, v in out.items() if v}@@ -465,7 +482,7 @@ def main(argv):started, minutes = track_run(found, pid)finally:lock.unlink(missing_ok=True)- report(a.game, a.title, a.launcher, started, minutes, "soju", reason(started, minutes, marks, found, a.path))+ report(a.game, a.title, a.launcher, started, minutes, "soju", reason(started, minutes, marks, found, a.path, a.launcher))return 0diff --git a/scripts/play.sh b/scripts/play.shindex a3d084e4e90..4c62d431fbd 100755--- a/scripts/play.sh+++ b/scripts/play.sh@@ -202,6 +202,29 @@ case "$MODE" inBN_EXE="C:\\Program Files (x86)\\Battle.net\\Battle.net.exe"BN_ARGS="--disable-gpu-compositing --from-launcher --in-process-gpu --use-gl=swiftshader"export WINE_DOCK_REOPEN_CMD="'$ENGINE/bin/wine' '$BN_EXE' $BN_ARGS"+ # Play from the library passes --exec="launch <game>". A Battle.net that is already open takes it and starts+ # the game; one that is just starting drops it and stops at its own Play button (seen 2026-11-22: signed in,+ # "What's New?" on top, no LaunchBinary in its log). So after a cold start the same request is sent again once+ # Battle.net's log says it is signed in, until the log shows the game being launched. Someone who has to type+ # a password first gets the game right after signing in, without pressing Play again.+ if [[ " ${*:2} " == *" --exec="* ]] && ! pgrep -f 'Battle\.net\.exe' >/dev/null 2>&1; then+ BN_MARK="$WINEPREFIX/.soju-launch-mark"; : > "$BN_MARK"+ (+ sent=0; last=0+ for tick in $(seq 1 120); do # ten minutes+ sleep 5+ [ "$tick" -lt 4 ] || pgrep -f 'Battle\.net\.exe' >/dev/null 2>&1 || exit 0 # Battle.net was closed+ logs=$(find "$WINEPREFIX/drive_c/users"/*/AppData/Local/Battle.net/Logs -name 'battle.net-*.log' -newer "$BN_MARK" 2>/dev/null)+ [ -n "$logs" ] || continue+ if echo "$logs" | tr '\n' '\0' | xargs -0 grep -qa 'LaunchBinary: uid=' 2>/dev/null; then exit 0; fi+ echo "$logs" | tr '\n' '\0' | xargs -0 grep -qa 'Logged into Battle.net successfully' 2>/dev/null || continue+ [ "$sent" -lt 4 ] || exit 0+ [ $((tick - last)) -ge 6 ] || continue # half a minute between tries+ "$ENGINE/bin/wine" "$BN_EXE" $BN_ARGS "${@:2}" >/dev/null 2>&1 || true+ sent=$((sent + 1)); last=$tick+ done+ ) >/dev/null 2>&1 &+ fiexec "$ENGINE/bin/wine" "$BN_EXE" $BN_ARGS "${@:2}";;d2r) # Launch the game directly (offline / previous session)diff --git a/site-worker/stats.js b/site-worker/stats.jsindex dc7c64f8a47..1865eee06cb 100644--- a/site-worker/stats.js+++ b/site-worker/stats.js@@ -22,7 +22,7 @@ const SCHEMA = [];const RESULTS = new Set(["ran", "quick_exit", "no_start"]);// Why a start did not run, as the Mac read it from its own launch log: one word, one name, and the game's anti-cheat.-const WHY = new Set(["crash", "missing_dll", "graphics", "memory", "dotnet"]);+const WHY = new Set(["crash", "missing_dll", "graphics", "memory", "dotnet", "launcher_open", "launcher_closed"]);const AC = new Set(["eac", "battleye", "vanguard", "gameguard", "xigncode", "punkbuster"]);const name = (v) => { const s = text(v, 40); return /^[A-Za-z0-9._+-]*$/.test(s) ? s : ""; };const HOW = new Set(["soju", "steam"]);diff --git a/tests/test_play_stats.py b/tests/test_play_stats.pyindex b821dc78853..8c02aac9b3a 100644--- a/tests/test_play_stats.py+++ b/tests/test_play_stats.py@@ -184,6 +184,10 @@ class PlayStats(unittest.TestCase):with open(log, 'a') as f: f.write(mine)self.assertEqual(ps.reason(True, 0, marks, found, game), {'why': 'missing_dll', 'detail': 'vcruntime140.dll', 'ac': 'eac'})self.assertEqual(ps.reason(True, 5, marks, found, game), {})+ # A game that never appeared and left nothing in the log: say whether its store was still open.+ self.assertEqual(ps.launcher_state('battlenet', 'c:\\program files (x86)\\battle.net\\battle.net.exe --exec=launch osi'), 'launcher_open')+ self.assertEqual(ps.launcher_state('battlenet', 'something else'), 'launcher_closed')+ self.assertEqual(ps.launcher_state('didim', 'anything'), '')def test_watch_stops_when_steam_is_gone(self):clock = Clock()