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.

Route Sony pads through SDL so XInput games see them (#42), add soju controllers (#43)

Mikeka261f151e4b7
diff --git a/README.ko.md b/README.ko.md
index 70e290f8e1a..61964daf7fe 100644
--- a/README.ko.md
+++ b/README.ko.md
@@ -175,6 +175,7 @@ GPTK 안의 `libd3dshared.dylib`는 그래픽만이 아닙니다. **D2R 로더(
- **Epic: "your account has too many active logins"**, 모든 기기에서 로그아웃하거나 비밀번호를 재설정해도 그대로인 경우. 서버가 실제로 답하는 것은 `too_many_sessions`(18048)이고, 이는 보유 중인 세션이 아니라 *발급된* 세션 수에 대한 제한이라 재시도할수록 나빠진다. 예전 엔진에서는 런처의 기기 키를 wine이 저장하지 못해 몇 번만 실행해도 걸렸다(`patches/ncrypt-persisted-keys.patch` 참고). 보틀을 끄고(`soju epic-kill`) 몇 시간 두어 카운터가 비워진 뒤 한 번만 실행하세요.
- **게임 종료 후(또는 실행이 죽은 뒤) 배틀넷이 "업데이트"(초기화 중)에 멈추고 플레이 버튼이 사라짐**: 게임 프로세스가 끝날 때마다 런처가 설치를 다시 점검합니다. 업데이트를 일시정지했다가 재개하면 플레이 버튼이 돌아오고 정상 실행됩니다. 설치 후 첫 플레이가 1분 안에 죽으면 플레이를 한 번 더 누르세요: 한 번 보고된 사례에서 두 번째 실행은 정상이었습니다.
+- **플레이스테이션 패드(듀얼쇼크 4, 듀얼센스)를 페어링해서 macOS는 인식하는데 게임이 무시함** (블루투스 듀얼쇼크 4 + D2R, #42): `soju controllers`를 열면 DirectInput에만 보이고 XInput 슬롯은 전부 비어 있습니다. Wine은 소니 패드를 기본으로 raw HID 백엔드로 붙이는데, macOS에서는 그 백엔드가 패드를 XInput으로 내놓지 않고, 블리자드 게임은 XInput만 봅니다. 이제 `soju battlenet`이 소니 패드만 SDL 경로로 돌립니다(제조사 단위 레지스트리 항목이라 raw HID가 필요한 휠·스틱은 그대로). 그러면 Xbox 패드처럼 동작합니다. 이 설정은 보틀이 뜰 때 한 번 읽으므로, 배틀넷이 이미 켜져 있었다면 `soju kill`로 완전히 내렸다가(창만 닫으면 보틀이 한동안 살아 있을 수 있습니다) 다시 여세요. `soju controllers`의 "Disable hidraw"를 켜면 모든 장치에 같은 효과입니다. 소니 패드에 raw HID를 되돌리려면 `HKLM\System\CurrentControlSet\Services\WineBus\Devices\054C`의 `Hidraw`를 1로 두면 됩니다.
- **BLZBNTBNA00000005** → `play.sh`가 서명된 exe를 자동으로 넣어 줍니다.
## 라이선스
diff --git a/README.md b/README.md
index 167b90858a2..1c1ded55f09 100644
--- a/README.md
+++ b/README.md
@@ -190,6 +190,7 @@ Start with `soju doctor`: it checks most of the items below and tells you which
- **A movement key stays pressed, or the keyboard goes dead while the mouse still works** (seen in Hogwarts Legacy): keyboard focus moved to another Wine window while the key was held. The usual culprit is the Epic (EOS) overlay, which is why `soju epic` now disables it (`SOJU_EPIC_OVERLAY=1` brings it back; restart the launcher with `soju epic-kill` for the change to apply). On engines before v1.5 a Korean/Japanese/Chinese input source is a second cause: the letter keys then produce jamo or kana, which Unreal games drop (only Escape, arrows and function keys work) and a key held during the switch stays down; keep the input source on English (ABC) there, or update the engine (`soju update`). Still happening? `SOJU_KEYLOG=1 soju epic` writes a key/focus trace to `~/.battlenet-macos/logs/` to attach to an issue.
- **Epic: "your account has too many active logins"** and logging out everywhere or resetting the password does not help. The account service is really answering `too_many_sessions` (18048), a limit on how many sessions were *issued*, not how many are held, so retrying makes it worse. Older engines hit this within a handful of launches because Wine could not keep the launcher's device key: see `patches/ncrypt-persisted-keys.patch`. Stop the bottle (`soju epic-kill`), leave it alone for a few hours so the counter clears, then start it once.
- **Battle.net shows "Update" (stuck at Initializing) and the Play button is gone** after a game exits, or after a launch that died: the launcher re-checks the install every time a game process ends. Pause the update and resume it; Play comes back and the game starts normally. If the very first Play after an install dies within a minute, press Play again: seen once, the second launch went through.
+- **A PlayStation pad (DualShock 4, DualSense) is paired and macOS sees it, but the game ignores it** (DualShock 4 over Bluetooth with D2R, #42): `soju controllers` lists it under DirectInput only, with every XInput slot empty. Wine attaches Sony pads through its raw HID backend by default, and on macOS that backend never presents them as XInput pads, which is all Blizzard's games look for. `soju battlenet` now routes Sony pads through SDL instead (a per-vendor registry entry, so wheels and sticks that need raw HID keep it), and the pad works as an Xbox-style controller. Wine reads this once when the bottle starts: if Battle.net was already open, stop it with `soju kill` (just closing the window can leave the bottle running for a while) and start it again. Ticking "Disable hidraw" in `soju controllers` does the same for every device. To give Sony pads raw HID again, set `Hidraw` to 1 under `HKLM\System\CurrentControlSet\Services\WineBus\Devices\054C`.
- **BLZBNTBNA00000005** -> `play.sh` seeds the signed exe automatically; make sure you launch through it.
### Leftover Wine processes
diff --git a/README.zh.md b/README.zh.md
index cbb7669c48b..8dae43ebc0e 100644
--- a/README.zh.md
+++ b/README.zh.md
@@ -179,6 +179,7 @@ scripts/play.sh steam-kill # 停止 Steam bottle
- **移动键卡在按下状态,或者鼠标正常但键盘完全没反应**(在 Hogwarts Legacy 中出现过):按住键的时候键盘焦点被另一个 Wine 窗口抢走了。常见元凶是 Epic(EOS)覆盖层,所以 `soju epic` 现在默认禁用它(`SOJU_EPIC_OVERLAY=1` 可恢复;先 `soju epic-kill` 再重启登录器才会生效)。v1.5 之前的引擎还有第二个原因:中日韩输入法会让字母键变成假名或字母以外的字符,虚幻引擎的游戏会直接丢弃(只有 Esc、方向键和 F 键有效),切换瞬间按住的键也会卡住;在那些引擎上请保持英文(ABC),或者更新引擎(`soju update`)。仍然复现?`SOJU_KEYLOG=1 soju epic` 会把按键和焦点日志写到 `~/.battlenet-macos/logs/`,提 issue 时附上。
- **Epic 提示 "your account has too many active logins"**,而且在所有设备退出登录、甚至重置密码后依旧如此。账号服务实际返回的是 `too_many_sessions`(18048),限制的是*已发放*的会话数量而非当前持有的数量,所以反复重试只会更糟。旧引擎上启动几次就会触发,因为 Wine 无法保存登录器的设备密钥,详见 `patches/ncrypt-persisted-keys.patch`。先停掉 bottle(`soju epic-kill`),放置几个小时等计数器清零,然后只启动一次。
- **游戏退出后(或启动失败后)Battle.net 停在"更新"(正在初始化),Play 按钮消失**:每当游戏进程结束,启动器都会重新检查安装。暂停更新再恢复,Play 按钮就会回来,游戏正常启动。如果安装后第一次 Play 在一分钟内退出,再按一次 Play:目前报告过一次,第二次启动正常。
+- **PlayStation 手柄(DualShock 4、DualSense)已配对,macOS 能识别,但游戏没有反应**(蓝牙 DualShock 4 + D2R,#42):打开 `soju controllers`,手柄只出现在 DirectInput 下,XInput 槽位全空。Wine 默认通过 raw HID 后端接入索尼手柄,而在 macOS 上这个后端不会把它们呈现为 XInput 手柄,暴雪的游戏只认 XInput。现在 `soju battlenet` 会把索尼手柄改走 SDL 路径(按厂商 ID 写的注册表项,需要 raw HID 的方向盘和摇杆不受影响),手柄就以 Xbox 手柄的形式工作。这个设置在 bottle 启动时只读一次:如果 Battle.net 已经开着,先用 `soju kill` 彻底停掉(只关窗口可能让 bottle 继续运行一阵)再重新打开。在 `soju controllers` 里勾选 "Disable hidraw" 对所有设备都有同样效果。要让索尼手柄恢复 raw HID,把 `HKLM\System\CurrentControlSet\Services\WineBus\Devices\054C` 下的 `Hidraw` 设为 1。
- **BLZBNTBNA00000005** -> `play.sh` 会自动播种签名 exe;请确认是通过它启动的。
### 残留的 Wine 进程
diff --git a/scripts/play.sh b/scripts/play.sh
index 77b4383d976..977b15f4136 100755
--- a/scripts/play.sh
+++ b/scripts/play.sh
@@ -99,6 +99,30 @@ case "$MODE" in
fi
echo " Mount the GPTK dmg (or have CrossOver installed) and run: $(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/soju gptk" >&2
exit 1
+ fi
+ # Sony pads (DualShock 4, DualSense; USB or Bluetooth): winebus prefers its
+ # raw HID backend for them, and on macOS that backend (IOHID) flags only
+ # Xbox pads as gamepads, so a Sony pad comes through as a plain DirectInput
+ # device with no XInput slot, which is all Blizzard's games look for (#42).
+ # Route Sony's vendor id through SDL instead: the pad is then an Xbox-style
+ # XInput controller. Same effect as "Disable hidraw" in the Game Controllers
+ # panel, but only for 054C, so wheels and sticks that need raw HID keep it.
+ # winebus reads this once when the bottle starts. With the bottle down the
+ # entry goes straight into the hive file, so the very next start sees it
+ # (`wine reg add` would boot the prefix, and winebus with it, before the
+ # value lands); wine only rereads the hive at boot, and a live wineserver
+ # rewrites the file, so with the bottle up it goes through reg.exe and
+ # applies at the next `soju kill` + start. Only added when the key is
+ # absent: set Hidraw to 1 there to get raw HID back for Sony pads.
+ if [ -f "$WINEPREFIX/system.reg" ] && ! grep -qi 'Services\\\\winebus\\\\Devices\\\\054C' "$WINEPREFIX/system.reg"; then
+ # wine names the server socket directory after the prefix; the socket
+ # exists exactly while a wineserver for this prefix is up.
+ srv="$(/usr/bin/stat -L -f "/tmp/.wine-$(id -u)/server-%Xd-%Xi" "$WINEPREFIX" 2>/dev/null || true)"
+ if [ -n "$srv" ] && [ -S "$srv/socket" ]; then
+ "$ENGINE/bin/wine" reg add 'HKLM\System\CurrentControlSet\Services\WineBus\Devices\054C' /v Hidraw /t REG_DWORD /d 0 /f >/dev/null 2>&1 || true
+ else
+ printf '\n[System\\\\CurrentControlSet\\\\Services\\\\winebus\\\\Devices\\\\054C]\n"Hidraw"=dword:00000000\n' >> "$WINEPREFIX/system.reg"
+ fi
fi ;;
esac
@@ -273,6 +297,12 @@ case "$MODE" in
WINE_DOCK_REOPEN_CMD="'$WINESTABLE' 'C:\\Program Files (x86)\\Steam\\steam.exe' steam://open/main" \
"$WINESTABLE" "${STEAM_CMD[@]}"
;;
+ controllers) # Game Controllers panel of the Battle.net bottle (Wine's joy.cpl):
+ # shows what the bottle sees (DirectInput, XInput slots) and the SDL/hidraw
+ # toggles. The bottle shuts down when the panel closes if nothing else runs
+ # in it; a running Battle.net needs `soju kill` for a toggle to apply.
+ exec "$ENGINE/bin/wine" control joy.cpl
+ ;;
kill) # Stop everything in the Battle.net bottle
pkill -f "soju-reaper.sh $WINEPREFIX" 2>/dev/null || true
"$ENGINE/bin/wineserver" -k 2>/dev/null || true
diff --git a/scripts/soju b/scripts/soju
index d6483cba0bc..25b109d47d1 100755
--- a/scripts/soju
+++ b/scripts/soju
@@ -26,6 +26,7 @@ Usage:
soju battlenet Launch Battle.net (default bottle)
soju d2r Launch Diablo II: Resurrected directly
soju kill Stop everything in the Battle.net bottle
+ soju controllers Game Controllers panel of the Battle.net bottle (is my pad seen?)
soju epic-install Set up the Epic Games Launcher bottle (same engine)
soju epic Launch the Epic Games Launcher
@@ -66,7 +67,7 @@ case "${1:-}" in
doctor) shift; exec bash "$ROOT/scripts/doctor.sh" "$@" ;;
update) shift; exec bash "$ROOT/scripts/update.sh" "$@" ;;
uninstall) shift; exec bash "$ROOT/scripts/uninstall.sh" "$@" ;;
- battlenet|d2r|epic|epic-kill|gog|gog-kill|steam|kill|steam-kill)
+ battlenet|d2r|controllers|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 ;;