Skip to content

Free fork of NotProton: Windows Steam games in Mac Steam, on CodeWeavers' Wine and Apple's Game Porting Toolkit

fix(engine): export D3DX11CreateThreadPump on WineCX 11.17

raymondchins87ddef2f1313
diff --git a/NOTICE b/NOTICE
index 81f8f5b..407a766 100644
--- a/NOTICE
+++ b/NOTICE
@@ -50,6 +50,10 @@ sha256 pins are in docs/WINECX.md and each patch directory's README.
winecoreaudio-winecx-11.17.so winecoreaudio-patch/winecx-render-buffer.patch
wined3d-winecx-11.17.dll wined3d-patch/winecx-driver-version.patch
ws2_32-winecx-11.17.dll ws2_32-patch/winecx-own-hostname.patch
+ d3dx11_43-winecx-11.17.dll d3dx11-patch/winecx-create-thread-pump.patch
+ d3dx11_43-winecx-11.17-i386.dll (same patch)
+ d3dx11_42-winecx-11.17.dll (same patch)
+ d3dx11_42-winecx-11.17-i386.dll (same patch)
crypt32-winecx-11.17.dll ngx-signer-patch/winecx-ngx-signer.patch
wintrust-winecx-11.17.dll ngx-signer-patch/winecx-ngx-signer.patch
diff --git a/app/Package.swift b/app/Package.swift
index 04471de..d62d806 100644
--- a/app/Package.swift
+++ b/app/Package.swift
@@ -59,6 +59,10 @@ let package = Package(
.copy("Resources/win32u-winecx-11.17.so"),
.copy("Resources/wined3d-winecx-11.17.dll"),
.copy("Resources/winecoreaudio-winecx-11.17.so"),
+ .copy("Resources/d3dx11_43-winecx-11.17.dll"),
+ .copy("Resources/d3dx11_43-winecx-11.17-i386.dll"),
+ .copy("Resources/d3dx11_42-winecx-11.17.dll"),
+ .copy("Resources/d3dx11_42-winecx-11.17-i386.dll"),
.copy("Resources/libSDL2-2.0.0.dylib"),
.copy("Resources/detour2-41073.bin"),
.copy("Resources/detour32-41073.bin"),
diff --git a/app/Sources/BridgeplayApp/Model/FreeEngineWinecx.swift b/app/Sources/BridgeplayApp/Model/FreeEngineWinecx.swift
index 5201b38..6917544 100644
--- a/app/Sources/BridgeplayApp/Model/FreeEngineWinecx.swift
+++ b/app/Sources/BridgeplayApp/Model/FreeEngineWinecx.swift
@@ -68,6 +68,10 @@ struct WinecxRelease: Sendable {
// pull, not a whole one, which Wine padded with silence and was heard as crackling
// (winecoreaudio-patch/). Empty where the runtime's own is kept.
let audio: [WinecxBundledFile]
+ // d3dx11_43 and d3dx11_42 rebuilt to export D3DX11CreateThreadPump, which games such as
+ // Persona 4 Golden import and Wine leaves as a stub (d3dx11-patch/). Empty where the
+ // runtime's own are kept.
+ let d3dx: [WinecxBundledFile]
// The runner build this release unpacks to, keyed by its pinned loader, and the ntdll
// detours for it (NtdllPatcher.byBuild).
let runner: RunnerBuild
@@ -194,6 +198,22 @@ enum FreeEngineWinecx {
path: "lib/wine/x86_64-unix/winecoreaudio.so",
sha256: "680b267e8cf41af0868de4adf7f6760615a434a4be06b4ab0cfeece2d9240faa"),
],
+ // d3dx11_43.dll, d3dx11_42.dll: winecx e0aa380's PE halves, both arches, with
+ // d3dx11-patch/winecx-create-thread-pump.patch.
+ d3dx: [
+ WinecxBundledFile(resource: "d3dx11_43-winecx-11.17", ext: "dll",
+ path: "lib/wine/x86_64-windows/d3dx11_43.dll",
+ sha256: "7d23cdfacc922f67dfa2eba98df277ae2ae351ad3646c3191a84966b55dbbfd3"),
+ WinecxBundledFile(resource: "d3dx11_43-winecx-11.17-i386", ext: "dll",
+ path: "lib/wine/i386-windows/d3dx11_43.dll",
+ sha256: "dd4dd351f2a5880c9848d5ccf4944a0b5e7622bb7fb196544115b1f9c92d749c"),
+ WinecxBundledFile(resource: "d3dx11_42-winecx-11.17", ext: "dll",
+ path: "lib/wine/x86_64-windows/d3dx11_42.dll",
+ sha256: "3d97e1de9000a78e27eb5c90d0ab9b36d54fd350760063da27226d22c90c8e1b"),
+ WinecxBundledFile(resource: "d3dx11_42-winecx-11.17-i386", ext: "dll",
+ path: "lib/wine/i386-windows/d3dx11_42.dll",
+ sha256: "85075f8b4f30f1a993238a0d6ab772a3a3df6c031e87ee9401c4367a527cd57c"),
+ ],
runner: RunnerBuild(
bundleVersion: "winecx-11.17",
releaseVersion: "WineCX 11.17",
@@ -283,6 +303,7 @@ enum FreeEngineWinecx {
network: [],
nvidia: [],
audio: [],
+ d3dx: [],
// The hash-pinned loader is what makes it free, so a CrossOver install can never be
// taken for it.
runner: RunnerBuild(
@@ -375,7 +396,7 @@ enum FreeEngineWinecx {
// checks them, since they are either Wine's own or links into a Game Porting Toolkit.
static func expectedFiles(_ release: WinecxRelease = current) -> [String: String] {
var table: [String: String] = [FreeEngine.macDriverPath: release.macDriver]
- for file in release.gamepad + release.network + release.nvidia + release.audio { table[file.path] = file.sha256 }
+ for file in release.gamepad + release.network + release.nvidia + release.audio + release.d3dx { table[file.path] = file.sha256 }
for file in release.backends { table["\(backendsPath)/\(file.destination)"] = file.sha256 }
for path in release.renderer.files.keys {
table[release.renderer.installPath(of: path)] = release.renderer.installedHash(of: path)
@@ -464,7 +485,7 @@ enum FreeEngineWinecx {
try fm.createDirectory(at: root.deletingLastPathComponent(), withIntermediateDirectories: true)
try fm.moveItem(at: wine, to: root)
try FreeEngine.installMacDriver(root: root, build: release.build, sha256: release.macDriver, step: step)
- try installBundled(release.gamepad + release.network + release.nvidia + release.audio, root: root)
+ try installBundled(release.gamepad + release.network + release.nvidia + release.audio + release.d3dx, root: root)
let libraries = wine.deletingLastPathComponent()
for file in release.backends {
diff --git a/app/Sources/BridgeplayApp/Resources/d3dx11_42-winecx-11.17-i386.dll b/app/Sources/BridgeplayApp/Resources/d3dx11_42-winecx-11.17-i386.dll
new file mode 100755
index 0000000..b66cd40
Binary files /dev/null and b/app/Sources/BridgeplayApp/Resources/d3dx11_42-winecx-11.17-i386.dll differ
diff --git a/app/Sources/BridgeplayApp/Resources/d3dx11_42-winecx-11.17.dll b/app/Sources/BridgeplayApp/Resources/d3dx11_42-winecx-11.17.dll
new file mode 100755
index 0000000..32bb395
Binary files /dev/null and b/app/Sources/BridgeplayApp/Resources/d3dx11_42-winecx-11.17.dll differ
diff --git a/app/Sources/BridgeplayApp/Resources/d3dx11_43-winecx-11.17-i386.dll b/app/Sources/BridgeplayApp/Resources/d3dx11_43-winecx-11.17-i386.dll
new file mode 100755
index 0000000..a129a51
Binary files /dev/null and b/app/Sources/BridgeplayApp/Resources/d3dx11_43-winecx-11.17-i386.dll differ
diff --git a/app/Sources/BridgeplayApp/Resources/d3dx11_43-winecx-11.17.dll b/app/Sources/BridgeplayApp/Resources/d3dx11_43-winecx-11.17.dll
new file mode 100755
index 0000000..ecd497d
Binary files /dev/null and b/app/Sources/BridgeplayApp/Resources/d3dx11_43-winecx-11.17.dll differ
diff --git a/app/Tests/BridgeplayAppTests/FreeEngineWinecxTests.swift b/app/Tests/BridgeplayAppTests/FreeEngineWinecxTests.swift
index f08827f..8023aae 100644
--- a/app/Tests/BridgeplayAppTests/FreeEngineWinecxTests.swift
+++ b/app/Tests/BridgeplayAppTests/FreeEngineWinecxTests.swift
@@ -243,6 +243,23 @@ struct FreeEngineWinecxTests {
}
}
+ // d3dx11-patch: 11.17 ships d3dx11_43 and d3dx11_42 exporting D3DX11CreateThreadPump.
+ @Test("The patched d3dx11 DLLs ship with the app and are pinned for 11.17",
+ arguments: FreeEngineWinecx.releases.map(\.build))
+ func d3dx(id: String) throws {
+ let release = try #require(FreeEngineWinecx.release(build: id))
+ let expected: Set<String> = release.build == "winecx-11.17"
+ ? ["lib/wine/x86_64-windows/d3dx11_43.dll", "lib/wine/i386-windows/d3dx11_43.dll",
+ "lib/wine/x86_64-windows/d3dx11_42.dll", "lib/wine/i386-windows/d3dx11_42.dll"] : []
+ #expect(Set(release.d3dx.map(\.path)) == expected)
+ let table = FreeEngineWinecx.expectedFiles(release)
+ for file in release.d3dx {
+ let bundled = try #require(Bundle.module.url(forResource: file.resource, withExtension: file.ext))
+ #expect(Digest.sha256IfPresent(bundled) == file.sha256, "\(file.resource)")
+ #expect(table[file.path] == file.sha256, "\(file.path)")
+ }
+ }
+
@Test("Each free engine is current, outdated or missing on its own pins")
func perEngineState() throws {
let winehqBuild = try #require(SupportedRunners.build(id: FreeEngine.current.build))
diff --git a/d3dx11-patch/README.md b/d3dx11-patch/README.md
new file mode 100644
index 0000000..f981b41
--- /dev/null
+++ b/d3dx11-patch/README.md
@@ -0,0 +1,11 @@
+# d3dx11-patch
+
+`winecx-create-thread-pump.patch` turns `D3DX11CreateThreadPump` in `d3dx11_43` and `d3dx11_42`
+from a spec stub into a function that returns `E_NOTIMPL`. A game that imports it (Persona 4
+Golden, Discussion #170) otherwise dies at the first call with
+`unimplemented function d3dx11_43.dll.D3DX11CreateThreadPump` (Wine bug 56176). The change is
+upstream MR 6654 (closed, not merged): the `async.c` function, both `.spec` entries and the
+prototype in `include/d3dx11core.idl`. winecx's `d3dx11_42.spec` forwards to `d3dx11_43` with
+`-import`, so its entry does too, and both DLLs ship together. Wine master still has the stub
+(checked 2026-10-22). Against winecx `e0aa380`; the build and pins are in `docs/WINECX.md`
+(D3DX11 thread pump).
diff --git a/d3dx11-patch/winecx-create-thread-pump.patch b/d3dx11-patch/winecx-create-thread-pump.patch
new file mode 100644
index 0000000..d528225
--- /dev/null
+++ b/d3dx11-patch/winecx-create-thread-pump.patch
@@ -0,0 +1,51 @@
+diff --git a/dlls/d3dx11_42/d3dx11_42.spec b/dlls/d3dx11_42/d3dx11_42.spec
+index 4e3d2f4..af20fa9 100644
+--- a/dlls/d3dx11_42/d3dx11_42.spec
++++ b/dlls/d3dx11_42/d3dx11_42.spec
+@@ -25,7 +25,7 @@
+ @ stdcall -import D3DX11CreateTextureFromMemory(ptr ptr long ptr ptr ptr ptr)
+ @ stdcall -import D3DX11CreateTextureFromResourceA(ptr long str ptr ptr ptr ptr)
+ @ stdcall -import D3DX11CreateTextureFromResourceW(ptr long wstr ptr ptr ptr ptr)
+-@ stub D3DX11CreateThreadPump
++@ stdcall -import D3DX11CreateThreadPump(long long ptr)
+ @ stdcall -import D3DX11FilterTexture(ptr ptr long long)
+ @ stdcall -import D3DX11GetImageInfoFromFileA(str ptr ptr ptr)
+ @ stdcall -import D3DX11GetImageInfoFromFileW(wstr ptr ptr ptr)
+diff --git a/dlls/d3dx11_43/async.c b/dlls/d3dx11_43/async.c
+index 897f33d..b6abd00 100644
+--- a/dlls/d3dx11_43/async.c
++++ b/dlls/d3dx11_43/async.c
+@@ -401,3 +401,10 @@ HRESULT WINAPI D3DX11CreateAsyncResourceLoaderW(HMODULE module, const WCHAR *res
+
+ return S_OK;
+ }
++
++HRESULT WINAPI D3DX11CreateThreadPump(UINT io_thread_count, UINT process_thread_count, ID3DX11ThreadPump **pump)
++{
++ FIXME("io_thread_count %u, process_thread_count %u, pump %p stub!\n", io_thread_count, process_thread_count, pump);
++
++ return E_NOTIMPL;
++}
+diff --git a/dlls/d3dx11_43/d3dx11_43.spec b/dlls/d3dx11_43/d3dx11_43.spec
+index 2033d60..ab28150 100644
+--- a/dlls/d3dx11_43/d3dx11_43.spec
++++ b/dlls/d3dx11_43/d3dx11_43.spec
+@@ -25,7 +25,7 @@
+ @ stdcall D3DX11CreateTextureFromMemory(ptr ptr long ptr ptr ptr ptr)
+ @ stdcall D3DX11CreateTextureFromResourceA(ptr long str ptr ptr ptr ptr)
+ @ stdcall D3DX11CreateTextureFromResourceW(ptr long wstr ptr ptr ptr ptr)
+-@ stub D3DX11CreateThreadPump
++@ stdcall D3DX11CreateThreadPump(long long ptr)
+ @ stdcall D3DX11FilterTexture(ptr ptr long long)
+ @ stdcall D3DX11GetImageInfoFromFileA(str ptr ptr ptr)
+ @ stdcall D3DX11GetImageInfoFromFileW(wstr ptr ptr ptr)
+diff --git a/include/d3dx11core.idl b/include/d3dx11core.idl
+index f619e3b..eba3747 100644
+--- a/include/d3dx11core.idl
++++ b/include/d3dx11core.idl
+@@ -63,3 +63,5 @@ interface ID3DX11ThreadPump : IUnknown
+ HRESULT PurgeAllItems();
+ HRESULT GetQueueStatus([in] UINT *io_queue, [in] UINT *process_queue, [in] UINT *device_queue);
+ }
++
++cpp_quote("HRESULT WINAPI D3DX11CreateThreadPump(UINT io_thread_count, UINT process_thread_count, ID3DX11ThreadPump **pump);")
diff --git a/docs/WINECX.md b/docs/WINECX.md
index db1ae36..5ea7f2d 100644
--- a/docs/WINECX.md
+++ b/docs/WINECX.md
@@ -98,6 +98,7 @@ lib/wine/x86_64-unix/winemac.so Retina fix, replacing the arch
lib/wine/x86_64-unix/winebus.so built with SDL2, replacing the archive's (Controllers)
lib/wine/x86_64-windows/winebus.sys 11.17 only: map-key fix, replacing the archive's (Controllers)
lib/wine/x86_64-windows/ws2_32.dll 11.17 only: own host name without loopback, replacing the archive's (Own host name)
+lib/wine/{x86_64,i386}-windows/d3dx11_4{2,3}.dll 11.17 only: D3DX11CreateThreadPump stub, replacing the archive's (D3DX11 thread pump)
lib/libSDL2-2.0.0.dylib SDL 2.32.10, x86_64, for winebus.so (Controllers)
```
@@ -204,6 +205,27 @@ is byte-identical to the runtime's `ws2_32.dll`; only the PE timestamp, checksum
differ, and the runtime's `.eh_frame` section name is cut to `.eh_fram` (10 bytes of string
table). 11.15 keeps the runtime's own `ws2_32.dll`, so it still answers loopback first.
+## D3DX11 thread pump
+
+Wine's `d3dx11_43` and `d3dx11_42` declare `D3DX11CreateThreadPump` as a spec stub, so a game
+that imports it (Persona 4 Golden) dies at the first call with
+`unimplemented function d3dx11_43.dll.D3DX11CreateThreadPump` (Wine bug 56176). Wine master
+still has the stub (checked 2026-10-22); MR 6654 (closed, not merged) added an `E_NOTIMPL`
+stub, MR 5357 (open) a fuller thread pump.
+
+11.17 ships `d3dx11_43-winecx-11.17{,-i386}.dll` and `d3dx11_42-winecx-11.17{,-i386}.dll` as
+`lib/wine/{x86_64,i386}-windows/d3dx11_4{3,2}.dll`: winecx `e0aa380`'s PE halves with
+`d3dx11-patch/winecx-create-thread-pump.patch`, MR 6654's change, which returns `E_NOTIMPL`.
+`d3dx11_42` forwards to `d3dx11_43` (`-import`), so both are rebuilt and ship together. The
+pins are the release's `d3dx`.
+
+Built in a tree configured as in `winemac-patch/README.md` but with
+`--enable-archs=i386,x86_64` (mingw-w64 gcc 16.2 for both), brew's bison on `PATH` for `make`
+too, `make dlls/d3dx11_4{3,2}/{x86_64,i386}-windows/d3dx11_4{3,2}.dll`, then
+`{x86_64,i686}-w64-mingw32-strip --strip-debug`. Built without the patch, every section of
+all four is byte-identical to the runtime's; only the build id differs and the runtime's
+`.eh_frame` name is cut to `.eh_fram`. 11.15 keeps the runtime's own.
+
## D3DMetal: the builtin model
Apple's forwarders only work as builtins: only a builtin gets its unix half
@@ -359,6 +381,10 @@ python3 apply.py <ntdll.dll> <out> <detour bin> # patched hashes
| `winebus-winecx-11.17.so` | `6223c035c824c90708abbc3e733f8d1d6ed6b8b4e9a3e1a5c813493ceba50473` |
| `winebus-winecx-11.17.sys` | `da108d1c3788fa32807ef08c4d26d8a89812c230317ffa7ba5111e126bda607c` |
| `ws2_32-winecx-11.17.dll` | `cb0a5670ce6dbf949ed25cca54e9f1c4930cd4c2ade895836d518d3d9073079c` |
+| `d3dx11_43-winecx-11.17.dll` | `7d23cdfacc922f67dfa2eba98df277ae2ae351ad3646c3191a84966b55dbbfd3` |
+| `d3dx11_43-winecx-11.17-i386.dll` | `dd4dd351f2a5880c9848d5ccf4944a0b5e7622bb7fb196544115b1f9c92d749c` |
+| `d3dx11_42-winecx-11.17.dll` | `3d97e1de9000a78e27eb5c90d0ab9b36d54fd350760063da27226d22c90c8e1b` |
+| `d3dx11_42-winecx-11.17-i386.dll` | `85075f8b4f30f1a993238a0d6ab772a3a3df6c031e87ee9401c4367a527cd57c` |
4.5.125 (`winecx-11.15`):