Skip to content

armgit / soju

Public Imported from GitHub
0

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.

Steam games: DXMT + patched winemac wiring, single Dock icon

mikey92c7d6f05d453b
diff --git a/README.ko.md b/README.ko.md
index 40124a42f0b..4ff7bb8b953 100644
--- a/README.ko.md
+++ b/README.ko.md
@@ -68,7 +68,7 @@ scripts/play.sh steam # 로그인 → 게임 설치·플레이
scripts/play.sh steam-kill # Steam 보틀 종료
```
-검증: M4 Pro / macOS 26.5 — 로그인 UI 렌더링·인증 확인. 참고: Steam 입력 시 macOS 입력기를 영어(ABC)로 전환하세요 (한글 IME 조합이 `?`로 보입니다). 게임(D3D11) 렌더링까지 가려면 업스트림 프로젝트의 DXMT 포크 빌드가 추가로 필요할 수 있습니다 — 해당 레포의 `docs/building-for-games.md` 참고.
+검증: M4 Pro / macOS 26.5 — 로그인·라이브러리·실제 D3D11(Unity) 게임 인게임 렌더링까지 (DXMT 포크). 전체 배선은 `docs/STEAM-GAMES.md` + `scripts/setup-steam-games.sh` 참고. 참고: Steam 입력 시 macOS 입력기를 영어(ABC)로 전환하세요 (한글 IME 조합이 `?`로 보입니다). 게임(D3D11) 렌더링까지 가려면 업스트림 프로젝트의 DXMT 포크 빌드가 추가로 필요할 수 있습니다 — 해당 레포의 `docs/building-for-games.md` 참고.
**전제조건**: Apple Silicon 맥, Rosetta 2, Xcode CLT, Homebrew, 본인 배틀넷 계정, GPTK용 무료 Apple ID.
diff --git a/README.md b/README.md
index b90fa01f5f7..712ba734566 100644
--- a/README.md
+++ b/README.md
@@ -72,7 +72,7 @@ scripts/play.sh steam # log in -> install & play
scripts/play.sh steam-kill # stop the Steam bottle
```
-Verified on M4 Pro / macOS 26.5: login UI renders and a real account login succeeds. Notes: switch your macOS input source to English (ABC) when typing in Steam (IME composition shows as `?` otherwise). D3D11 game rendering under this stack may additionally want the DXMT fork from the upstream project — see their `docs/building-for-games.md`.
+Verified on M4 Pro / macOS 26.5: login, library, and an actual D3D11 (Unity) game rendering in-game via a DXMT fork — see `docs/STEAM-GAMES.md` for the full wiring (`scripts/setup-steam-games.sh`). Notes: switch your macOS input source to English (ABC) when typing in Steam (IME composition shows as `?` otherwise). D3D11 game rendering under this stack may additionally want the DXMT fork from the upstream project — see their `docs/building-for-games.md`.
**Prerequisites**: Apple Silicon Mac, Rosetta 2, Xcode Command Line Tools, Homebrew, your own Battle.net account/games, and a free Apple ID for the GPTK download. Nothing from Apple, Blizzard, or CodeWeavers is redistributed by this repo.
diff --git a/docs/STEAM-GAMES.md b/docs/STEAM-GAMES.md
new file mode 100644
index 00000000000..a7e8223dc47
--- /dev/null
+++ b/docs/STEAM-GAMES.md
@@ -0,0 +1,81 @@
+# Steam + D3D11 games on Apple Silicon — the full free path
+
+Verified 2026-08-27 on M4 Pro / macOS 26.5: Windows Steam client (Aug 2026 build,
+CEF 126) renders and authenticates, and a Unity D3D11 title launched from the
+library renders in-game, windowed, with a single Dock icon. Everything below is
+free software.
+
+## Why not the Soju CX engine?
+
+The modern Steam client's CEF UI does not render on CrossOver-source builds:
+the GPU process crash-loops (sandbox faults, 0xC0000005), and DXMT's
+cross-process swapchain limit ([DXMT #141](https://github.com/3Shain/dxmt/issues/141))
+blacks out the composer. Homebrew's `wine-stable` 11 cask works once the
+steamwebhelper wrapper forces `--disable-gpu --single-process`
+(from [notpop/steam-on-m1-wine](https://github.com/notpop/steam-on-m1-wine), MIT,
+vendored in `third_party/`).
+
+## The wiring that finally worked
+
+Two D3D11 implementations must coexist in one prefix:
+
+| consumer | needs | gets it via |
+| --- | --- | --- |
+| Steam client (32-bit steam.exe + 64-bit CEF helper) | vanilla wined3d | per-app `DllOverrides=native` → marker-stripped vanilla copies in `system32` |
+| 64-bit games | DXMT (D3D11→Metal) | global `DllOverrides=builtin` → DXMT dlls installed as bundle builtins (x86_64 only) |
+
+Hard-won facts, in the order they burned us:
+
+1. **DXMT dlls must be builtins.** Loaded as native they cannot attach their
+ unixlib (`winemetal.so`) — wine falls back to vanilla silently.
+2. **Wine-built PEs dropped into a game folder are treated as fake dlls** and
+ silently redirected to the bundle builtin — game-local DXMT does not work.
+3. **A builtin that isn't part of wine needs a placeholder**: without a
+ `winemetal.dll` copy in `system32`, by-name lookup fails with `c0000135`
+ ("Failed to initialize graphics" in Unity) even though the builtin exists.
+4. **The Steam client dies on DXMT builtins** (helper restart loop every 10 s),
+ so it must be forced to vanilla per-app. But per-app `native` pointing at a
+ vanilla wine PE gets redirected to the (DXMT) builtin — unless you strip the
+ `Wine builtin DLL` marker from the copies (1-byte patch).
+5. **i386 stays vanilla.** steam.exe is 32-bit; its composer must not see DXMT.
+6. **`winemac.so` must export macdrv symbols** (`-fvisibility=default` rebuild)
+ or DXMT's `_CreateMetalViewFromHWND` cannot dlsym them.
+7. **Env `WINEDLLOVERRIDES` beats per-app registry** — keep d3d overrides out of
+ the env; drive the split from the registry only.
+8. **Steam tags games with `DISABLEDXMAXIMIZEDWINDOWEDMODE`**, forcing
+ fullscreen; scrub it from `user.reg` for windowed play. Unity then remembers
+ `-screen-fullscreen 0`.
+9. **Crashed Chromium leaves `SingletonLock`** in htmlcache; the next launch
+ silently becomes `--silent` (no window). Purge on every launch (play.sh does).
+10. **One Dock icon**: macdrv registers a Dock icon per wine process with
+ windows, and this macdrv ignores virtual desktops. We patched
+ `cocoa_app.m` (modeled on CrossOver's hack 24141) to honor
+ `WINE_NO_DOCK_ICON="steam.exe;steamservice.exe"` — matching the basename of
+ the first two argv entries (NSProcessInfo sees pre-rewrite argv; scanning all
+ args would also hide the helper via its `-steampath=` argument).
+
+## Building the artifacts
+
+Based on notpop's `07-build-dxmt-fork.sh` / `08-patch-wine-visibility.sh`, with
+three fixes we needed on macOS 26.5 / current Homebrew:
+
+- meson must be 1.10.x (`python3 -m venv … && pip install 'meson==1.10.*'`,
+ pass `MESON=`), Homebrew's 1.12 breaks the DXMT build.
+- `src/util/com/com_guid.cpp` needs `#include <iomanip>` (newer mingw).
+- The prebuilt LLVM 15 x86_64 tree references zstd: build an x86_64
+ `libzstd.a` and `libtool -static`-merge it into `libLLVMSupport.a`.
+- The 3Shain wine toolchain tarball extracts flat — normalise into
+ `toolchains/wine/`.
+- The Dock-icon patch on top of the visibility rebuild lives in
+ `transformProcessToForeground:` (see `scripts/setup-steam-games.sh` header).
+
+Artifacts land in `~/.battlenet-macos/steam-support/` and
+`scripts/setup-steam-games.sh` wires everything idempotently.
+
+## Runbook
+
+```bash
+scripts/create-steam-bottle.sh # wine-stable + wrapper + Steam
+scripts/setup-steam-games.sh # DXMT + winemac wiring (needs built artifacts)
+scripts/play.sh steam # play
+```
diff --git a/scripts/play.sh b/scripts/play.sh
index 4db635ccc4e..2876c4c7633 100755
--- a/scripts/play.sh
+++ b/scripts/play.sh
@@ -68,13 +68,31 @@ case "$MODE" in
cp -f "$WRAP" "$d/steamwebhelper.exe"
fi
done
- # 3) 실행 — CX 엔진 env 없이 wine-stable 순정 환경
+ # 3) 가상 데스크톱 — 이 macdrv(gcenx wine 11)는 가상 데스크톱을 무시함이 확인돼
+ # 기본 비활성. 독 아이콘 단일화는 WINE_NO_DOCK_ICON(winemac 패치)으로 해결.
+ # 켜려면 WINE_VIRTUAL_DESKTOP=auto (또는 1600x900 등 해상도 지정).
+ VD="${WINE_VIRTUAL_DESKTOP-}"
+ if [[ "$VD" == "auto" ]]; then
+ B=$(osascript -e 'tell application "Finder" to get bounds of window of desktop' 2>/dev/null || true)
+ if [[ "$B" =~ ,[[:space:]]*([0-9]+),[[:space:]]*([0-9]+)$ ]]; then
+ VD="${BASH_REMATCH[1]}x${BASH_REMATCH[2]}"
+ else
+ VD="1728x1080"
+ fi
+ fi
+ # 가상 데스크톱 창이 고정되지 않게 macdrv 설정 (1회성 레지스트리)
+ grep -q 'AllowImmovableWindows' "$WINEPREFIX/user.reg" 2>/dev/null || {
+ printf '\n[Software\\\\Wine\\\\Mac Driver]\n"AllowImmovableWindows"="n"\n' >> "$WINEPREFIX/user.reg"
+ }
+ # 4) 실행 — CX 엔진 env 없이 wine-stable 순정 환경
+ STEAM_CMD=("C:\\Program Files (x86)\\Steam\\steam.exe" -no-cef-sandbox -cef-single-process -noverifyfiles "${@:2}")
+ [[ -n "$VD" ]] && STEAM_CMD=(explorer.exe "/desktop=soju-steam,$VD" "${STEAM_CMD[@]}")
env -u DYLD_FALLBACK_LIBRARY_PATH -u CX_ACTIVE_GRAPHICS_BACKEND -u CX_GRAPHICS_BACKEND \
-u CX_APPLEGPTK_LIBD3DSHARED_PATH -u WINEMSYNC -u ROSETTA_ADVERTISE_AVX \
WINEPREFIX="$WINEPREFIX" WINEDEBUG="${WINEDEBUG:-fixme-all}" \
- WINEDLLOVERRIDES="d3d11,d3d10core,dxgi=b;winemetal=d;bcrypt=b;ncrypt=b;gameoverlayrenderer,gameoverlayrenderer64=d" \
- "$WINESTABLE" "C:\\Program Files (x86)\\Steam\\steam.exe" \
- -no-cef-sandbox -cef-single-process -noverifyfiles "${@:2}"
+ WINEDLLOVERRIDES="bcrypt=b;ncrypt=b;gameoverlayrenderer,gameoverlayrenderer64=d" \
+ WINE_NO_DOCK_ICON="steam.exe;steamservice.exe" \
+ "$WINESTABLE" "${STEAM_CMD[@]}"
;;
kill|steam-kill) # 종료 (kill=배틀넷 보틀, steam-kill=Steam 보틀)
"$ENGINE/bin/wineserver" -k 2>/dev/null || true
diff --git a/scripts/setup-steam-games.sh b/scripts/setup-steam-games.sh
new file mode 100755
index 00000000000..9ffc30f4c3d
--- /dev/null
+++ b/scripts/setup-steam-games.sh
@@ -0,0 +1,76 @@
+#!/usr/bin/env bash
+# Steam 게임(D3D11) 렌더링 활성화 — DXMT + 패치 winemac 배선.
+#
+# 전제: create-steam-bottle.sh 완료 + DXMT 아티팩트가 ~/.battlenet-macos/steam-support/
+# 에 존재 (dxmt-x64/{d3d11,dxgi,d3d10core,winemetal}.dll + winemetal.so, winemac-patched.so).
+# 아티팩트 빌드법은 docs/STEAM-GAMES.md 참고 (notpop/steam-on-m1-wine 기반 + 3가지 픽스).
+#
+# 아키텍처 (검증: 2026-08-27, M4 Pro / macOS 26.5, Unity 게임 인게임 렌더링 확인):
+# - 번들 x86_64 빌트인 = DXMT (게임용) / i386 빌트인 = 순정 유지 (32비트 steam.exe 보호)
+# - winemetal: 번들 빌트인 + system32 "플레이스홀더" 사본 (없으면 wine이 빌트인을
+# 이름으로 못 찾아 c0000135 → 게임 "Failed to initialize graphics")
+# - system32에 "마커 제거" 순정 d3d dll (Steam 클라이언트 전용 native)
+# - 레지스트리: 전역 d3d11/d3d10core/dxgi/winemetal=builtin(DXMT),
+# steam.exe·steamwebhelper*·steamservice per-app=native(순정) — 신형 Steam CEF는
+# DXMT 빌트인과 충돌해 무한 재시작하므로 반드시 분리
+# - winemac-patched.so: -fvisibility=default (DXMT가 macdrv API를 dlsym) +
+# WINE_NO_DOCK_ICON 지원 (독 아이콘 단일화)
+set -euo pipefail
+
+SUP="$HOME/.battlenet-macos/steam-support"
+export WINEPREFIX="${WINEPREFIX:-$HOME/.battlenet-macos/steam-bottle}"
+WAPP="/Applications/Wine Stable.app/Contents/Resources/wine"
+WLIB="$WAPP/lib/wine"
+WINE="$WAPP/bin/wine"
+B="$WINEPREFIX/drive_c/windows"
+
+[ -x "$WINE" ] || { echo "wine-stable 없음 — create-steam-bottle.sh 먼저"; exit 1; }
+for f in dxmt-x64/d3d11.dll dxmt-x64/dxgi.dll dxmt-x64/d3d10core.dll dxmt-x64/winemetal.dll dxmt-x64/winemetal.so winemac-patched.so; do
+ [ -f "$SUP/$f" ] || { echo "아티팩트 없음: $SUP/$f — docs/STEAM-GAMES.md의 빌드 절차 참고"; exit 1; }
+done
+
+echo "==> 1/5 순정 dll 백업 (최초 1회)"
+for D in d3d11 dxgi d3d10core; do
+ [ -f "$WLIB/x86_64-windows/$D.dll.vanilla" ] || cp -f "$WLIB/x86_64-windows/$D.dll" "$WLIB/x86_64-windows/$D.dll.vanilla"
+done
+
+echo "==> 2/5 번들 배선: x86_64=DXMT, winemetal(빌트인+unix), 패치 winemac"
+cp -f "$SUP/dxmt-x64/"{d3d11.dll,dxgi.dll,d3d10core.dll,winemetal.dll} "$WLIB/x86_64-windows/"
+cp -f "$SUP/dxmt-x64/winemetal.so" "$WLIB/x86_64-unix/"
+cp -f "$SUP/winemac-patched.so" "$WLIB/x86_64-unix/winemac.so"
+# i386은 순정 그대로 (32비트 steam.exe 컴포저 보호)
+
+echo "==> 3/5 프리픽스: winemetal 플레이스홀더 + Steam 전용 순정 native(마커 제거)"
+cp -f "$WLIB/x86_64-windows/winemetal.dll" "$B/system32/winemetal.dll"
+for D in d3d11 dxgi d3d10core; do
+ cp -f "$WLIB/x86_64-windows/$D.dll.vanilla" "$B/system32/$D.dll"
+ /usr/bin/python3 - "$B/system32/$D.dll" <<'EOF'
+import sys
+p = sys.argv[1]; d = open(p,'rb').read()
+m = b'Wine builtin DLL'
+if m in d: open(p,'wb').write(d.replace(m, b'Xine builtin DLL', 1))
+EOF
+done
+
+echo "==> 4/5 레지스트리: 전역=builtin(DXMT), Steam 계열 per-app=native(순정)"
+for DLL in d3d11 d3d10core dxgi winemetal; do
+ "$WINE" reg add "HKCU\\Software\\Wine\\DllOverrides" /v "$DLL" /t REG_SZ /d builtin /f >/dev/null 2>&1
+done
+for APP in steam.exe steamwebhelper.exe steamwebhelper_real.exe steamservice.exe; do
+ for DLL in d3d11 d3d10core dxgi; do
+ "$WINE" reg add "HKCU\\Software\\Wine\\AppDefaults\\$APP\\DllOverrides" /v "$DLL" /t REG_SZ /d native /f >/dev/null 2>&1
+ done
+ "$WINE" reg add "HKCU\\Software\\Wine\\AppDefaults\\$APP\\DllOverrides" /v winemetal /t REG_SZ /d disabled /f >/dev/null 2>&1
+done
+
+echo "==> 5/5 전체화면 강제 AppCompat 토큰 제거 (창모드 허용)"
+/usr/bin/python3 - "$WINEPREFIX/user.reg" <<'EOF'
+import sys
+p = sys.argv[1]
+d = open(p, encoding='utf-8', errors='surrogateescape').read()
+n = d.replace('DISABLEDXMAXIMIZEDWINDOWEDMODE', '')
+if n != d: open(p, 'w', encoding='utf-8', errors='surrogateescape').write(n)
+EOF
+
+echo "완료. scripts/play.sh steam 으로 실행 — 게임 창모드 고정은 게임 내 설정 또는"
+echo "Steam 시작 옵션 '-screen-fullscreen 0' (Unity 계열) 사용."