Skip to content

Run Windows games on Apple Silicon — free, open source, with an open compatibility database that tells you what actually works.

tsshim: export with Microsoft's d3d12 ordinals (D3D12CreateDevice at 101) so ordinal-bound games load through the shim; probe checks it (highball-db#53)

Gauthier Piarrette293a3834a730
diff --git a/spike/tsshim/d3d12.def b/spike/tsshim/d3d12.def
index dd3032c..4ed3af5 100644
--- a/spike/tsshim/d3d12.def
+++ b/spike/tsshim/d3d12.def
@@ -1,13 +1,13 @@
LIBRARY d3d12.dll
EXPORTS
- D3D12CoreCreateLayeredDevice
- D3D12CoreGetLayeredDeviceSize
- D3D12CoreRegisterLayers
- D3D12CreateDevice
- D3D12CreateRootSignatureDeserializer
- D3D12CreateVersionedRootSignatureDeserializer
- D3D12EnableExperimentalFeatures
- D3D12GetDebugInterface
- D3D12SerializeRootSignature
- D3D12SerializeVersionedRootSignature
- GetBehaviorValue
+ GetBehaviorValue @100
+ D3D12CreateDevice @101
+ D3D12GetDebugInterface @102
+ D3D12CoreCreateLayeredDevice @103
+ D3D12CoreGetLayeredDeviceSize @104
+ D3D12CoreRegisterLayers @105
+ D3D12CreateRootSignatureDeserializer @106
+ D3D12CreateVersionedRootSignatureDeserializer @107
+ D3D12EnableExperimentalFeatures @108
+ D3D12SerializeRootSignature @109
+ D3D12SerializeVersionedRootSignature @110
diff --git a/spike/tsshim/probe.c b/spike/tsshim/probe.c
index 81749c9..32c8f76 100644
--- a/spike/tsshim/probe.c
+++ b/spike/tsshim/probe.c
@@ -25,6 +25,12 @@ int main(void) {
if (real) { GetModuleFileNameA(real, path, sizeof path); say(" shim active, real: %s", path); }
else say(" no apd12.dll in the process (shim absent or idle)");
+ // Some engines bind d3d12 imports by ordinal, Microsoft's numbering (D3D12CreateDevice is 101,
+ // which Apple's D3DMetal mirrors). A DLL in front that numbers from 1 breaks their delay-load
+ // with 0xc06d007f (Path of Exile 2, highball-db#53).
+ say(" GetProcAddress by ordinal 101: %s, by ordinal 100: %s",
+ GetProcAddress(m, MAKEINTRESOURCEA(101)) == GetProcAddress(m, "D3D12CreateDevice") && GetProcAddress(m, "D3D12CreateDevice") ? "D3D12CreateDevice, correct" : "NOT D3D12CreateDevice (ordinal-bound games fail here)",
+ GetProcAddress(m, MAKEINTRESOURCEA(100)) == GetProcAddress(m, "GetBehaviorValue") && GetProcAddress(m, "GetBehaviorValue") ? "GetBehaviorValue, correct" : "wrong");
typedef HRESULT (WINAPI *create_t)(IUnknown *, D3D_FEATURE_LEVEL, REFIID, void **);
create_t create = (create_t)GetProcAddress(m, "D3D12CreateDevice");
if (!create) { say(" no D3D12CreateDevice export, error %lu", GetLastError()); return 2; }