make a step by step plan for ripping my livery i created in forza horizon 5, i have steam version, ninja ripper works fine, special K doesnt have d3d12 texture dump currently, renderdoc doesnt launch, i wanna make a custom dll or something to make it work, make a plan, library usage, how fh5 handles liveries (its downloaded into the memory from internet), send code too.
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Creating a custom DLL to rip liveries from Forza Horizon 5 (Steam version) is a complex task that involves reverse engineering, memory inspection, and potentially hooking into the game's rendering pipeline. Below is a step-by-step plan, including library usage, how liveries are handled, and a basic code example for a custom DLL.
Step-by-Step Plan
1. Understand How Liveries Work in FH5
Liveries are downloaded from the internet and stored in memory as textures.
The game likely uses DirectX 12 (D3D12) for rendering.
Liveries are applied to car models dynamically, meaning textures are loaded into GPU memory.
The game may use a custom format or standard formats like .dds (DirectDraw Surface).
2. Tools & Libraries Needed
NinjaRipper (already working for you) – Can dump some textures but may miss dynamic ones.
RenderDoc (not launching for you) – Normally useful for capturing frames and inspecting textures.
Special K (no D3D12 texture dump yet) – Could be useful if updated.
Cheat Engine – For memory inspection and finding texture pointers.
Visual Studio – For compiling a custom DLL.
Detours / MinHook – For hooking DirectX functions.
DirectX 12 SDK – For interacting with D3D12.
D3D12 Memory Inspection Tools – To find texture resources.
3. Approach for Custom DLL
Since RenderDoc isn’t working and Special K lacks D3D12 support, we’ll create a custom DLL that hooks into D3D12 to dump textures.
Steps:
Find the D3D12 Device and Command Queue
The game initializes a ID3D12Device and ID3D12CommandQueue.
We need to hook into these to intercept texture uploads.
Hook ID3D12Device::CreateCommittedResource
This function is called when the game creates textures.
We can log or dump textures when they are created.
Dump Textures to Disk
When a texture is created, we can save it as a .dds file.
Inject the DLL into FH5
Use a DLL injector (e.g., Extreme Injector) to load your custom DLL.
Code Example: Basic D3D12 Texture Dump DLL
Below is a simplified example using MinHook to intercept CreateCommittedResource.
1. Required Libraries
MinHook (for hooking)
DirectX 12 SDK (for D3D12 functions)
Windows SDK (for basic Windows functions)
2. Code
cpp
#include <Windows.h>
#include <d3d12.h>
#include <minhook/MinHook.h>
#include <fstream>
#include <vector>
// Function pointer for the original CreateCommittedResource
typedef HRESULT(WINAPI* D3D12CreateCommittedResource_t)(
ID3D12Device* pDevice,
const D3D12_HEAP_PROPERTIES* pHeapProperties,
D3D12_HEAP_FLAGS HeapFlags,
const D3D12_RESOURCE_DESC* pDesc,
D3D12_RESOURCE_STATES InitialResourceState,
const D3D12_CLEAR_VALUE* pOptimizedClearValue,
REFIID riidResource,
void** ppvResource
);
D3D12CreateCommittedResource_t OriginalCreateCommittedResource = nullptr;
// Our hooked function
HRESULT WINAPI HookedCreateCommittedResource(
ID3D12Device* pDevice,
const D3D12_HEAP_PROPERTIES* pHeapProperties,
D3D12_HEAP_FLAGS HeapFlags,
const D3D12_RESOURCE_DESC* pDesc,
D3D12_RESOURCE_STATES InitialResourceState,
const D3D12_CLEAR_VALUE* pOptimizedClearValue,
REFIID riidResource,
void** ppvResource
) {
// Call the original function first
HRESULT result = OriginalCreateCommittedResource(
pDevice,
pHeapProperties,
HeapFlags,
pDesc,
InitialResourceState,
pOptimizedClearValue,
riidResource,
ppvResource
);
// Check if this is a texture resource
if (pDesc->Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE2D) {
// Dump the texture (simplified example)
ID3D12Resource* pResource = static_cast<ID3D12Resource*>(*ppvResource);
// Here, you would need to map the resource and save it as a DDS file.
// This is a placeholder for actual texture dumping logic.
OutputDebugStringA("Texture created! (This is where you'd dump it)\n");
}
return result;
}
// DLL Entry Point
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
if (ul_reason_for_call == DLL_PROCESS_ATTACH) {
// Initialize MinHook
MH_Initialize();
// Get the D3D12 device (this is a simplified example; you may need to find it dynamically)
ID3D12Device* pDevice = nullptr; // You need to find this in memory
if (pDevice) {
// Hook CreateCommittedResource
MH_CreateHook(
&ID3D12Device::CreateCommittedResource,
&HookedCreateCommittedResource,
reinterpret_cast<void**>(&OriginalCreateCommittedResource)
);
MH_EnableHook(&ID3D12Device::CreateCommittedResource);
}
}
else if (ul_reason_for_call == DLL_PROCESS_DETACH) {
// Cleanup
MH_DisableHook(&ID3D12Device::CreateCommittedResource);
MH_Uninitialize();
}
return TRUE;
}
3. Compile & Inject
Compile the DLL in Visual Studio (x64 Release mode).
Use Extreme Injector or similar to inject the DLL into ForzaHorizon5.exe.
Alternative Approach: Memory Scanning
If hooking D3D12 is too complex, you can try:
Using Cheat Engine to find texture pointers in memory.
Dumping memory regions where liveries are stored.
Analyzing the game’s network traffic to see if liveries are downloaded in a readable format.
Final Notes
This is a simplified example. Real-world implementation requires deeper reverse engineering.
Anti-cheat systems (like EAC) may detect DLL injection, so proceed with caution.
Texture dumping requires additional code to properly save .dds files from GPU memory.
Would you like a more detailed breakdown of any specific part?