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
winemac: build the key tables from the ASCII layout while an input method is selected
mikey9283aa352f7b02
diff --git a/README.ko.md b/README.ko.mdindex 2fae537fac5..8e9132355cf 100644--- a/README.ko.md+++ b/README.ko.md@@ -114,7 +114,7 @@ scripts/play.sh epic # 로그인 → 게임 설치·플레이scripts/play.sh epic-kill # Epic 보틀 종료 (창을 닫으면 런처는 메뉴바 트레이로 들어감. 독 아이콘 클릭, 또는 메뉴바 아이콘 더블클릭/우클릭으로 복귀)```-검증 2026-08-30: 런처에서 Hogwarts Legacy 71GB 설치 후 인게임까지(UE4, D3DMetal 경유 D3D12). 알아두실 점 두 가지: 플레이 전에 macOS 입력기를 영어(ABC)로 바꾸세요, 한글 IME가 켜져 있으면 Wine 게임에 키 입력이 전달되지 않습니다. 게임이 전체화면으로 뜨면 게임 자체 디스플레이 설정에서 창 모드로 바꾸면 됩니다(Soju가 강제하지 않습니다). wine 11.0의 알려진 문제 하나: 여러 Wine 창(런처, 게임, 다른 보틀)을 오간 뒤 게임이 키보드 입력을 못 받는 경우가 있으며 재시작해야 풀립니다. upstream은 wine 11.11에서 수정했습니다.+검증 2026-08-30: 런처에서 Hogwarts Legacy 71GB 설치 후 인게임까지(UE4, D3DMetal 경유 D3D12). 알아두실 점 두 가지: 한글/일본어/중국어 입력기는 이제 상관없습니다(engine-v1.5부터 Windows처럼 입력기 밑의 영문 레이아웃으로 키 테이블을 만들어서, 게임 중 한글로 바꿨다 돌아와도 됩니다). 게임이 전체화면으로 뜨면 게임 자체 디스플레이 설정에서 창 모드로 바꾸면 됩니다(Soju가 강제하지 않습니다). wine 11.0의 알려진 문제 하나: 여러 Wine 창(런처, 게임, 다른 보틀)을 오간 뒤 게임이 키보드 입력을 못 받는 경우가 있으며 재시작해야 풀립니다. upstream은 wine 11.11에서 수정했습니다.### GOG GALAXY@@ -155,7 +155,7 @@ GPTK 안의 `libd3dshared.dylib`는 그래픽만이 아닙니다. **D2R 로더(- **배틀넷 로그인 화면이 가끔 깜빡임(~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 설정에서 데스크톱 알림을 끄면 안 뜹니다.-- **이동키가 눌린 채로 고정되거나, 마우스는 되는데 키보드가 죽는 경우** (Hogwarts Legacy에서 확인): 키를 누른 사이에 키보드 포커스가 다른 Wine 창으로 넘어간 것입니다. 주범은 Epic(EOS) 오버레이라 `soju epic`은 이제 오버레이를 끕니다(`SOJU_EPIC_OVERLAY=1`로 복구, 적용하려면 `soju epic-kill` 후 재실행). 입력 소스는 세션 내내 영어(ABC)로 두세요. 게임 중 전환 자체가 포커스 이탈입니다. 그래도 재발하면 `SOJU_KEYLOG=1 soju epic`이 `~/.battlenet-macos/logs/`에 키·포커스 로그를 남기니 이슈에 첨부해 주세요.+- **이동키가 눌린 채로 고정되거나, 마우스는 되는데 키보드가 죽는 경우** (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/`에 키·포커스 로그를 남기니 이슈에 첨부해 주세요.- **Epic: "your account has too many active logins"**, 모든 기기에서 로그아웃하거나 비밀번호를 재설정해도 그대로인 경우. 서버가 실제로 답하는 것은 `too_many_sessions`(18048)이고, 이는 보유 중인 세션이 아니라 *발급된* 세션 수에 대한 제한이라 재시도할수록 나빠진다. 예전 엔진에서는 런처의 기기 키를 wine이 저장하지 못해 몇 번만 실행해도 걸렸다(`patches/ncrypt-persisted-keys.patch` 참고). 보틀을 끄고(`soju epic-kill`) 몇 시간 두어 카운터가 비워진 뒤 한 번만 실행하세요.- **BLZBNTBNA00000005** → `play.sh`가 서명된 exe를 자동으로 넣어 줍니다.diff --git a/README.md b/README.mdindex bcb1f24bc61..7b75bc65f22 100644--- a/README.md+++ b/README.md@@ -33,7 +33,7 @@ All verified on an M4 Pro running macOS 26.5. Same engine, one bottle per launch| Game | Store | Graphics | Status | Notes || --- | --- | --- | :-: | --- || Diablo II: Resurrected | Battle.net | D3DMetal (D3D11) | ✅ in-game, online | `play.sh` sets `ROSETTA_ADVERTISE_AVX=1`; [guide](https://bcd1210.github.io/soju/guides/diablo-2-resurrected-apple-silicon.html) |-| Hogwarts Legacy | Epic | D3DMetal (D3D12) | ✅ in-game | UE4 "AMD driver" warning is harmless; switch input source to English |+| Hogwarts Legacy | Epic | D3DMetal (D3D12) | ✅ in-game | UE4 "AMD driver" warning is harmless || Unity D3D11 title | Steam | DXMT | ✅ in-game, windowed | via `soju steam-games`; see [docs/STEAM-GAMES.md](docs/STEAM-GAMES.md) || Diablo II: Resurrected (Infernal Edition) | Steam | — | ⏳ not verified yet | the Steam bottle has no GPTK, and D2R's loader needs `libd3dshared` |@@ -118,7 +118,7 @@ scripts/play.sh epic # log in -> install & playscripts/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). 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.+Verified 2026-08-30: 71 GB install of Hogwarts Legacy (UE4, D3D12 through D3DMetal) from the launcher, then in-game. Two things to know: a Korean/Japanese/Chinese input source no longer matters (engine-v1.5 builds the key tables from the ASCII layout the input method sits on, as Windows does, so you can switch to Korean and back mid-game); 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@@ -160,7 +160,7 @@ Start with `soju doctor`: it checks most of the items below and tells you which- **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.-- **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). Keep the macOS input source on English (ABC) for the whole session, switching it mid-game is itself a focus change. Still happening? `SOJU_KEYLOG=1 soju epic` writes a key/focus trace to `~/.battlenet-macos/logs/` to attach to an issue.+- **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.- **BLZBNTBNA00000005** -> `play.sh` seeds the signed exe automatically; make sure you launch through it.diff --git a/README.zh.md b/README.zh.mdindex 8611f89196b..3c5278519a5 100644--- a/README.zh.md+++ b/README.zh.md@@ -33,7 +33,7 @@| 游戏 | 平台 | 图形 | 状态 | 说明 || --- | --- | --- | :-: | --- || Diablo II: Resurrected | 战网 | D3DMetal (D3D11) | ✅ 进入游戏,可联网 | `play.sh` 设置 `ROSETTA_ADVERTISE_AVX=1`;[指南](https://bcd1210.github.io/soju/guides/diablo-2-resurrected-apple-silicon.html) |-| Hogwarts Legacy | Epic | D3DMetal (D3D12) | ✅ 进入游戏 | UE4 的"AMD 驱动"警告无害;输入法切到英文 |+| Hogwarts Legacy | Epic | D3DMetal (D3D12) | ✅ 进入游戏 | UE4 的"AMD 驱动"警告无害 || Unity D3D11 游戏 | Steam | DXMT | ✅ 进入游戏,窗口模式 | 需要 `soju steam-games`,见 [docs/STEAM-GAMES.md](docs/STEAM-GAMES.md) || Diablo II: Resurrected(Infernal Edition) | Steam | — | ⏳ 尚未验证 | Steam bottle 没有 GPTK,而 D2R 的加载器需要 `libd3dshared` |@@ -118,7 +118,7 @@ scripts/play.sh epic # 登录 -> 安装并游玩scripts/play.sh epic-kill # 停止 Epic bottle(关窗口会缩到菜单栏托盘;点 Dock 图标恢复)```-2026-08-30 验证:从登录器安装 71 GB 的《霍格沃茨之遗》(UE4,D3D12 走 D3DMetal),进入游戏。两点提示:进游戏前把 macOS 输入法切到英文(ABC),中日韩输入法会吞掉 Wine 游戏里的按键;如果游戏以全屏启动,请在游戏自己的显示设置里改成窗口模式(Soju 不强制)。wine 11.0 的一个已知问题:在多个 Wine 窗口(登录器、游戏、另一个 bottle)之间切换几次后,游戏可能收不到键盘输入,重启游戏即可;上游在 wine 11.11 修复。+2026-08-30 验证:从登录器安装 71 GB 的《霍格沃茨之遗》(UE4,D3D12 走 D3DMetal),进入游戏。两点提示:中日韩输入法已经不影响了(engine-v1.5 起像 Windows 一样,用输入法底下的英文布局生成键表,游戏中切到中文再切回来也没问题);如果游戏以全屏启动,请在游戏自己的显示设置里改成窗口模式(Soju 不强制)。wine 11.0 的一个已知问题:在多个 Wine 窗口(登录器、游戏、另一个 bottle)之间切换几次后,游戏可能收不到键盘输入,重启游戏即可;上游在 wine 11.11 修复。### GOG GALAXY@@ -160,7 +160,7 @@ scripts/play.sh steam-kill # 停止 Steam bottle- **战网登录 webview 偶尔闪烁(约一分钟一次)** -> 已知的外观问题;会自动恢复,不影响登录。- **虚幻引擎游戏启动时提示 "The installed version of the AMD graphics driver has known issues"**(《霍格沃茨之遗》等):D3DMetal 把自己伪装成旧驱动版本的 AMD 显卡,触发了 UE4 的驱动检查。无害,点确定即可;想彻底关掉就在游戏的用户 `Engine.ini`(`AppData/Local/<游戏>/Saved/Config/WindowsNoEditor/` 下)加入 `[SystemSettings]` / `r.WarnOfBadDrivers=0`。- **GOG GALAXY:通知弹出时右下角出现黑色矩形**,随通知一起消失。通知是 GOG 通知渲染器的透明分层窗口;没有 DWM 合成时 Wine 会把透明区域涂黑。无害。在 GOG 设置里关闭桌面通知即可避免。-- **移动键卡在按下状态,或者鼠标正常但键盘完全没反应**(在 Hogwarts Legacy 中出现过):按住键的时候键盘焦点被另一个 Wine 窗口抢走了。常见元凶是 Epic(EOS)覆盖层,所以 `soju epic` 现在默认禁用它(`SOJU_EPIC_OVERLAY=1` 可恢复;先 `soju epic-kill` 再重启登录器才会生效)。整个游戏过程保持 macOS 输入法为英文(ABC),游戏中切换输入法本身就是一次焦点切换。仍然复现?`SOJU_KEYLOG=1 soju epic` 会把按键和焦点日志写到 `~/.battlenet-macos/logs/`,提 issue 时附上。+- **移动键卡在按下状态,或者鼠标正常但键盘完全没反应**(在 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`),放置几个小时等计数器清零,然后只启动一次。- **BLZBNTBNA00000005** -> `play.sh` 会自动播种签名 exe;请确认是通过它启动的。diff --git a/docs/DIAGNOSIS.md b/docs/DIAGNOSIS.mdindex 7a7267bb551..4daa07cb004 100644--- a/docs/DIAGNOSIS.md+++ b/docs/DIAGNOSIS.md@@ -214,6 +214,57 @@ override가 적용되는 것은 regsvr32로 확인했다. `SOJU_EPIC_OVERLAY=1`두도록 고쳤다. (2) 릴리스를 `frontWineWindow`로 보내는데 그것이 키를 누른 창이 아닐 수 있다(오버레이 창이 맨 앞인 경우). 키마다 누른 창을 기억해야 제대로 고쳐지며, 아직 안 했다.+### 실측으로 확정 (2026-09-02): 한글 입력기가 켜지면 글자키가 자모로 번역된다++`SOJU_KEYLOG=1`로 남긴 로그(`keys-epic-20260902-181823.log`, 291만 줄)에 재발 순간이 통째로 잡혔다.+증상은 "ESC만 되고 글자키가 전부 안 먹음 + W 고정". 로그가 말해 주는 순서:++1. 게임 창(hwnd 0x50126)이 포커스를 가진 채로 W, Shift, Space가 눌려 있는 순간(달리기 점프)에+ `KEYBOARD_CHANGED`가 온다. 바로 앞 줄에 `IMKCFRunLoopWakeUpReliable`(한글 입력기 서버 기동)이+ 찍힌다. 즉 게임 도중 macOS 입력기가 ABC에서 한글 2벌식으로 바뀌었다. 포커스 이탈은 없었다+ (`WINDOW_LOST_FOCUS` 없음). 방아쇠는 한/영 전환 키(Shift+Space 조합 또는 Caps Lock 짧게 누름,+ 후자는 시스템이 삼켜서 로그에 안 남는다).+2. 그 뒤로 모든 글자키가 `macdrv_ToUnicodeEx returning 1 / L"\3139"`(F=ㄹ), `L"\3148"`(W=ㅈ)으로+ 번역된다. 전환 전에는 `L"f"`, `L"w"`였다. `WM_KEYDOWN VK_F`는 여전히 게임 창으로 들어간다.+3. 언리얼은 글자키를 가상키가 아니라 **문자 코드**로 찾는다(`FWindowsPlatformInput::GetKeyMap`에는+ ESC·방향키·F키 같은 특수키만 있고 A~Z는 `GetCharKeyMap`에 문자로 들어 있다). `WM_KEYDOWN`을+ 받으면 `MapVirtualKey(vk, MAPVK_VK_TO_CHAR)`로 문자를 얻어 키를 찾는데, U+3139에 해당하는 키가+ 없으니 버린다. 그래서 정확히 "ESC만 된다"가 된다.+4. W 고정도 같은 이유다. 전환 전에 눌린 W는 'w'로 들어가 `EKeys::W` down이 됐고, 전환 후에 온+ 뗌(`KEY_RELEASE`는 드라이버 단계에서 정상 전달됨)은 ㅈ으로 번역돼 언리얼이 버린다. 엔진 입장에서+ W는 영영 눌린 상태다. 앞 절의 `releasePressedKeys` 패치는 앱이 비활성화될 때만 동작하므로+ 앱은 활성인 채 입력기만 바뀐 이 경우를 다루지 못한다.++왜 Wine에서만 이런가. Windows는 키보드 레이아웃과 IME를 분리한다. 한글 IME가 켜져 있어도 HKL의+레이아웃은 US라서 `MapVirtualKey('W', VK_TO_CHAR)`는 'W'를 주고, 한글 조합은 IME 단계에서만+일어난다. macOS는 둘을 하나의 입력 소스로 묶고, 한글 2벌식 입력기는 글자키가 자모를 내는 자체+레이아웃(uchr)을 가진다. winemac은 `TISCopyCurrentKeyboardLayoutInputSource()`가 주는 그 uchr로+키 테이블을 만들기 때문에 한글이 선택된 동안 `ToUnicode`/`MapVirtualKey`가 자모를 돌려준다.+(ABC 상태에서만 플레이하라는 기존 안내는 이걸 우회한 것이었고, 게임 중 실수로 전환되면 무력하다.)++### 해결책 (`patches/winemac-ime-ascii-layout.patch`)++`cocoa_app.m`에 `CopyKeyboardLayoutForKeyTables()`를 두고, 현재 입력 소스의 타입이+`kTISTypeKeyboardLayout`이 아니면(즉 입력기이면)+`TISCopyCurrentASCIICapableKeyboardLayoutInputSource()`가 주는 레이아웃(입력기 밑에 깔린 ABC)으로+키 테이블을 만든다. `keyboardSelectionDidChange:`와 `macdrv_get_input_source_info`(스레드 초기화)+두 곳이 이 헬퍼를 쓴다. Windows가 보고하는 것과 같아진다. 한글 조합은 `NSTextInputContext`를+통해 입력기 자체가 하므로 이 테이블과 무관하다(조합 동작은 별도 확인 필요).++### 검증++창 포커스 없이 재현할 수 있는 테스트 프로그램(mingw, `MapVirtualKeyW(vk, MAPVK_VK_TO_CHAR)`와+`ToUnicode`를 찍음)을 한글 2벌식이 선택된 상태에서 임시 프리픽스로 돌렸다.++| 드라이버 | W | F | A | ESC |+|---|---|---|---|---|+| 기존 winemac.so | U+3148 ㅈ | U+3139 ㄹ | U+3141 ㅁ | U+001B |+| 패치 winemac.so | U+0057 'W' / ToUnicode 'w' | 'F' / 'f' | 'A' / 'a' | U+001B |++로그의 자모 코드와 기존 드라이버의 출력이 일치하고, 패치 후에는 입력기가 한글인 채로도 Windows와+같은 값이 나온다. 게임에서의 확인(한글로 바꿨다 돌아와도 이동·상호작용 정상, 고정 없음)은 플레이로+본다.+## 켜둔 런처가 먹통이 되는 이유: wineserver를 잃은 고아 프로세스 (2026-08-31)### 증상diff --git a/patches/winemac-ime-ascii-layout.patch b/patches/winemac-ime-ascii-layout.patchnew file mode 100644index 00000000000..e425586ae4e--- /dev/null+++ b/patches/winemac-ime-ascii-layout.patch@@ -0,0 +1,81 @@+Build the key tables from the ASCII-capable layout while an input method is+selected.++Windows keeps the keyboard layout and the IME apart: with the Korean IME+active, VK_W still maps to 'W' (MapVirtualKey, ToUnicode) and the Hangul+composition happens inside the IME. macOS folds both into one input source,+and the Korean input method carries a layout whose letter keys produce jamo.+winemac builds its key tables from that layout, so while Korean is selected+every letter key produces a jamo character instead of its letter.++A game does not notice the input method at all, it just stops responding:+Unreal maps the letter keys by character (FWindowsPlatformInput::GetKeyMap+lists only the special keys), so W arrives as U+3148, matches nothing and is+dropped, while Escape, arrows and function keys still work. A movement key+held at the moment the source switches never gets its release either, because+the release maps the same way, so the character keeps walking. Measured in+Hogwarts Legacy with a +key trace: the source flipped mid-game with W, Shift+and Space held (a sprint-jump on the input source shortcut), and from then on+"WM_CHAR ... L\"\3139\"" replaced "L\"f\"" for every press.++So while an input method is selected, use the ASCII-capable layout it sits on+(TISCopyCurrentASCIICapableKeyboardLayoutInputSource), which is what Windows+would report. Composition is unaffected: it goes through the input method+itself (NSTextInputContext), which does not read these tables.++--- a/dlls/winemac.drv/cocoa_app.m 2026-07-15 03:37:33++++ b/dlls/winemac.drv/cocoa_app.m 2026-09-02 22:05:35+@@ -127,6 +127,35 @@+ @end++++++/* The keyboard layout Wine builds its key tables from.++ *++ * Windows keeps the keyboard layout and the IME apart: with the Korean IME++ * active, VK_W still maps to 'W' (MapVirtualKey, ToUnicode) and the Hangul++ * composition happens inside the IME. macOS folds both into one input source,++ * and the Korean input method carries a layout whose letter keys produce jamo.++ * Building the key tables from that layout makes every letter key++ * unrecognisable to a game: Unreal maps letters by character, so W arrives as++ * U+3148 and is dropped, and a W held while the source is switched stays down++ * because its release maps the same way.++ *++ * So while an input method is selected, use the ASCII-capable layout it sits++ * on, which is what Windows would report. Composition is unaffected: it goes++ * through the input method itself (NSTextInputContext), not these tables. */++static TISInputSourceRef CopyKeyboardLayoutForKeyTables(void)++{++ TISInputSourceRef source = TISCopyCurrentKeyboardInputSource();++ TISInputSourceRef layout = NULL;++ CFStringRef type = source ? TISGetInputSourceProperty(source, kTISPropertyInputSourceType) : NULL;++++ if (type && !CFEqual(type, kTISTypeKeyboardLayout))++ layout = TISCopyCurrentASCIICapableKeyboardLayoutInputSource();++ if (!layout)++ layout = TISCopyCurrentKeyboardLayoutInputSource();++ if (source) CFRelease(source);++ return layout;++}+++ @implementation WineApplicationController++ @synthesize keyboardType, lastFlagsChanged;+@@ -554,7 +583,7 @@+ }++ inputSource = TISCopyCurrentKeyboardInputSource();+- inputSourceLayout = TISCopyCurrentKeyboardLayoutInputSource();++ inputSourceLayout = CopyKeyboardLayoutForKeyTables();+ if (!force && EqualInputSource(inputSource, lastKeyboardInputSource) &&+ EqualInputSource(inputSourceLayout, lastKeyboardLayoutInputSource))+ {+@@ -2696,7 +2725,7 @@+ OnMainThread(^{+ TISInputSourceRef inputSourceLayout;++- inputSourceLayout = TISCopyCurrentKeyboardLayoutInputSource();++ inputSourceLayout = CopyKeyboardLayoutForKeyTables();+ if (inputSourceLayout)+ {+ CFDataRef data = TISGetInputSourceProperty(inputSourceLayout,diff --git a/scripts/build-engine.sh b/scripts/build-engine.shindex 9cc96890713..5455da0187b 100755--- a/scripts/build-engine.sh+++ b/scripts/build-engine.sh@@ -43,6 +43,10 @@ if ! grep -q "releasePressedKeys" "$WINE/dlls/winemac.drv/cocoa_app.m"; thenecho "==> Applying patches/winemac-release-keys-on-focus-loss.patch (keys stuck down after a focus change)"patch -p1 -d "$WINE" < "$SCRIPT_DIR/../patches/winemac-release-keys-on-focus-loss.patch"fi+if ! grep -q "CopyKeyboardLayoutForKeyTables" "$WINE/dlls/winemac.drv/cocoa_app.m"; then+ echo "==> Applying patches/winemac-ime-ascii-layout.patch (letter keys dead under a Korean/CJK input source)"+ patch -p1 -d "$WINE" < "$SCRIPT_DIR/../patches/winemac-ime-ascii-layout.patch"+fiif ! grep -q "KEY_STORE_MAGIC" "$WINE/dlls/ncrypt/main.c"; thenecho "==> Applying patches/ncrypt-persisted-keys.patch (named CNG keys survive the process)"patch -p1 -d "$WINE" < "$SCRIPT_DIR/../patches/ncrypt-persisted-keys.patch"