How bo3b/3dmigoto works
Purpose and runtime
3Dmigoto is a native Windows Direct3D interception/modding system, originally for stereoscopic-effect fixes and now general DX11 game modding. It is built as a Visual Studio C++ solution (StereovisionHacks.sln) and deployed beside a target game as replacement/wrapper DLLs plus d3dx.ini and ShaderFixes. Primary runtime targets are injected/loaded D3D9, D3D10, D3D11, DXGI, D3DCompiler, and NVAPI DLL facades.
DLL entry and API interception
Versioned wrapper projects expose expected Direct3D compiler/API DLL exports and forward or intercept calls:
• DirectX11/DLLMainHook.cpp, DirectX11/D3D11Wrapper.cpp, DirectX11/d3d11Wrapper.def
• DirectX9/d3d9Wrapper.cpp, DirectX9/DLLMainHookDX9.cpp
• DirectX10/d3d10Wrapper.cpp, DirectXGI/DXGIWrapper.cpp
For D3DCompiler variants, thin DLL projects (D3DCompiler_39/Main.h, D3DCompiler_43/Main.h) use shared wrapping logic in D3DCompiler/d3dcWrapper.cpp. This boundary receives game API calls and establishes interception before calls reach the real graphics runtime.
D3D device/context proxy layer
The central DX11 path wraps DXGI, devices, and immediate/deferred contexts, allowing calls and COM objects to be observed or replaced:
• DirectX11/HackerDXGI.cpp, DirectX11/HackerDevice.cpp, DirectX11/HackerContext.cpp
• DirectX11/HookedDXGI.cpp, DirectX11/HookedDevice.cpp, DirectX11/HookedContext.cpp
The analogous DX9 layer consists of hook/proxy implementations for the D3D object, device, swap chain, resources, and shaders, such as DirectX9/HookedD9.cpp, DirectX9/HookedDeviceDX9.cpp, and DirectX9/HookedSwapChain.cpp. The key control flow is game render call → wrapper/proxy → analysis, matching, override logic → underlying Direct3D call.
Render inspection, hunting, and overrides
Per-API “hunting” and frame-analysis components identify draw calls/resources and support capture or diagnosis:
• DirectX11/Hunting.cpp, DirectX11/FrameAnalysis.cpp, DirectX11/DrawCallInfo.h
• DirectX9/Hunting.cpp, DirectX9/FrameAnalysis.cpp, DirectX9/DrawCallInfo.h
Override components apply configured changes to rendering state and resources:
• DirectX11/Override.cpp, DirectX11/ResourceHash.cpp, DirectX11/ShaderRegex.cpp
• DirectX9/Override.cpp, DirectX9/ResourceHash.cpp, DirectX9/ShaderRegex.cpp
Hashes and optional shader-regex matching form the selection boundary between intercepted game assets and user-authored replacements.
Shader pipeline
The repository can decode DirectX shader bytecode, extract reflection/signatures, decompile to HLSL, and assemble shaders:
• BinaryDecompiler/decode.cpp, BinaryDecompiler/reflect.cpp, BinaryDecompiler/include/hlslcc.h
• HLSLDecompiler/DecompileHLSL.cpp, HLSLDecompiler/cmd_Decompiler/cmd_Decompiler.cpp
• D3D_Shaders/Assembler.cpp, D3D_Shaders/SignatureParser.cpp
Runtime interception can dump/identify shaders, while replacement shader sources in deployment directories are compiled/consumed to alter selected draw behavior. TestShaders holds broad bytecode/HLSL compatibility fixtures and real-game examples.
User interaction and presentation
In-process input, overlay, cursor, and command-list subsystems provide runtime controls and visual feedback:
• DirectX11/input.cpp, DirectX11/Overlay.cpp, DirectX11/CommandList.cpp
• DirectX9/Input.cpp, DirectX9/Overlay.cpp, DirectX9/CommandList.cpp
These operate inside the hooked game render loop rather than as a separate application.
External integrations and dependencies
The code targets Windows desktop, DirectX 9–11/DXGI, MSVC C++14-era projects, and NVIDIA driver/stereo APIs. NVAPI is wrapped by NVAPI/DllMain.cpp and used by DX paths including DirectX11/nvprofile.cpp; headers/libs are vendored under ThirdPartyLibs/nvapi-lib. Other material bundled dependencies are Nektra hooking (ThirdPartyLibs/Nektra-lib/NktHookLib.h), DirectXTK for graphics/UI support, PCRE2 for regex matching, and hardware CRC32C (crc32c-hw-1.0.5/src/crc32c.cpp).
Main entry points: HookedContext.cpp DX11 device/context proxies · HookedDeviceDX9.cpp DX9 device proxies · Override.cpp Render overrides · D3D11Wrapper.cpp DX11 DLL facade
Components 18
Injection & DLL facades
Replacement DLLs loaded by the target game.
- DX11 DLL facade · Exports D3D11 entry points and establishes hooks.
DirectX11/D3D11Wrapper.cpp - DX9 DLL facade · Exports and intercepts D3D9 calls.
DirectX9/d3d9Wrapper.cpp - DX10/DXGI facades · Intercept DirectX 10 and DXGI API boundaries.
DirectX10/d3d10Wrapper.cpp - D3DCompiler facades · Versioned compiler DLLs share interception logic.
D3DCompiler/d3dcWrapper.cpp
Hooked render runtime
In-process interception, inspection, and render changes.
- DX11 device/context proxies · Wraps DXGI, devices, and immediate or deferred contexts.
DirectX11/HookedContext.cpp - DX9 device proxies · Wraps D3D objects, devices, swap chains, resources, and shaders.
DirectX9/HookedDeviceDX9.cpp - Hunting & frame analysis · Identifies draw calls and supports capture and diagnosis.
DirectX11/FrameAnalysis.cpp - Render overrides · Changes selected rendering state and resources.
DirectX11/Override.cpp - Hash & regex matching · Matches intercepted resources and shaders to configured replacements.
DirectX11/ResourceHash.cpp - Overlay, input & commands · Provides runtime controls and visual feedback in the render loop.
DirectX11/Overlay.cpp
Shader tooling
Shader decoding, decompilation, and assembly pipeline.
- Bytecode decode & reflection · Extracts shader structure, reflection, and signatures.
BinaryDecompiler/decode.cpp - HLSL decompiler · Converts decoded shaders to HLSL.
HLSLDecompiler/DecompileHLSL.cpp - Shader assembler · Assembles shaders and parses signatures.
D3D_Shaders/Assembler.cpp
External integrations
- NVAPI wrapper · Connects runtime paths to NVIDIA driver and stereo APIs.
NVAPI/DllMain.cpp - Nektra hook library · Provides low-level API hooking support.
ThirdPartyLibs/Nektra-lib/NktHookLib.h
Other components
- Target game · Loads deployed replacement DLLs.
- ShaderFixes · User-authored replacement shaders consumed at runtime.
- Real Direct3D runtime · Underlying D3D9–11 and DXGI implementation.
Connections 24
- Target game → DX11 DLL facade: loads
- Target game → DX9 DLL facade: loads
- Target game → DX10/DXGI facades: loads
- Target game → D3DCompiler facades: loads
- DX11 DLL facade → DX11 device/context proxies: creates proxies
- DX10/DXGI facades → DX11 device/context proxies: hooks DXGI path
- DX9 DLL facade → DX9 device proxies: creates proxies
- DX11 device/context proxies → Hunting & frame analysis: observes draw calls
- DX9 device proxies → Hunting & frame analysis: observes draw calls
- Hunting & frame analysis → Hash & regex matching: identifies assets
- Hash & regex matching → Render overrides: selects changes
- ShaderFixes → Render overrides: provides replacements
- Render overrides → DX11 device/context proxies: alters DX11 calls
- Render overrides → DX9 device proxies: alters DX9 calls
- DX11 device/context proxies → Overlay, input & commands: drives render-loop UI
- DX11 device/context proxies → Real Direct3D runtime: forwards calls
- DX9 device proxies → Real Direct3D runtime: forwards calls
- D3DCompiler facades → Bytecode decode & reflection: captures bytecode
- Bytecode decode & reflection → HLSL decompiler: decoded shader data
- Bytecode decode & reflection → Shader assembler: signatures
- HLSL decompiler → ShaderFixes: produces editable HLSL
- Shader assembler → ShaderFixes: produces replacement bytecode
- DX11 device/context proxies → NVAPI wrapper: uses driver APIs
- DX11 DLL facade → Nektra hook library: uses hooks