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.

GOG GALAXY support, tray restore for all four launchers, engine hooks

Mikek9387c337b8b1
diff --git a/README.ko.md b/README.ko.md
index d95d59771f3..394b148e337 100644
--- a/README.ko.md
+++ b/README.ko.md
@@ -2,13 +2,13 @@
> *Wine → Whisky → Kegworks… 그리고 한국의 차례: **Soju** 🍶*
-**런처가 실제로 로그인됩니다.** Apple Silicon 맥에서 Battle.net·Steam·Epic Games Launcher. 검은 로그인 창도, 끝나지 않는 "Signing in…"도, CrossOver 라이선스도 없이. 완전 무료 오픈소스 Wine 스택.
+**런처가 실제로 로그인됩니다.** Apple Silicon 맥에서 Battle.net·Steam·Epic Games Launcher·GOG GALAXY. 검은 로그인 창도, 끝나지 않는 "Signing in…"도, CrossOver 라이선스도 없이. 완전 무료 오픈소스 Wine 스택.
Whisky/Kegworks 스레드의 *"배틀넷 로그인 시 크래시"*, *"Steam이 안 열림"*, *"런처 창이 비어 있음"* 때문에 오셨다면, 바로 그 벽들을 이 레포가 기록하고 해결했습니다(CEF 렌더러 `PAGE_WRITECOPY` int3, CEF GPU 프로세스 초기화 사망, Steam webhelper). [docs/DIAGNOSIS.md](docs/DIAGNOSIS.md).
CodeWeavers가 GPL로 공개한 소스(Wine 11.0, CrossOver 26.3 소스 드롭)를 이 레포의 스크립트로 직접 빌드·조립합니다. 유료 소프트웨어 불필요.
-> 상태(2026-08): **전 구간 동작**: 배틀넷 로그인·Agent·D2R 인게임 렌더링(D3DMetal), Epic Games Launcher 로그인(메뉴바 트레이), Steam 로그인 + D3D11 게임. M4 Pro / macOS 26.5에서 검증.
+> 상태(2026-08): **전 구간 동작**: 배틀넷 로그인·Agent·D2R 인게임 렌더링(D3DMetal), Epic Games Launcher 로그인·게임 설치(메뉴바 트레이), GOG GALAXY 로그인, Steam 로그인 + D3D11 게임. M4 Pro / macOS 26.5에서 검증.
*[English README](README.md)*
@@ -62,7 +62,7 @@ scripts/get-gptk.sh
scripts/create-bottle.sh
# 6. 플레이
-scripts/play.sh battlenet # 런처 → 로그인 → 게임 설치·플레이
+scripts/play.sh battlenet # 런처 → 로그인 → 게임 설치·플레이 (창을 닫으면 Windows처럼 종료. 설정에서 "트레이로 최소화"로 바꾸면 독 아이콘 클릭으로 복귀)
scripts/play.sh d2r # 게임 직접 실행 (오프라인)
scripts/play.sh kill # 전부 종료
```
@@ -76,10 +76,20 @@ scripts/play.sh kill # 전부 종료
```bash
scripts/create-epic-bottle.sh # 공식 Epic MSI, 무인 설치
scripts/play.sh epic # 로그인 → 게임 설치·플레이
-scripts/play.sh epic-kill # Epic 보틀 종료 (창을 닫아도 런처는 살아 있음, macOS 메뉴바의 Epic 아이콘을 **우클릭**해 열기/Exit, Windows 트레이와 동일, 좌클릭 한 번엔 반응 없음)
+scripts/play.sh epic-kill # Epic 보틀 종료 (창을 닫으면 런처는 메뉴바 트레이로 들어감. 독 아이콘 클릭, 또는 메뉴바 아이콘 더블클릭/우클릭으로 복귀)
```
-검증 2026-08-30: 런처에서 Hogwarts Legacy 71GB 설치 후 인게임까지(UE4, D3DMetal 경유 D3D12). 알아두실 점 두 가지: 플레이 전에 macOS 입력기를 영어(ABC)로 바꾸세요, 한글 IME가 켜져 있으면 Wine 게임에 키 입력이 전달되지 않습니다. 게임이 전체화면으로 뜨면 게임 자체 디스플레이 설정에서 창 모드로 바꾸면 됩니다(Soju가 강제하지 않습니다).
+검증 2026-08-30: 런처에서 Hogwarts Legacy 71GB 설치 후 인게임까지(UE4, D3DMetal 경유 D3D12). 알아두실 점 두 가지: 플레이 전에 macOS 입력기를 영어(ABC)로 바꾸세요, 한글 IME가 켜져 있으면 Wine 게임에 키 입력이 전달되지 않습니다. 게임이 전체화면으로 뜨면 게임 자체 디스플레이 설정에서 창 모드로 바꾸면 됩니다(Soju가 강제하지 않습니다). wine 11.0의 알려진 문제 하나: 여러 Wine 창(런처, 게임, 다른 보틀)을 오간 뒤 게임이 키보드 입력을 못 받는 경우가 있으며 재시작해야 풀립니다. upstream은 wine 11.11에서 수정했습니다.
+
+### GOG GALAXY
+
+```bash
+scripts/create-gog-bottle.sh # 별도 보틀, 공식 웹 설치기(무인)
+scripts/play.sh gog # 로그인 → 게임 설치·플레이
+scripts/play.sh gog-kill # GOG 보틀 종료 (창을 닫으면 메뉴바 트레이로 들어가고, 독 아이콘 클릭으로 돌아옴)
+```
+
+검증 2026-08-30: 설치, 로그인, 라이브러리. GOG GALAXY 2.x는 CEF가 아니라 Qt6 + QtWebEngine이며, 이 엔진에서는 Qt의 D3D11 합성이 D3DMetal DXGI에 없는 `IDXGIResource`를 요구해 창이 검게 나옵니다. 해법은 Chromium을 CPU로 돌리는 것(`--disable-gpu`)인데, GOG가 `QTWEBENGINE_CHROMIUM_FLAGS`를 스스로 덮어쓰고 자기 커맨드라인도 무시하며 실행 파일 체크섬까지 검사해서 엔진 밖에서는 스위치를 넣을 방법이 없습니다. 그래서 엔진에 작은 훅(`patches/chromium-flags-append.patch`)을 넣었습니다: 프로그램이 `QTWEBENGINE_CHROMIUM_FLAGS`를 설정할 때마다 `SOJU_CHROMIUM_FLAGS`의 내용이 덧붙습니다. `play.sh gog`가 이 값을 설정합니다. 같은 패치에 `WINE_CUSTOM_FRAME`도 추가해, GOG 자체 타이틀바 위에 macOS 타이틀바가 겹치지 않게 했습니다. 자세한 내용은 [docs/DIAGNOSIS.md](docs/DIAGNOSIS.md).
게임은 아직 폭넓게 테스트하지 않았습니다. 커널 안티치트(EAC/BattlEye)가 필요한 게임은 Wine에서 돌지 않습니다.
@@ -108,6 +118,8 @@ GPTK 안의 `libd3dshared.dylib`는 그래픽만이 아닙니다. **D2R 로더(
- **게임이 86MB/0% CPU로 영원히 멈춤** → AVX 변수 또는 libd3dshared가 게임에 전달되지 않은 것입니다. 반드시 `play.sh`로 실행하고 4단계를 확인하세요.
- **라이브러리 로드 실패(gnutls/freetype)** → `nohup`/`arch` 등 애플 서명 바이너리를 거치면 `DYLD_*`가 제거됩니다. `play.sh`로 실행하세요.
- **배틀넷 로그인 화면이 가끔 깜빡임(~1분 1회)** → 알려진 외관 이슈이며 자동으로 복구됩니다.
+- **언리얼 엔진 게임 시작 시 "AMD graphics driver has known issues" 경고**(Hogwarts Legacy 등): D3DMetal이 자신을 구형 드라이버의 AMD 카드로 소개해 UE4의 드라이버 검사가 걸리는 것입니다. 무해하며 OK로 넘어가면 됩니다. 없애려면 게임의 사용자 `Engine.ini`(`AppData/Local/<게임>/Saved/Config/WindowsNoEditor/`)에 `[SystemSettings]` / `r.WarnOfBadDrivers=0`을 추가하세요.
+- **GOG GALAXY: 알림 토스트가 뜨는 동안 오른쪽 아래가 검은 사각형으로 가려짐**, 토스트가 사라지면 함께 사라짐. 토스트는 GOG 알림 렌더러의 투명 레이어 창인데 Wine에는 DWM 합성이 없어 투명 영역이 검게 칠해집니다. 무해하며, GOG 설정에서 데스크톱 알림을 끄면 안 뜹니다.
- **BLZBNTBNA00000005** → `play.sh`가 서명된 exe를 자동으로 넣어 줍니다.
## 라이선스
diff --git a/README.md b/README.md
index 65d121cb020..3693a94792f 100644
--- a/README.md
+++ b/README.md
@@ -2,13 +2,13 @@
> *Wine → Whisky → Kegworks… and now a Korean round: **Soju** 🍶*
-**The launchers actually log in.** Battle.net, Steam and the Epic Games Launcher on Apple Silicon. No black login window, no "Signing in…" that never ends, no CrossOver license. A fully free, open-source Wine stack.
+**The launchers actually log in.** Battle.net, Steam, the Epic Games Launcher and GOG GALAXY on Apple Silicon. No black login window, no "Signing in…" that never ends, no CrossOver license. A fully free, open-source Wine stack.
If you got here from a Whisky/Kegworks thread titled *"Battle.net crashes on login"*, *"Steam won't open"* or *"launcher shows a blank window"*: those are the exact walls this repo documents and fixes (CEF renderer `int3` on `PAGE_WRITECOPY`, CEF GPU process dying on init, Steam's webhelper). See [docs/DIAGNOSIS.md](docs/DIAGNOSIS.md).
Built from CodeWeavers' published GPL sources (Wine 11.0, CrossOver 26.3 source drop), compiled and assembled by scripts in this repo. No paid software required.
-> Status (2026-08): **Working end-to-end**: Battle.net login, Agent, and D2R in-game rendering (D3DMetal); Epic Games Launcher login (tray icon in the menu bar); Steam client login + D3D11 games. Verified on an M4 Pro running macOS 26.5.
+> Status (2026-08): **Working end-to-end**: Battle.net login, Agent, and D2R in-game rendering (D3DMetal); Epic Games Launcher login and game installs (tray icon in the menu bar); GOG GALAXY login; Steam client login + D3D11 games. Verified on an M4 Pro running macOS 26.5.
*[한국어 README](README.ko.md)*
@@ -66,7 +66,7 @@ scripts/get-gptk.sh
scripts/create-bottle.sh
# 6. Play
-scripts/play.sh battlenet # launcher -> log in -> install & play your game
+scripts/play.sh battlenet # launcher -> log in -> install & play your game (closing the window exits, as on Windows; if you set "minimize to tray" in its settings, a Dock-icon click brings it back)
scripts/play.sh d2r # direct game launch (offline)
scripts/play.sh kill # stop everything
```
@@ -80,10 +80,20 @@ Same engine, own bottle, no extra tricks: Epic's CEF keeps its GPU process alive
```bash
scripts/create-epic-bottle.sh # official Epic MSI, unattended
scripts/play.sh epic # log in -> install & play
-scripts/play.sh epic-kill # stop the Epic bottle (closing the window keeps the launcher running; right-click the Epic icon in the macOS menu bar to reopen or Exit, same as the Windows tray; a plain left click does nothing, as Epic only reacts to the menu)
+scripts/play.sh epic-kill # stop the Epic bottle (closing the window parks the launcher in the menu bar tray; click the Dock icon, or double-click / right-click the menu bar icon, to bring it back)
```
-Verified 2026-08-30: 71 GB install of Hogwarts Legacy (UE4, D3D12 through D3DMetal) from the launcher, then in-game. Two things to know: switch the macOS input source to English (ABC) before playing, a Korean/Japanese/Chinese IME swallows key presses in Wine games; and if a game starts full screen, set windowed mode in its own display settings (Soju does not force it).
+Verified 2026-08-30: 71 GB install of Hogwarts Legacy (UE4, D3D12 through D3DMetal) from the launcher, then in-game. Two things to know: switch the macOS input source to English (ABC) before playing, a Korean/Japanese/Chinese IME swallows key presses in Wine games; and if a game starts full screen, set windowed mode in its own display settings (Soju does not force it). One known wine 11.0 issue: after switching between several Wine windows (a launcher, a game, another bottle) a game can stop receiving keyboard input until it is restarted; upstream fixed this in wine 11.11.
+
+### GOG GALAXY
+
+```bash
+scripts/create-gog-bottle.sh # separate bottle, official web installer (silent)
+scripts/play.sh gog # log in, install and play
+scripts/play.sh gog-kill # stop the GOG bottle (closing the window parks GOG in the menu bar tray; a Dock-icon click brings it back)
+```
+
+Verified 2026-08-30: install, login, library. GOG GALAXY 2.x is Qt6 + QtWebEngine, not CEF, and on this engine its window stays black because Qt's D3D11 compositing asks D3DMetal's DXGI for `IDXGIResource`, which it does not implement. The fix is to run Chromium on the CPU (`--disable-gpu`), but GOG overwrites `QTWEBENGINE_CHROMIUM_FLAGS` itself and ignores its own command line, and it checksums its executable, so nothing outside the engine can inject the switch. The engine therefore carries a small hook (`patches/chromium-flags-append.patch`): whenever a program sets `QTWEBENGINE_CHROMIUM_FLAGS`, the contents of `SOJU_CHROMIUM_FLAGS` are appended. `play.sh gog` sets it. The same patch set adds `WINE_CUSTOM_FRAME`, which stops the Mac driver from putting a macOS title bar on top of GOG's own. Details in [docs/DIAGNOSIS.md](docs/DIAGNOSIS.md).
Games have not been broadly tested yet; anything that needs kernel anti-cheat (EAC/BattlEye) will not run under Wine.
@@ -111,6 +121,8 @@ Verified on M4 Pro / macOS 26.5: login, library, and an actual D3D11 (Unity) gam
- **Game hangs forever at ~86 MB RAM, 0% CPU** -> `ROSETTA_ADVERTISE_AVX=1` or `libd3dshared` not reaching the game. Launch via `play.sh` only, and check step 4.
- **Libraries not found (gnutls/freetype errors)** -> you launched wine through `nohup`/`arch`/another Apple-signed binary, which strips `DYLD_*` vars. Launch via `play.sh`.
- **Battle.net login webview may flicker (~once a minute)** -> known cosmetic issue; it recovers automatically and login works.
+- **"The installed version of the AMD graphics driver has known issues" when an Unreal Engine game starts** (Hogwarts Legacy and others): D3DMetal presents itself as an AMD adapter with an old driver version, so UE4's driver check fires. Harmless, click OK; to silence it add `[SystemSettings]` / `r.WarnOfBadDrivers=0` to the game's user `Engine.ini` (under `AppData/Local/<Game>/Saved/Config/WindowsNoEditor/`).
+- **GOG GALAXY: a black rectangle appears at the bottom right while a notification toast is shown** and disappears with it. The toast is a transparent layered window from GOG's notifications renderer; without DWM composition Wine paints its transparent area black. Harmless. Turning off desktop notifications in GOG's settings avoids it.
- **BLZBNTBNA00000005** -> `play.sh` seeds the signed exe automatically; make sure you launch through it.
### Leftover Wine processes
diff --git a/docs/DIAGNOSIS.md b/docs/DIAGNOSIS.md
index 57477dc0cda..ce31d1de0d7 100644
--- a/docs/DIAGNOSIS.md
+++ b/docs/DIAGNOSIS.md
@@ -86,7 +86,7 @@ CrossOver 바이너리 의존 0.
- 실행: `EpicGamesLauncher.exe` 기본 인자 그대로. CEF가 `--type=gpu-process`를 별도 프로세스로 띄우는데 **죽지 않는다**. 배틀넷과 달리 `--in-process-gpu --use-gl=swiftshader`가 필요 없었다. 1826×857 메인창, 로그인, 스토어 UI 렌더링 확인.
- wined3d는 `Using the Vulkan renderer for d3d10/11`(MoltenVK) 경로를 탔다. 런처 UI 자체는 이걸로 충분.
- 로그의 `LogDPoP: Failed to create persistent DPoP key (0x80090029)`는 Linux Wine에서도 나오는 것으로 로그인에 영향 없음.
-- 트레이 UX: 창 닫기 = 숨김(Windows와 동일). Epic이 `Shell_NotifyIcon`으로 등록한 트레이 아이콘을 winemac systray가 **macOS 메뉴바 NSStatusItem**으로 올리고(`+systray` 트레이스로 확인), **우클릭** 메뉴로 창 열기·Exit가 된다, 사용자 검증 완료. 좌클릭은 WM_LBUTTONDOWN/UP+NIN_SELECT까지 정상 전달되지만 Epic이 반응하지 않는다(Windows에서도 메뉴 기반). 시도했다 버린 것들: exe 재실행·`com.epicgames.launcher://` URL은 실행 중 인스턴스가 무시; 외부에서 `ShowWindow(SW_SHOW/RESTORE)`로 숨긴 창을 띄우면 보이긴 하지만 Slate가 "최소화" 상태를 유지해 **입력을 안 받는 먹통 창**이 된다. 그래서 Epic 모드는 `WINE_DOCK_REOPEN_CMD`를 쓰지 않는다.
+- 트레이 UX: 창 닫기 = 숨김(Windows와 동일). Epic이 `Shell_NotifyIcon`으로 등록한 트레이 아이콘을 winemac systray가 **macOS 메뉴바 NSStatusItem**으로 올리고(`+systray` 트레이스로 확인), **우클릭** 메뉴로 창 열기·Exit가 된다, 사용자 검증 완료. 좌클릭은 WM_LBUTTONDOWN/UP+NIN_SELECT까지 정상 전달되지만 Epic이 반응하지 않는다(Windows에서도 메뉴 기반). 시도했다 버린 것들: exe 재실행·`com.epicgames.launcher://` URL은 실행 중 인스턴스가 무시; 외부에서 `ShowWindow(SW_SHOW/RESTORE)`로 숨긴 창을 띄우면 보이긴 하지만 Slate가 "최소화" 상태를 유지해 **입력을 안 받는 먹통 창**이 된다. `WM_SYSCOMMAND/SC_RESTORE`도 마찬가지로 먹통 창을 만든다. 유일하게 정상인 경로는 Epic 자신의 트레이 코드라서, 독 클릭은 트레이 더블클릭을 그대로 재현한다(`tools/soju-epic-restore.c`): Epic은 트레이 아이콘을 `uCallbackMessage=0x8054`(WM_APP+0x54), 버전 0으로 등록하므로(winemac `+systray` 트레이스에 콜백 메시지 출력을 추가해 확인) 런처 프로세스의 창들에 그 메시지를 wParam=1, lParam=`WM_LBUTTONDOWN/UP, NIN_SELECT, WM_LBUTTONDBLCLK, WM_LBUTTONUP, NIN_SELECT` 순으로 보내면 Slate가 스스로 창을 복원하고 입력도 정상이다. 단일 클릭(NIN_SELECT만)은 Epic이 무시한다.
- 부수 수정: `WINE_DOCK_REOPEN_CMD` 훅의 "보이는 창" 판정이 Epic의 화면 밖(-10000,-10000) 1×1 투명 보조창을 보이는 창으로 세던 것을 실제 화면 안·alpha>0·크기>1 조건으로 고쳤고, `build-engine.sh`가 CX 엔진에도 winemac 패치를 적용한다.
결론: 벽 1(`WRITECOPY`)은 libcef 버전에 따라 걸리는 일반 문제일 수 있지만, 벽 1-b(GPU 프로세스 사망)는 Battle.net의 CEF 빌드/설정 고유. 다른 CEF 런처(GOG Galaxy·EA app·Ubisoft Connect)도 같은 절차로 먼저 "그냥 돌려보는" 것이 맞다.
@@ -103,6 +103,34 @@ CrossOver 바이너리 의존 0.
부수 확인: 한글 IME가 켜져 있으면 게임이 키 입력을 못 받는다(입력기를 ABC로). 이 alert 코드들은 Whisky/Kegworks 계열 빌드에도 같은 이유로 해당될 가능성이 높다(그쪽 wineserver의 libinotify 링크 여부로 판별 가능).
+## GOG GALAXY 검은 창: Qt D3D11 합성 + 덮어쓰이는 Chromium 플래그 (2026-08-30)
+
+GOG GALAXY 2.1.8은 CEF가 아니라 **Qt6 + QtWebEngine**(Chromium 118/125)이다. Sikarugir#257·#258, Whisky#1004에 보고된 "흰/검은 창"을 이 엔진에서 재현하고 원인을 갈랐다.
+
+1. D3DMetal에서는 QtWebEngine의 네이티브 합성기(`native_skia_output_device.cpp`)가 Chromium D3D11 텍스처를 Qt의 D3D11 RHI와 공유하려고 `QueryInterface(IDXGIResource)`를 부르는데 D3DMetal의 DXGI가 `E_NOINTERFACE(80004002)`를 돌려준다. 그 뒤 `CreateSharedImage failed` → `context is marked as lost`가 초당 수백 번 찍히고 창은 검다.
+2. 보틀만 wined3d(마커 제거한 wine-stable 11.0 PE, `WINEDLLOVERRIDES=d3d11,dxgi,d3d10core,wined3d=n`)로 바꾸면 그 에러는 사라지지만, ANGLE이 wined3d의 FL 9_3에서 GLES 3.0을 못 만들고(`Renderer11.cpp:1107`, `too few uniforms`) 창은 투명(GL 렌더러: `glClear`에서 `GL_INVALID_FRAMEBUFFER_OPERATION`, Vulkan 렌더러: 에러 없이도 안 그림; 레이어드 창에 D3D 프레젠트가 안 되는 Wine 한계로 보임).
+3. Qt RHI를 OpenGL로 바꾸면(`QSG_RHI_BACKEND=opengl`) Chromium이 WGL pbuffer를 못 만들어(`gl_surface_wgl.cc: Unable to create pbuffer`) int3, Vulkan으로 바꾸면 즉시 c0000409.
+4. 남은 답은 Chromium을 CPU 합성으로 돌리는 것이다. 그런데 GOG는 `QTWEBENGINE_CHROMIUM_FLAGS`를 **자기가 설정**해서(바이너리에 변수명 존재) 밖에서 준 값을 덮어쓰고, 자기 argv의 Chromium 스위치는 무시하며(`--verbose-logging` 등 자기 옵션만 파싱), 실행 파일을 바꾸면 "executable checksum doesn't match"로 거부한다. 즉 사용자 공간에서는 스위치를 넣을 길이 없다.
+
+해결(엔진 훅, `patches/chromium-flags-append.patch`): kernelbase `SetEnvironmentVariableW`와 msvcrt/ucrtbase `env_set`(CRT `_putenv_s` 경로, Qt의 `qputenv`가 쓰는 곳)에서 이름이 `QTWEBENGINE_CHROMIUM_FLAGS`이고 `SOJU_CHROMIUM_FLAGS`가 있으면 그 값을 뒤에 덧붙인다. CRT 테이블과 Win32 블록 둘 다 갱신되므로 Qt의 `qgetenv`(CRT `getenv`)가 덧붙은 값을 읽는다. CodeWeavers가 같은 파일에 Ubisoft Connect용으로 `VK_ICD_FILENAMES` 훅을 둔 것과 같은 종류다.
+
+검증: `play.sh gog`가 `SOJU_CHROMIUM_FLAGS="--disable-gpu --disable-gpu-compositing"`를 설정하면 D3DMetal 그대로 에러 3개(`WSALookupServiceBegin`, GLES3 폴백 2개)만 남고 로그인 창·로그인·메인 창(1732×798)이 뜬다. 렌더러 프로세스 커맨드라인에 `--disable-gpu-compositing`이 보인다.
+
+타이틀바: GOG 메인 창은 `WS_OVERLAPPEDWINDOW`이지만 `WM_NCCALCSIZE`로 클라이언트를 창 전체로 잡고 자기 타이틀바를 그린다. Mac 드라이버는 `WS_CAPTION`이면 Cocoa 타이틀바를 얹고(`get_window_features_for_style`) `GetWindowStyleMasks`로 win32u에 캡션을 자기가 그린다고 알리므로 UI 첫 줄이 타이틀바 밑에 숨는다. winemac 패치에 `WINE_CUSTOM_FRAME`(세미콜론 구분 exe 목록)을 추가해 해당 프로세스는 두 곳 모두에서 title_bar를 끈다(`play.sh gog`가 `GalaxyClient.exe`로 설정). Win32 창 크기와 Cocoa 창 크기가 일치하는 것으로 확인.
+
+트레이 복귀: 창을 닫으면 GOG는 트레이로 들어간다. 두 번째 `GalaxyClient.exe` 인스턴스는 `FindWindowW("GalaxyClientClass")`로 메인 창을 찾아 `WM_COPYDATA`(dwData=1, 16바이트: 자기 이미지 안 `RestoreClientMessage` vtable 포인터 `0x140a74858` + dword 1)를 보내고 종료하는데, 수신 측이 그 포인터를 그대로 역참조한다(같은 exe라 주소가 같아 동작). `tools/soju-gog-restore.c`가 이 메시지를 직접 보내 독 아이콘 클릭 시 0.2초 안에 창이 돌아온다. vtable 주소는 GOG 버전마다 바뀌므로 도구가 실행 시 GalaxyClient.exe의 MSVC RTTI(맹글드 클래스명 → 타입 디스크립터 → complete object locator → vtable)를 파싱해 계산하고, 실행 중인 클라이언트의 실제 모듈 베이스를 더한다. 버전 상수 없음. 미끼 창(같은 클래스명)으로 페이로드를 캡처했다.
+
+부수: 강제 종료 후엔 `ProgramData/GOG.com/Galaxy/lock-files/`의 잠금 파일 때문에 "Second client instance detected"로 즉시 종료되므로 `play.sh gog`가 실행 전에 지운다. 설치기가 자동 실행하는 `GalaxyClient.exe /installerLaunch /payload=`는 빈 payload로 `campaignParamsForLogIn` 설정 오류를 내고 죽는데 무해하다. 이 훅은 Qt/QtWebEngine 기반 런처 전반(다른 스토어 클라이언트 포함)에 그대로 쓸 수 있다.
+
+## 트레이 복귀 정리: 네 런처 모두 독 아이콘 클릭으로 돌아온다 (2026-08-30)
+
+winemac 패치의 `WINE_DOCK_REOPEN_CMD`(보이는 창이 없을 때 독 클릭 시 실행)에 런처별 복원 명령을 연결했다.
+
+- Battle.net: 기본은 X = 종료(Windows와 동일). `Client.HideOnClose`로 트레이 최소화를 켠 경우 두 번째 `Battle.net.exe` 실행이 기존 인스턴스에 넘겨져 창이 뜬다.
+- Steam: `steam.exe steam://open/main` 재실행.
+- Epic: 트레이 더블클릭 시퀀스 재현(`tools/soju-epic-restore.c`, 위 참조).
+- GOG: `RestoreClientMessage` 직접 전송(`tools/soju-gog-restore.c`, 위 참조).
+
## 벽 2: Battle.net Agent caller 서명 검증 실패 (해결됨)
### 증상
diff --git a/patches/chromium-flags-append.patch b/patches/chromium-flags-append.patch
new file mode 100644
index 00000000000..2f01239cb02
--- /dev/null
+++ b/patches/chromium-flags-append.patch
@@ -0,0 +1,104 @@
+--- a/dlls/kernelbase/process.c
++++ b/dlls/kernelbase/process.c 2026-08-30 01:16:39
+@@ -1815,10 +1815,33 @@
+ /***********************************************************************
+ * SetEnvironmentVariableW (kernelbase.@)
+ */
++
++/* Soju: let the launcher environment append Chromium switches to
++ * QTWEBENGINE_CHROMIUM_FLAGS even when the application overwrites that variable
++ * itself (GOG Galaxy does). SOJU_CHROMIUM_FLAGS holds the switches to append.
++ * Returns a heap buffer the caller must free, or NULL when nothing applies. */
++static WCHAR *soju_append_chromium_flags( const WCHAR *name, const WCHAR *value )
++{
++ WCHAR extra[1024];
++ DWORD len, vlen;
++ WCHAR *ret;
++
++ if (!name || wcsicmp( name, L"QTWEBENGINE_CHROMIUM_FLAGS" )) return NULL;
++ len = GetEnvironmentVariableW( L"SOJU_CHROMIUM_FLAGS", extra, ARRAY_SIZE(extra) );
++ if (!len || len >= ARRAY_SIZE(extra)) return NULL;
++ if (value && wcsstr( value, extra )) return NULL;
++ vlen = value ? lstrlenW( value ) : 0;
++ if (!(ret = HeapAlloc( GetProcessHeap(), 0, (vlen + len + 2) * sizeof(WCHAR) ))) return NULL;
++ if (vlen) { lstrcpyW( ret, value ); ret[vlen] = ' '; lstrcpyW( ret + vlen + 1, extra ); }
++ else lstrcpyW( ret, extra );
++ return ret;
++}
++
+ BOOL WINAPI DECLSPEC_HOTPATCH SetEnvironmentVariableW( LPCWSTR name, LPCWSTR value )
+ {
+ UNICODE_STRING us_name, us_value;
+ NTSTATUS status;
++ WCHAR *soju_value;
+
+ TRACE( "(%s %s)\n", debugstr_w(name), debugstr_w(value) );
+
+@@ -1834,6 +1857,12 @@
+ if (!wcscmp( name, L"VK_ICD_FILENAMES" ) && value && is_ubisoft())
+ write_ubisoft_vulkan_json( value );
+
++ if ((soju_value = soju_append_chromium_flags( name, value )))
++ {
++ FIXME( "Soju: appending SOJU_CHROMIUM_FLAGS to %s\n", debugstr_w(name) );
++ value = soju_value;
++ }
++
+ RtlInitUnicodeString( &us_name, name );
+ if (value)
+ {
+@@ -1842,6 +1871,7 @@
+ }
+ else status = RtlSetEnvironmentVariable( NULL, &us_name, NULL );
+
++ HeapFree( GetProcessHeap(), 0, soju_value );
+ return set_ntstatus( status );
+ }
+
+--- a/dlls/msvcrt/environ.c
++++ b/dlls/msvcrt/environ.c
+@@ -144,11 +144,41 @@
+ return i;
+ }
+
+-static int env_set(char **env, wchar_t **wenv)
++/* Soju: append SOJU_CHROMIUM_FLAGS to QTWEBENGINE_CHROMIUM_FLAGS when a program
++ * sets it through the CRT (Qt's qputenv), so the CRT copy Qt reads back carries
++ * the extra switches too. kernelbase does the same for the Win32 block. */
++static void soju_env_append(char **env, wchar_t **wenv)
+ {
+- wchar_t *weq = wcschr(*wenv, '=');
+- char *eq = strchr(*env, '=');
++ static const wchar_t prefix[] = L"QTWEBENGINE_CHROMIUM_FLAGS=";
++ wchar_t extra[1024], *nw;
++ char *na;
++ DWORD len;
++ size_t wl, al;
++
++ if (wcsnicmp(*wenv, prefix, ARRAY_SIZE(prefix) - 1)) return;
++ len = GetEnvironmentVariableW(L"SOJU_CHROMIUM_FLAGS", extra, ARRAY_SIZE(extra));
++ if (!len || len >= ARRAY_SIZE(extra)) return;
++ if (wcsstr(*wenv, extra)) return;
++
++ wl = wcslen(*wenv);
++ if (!(nw = malloc((wl + len + 2) * sizeof(wchar_t)))) return;
++ wcscpy(nw, *wenv); nw[wl] = ' '; wcscpy(nw + wl + 1, extra);
++ al = WideCharToMultiByte(CP_ACP, 0, nw, -1, NULL, 0, NULL, NULL);
++ if (!(na = malloc(al))) { free(nw); return; }
++ WideCharToMultiByte(CP_ACP, 0, nw, -1, na, al, NULL, NULL);
++ free(*wenv); free(*env);
++ *wenv = nw; *env = na;
++}
++
++static int env_set(char **env, wchar_t **wenv)
++{
++ wchar_t *weq;
++ char *eq;
+ int idx;
++
++ soju_env_append(env, wenv);
++ weq = wcschr(*wenv, '=');
++ eq = strchr(*env, '=');
+
+ *weq = 0;
+ if (!SetEnvironmentVariableW(*wenv, weq[1] ? weq + 1 : NULL) &&
diff --git a/patches/winemac-no-dock-icon.patch b/patches/winemac-no-dock-icon.patch
index 13264b99aa0..b79cf5d770e 100644
--- a/patches/winemac-no-dock-icon.patch
+++ b/patches/winemac-no-dock-icon.patch
@@ -42,7 +42,7 @@ index 2a9dab2..13e054b 100644
// don't count as "visible windows" for this purpose.
[self unminimizeWindowIfNoneVisible];
+
-+ /* Soju: WINE_DOCK_REOPEN_CMD — Windows apps that "close to the tray"
++ /* Soju: WINE_DOCK_REOPEN_CMD: Windows apps that "close to the tray"
+ (Steam) hide their window; there is no tray on macOS, so a Dock click
+ would do nothing. If nothing is visible after the unminimize attempt,
+ run the command (e.g. "steam.exe steam://open/main") to bring it back. */
@@ -78,3 +78,66 @@ index 2a9dab2..13e054b 100644
return YES;
}
+--- a/dlls/winemac.drv/window.c
++++ b/dlls/winemac.drv/window.c
+@@ -47,6 +47,38 @@
+
+
+ /* CrossOver Hack #16933 */
++
++/* Soju: apps listed in WINE_CUSTOM_FRAME (semicolon-separated exe names) draw
++ * their own title bar inside the client area (Qt/Electron style custom frames,
++ * e.g. GOG GALAXY). Adding a macOS title bar on top of that hides the first
++ * rows of their UI, so such windows get no Cocoa title bar or buttons. */
++static BOOL is_custom_frame_app(void)
++{
++ static int result = -1;
++
++ if (result == -1)
++ {
++ const char *list = getenv("WINE_CUSTOM_FRAME");
++ WCHAR *name = NtCurrentTeb()->Peb->ProcessParameters->ImagePathName.Buffer;
++ WCHAR *exe = wcsrchr(name, '\\');
++ char exe_a[MAX_PATH];
++ int i;
++
++ result = 0;
++ exe = exe ? exe + 1 : name;
++ for (i = 0; exe[i] && i < MAX_PATH - 1; i++) exe_a[i] = (char)exe[i];
++ exe_a[i] = 0;
++ while (list && *list)
++ {
++ const char *end = strchr(list, ';');
++ size_t len = end ? (size_t)(end - list) : strlen(list);
++ if (len == strlen(exe_a) && !strncasecmp(list, exe_a, len)) { result = 1; break; }
++ list = end ? end + 1 : NULL;
++ }
++ }
++ return result;
++}
++
+ static BOOL is_main_quicken_window(HWND hwnd)
+ {
+ static const WCHAR qw_exeW[] = {'q','w','.','e','x','e',0};
+@@ -127,7 +159,10 @@
+ return wf;
+ }
+
+- return get_window_features_for_style(style, ex_style, data->shaped);
++ wf = get_window_features_for_style(style, ex_style, data->shaped);
++ if (wf.title_bar && is_custom_frame_app())
++ wf.title_bar = wf.close_button = wf.minimize_button = wf.maximize_button = FALSE;
++ return wf;
+ }
+
+
+@@ -1653,6 +1688,9 @@
+
+ /* CW HACK 16933: No Cocoa window decorations for the Quicken main window. */
+ if (is_main_quicken_window(hwnd)) return FALSE;
++ /* Soju: custom-frame apps keep their caption inside the client area. */
++ if (wf.title_bar && is_custom_frame_app())
++ wf.title_bar = wf.close_button = wf.minimize_button = wf.maximize_button = FALSE;
+
+ *style_mask = ex_style = 0;
+ if (wf.title_bar)
diff --git a/scripts/build-engine.sh b/scripts/build-engine.sh
index 723cf189ba3..39981451ad8 100755
--- a/scripts/build-engine.sh
+++ b/scripts/build-engine.sh
@@ -35,6 +35,10 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if ! grep -q WINE_DOCK_REOPEN_CMD "$WINE/dlls/winemac.drv/cocoa_app.m"; then
patch -p1 -d "$WINE" < "$SCRIPT_DIR/../patches/winemac-no-dock-icon.patch"
fi
+if ! grep -q "soju_append_chromium_flags" "$WINE/dlls/kernelbase/process.c"; then
+ echo "==> Applying patches/chromium-flags-append.patch (SOJU_CHROMIUM_FLAGS hook for Qt launchers)"
+ patch -p1 -d "$WINE" < "$SCRIPT_DIR/../patches/chromium-flags-append.patch"
+fi
echo "==> Building x86_64 freetype (Rosetta)"
[ -f "$WORK/ft.tar.gz" ] || curl -fL "$FT_URL" -o "$WORK/ft.tar.gz"
diff --git a/scripts/create-epic-bottle.sh b/scripts/create-epic-bottle.sh
index 5eb0aad62ea..47a839f2e31 100755
--- a/scripts/create-epic-bottle.sh
+++ b/scripts/create-epic-bottle.sh
@@ -36,6 +36,13 @@ echo "==> Running the installer (unattended, about half a minute)"
EXE="$WINEPREFIX/drive_c/Program Files/Epic Games/Launcher/Portal/Binaries/Win64/EpicGamesLauncher.exe"
[ -f "$EXE" ] || { echo "Install failed, try: WINEDEBUG=+msi $W msiexec /i \"$MSI\""; exit 1; }
+SUPPORT="$HOME/.battlenet-macos/epic-support"; mkdir -p "$SUPPORT"
+if [ ! -f "$SUPPORT/soju-epic-restore.exe" ]; then
+ echo "==> Building the tray-restore helper (mingw-w64)"
+ command -v x86_64-w64-mingw32-gcc >/dev/null || brew install mingw-w64
+ x86_64-w64-mingw32-gcc -O2 -Wall -mwindows -o "$SUPPORT/soju-epic-restore.exe" -lpsapi \
+ "$(cd "$(dirname "$0")/.." && pwd)/tools/soju-epic-restore.c"
+fi
echo "==> Epic Games Launcher installed"
"$ENGINE/bin/wineserver" -k 2>/dev/null || true
echo "==> Done. Now run: scripts/play.sh epic (log in, then install games from the launcher)"
diff --git a/scripts/create-gog-bottle.sh b/scripts/create-gog-bottle.sh
new file mode 100755
index 00000000000..d9f64f65637
--- /dev/null
+++ b/scripts/create-gog-bottle.sh
@@ -0,0 +1,54 @@
+#!/usr/bin/env bash
+# Create a bottle for GOG GALAXY on the free CX-source engine and install it
+# with GOG's official web installer.
+# Verified 2026-08-30 (M4 Pro / macOS 26.5): install, login window, login.
+# GOG GALAXY 2.x is a Qt6 + QtWebEngine app, not CEF. Its window stays black
+# on this engine unless Chromium runs with --disable-gpu, and GOG overwrites
+# QTWEBENGINE_CHROMIUM_FLAGS itself and ignores its own argv, so the engine
+# carries a small hook (patches/chromium-flags-append.patch) that appends
+# SOJU_CHROMIUM_FLAGS to that variable whenever a program sets it. play.sh gog
+# sets it. See docs/DIAGNOSIS.md.
+set -euo pipefail
+
+ENGINE="${ENGINE:-$HOME/.battlenet-macos/cx26-engine}"
+export WINEPREFIX="${WINEPREFIX:-$HOME/.battlenet-macos/gog-bottle}"
+export WINEDEBUG="${WINEDEBUG:-fixme-all}"
+export WINEMSYNC=1 ROSETTA_ADVERTISE_AVX=1 WINE_SIMULATE_WRITECOPY=1
+export CX_APPLEGPTK_LIBD3DSHARED_PATH="$ENGINE/lib/external/libd3dshared.dylib"
+export DYLD_FALLBACK_LIBRARY_PATH="$ENGINE/lib:/usr/lib"
+
+[ -x "$ENGINE/bin/wine" ] || { echo "Engine not found, run install.sh (or build-engine.sh) first"; exit 1; }
+[ -f "$CX_APPLEGPTK_LIBD3DSHARED_PATH" ] || { echo "libd3dshared not found, run get-gptk.sh first"; exit 1; }
+
+WORK="${WORK:-$HOME/.battlenet-macos/build}"; mkdir -p "$WORK"
+W="$ENGINE/bin/wine"
+
+echo "==> Initializing the prefix: $WINEPREFIX"
+"$W" wineboot -u >/dev/null 2>&1 || true
+"$ENGINE/bin/wineserver" -w
+"$W" reg add "HKCU\\Software\\Wine\\WineDbg" /v ShowCrashDialog /t REG_DWORD /d 0 /f >/dev/null 2>&1
+"$ENGINE/bin/wineserver" -w
+
+echo "==> Downloading the GOG GALAXY installer"
+EXE="$WORK/setup_galaxy.exe"
+[ -f "$EXE" ] || curl -fL "https://webinstallers.gog-statics.com/download/GOG_Galaxy_2.0.exe" -o "$EXE"
+
+echo "==> Running the installer (silent; it downloads the client, a few minutes)"
+"$W" "$EXE" /VERYSILENT /NORESTART /SUPPRESSMSGBOXES >/dev/null 2>&1 || true
+"$ENGINE/bin/wineserver" -w 2>/dev/null || true
+
+CLIENT="$WINEPREFIX/drive_c/Program Files/GOG Galaxy/GalaxyClient.exe"
+[ -f "$CLIENT" ] || { echo "Install failed, try running the installer by hand: $W \"$EXE\""; exit 1; }
+# The installer auto-starts the client with an empty payload, which makes it
+# exit with a config error and leave a lock file behind. Stop it and clean up.
+"$ENGINE/bin/wineserver" -k 2>/dev/null || true
+sleep 2
+rm -f "$WINEPREFIX/drive_c/ProgramData/GOG.com/Galaxy/lock-files/"* 2>/dev/null || true
+SUPPORT="$HOME/.battlenet-macos/gog-support"; mkdir -p "$SUPPORT"
+if [ ! -f "$SUPPORT/soju-gog-restore.exe" ]; then
+ echo "==> Building the tray-restore helper (mingw-w64)"
+ command -v x86_64-w64-mingw32-gcc >/dev/null || brew install mingw-w64
+ x86_64-w64-mingw32-gcc -O2 -Wall -mwindows -o "$SUPPORT/soju-gog-restore.exe" -lpsapi \
+ "$(cd "$(dirname "$0")/.." && pwd)/tools/soju-gog-restore.c"
+fi
+echo "==> GOG GALAXY installed. Launch with: scripts/play.sh gog"
diff --git a/scripts/play.sh b/scripts/play.sh
index 9e2557bbd78..cf5d65f3d79 100755
--- a/scripts/play.sh
+++ b/scripts/play.sh
@@ -22,6 +22,8 @@ if [[ "$MODE" == steam* ]]; then
export WINEPREFIX="${WINEPREFIX:-$HOME/.battlenet-macos/steam-bottle}"
elif [[ "$MODE" == epic* ]]; then
export WINEPREFIX="${WINEPREFIX:-$HOME/.battlenet-macos/epic-bottle}"
+elif [[ "$MODE" == gog* ]]; then
+ export WINEPREFIX="${WINEPREFIX:-$HOME/.battlenet-macos/gog-bottle}"
else
export WINEPREFIX="${WINEPREFIX:-$HOME/.battlenet-macos/bottle}"
fi
@@ -58,6 +60,10 @@ start_reaper(){
[ -x "$REAPER" ] && ( "$REAPER" "$WINEPREFIX" "$ENGINE/bin/wineserver" >/dev/null 2>&1 & )
}
+# A Korean/Japanese/Chinese IME swallows key presses in Wine games, and macOS
+# remembers the input source per app, so switch to ABC before launching.
+case "$MODE" in *-kill) ;; *) python3 "$(dirname "${BASH_SOURCE[0]}")/soju-input-abc.py" 2>/dev/null || true ;; esac
+
case "$MODE" in
battlenet) # Battle.net launcher (log in, then Play for online)
# Battle.net.exe is started directly, not through "Battle.net Launcher.exe":
@@ -66,9 +72,14 @@ case "$MODE" in
# spawns a separate GPU process that dies on init and the frameless main
# window stays fully transparent (Dock icon, no window). See docs/DIAGNOSIS.md.
start_reaper
- exec "$ENGINE/bin/wine" \
- "C:\\Program Files (x86)\\Battle.net\\Battle.net.exe" \
- --disable-gpu-compositing --from-launcher --in-process-gpu --use-gl=swiftshader
+ # By default Battle.net exits when its window is closed (same as Windows).
+ # With Settings > "When I close the app" set to the tray (Client.HideOnClose),
+ # the window hides instead; a Dock-icon click then starts a second
+ # Battle.net.exe, which hands off to the running one and shows its window.
+ BN_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"
+ exec "$ENGINE/bin/wine" "$BN_EXE" $BN_ARGS
;;
d2r) # Launch the game directly (offline / previous session)
start_reaper
@@ -79,10 +90,13 @@ case "$MODE" in
# Runs as-is: Epic's CEF (EpicWebHelper) keeps its GPU process alive here,
# so none of the Battle.net command-line switches are needed.
# Closing the window hides it, exactly like on Windows: Epic's tray icon
- # lands in the macOS menu bar (winemac systray -> NSStatusItem), and its
- # right-click menu reopens the window or exits (left click is ignored by Epic). Do NOT force the hidden window back via
- # ShowWindow() from outside: Slate keeps its "minimized" state and the
- # window comes back unresponsive.
+ # lands in the macOS menu bar (winemac systray -> NSStatusItem); a
+ # double-click or the right-click menu there reopens it. Do NOT force the
+ # hidden window back via ShowWindow()/SC_RESTORE from outside: Slate keeps
+ # its "minimized" state and the window comes back unresponsive. A Dock-icon
+ # click therefore replays the tray double-click into the launcher instead
+ # (tools/soju-epic-restore.c, built by create-epic-bottle.sh).
+ export WINE_DOCK_REOPEN_CMD="'$ENGINE/bin/wine' '$HOME/.battlenet-macos/epic-support/soju-epic-restore.exe'"
EPIC="C:\\Program Files\\Epic Games\\Launcher\\Portal\\Binaries\\Win64\\EpicGamesLauncher.exe"
[[ -f "$WINEPREFIX/drive_c/Program Files/Epic Games/Launcher/Portal/Binaries/Win64/EpicGamesLauncher.exe" ]] || \
{ echo "Epic Games Launcher not found, run scripts/create-epic-bottle.sh first"; exit 1; }
@@ -95,6 +109,38 @@ case "$MODE" in
"$ENGINE/bin/wineserver" -k 2>/dev/null || true
sleep 2; [ -x "$SWEEP" ] && "$SWEEP"
;;
+ gog) # GOG GALAXY, same engine and env as Battle.net (verified 2026-08-30)
+ # GOG GALAXY 2.x is Qt6 + QtWebEngine. Its D3D11 compositing path needs
+ # IDXGIResource, which D3DMetal's DXGI does not implement, so the window
+ # stays black unless Chromium runs on the CPU (--disable-gpu). GOG
+ # overwrites QTWEBENGINE_CHROMIUM_FLAGS itself and ignores its argv, so the
+ # engine's kernelbase/ucrtbase hook appends SOJU_CHROMIUM_FLAGS to that
+ # variable whenever the program sets it (patches/chromium-flags-append.patch).
+ # Closing the window parks GOG in the tray (macOS menu bar icon).
+ GOG="C:\\Program Files\\GOG Galaxy\\GalaxyClient.exe"
+ [[ -f "$WINEPREFIX/drive_c/Program Files/GOG Galaxy/GalaxyClient.exe" ]] || \
+ { echo "GOG GALAXY not found, run scripts/create-gog-bottle.sh first"; exit 1; }
+ rm -f "$WINEPREFIX/drive_c/ProgramData/GOG.com/Galaxy/lock-files/"* 2>/dev/null || true
+ pgrep -f "soju-reaper.sh $WINEPREFIX" >/dev/null 2>&1 || \
+ { [ -x "$REAPER" ] && ( "$REAPER" "$WINEPREFIX" "$ENGINE/bin/wineserver" gog >/dev/null 2>&1 & ); }
+ export SOJU_CHROMIUM_FLAGS="${SOJU_CHROMIUM_FLAGS:---disable-gpu --disable-gpu-compositing}"
+ export WINE_NO_DOCK_ICON="QtWebEngineProcess.exe;GalaxyClientService.exe;GOG Galaxy Notifications Renderer.exe;GalaxyCommunication.exe;GalaxyClientHelper.exe"
+ # GOG draws its own title bar inside the client area; a macOS title bar on
+ # top would hide the first rows of its UI (winemac patch: WINE_CUSTOM_FRAME).
+ export WINE_CUSTOM_FRAME="GalaxyClient.exe"
+ # Closing the window parks GOG in the tray. A Dock-icon click (winemac
+ # patch: WINE_DOCK_REOPEN_CMD runs when no window is visible) sends the
+ # same WM_COPYDATA "restore" message a second GalaxyClient.exe instance
+ # would send, without paying for a whole second client start-up
+ # (tools/soju-gog-restore.c, built by create-gog-bottle.sh).
+ export WINE_DOCK_REOPEN_CMD="'$ENGINE/bin/wine' '$HOME/.battlenet-macos/gog-support/soju-gog-restore.exe'"
+ exec "$ENGINE/bin/wine" "$GOG" "${@:2}"
+ ;;
+ gog-kill) # Stop everything in the GOG bottle
+ pkill -f "soju-reaper.sh $WINEPREFIX" 2>/dev/null || true
+ "$ENGINE/bin/wineserver" -k 2>/dev/null || true
+ sleep 2; [ -x "$SWEEP" ] && "$SWEEP"
+ ;;
steam) # Steam client, wine-stable + webhelper wrapper (verified 2026-08-27)
# Steam's CEF does not render on the CX engine (black screen / SEGV storm).
# The verified combination is Homebrew wine-stable 11 + the steamwebhelper
@@ -172,5 +218,5 @@ case "$MODE" in
"/Applications/Wine Stable.app/Contents/Resources/wine/bin/wineserver" -k 2>/dev/null || true
sleep 2; [ -x "$SWEEP" ] && "$SWEEP"
;;
- *) echo "usage: play.sh [battlenet|d2r|epic|epic-kill|steam|kill|steam-kill]"; exit 1;;
+ *) echo "usage: play.sh [battlenet|d2r|epic|epic-kill|gog|gog-kill|steam|kill|steam-kill]"; exit 1;;
esac
diff --git a/scripts/soju b/scripts/soju
index 0d4db365534..bec199fe33d 100755
--- a/scripts/soju
+++ b/scripts/soju
@@ -17,6 +17,9 @@ Usage:
soju epic-install Set up the Epic Games Launcher bottle (same engine)
soju epic Launch the Epic Games Launcher
soju epic-kill Stop everything in the Epic bottle
+ soju gog-install Set up the GOG GALAXY bottle (same engine)
+ soju gog Launch GOG GALAXY
+ soju gog-kill Stop everything in the GOG bottle
soju steam-install Set up the Steam bottle (wine-stable + wrapper + Steam)
soju steam-games Wire DXMT so D3D11 games render (needs built artifacts)
@@ -30,9 +33,10 @@ EOF
case "${1:-}" in
install) shift; exec bash "$ROOT/install.sh" "$@" ;;
epic-install) shift; exec bash "$ROOT/scripts/create-epic-bottle.sh" "$@" ;;
+ gog-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" "$@" ;;
- battlenet|d2r|epic|epic-kill|steam|kill|steam-kill)
+ battlenet|d2r|epic|epic-kill|gog|gog-kill|steam|kill|steam-kill)
exec bash "$ROOT/scripts/play.sh" "$@" ;;
-h|--help|help|"") usage ;;
*) echo "soju: unknown command '$1'" >&2; usage >&2; exit 64 ;;
diff --git a/scripts/soju-input-abc.py b/scripts/soju-input-abc.py
new file mode 100755
index 00000000000..db9a841172d
--- /dev/null
+++ b/scripts/soju-input-abc.py
@@ -0,0 +1,27 @@
+#!/usr/bin/env python3
+"""Switch the macOS keyboard input source to ABC (US) before a game starts.
+A Korean/Japanese/Chinese IME swallows key presses in Wine games; macOS also
+remembers the input source per app, so the game can inherit the IME from the
+app you were typing in. Safe no-op when ABC is already selected or missing."""
+import ctypes, ctypes.util
+
+cf = ctypes.CDLL("/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation")
+tis = ctypes.CDLL("/System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/HIToolbox")
+cf.CFStringCreateWithCString.restype = ctypes.c_void_p
+cf.CFStringCreateWithCString.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_uint32]
+cf.CFDictionaryCreate.restype = ctypes.c_void_p
+cf.CFDictionaryCreate.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_long, ctypes.c_void_p, ctypes.c_void_p]
+cf.CFArrayGetCount.restype = ctypes.c_long; cf.CFArrayGetCount.argtypes = [ctypes.c_void_p]
+cf.CFArrayGetValueAtIndex.restype = ctypes.c_void_p; cf.CFArrayGetValueAtIndex.argtypes = [ctypes.c_void_p, ctypes.c_long]
+tis.TISCreateInputSourceList.restype = ctypes.c_void_p
+tis.TISCreateInputSourceList.argtypes = [ctypes.c_void_p, ctypes.c_bool]
+tis.TISSelectInputSource.restype = ctypes.c_int32; tis.TISSelectInputSource.argtypes = [ctypes.c_void_p]
+
+def cfstr(s): return cf.CFStringCreateWithCString(None, s.encode(), 0x08000100)
+key = ctypes.c_void_p(cfstr("TISPropertyInputSourceID"))
+val = ctypes.c_void_p(cfstr("com.apple.keylayout.ABC"))
+keys = (ctypes.c_void_p * 1)(key); vals = (ctypes.c_void_p * 1)(val)
+d = cf.CFDictionaryCreate(None, keys, vals, 1, None, None)
+lst = tis.TISCreateInputSourceList(d, False)
+if lst and cf.CFArrayGetCount(lst) > 0:
+ tis.TISSelectInputSource(cf.CFArrayGetValueAtIndex(lst, 0))
diff --git a/scripts/soju-reaper.sh b/scripts/soju-reaper.sh
index c2e16d3a414..15df21be005 100755
--- a/scripts/soju-reaper.sh
+++ b/scripts/soju-reaper.sh
@@ -36,6 +36,11 @@ case "$MODE" in
UI_RE='EpicGamesLauncher\.exe|EpicWebHelper\.exe|EpicOnlineServices'
TRAY_RE='EpicGamesLauncher\.exe'; TRAY_KILL_RE="$UI_RE"
;;
+ gog)
+ GAME_RE='__none__'
+ UI_RE='GalaxyClient\.exe|QtWebEngineProcess\.exe|GalaxyClientService\.exe|GOG Galaxy Notifications|GalaxyCommunication'
+ TRAY_RE='GalaxyClient\.exe'; TRAY_KILL_RE="$UI_RE"
+ ;;
*)
GAME_RE='D2R\.exe|BlizzardError\.exe'
UI_RE='Battle\.net\.exe.*--from-launcher|Battle\.net Launcher\.exe'
@@ -75,7 +80,7 @@ PY
declare -A STRIKES
IDLE_STRIKES=0
-if [ "$MODE" = "steam" ] || [ "$MODE" = "epic" ]; then
+if [ "$MODE" = "steam" ] || [ "$MODE" = "epic" ] || [ "$MODE" = "gog" ]; then
# Steam parks itself in an (invisible on macOS) tray when its window is closed,
# so a missing window means nothing here. Only once steam.exe has really gone
# (Steam menu > Exit) do we shut the rest of the bottle down.
diff --git a/tools/soju-epic-restore.c b/tools/soju-epic-restore.c
new file mode 100644
index 00000000000..baa095620f1
--- /dev/null
+++ b/tools/soju-epic-restore.c
@@ -0,0 +1,56 @@
+/* soju-epic-restore: bring the Epic Games Launcher back from the tray.
+ *
+ * Epic hides its Slate window on close and only reopens it from its own tray
+ * icon; showing the window from outside (ShowWindow, SC_RESTORE) leaves Slate
+ * convinced it is still minimized and the window comes back unresponsive.
+ * So this replays exactly what a double-click on the tray icon delivers: the
+ * launcher registers its icon with uCallbackMessage 0x8054 (WM_APP+0x54),
+ * NOTIFYICON_VERSION 0, so the owner window receives that message with
+ * wParam = icon id (1) and lParam = the mouse message. The owner is a hidden
+ * window of EpicGamesLauncher.exe, so the sequence is sent to every window of
+ * that process; only the tray owner reacts.
+ *
+ * Build: x86_64-w64-mingw32-gcc -O2 -Wall -mwindows soju-epic-restore.c -o soju-epic-restore.exe -lpsapi
+ */
+#include <windows.h>
+#include <psapi.h>
+#include <shellapi.h>
+#include <string.h>
+#include <wchar.h>
+
+#define EPIC_TRAY_CALLBACK 0x8054
+#define EPIC_TRAY_ID 1
+
+static HWND owners[256];
+static int nowners;
+
+static BOOL CALLBACK enum_cb(HWND hwnd, LPARAM lp)
+{
+ WCHAR path[MAX_PATH] = {0};
+ DWORD pid = 0;
+ HANDLE proc;
+
+ GetWindowThreadProcessId(hwnd, &pid);
+ proc = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid);
+ if (!proc) return TRUE;
+ GetModuleFileNameExW(proc, NULL, path, MAX_PATH);
+ CloseHandle(proc);
+ if (wcsstr(path, L"EpicGamesLauncher.exe") && nowners < 256) owners[nowners++] = hwnd;
+ return TRUE;
+}
+
+static void tray(UINT msg)
+{
+ int i;
+ for (i = 0; i < nowners; i++)
+ SendNotifyMessageW(owners[i], EPIC_TRAY_CALLBACK, EPIC_TRAY_ID, msg);
+}
+
+int main(void)
+{
+ EnumWindows(enum_cb, 0);
+ if (!nowners) return 1;
+ tray(WM_LBUTTONDOWN); tray(WM_LBUTTONUP); tray(NIN_SELECT);
+ tray(WM_LBUTTONDBLCLK); tray(WM_LBUTTONUP); tray(NIN_SELECT);
+ return 0;
+}
diff --git a/tools/soju-gog-restore.c b/tools/soju-gog-restore.c
new file mode 100644
index 00000000000..780106763ac
--- /dev/null
+++ b/tools/soju-gog-restore.c
@@ -0,0 +1,100 @@
+/* soju-gog-restore: bring a running GOG GALAXY window back from the tray.
+ *
+ * A second GalaxyClient.exe instance does this by finding the main window
+ * (class "GalaxyClientClass") and sending it WM_COPYDATA with dwData=1 and a
+ * 16-byte block: the vtable pointer of
+ * galaxy::client_base::windows_messaging::RestoreClientMessage inside
+ * GalaxyClient.exe (the receiver dereferences it, which works between two
+ * copies of the same image) followed by dword 1. Launching a whole second
+ * client for that takes several seconds; this sends the same message directly
+ * and is what the Dock-icon click runs (WINE_DOCK_REOPEN_CMD in play.sh gog).
+ *
+ * The vtable moves with every GOG release, so it is located at run time from
+ * the MSVC RTTI in the client's exe: type descriptor (by mangled name) ->
+ * complete object locator -> vtable, plus the module base of the running
+ * client. No version-specific constants.
+ *
+ * Build: x86_64-w64-mingw32-gcc -O2 -Wall -mwindows soju-gog-restore.c -o soju-gog-restore.exe -lpsapi
+ */
+#include <windows.h>
+#include <psapi.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+static const char TYPE_NAME[] = ".?AVRestoreClientMessage@windows_messaging@client_base@galaxy@@";
+
+static DWORD off_to_rva(const BYTE *img, DWORD off)
+{
+ IMAGE_NT_HEADERS64 *nt = (IMAGE_NT_HEADERS64 *)(img + ((IMAGE_DOS_HEADER *)img)->e_lfanew);
+ IMAGE_SECTION_HEADER *s = IMAGE_FIRST_SECTION(nt);
+ for (int i = 0; i < nt->FileHeader.NumberOfSections; i++, s++)
+ if (off >= s->PointerToRawData && off < s->PointerToRawData + s->SizeOfRawData)
+ return s->VirtualAddress + (off - s->PointerToRawData);
+ return 0;
+}
+
+/* Returns the vtable RVA, 0 when not found. */
+static DWORD find_vtable_rva(const BYTE *img, DWORD size)
+{
+ IMAGE_NT_HEADERS64 *nt = (IMAGE_NT_HEADERS64 *)(img + ((IMAGE_DOS_HEADER *)img)->e_lfanew);
+ ULONGLONG pref_base = nt->OptionalHeader.ImageBase;
+ DWORD i, td_rva = 0, col_rva = 0;
+
+ /* type descriptor: { vtable ptr; spare ptr; char name[] } */
+ for (i = 0; i + sizeof(TYPE_NAME) < size; i++)
+ if (!memcmp(img + i, TYPE_NAME, sizeof(TYPE_NAME))) { td_rva = off_to_rva(img, i - 16); break; }
+ if (!td_rva) return 0;
+
+ /* complete object locator: { sig=1, offset=0, cdOffset, typeDescriptor RVA, classHierarchy RVA, self RVA } */
+ for (i = 0; i + 24 <= size; i += 4)
+ {
+ const DWORD *d = (const DWORD *)(img + i);
+ if (d[0] == 1 && d[1] == 0 && d[3] == td_rva) { col_rva = off_to_rva(img, i); if (d[5] == col_rva) break; }
+ }
+ if (!col_rva) return 0;
+
+ /* vtable: the qword right before it holds the COL's absolute (preferred) address */
+ for (i = 0; i + 16 <= size; i += 8)
+ if (*(const ULONGLONG *)(img + i) == pref_base + col_rva) return off_to_rva(img, i + 8);
+ return 0;
+}
+
+int main(void)
+{
+ HWND hwnd = FindWindowW(L"GalaxyClientClass", NULL);
+ WCHAR path[MAX_PATH];
+ DWORD pid = 0, size, read, vt_rva;
+ HANDLE proc, file;
+ HMODULE mod; DWORD needed;
+ BYTE *img;
+ unsigned char block[16];
+ COPYDATASTRUCT cds;
+
+ if (!hwnd) return 1;
+ GetWindowThreadProcessId(hwnd, &pid);
+ proc = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid);
+ if (!proc) return 1;
+ if (!EnumProcessModules(proc, &mod, sizeof(mod), &needed)) return 1;
+ if (!GetModuleFileNameExW(proc, mod, path, MAX_PATH)) return 1;
+ CloseHandle(proc);
+
+ file = CreateFileW(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
+ if (file == INVALID_HANDLE_VALUE) return 1;
+ size = GetFileSize(file, NULL);
+ img = malloc(size);
+ if (!img || !ReadFile(file, img, size, &read, NULL) || read != size) return 1;
+ CloseHandle(file);
+ vt_rva = find_vtable_rva(img, size);
+ free(img);
+ if (!vt_rva) return 3;
+
+ memset(block, 0, sizeof(block));
+ *(ULONGLONG *)block = (ULONGLONG)(ULONG_PTR)mod + vt_rva; /* vtable in the running client */
+ block[8] = 1; /* restore */
+ cds.dwData = 1;
+ cds.cbData = sizeof(block);
+ cds.lpData = block;
+ SendMessageTimeoutW(hwnd, WM_COPYDATA, 0, (LPARAM)&cds, SMTO_ABORTIFHUNG, 3000, NULL);
+ return 0;
+}