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
homebrew and doctor: find the repo through the bin/ symlink, stop the false orphan warning
mikey92111fbbac7894
diff --git a/install.sh b/install.shindex b469e9c2288..684cebc45ab 100644--- a/install.sh+++ b/install.sh@@ -40,8 +40,9 @@ elserm -f "$BASE/engine.tar.xz"TAG=$(echo "$URL" | sed -n 's#.*/download/\([^/]*\)/.*#\1#p')[ -n "$TAG" ] && printf '%s\n' "$TAG" > "$ENGINE/.soju-engine-release"- DYLD_FALLBACK_LIBRARY_PATH="$ENGINE/lib:/usr/lib" "$ENGINE/bin/wine" --version >/dev/null \- && echo "Engine OK: $(DYLD_FALLBACK_LIBRARY_PATH="$ENGINE/lib:/usr/lib" "$ENGINE/bin/wine" --version)"+ v=$(DYLD_FALLBACK_LIBRARY_PATH="$ENGINE/lib:/usr/lib" "$ENGINE/bin/wine" --version 2>&1) \+ || { echo "The engine does not start on this Mac:"; echo "$v"; echo "Please report this with the output of: sw_vers; uname -m"; exit 1; }+ echo "Engine OK: $v"fi# ---------- 2. Apple GPTK ----------@@ -80,7 +81,7 @@ elseEOTwhile true; doread -r -p " Press Enter when ready (or s to skip): " ans < "$TTY" || ans=s- [ "$ans" = "s" ] && { echo " Skipped - run scripts/get-gptk.sh later"; break; }+ [ "$ans" = "s" ] && { echo " Skipped - the last lines of this installer say how to add it later"; break; }if SRC=$(find_gptk); then install_gptk "$SRC"; echo " Installed"; break; fiecho " Not found yet - make sure the dmg is mounted"done@@ -93,6 +94,12 @@ fiSELF_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" 2>/dev/null && pwd || true)"if [ -n "$SELF_DIR" ] && [ -f "$SELF_DIR/scripts/play.sh" ]; thenSOJU_DIR="$SELF_DIR"+ # Homebrew: the Cellar path carries the version and goes away on `brew+ # upgrade`, which would leave every app bundle pointing at nothing. Bake the+ # stable opt/ path into the bundles instead.+ case "$SOJU_DIR" in+ */Cellar/soju/*/libexec) SOJU_DIR="$(brew --prefix 2>/dev/null || echo /opt/homebrew)/opt/soju/libexec" ;;+ esacelseSOJU_DIR="$BASE/soju"say "Fetching the Soju scripts into $SOJU_DIR"@@ -199,5 +206,5 @@ for p in $PLATFORMS; dodonesay "Done! 🍶 Double-click the app(s) above, log in, install and play."-echo "Command line: $SOJU_DIR/scripts/soju (battlenet | d2r | steam | epic | gog, plus *-kill)"-GPTK_OK || echo "NOTE: GPTK was skipped - run scripts/get-gptk.sh before launching a game."+echo "Command line: $SOJU_DIR/scripts/soju (battlenet | d2r | kill | epic | epic-kill | gog | gog-kill | steam | steam-kill | doctor | update)"+GPTK_OK || echo "NOTE: GPTK was skipped - before launching a game, mount the GPTK dmg and run: $SOJU_DIR/scripts/soju gptk"diff --git a/scripts/doctor.sh b/scripts/doctor.shindex 534dbc48f48..f6834acb2d2 100755--- a/scripts/doctor.sh+++ b/scripts/doctor.sh@@ -6,6 +6,8 @@ set -uo pipefailBASE="${SOJU_BASE:-$HOME/.battlenet-macos}"ENGINE="${ENGINE:-$BASE/cx26-engine}"REPO="BCD1210/soju"+ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"+SOJU="$ROOT/scripts/soju"WINESTABLE="/Applications/Wine Stable.app/Contents/Resources/wine/bin/wine"nok=0; nwarn=0; nfail=0@@ -49,15 +51,15 @@ echo "Apple GPTK (D3DMetal)"if [ -f "$ENGINE/lib/external/libd3dshared.dylib" ]; thenpass "libd3dshared.dylib present"[ -d "$ENGINE/lib/external/D3DMetal.framework" ] && pass "D3DMetal.framework present" \- || warn "D3DMetal.framework missing from lib/external (get-gptk.sh installs it)"+ || warn "D3DMetal.framework missing from lib/external ($SOJU gptk installs it)"for f in d3d10 d3d11 d3d12 dxgi; doso="$ENGINE/lib/wine/x86_64-unix/$f.so"if [ -L "$so" ]; then pass "$f.so is a symlink"- elif [ -f "$so" ]; then fail "$f.so is a regular file: must be a symlink into lib/external (copying breaks @loader_path); re-run scripts/get-gptk.sh"+ elif [ -f "$so" ]; then fail "$f.so is a regular file: must be a symlink into lib/external (copying breaks @loader_path); re-run: $SOJU gptk"else warn "$f.so missing"; fidoneelse- fail "GPTK not installed: games will not start (run scripts/get-gptk.sh)"+ fail "GPTK not installed: games will not start (run: $SOJU gptk)"fiecho@@ -78,12 +80,13 @@ fiechoecho "Processes"-nsrv=$(pgrep -fc wineserver 2>/dev/null || true); nsrv=${nsrv:-0}+# macOS pgrep has no -c: count lines instead.+nsrv=$(pgrep -x wineserver 2>/dev/null | wc -l | tr -d ' ')if [ "$nsrv" -gt 0 ]; theninfo "$nsrv wineserver(s) running (a launcher or game is open)"elseif pgrep -f 'services\.exe|winedevice\.exe|plugplay\.exe' >/dev/null 2>&1; then- warn "orphaned Wine service processes with no wineserver: run scripts/soju-sweep.sh"+ warn "orphaned Wine service processes with no wineserver: run: $SOJU sweep"elsepass "no leftover Wine processes"fidiff --git a/scripts/get-gptk.sh b/scripts/get-gptk.shindex 86ccaf9a9a9..bdf4a480681 100755--- a/scripts/get-gptk.sh+++ b/scripts/get-gptk.sh@@ -19,7 +19,7 @@set -euo pipefailENGINE="${ENGINE:-$HOME/.battlenet-macos/cx26-engine}"-[ -d "$ENGINE/lib" ] || { echo "Engine not found. Run build-engine.sh first."; exit 1; }+[ -d "$ENGINE/lib" ] || { echo "Engine not found at $ENGINE. Run install.sh (prebuilt) or scripts/build-engine.sh first."; exit 1; }find_payload() {local roots=("$@")diff --git a/scripts/play.sh b/scripts/play.shindex 7cf72cbc8ea..961af27508e 100755--- a/scripts/play.sh+++ b/scripts/play.sh@@ -70,6 +70,7 @@ start_reaper(){# prefix down once everything is closed: so "quit" really means quit.pgrep -f "soju-reaper.sh $WINEPREFIX" >/dev/null 2>&1 && return 0[ -x "$REAPER" ] && ( "$REAPER" "$WINEPREFIX" "$ENGINE/bin/wineserver" >/dev/null 2>&1 & )+ return 0 # a missing reaper must not abort the launch (set -e)}# A Korean/Japanese/Chinese IME swallows key presses in Wine games, and macOSdiff --git a/scripts/setup-bottle.sh b/scripts/setup-bottle.shindex 270c45f6f9c..6634b5c19c6 100755--- a/scripts/setup-bottle.sh+++ b/scripts/setup-bottle.sh@@ -23,4 +23,4 @@ done[[ -d "$CX_BOTTLE/dosdevices" ]] && cp -Rc "$CX_BOTTLE/dosdevices" "$DEST/"echo "==> Done. Launch with:"-echo " WINEPREFIX='$DEST' scripts/launch.sh"+echo " WINEPREFIX='$DEST' scripts/play.sh battlenet"diff --git a/scripts/soju b/scripts/sojuindex 02d7eab28a0..b39bc348f5b 100755--- a/scripts/soju+++ b/scripts/soju@@ -2,11 +2,18 @@# soju: command-line entry point (used by the Homebrew formula)set -euo pipefail-ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"+# Homebrew installs this file as a symlink in bin/, so resolve links before+# locating the repo, otherwise ROOT becomes the brew prefix and nothing is found.+SELF="${BASH_SOURCE[0]}"+while [ -L "$SELF" ]; do+ target="$(readlink "$SELF")"+ case "$target" in /*) SELF="$target" ;; *) SELF="$(dirname "$SELF")/$target" ;; esac+done+ROOT="$(cd "$(dirname "$SELF")/.." && pwd)"usage() {cat <<'EOF'-soju: free Battle.net / Diablo II: Resurrected / Epic / Steam on Apple Silicon+soju: free Battle.net / Diablo II: Resurrected / Epic / GOG / Steam on Apple SiliconUsage:soju install Set up the Wine engine, Apple GPTK and Battle.net@@ -26,6 +33,8 @@ Usage:soju steam Launch Steamsoju steam-kill Stop everything in the Steam bottle+ soju gptk Install Apple's GPTK payload into the engine (mounted dmg or CrossOver)+ soju sweep Remove orphaned Wine service processes (only when no bottle is running)soju doctor Check the whole stack and print what is wrongsoju update Update the scripts and the prebuilt enginesoju uninstall Remove apps, bottles and the engine (asks per item)@@ -40,6 +49,8 @@ case "${1:-}" ingog-install) shift; exec bash "$ROOT/scripts/create-gog-bottle.sh" "$@" ;;steam-install) shift; exec bash "$ROOT/scripts/create-steam-bottle.sh" "$@" ;;steam-games) shift; exec bash "$ROOT/scripts/setup-steam-games.sh" "$@" ;;+ gptk) shift; exec bash "$ROOT/scripts/get-gptk.sh" "$@" ;;+ sweep) shift; exec bash "$ROOT/scripts/soju-sweep.sh" "$@" ;;doctor) shift; exec bash "$ROOT/scripts/doctor.sh" "$@" ;;update) shift; exec bash "$ROOT/scripts/update.sh" "$@" ;;uninstall) shift; exec bash "$ROOT/scripts/uninstall.sh" "$@" ;;