How riccochicco/ninjaripper works
Project Type and Purpose
• Ninja Ripper is a native, desktop C++ utility for extracting (“ripping”) 3D meshes, textures, and shaders from running DirectX games.
• It consists of two main user‐facing parts:
• Ripper GUI (Windows executable) that launches or injects into a DirectX8/9/11 game and configures ripping modes.
• 3ds Max Importer (MaxScript) that reads the .rip output files and reconstructs models inside 3ds Max.
High-Level File Structure Analysis
• Top-level:
• Common – shared C++ headers/registry handling.
• DXSDK – bundled DirectX headers & libs for DX7/8/9/11 build targets.
• MaxScript – importer script (.ms) for 3ds Max.
• Tools/D3DWrapper – source for wrapper DLL that replaces d3d9.dll/d3d11.dll.
• injector – standalone injector tool to load intruder.dll into any running process.
• README.md – describes features and usage.
Insights from README
• Describes three modes:
• “No Wrapper” – GUI launches game with intruder.dll loaded via standard Windows DLL search.
• “D3DX Wrapper” – GUI copies a proxy d3d#.dll into game folder; when game loads DirectX it loads this wrapper, which in turn loads intruder.dll.
• “Injector” – a separate EXE that injects intruder.dll into an already‐running process.
• Output (.rip, texture files, shaders) go into user‐specified folder.
• Importer for 3ds Max reads .rip files, reconstructs geometry and UVs.
Main Components
a. Ripper GUI
– Windows Forms or MFC app
– Reads/Writes registry for config
– Presents UI fields (Exe path, Args, Wrapper mode, Output dir)
– Launches game process or copies wrapper DLL or launches injector
b. Wrapper DLL (d3d8.dll / d3d9.dll / d3d11.dll)
– Placed next to game .exe
– Acts as proxy: loads real DirectX, loads intruder.dll
c. Injector Tool
– Standalone EXE that injects intruder.dll into any process via CreateRemoteThread or similar
d. Intruder DLL
– Entry point: DllMain initializes hooking manager (Common/KHookMgr)
– Per-API submodules (intruder/dx8, intruder/dx9, intruder/dx11) hook key D3D functions (e.g., IDirect3DDevice9::DrawIndexedPrimitive)
– Capture calls: extract vertex buffers, index buffers, texture & shader data
– Save extracted data to disk (.rip, texture files)
e. Output Directory
– Receives .rip container files plus auxiliary textures/shaders
f. 3ds Max Importer (MaxScript)
– Reads .rip files, parses embedded binary data, rebuilds mesh, UVs, optionally weights
– Runs inside 3ds Max as a script plugin
Relationships and Data Flows
• User starts Ripper GUI → selects DirectX mode → GUI writes config to registry
• GUI either:
1. Launches game with intruder.dll in PATH (“No Wrapper” mode),
2. Copies wrapper DLL to game folder then closes (“Wrapper” mode),
3. Or launches injector tool to attach intruder.dll to a running process.
• Game process loads wrapper or intruder.dll → intruder hooks D3D API
• During rendering, hooked D3D calls trigger extraction routines
• Extracted data flows to file system → .rip + textures/shaders
• User switches to 3ds Max → runs MaxScript importer → reads .rip → creates scene graph & meshes
Architectural Patterns & Principles
• Plugin/Hooking Pattern: intruder.dll plugins into host via shared hooking manager.
• Proxy/Wrapping: wrapper DLL forwards all calls to real D3D DLL after hooking.
• Modular Subsystems: separate code for DX8/DX9/DX11 to isolate API‐specific logic.
• Shared Utility Layer: Common directory handles registry, logging, hook management.
Key Technologies & Frameworks
• C++ / Win32 / Visual Studio solution and project files (.sln, .vcxproj).
• DirectX SDK 7, 8, 9, 11 headers/libs.
• Windows registry API for config storage.
• CreateRemoteThread or Detours‐style inline hooking techniques.
• MaxScript for 3ds Max importer.