Free fork of NotProton: Windows Steam games in Mac Steam, on CodeWeavers' Wine and Apple's Game Porting Toolkit
Swift apple-silicond3dmetaldxmtdxvkgame-porting-toolkitgptkmac-gamingmacosmetalfxrosetta-2steamsteam-playwinewinecx
fix(ntdll): 32-bit games reach Steam on WineCX 11.17
raymondchinsaa171585dfa7
diff --git a/app/Sources/BridgeplayApp/Model/FreeEngineWinecx.swift b/app/Sources/BridgeplayApp/Model/FreeEngineWinecx.swiftindex 8f0653d..5201b38 100644--- a/app/Sources/BridgeplayApp/Model/FreeEngineWinecx.swift+++ b/app/Sources/BridgeplayApp/Model/FreeEngineWinecx.swift@@ -205,7 +205,7 @@ enum FreeEngineWinecx {],patchedNtdll: [.x86_64Windows: "4573d521671a48212670e7543aa9ebf0921e383dada69477f677f435df2bef5a",- .i386Windows: "8ad83740df2da5e79ed435e4bc57e82b4b6a4b984fbec73e1160ca81dfce1b44",+ .i386Windows: "628d08854dc42009f63dc489005c2a49a3f1fe4c6a949dc1ac505915004e5b70",],tools: [CompatTool(name: "bridgeplay-proton-winecx-11.17", flavor: .rosetta, display: "WineCX 11.17 (msync, D3DMetal)"),@@ -234,7 +234,7 @@ enum FreeEngineWinecx {NtdllPatch(arch: .i386Windows,payloadResource: "detour32-winecx-11.17",- payloadSHA256: "0676104e0bd56c4a1e8c473d9cbcd21fb2ba105fc7dc6cf5a70d37692c129e28",+ payloadSHA256: "085df281ffe81c2803f44dd30df885248e5510c8560f0f20a5ae36e8446f7559",caveRVA: 0x808a0,payloadRVA: 0x808a0,hooks: [diff --git a/app/Sources/BridgeplayApp/Resources/detour32-winecx-11.17.bin b/app/Sources/BridgeplayApp/Resources/detour32-winecx-11.17.binindex c1752de..9682dbf 100644Binary files a/app/Sources/BridgeplayApp/Resources/detour32-winecx-11.17.bin and b/app/Sources/BridgeplayApp/Resources/detour32-winecx-11.17.bin differdiff --git a/docs/WINECX.md b/docs/WINECX.mdindex c279239..db1ae36 100644--- a/docs/WINECX.md+++ b/docs/WINECX.md@@ -352,9 +352,9 @@ python3 apply.py <ntdll.dll> <out> <detour bin> # patched hashes| clean x86_64 ntdll | `8b32c9f6f71b4f15fcaccb19b0f2adab9391ae73ad539cae9e136f8ee7d24128` || patched x86_64 ntdll | `4573d521671a48212670e7543aa9ebf0921e383dada69477f677f435df2bef5a` || clean i386 ntdll | `cc8a9035cea0e26c5d333ef220f1becefc27ae44d2cdcdaea3278e8739d26fd9` |-| patched i386 ntdll | `8ad83740df2da5e79ed435e4bc57e82b4b6a4b984fbec73e1160ca81dfce1b44` |+| patched i386 ntdll | `628d08854dc42009f63dc489005c2a49a3f1fe4c6a949dc1ac505915004e5b70` || `detour2-winecx-11.17.bin` | `e1bbd185b19de3e23d627ae3a8bf25ed1b767bff5690102c5312a5ed3813e736` |-| `detour32-winecx-11.17.bin` | `0676104e0bd56c4a1e8c473d9cbcd21fb2ba105fc7dc6cf5a70d37692c129e28` |+| `detour32-winecx-11.17.bin` | `085df281ffe81c2803f44dd30df885248e5510c8560f0f20a5ae36e8446f7559` || `winemac-winecx-11.17.so` | `aa192f846ad15d56de200fc92752eaf2d455700846ae2cf1ccc7b27b535f1c00` || `winebus-winecx-11.17.so` | `6223c035c824c90708abbc3e733f8d1d6ed6b8b4e9a3e1a5c813493ceba50473` || `winebus-winecx-11.17.sys` | `da108d1c3788fa32807ef08c4d26d8a89812c230317ffa7ba5111e126bda607c` |diff --git a/ntdll-patch/build32.sh b/ntdll-patch/build32.shindex ecca433..34323a3 100755--- a/ntdll-patch/build32.sh+++ b/ntdll-patch/build32.sh@@ -23,7 +23,8 @@ CFLAGS="-Os -fno-asynchronous-unwind-tables -ffreestanding -fno-stack-protector"$CC" -c $CFLAGS detour32.c -o detour32_c.o \"-DFLAGS_SLOT=$NP_FLAGS_SLOT" "-DFLAGS_BIT=$NP_FLAGS_BIT" "-DLOAD_PATH_SLOT=$NP_LOAD_PATH""$CC" -c -x assembler-with-cpp shim32.S -o shim32.o \- "-DWM_REG=$NP_WM" "-DSTOLEN_HEAD_BYTES=$NP_STOLEN_HEAD_BYTES" \+ "-DWM_REG=$NP_WM" "-DWM_IN_EBX=$([ "$NP_WM" = ebx ] && echo 1 || echo 0)" \+ "-DSTOLEN_HEAD_BYTES=$NP_STOLEN_HEAD_BYTES" \"-DSTOLE_BRANCH=${NP_STOLE_BRANCH:-0}""$LD" -T link32.ld shim32.o detour32_c.o -o detour32_linked.elf \--defsym "CAVE_VA=$NP_PAYLOAD_VA" \diff --git a/ntdll-patch/resolve.py b/ntdll-patch/resolve.pyindex 2a3088b..380a36f 100755--- a/ntdll-patch/resolve.py+++ b/ntdll-patch/resolve.py@@ -132,7 +132,7 @@ PINNED = {'cc8a9035cea0e26c5d333ef220f1becefc27ae44d2cdcdaea3278e8739d26fd9':{'hookRVA': 0x4f880, 'stolen': 'f645b4027529', 'caveRVA': 0x808a0, 'caveSize': 1888,'resume': 0x4f886, 'wm': 'ebx', 'load_path': -0x5c,- 'payload': '0676104e0bd56c4a1e8c473d9cbcd21fb2ba105fc7dc6cf5a70d37692c129e28',+ 'payload': '085df281ffe81c2803f44dd30df885248e5510c8560f0f20a5ae36e8446f7559','exports': {'LdrGetDllHandle': 0x7bc12aa0, 'LdrLoadDll': 0x7bc13640,'NtProtectVirtualMemory': 0x7bc0d7a4, 'NtOpenFile': 0x7bc0d5d4,'NtReadFile': 0x7bc0d304, 'NtClose': 0x7bc0d394}},diff --git a/ntdll-patch/shim32.S b/ntdll-patch/shim32.Sindex ba8fbe1..94ad04b 100644--- a/ntdll-patch/shim32.S+++ b/ntdll-patch/shim32.S@@ -10,8 +10,13 @@ shim_entry32:delta_ref:pop ecxsub ecx, offset delta_ref // ecx = load base, preferred base+#if WM_IN_EBX+ mov esi, ebx // wm, read before ebx takes fp+ mov ebx, ebp+#elsemov ebx, ebp // fp; ebx/esi survive the cdecl callmov esi, WM_REG // wm+#endifmov edi, esp // pre-align esp, for an exact restoreand esp, -16sub esp, 0x30 // [esp+0x00..0x0B] args, [esp+0x0C..0x27] ctx