Skip to content
TheChatArchiveThe Chat Archive
Geminigemini-2.5-pro· GoogleHugging Face LMArena Human Preference 140K

make a step by step plan for ripping my livery i created in forza horizon 5, i have…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Mistralmistral-medium-2505’s answer.
  1. User

    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.

  2. Gemini Assistant

    Of course. This is a highly advanced and challenging project that sits at the intersection of reverse engineering, graphics programming, and game modding. I will provide a detailed, phased plan for creating a custom DLL to achieve your goal.


    ⚠️ Important Disclaimer & Warning ⚠️

    1. High Risk of Ban: Forza Horizon 5 has a robust anti-cheat system. Injecting custom DLLs, hooking game functions, and reading process memory are all activities that can be flagged. Attempting this on your main account is extremely risky and could lead to a permanent ban. Use a throwaway Xbox/Steam account for all development and testing.
    2. Extreme Difficulty: This is not a beginner or even intermediate project. It requires a strong understanding of C++, the Win32 API, DirectX 12, assembly (for debugging), and reverse engineering principles. The provided code will be a starting point, not a copy-paste solution.
    3. Game Updates Will Break Your Code: Any time Forza Horizon 5 is updated, memory addresses, function signatures, and internal structures can change, which will break your DLL. You will need to re-analyze the game after each patch.
    4. This is for Educational Purposes: The techniques described are for understanding how a modern game engine works.

    How Forza Horizon 5 Likely Handles Liveries

    You are correct that liveries are downloaded from the server. However, they are almost certainly not downloaded as flat texture files (like a .DDS or .PNG).

    Instead, a livery is stored as procedural data. Think of it as a set of instructions:

    • Car Model ID: Which car this livery applies to.
    • Base Paint: Color, material type (matte, metallic, etc.).
    • Vinyl Groups: A list of shapes (vinyls). Each entry in the list contains:
      • Vinyl Shape ID (e.g., square, primitive 10, manufacturer logo 5).
      • Transform Data: Position (X, Y), Scale, Rotation, Skew.
      • Color Data: RGBA value.
      • Layer Order (which vinyl is on top of which).

    When you load the car in-game, the ForzaTech engine reads this procedural data and renders it in real-time onto a texture atlas that corresponds to the car's UV map. This final, rendered texture is what exists in the GPU's VRAM.

    Your Goal: Hook the game's rendering pipeline to intercept this final texture just after it's been rendered but before it's used for the final scene, and then copy it to a file on your disk.


    Phase 1: Reconnaissance and Setup

    This phase is about understanding the target and preparing your tools. Do not skip this.

    Step 1: Confirm the Graphics API

    • Launch Forza Horizon 5.
    • Open Task Manager, go to the "Details" tab, right-click the column headers, "Select columns," and enable "GPU engine."
    • Observe ForzaHorizon5.exe. You will likely see it using "GPU 0 - 3D," which confirms it's a primary 3D application.
    • More definitively, use a tool like Process Explorer (from Sysinternals). Select the game process and look at the loaded DLLs (Ctrl+D). You will see d3d12.dll, dxgi.dll, etc. This confirms it's a DirectX 12 application. Ninja Ripper's success might be due to its D3D12 hooking capabilities, even if they are sometimes unreliable.

    Step 2: Environment Setup

    • IDE: Install Visual Studio 2022 with the "Desktop development with C++" workload.
    • SDK: Ensure you have the latest Windows 11 SDK.
    • Libraries:
      1. MinHook: The gold standard for x86/x64 API hooking in Windows. It's robust and reliable. Download it from GitHub.
      2. DirectXTex: A Microsoft library for reading, writing, and converting DDS, WIC, and TGA texture files. It's perfect for saving the ripped data. You can get it via NuGet in Visual Studio or from GitHub.

    Step 3: Creating a Proxy DLL The safest way to get your code into the game process without an aggressive injection method is by creating a proxy DLL. The game needs to load d3d12.dll, so we'll create our own fake d3d12.dll, place it in the game directory, and have it forward all original calls to the real DLL (which we'll rename).

    1. Navigate to C:\Windows\System32\.
    2. Copy the real d3d12.dll to your project directory and rename it to d3d12_original.dll.
    3. Use a tool like dll-proxy-generator or manually create function forwards for all exports of d3d12.dll. The most important one is D3D12CreateDevice.

    Phase 2: The Plan - Developing the Ripper DLL

    Here, we will build the core logic of the tool.

    Step 1: DLL Entry Point and Hook Initialization

    Your dllmain.cpp will be the entry point. When the game loads our proxy d3d12.dll, the DLL_PROCESS_ATTACH case will be triggered. This is where we initialize MinHook and set up our hooks.

    // dllmain.cpp
    #include <Windows.h>
    #include "MinHook.h"
    
    // Define pointers for the original functions we are going to hook
    // We focus on the command queue, as that's where everything happens in DX12
    typedef void(WINAPI* PFN_ExecuteCommandLists)(ID3D12CommandQueue*, UINT, ID3D12CommandList* const*);
    PFN_ExecuteCommandLists oExecuteCommandLists = nullptr;
    
    // Our hook function
    void WINAPI hkExecuteCommandLists(ID3D12CommandQueue* pQueue, UINT NumCommandLists, ID3D12CommandList* const* ppCommandLists) {
        // This is where our main logic will go!
        // For now, just call the original function
        return oExecuteCommandLists(pQueue, NumCommandLists, ppCommandLists);
    }
    
    // DllMain
    BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
        if (ul_reason_for_call == DLL_PROCESS_ATTACH) {
            DisableThreadLibraryCalls(hModule);
    
            // Initialize MinHook
            if (MH_Initialize() != MH_OK) {
                // Handle error
                return TRUE;
            }
    
            // We need to find the address of ExecuteCommandLists.
            // It's a virtual function, so we can't just GetProcAddress it.
            // We need to create a dummy device and command queue to get its vtable address.
            // This is a common and reliable technique.
            // ... (Code for this is in the next step)
        } else if (ul_reason_for_call == DLL_PROCESS_DETACH) {
            MH_Uninitialize();
        }
        return TRUE;
    }
    

    Step 2: Finding the Target Function Address

    ExecuteCommandLists is a method of the ID3D12CommandQueue interface. It exists in a virtual function table (vtable). We can get its address by creating a temporary, dummy device and queue.

    // Place this inside your DLL_PROCESS_ATTACH block
    // after MH_Initialize()
    
    // Load the real d3d12.dll
    HMODULE hD3D12 = GetModuleHandle(L"d3d12_original.dll");
    if (!hD3D12) {
        hD3D12 = LoadLibrary(L"d3d12_original.dll");
    }
    
    PFN_D3D12_CREATE_DEVICE pD3D12CreateDevice = (PFN_D3D12_CREATE_DEVICE)GetProcAddress(hD3D12, "D3D12CreateDevice");
    
    // Create a dummy device to get the vtable
    ID3D12Device* pDummyDevice = nullptr;
    if (SUCCEEDED(pD3D12CreateDevice(nullptr, D3D_FEATURE_LEVEL_12_0, __uuidof(ID3D12Device), (void**)&pDummyDevice))) {
        D3D12_COMMAND_QUEUE_DESC queueDesc = {};
        queueDesc.Type = D3D12_COMMAND_LIST_TYPE_DIRECT;
        queueDesc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE;
    
        ID3D12CommandQueue* pDummyCommandQueue = nullptr;
        if (SUCCEEDED(pDummyDevice->CreateCommandQueue(&queueDesc, __uuidof(ID3D12CommandQueue), (void**)&pDummyCommandQueue))) {
            // Get the vtable from the dummy queue object
            void** pVTable = *(void***)pDummyCommandQueue;
            
            // The index of ExecuteCommandLists in the vtable is 10 for x64
            // You can find this by looking at d3d12.h or through disassembly
            void* pExecuteCommandLists = pVTable[10];
    
            // Create the hook
            MH_CreateHook(pExecuteCommandLists, &hkExecuteCommandLists, reinterpret_cast<void**>(&oExecuteCommandLists));
            MH_EnableHook(pExecuteCommandLists);
            
            pDummyCommandQueue->Release();
        }
        pDummyDevice->Release();
    }
    

    Step 3: The Core Logic - Finding and Dumping the Texture

    This is the most complex part. Inside hkExecuteCommandLists, we need to analyze the commands being executed to find our target texture and then copy it.

    The Strategy:

    1. Trigger Condition: We don't want to dump textures every frame. We'll use a key press (e.g., the INSERT key) to trigger the dump logic.
    2. Fingerprinting: We can't know the exact resource pointer for the livery. We need to "fingerprint" it. A car livery texture will likely have specific properties:
      • Dimensions: Often a power-of-two square, like 2048x2048 or 4096x4096.
      • Format: Probably a compressed format like DXGI_FORMAT_BC7_UNORM_SRGB.
      • State: It will be transitioned to a D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE.
    3. Dumping: Once we find a likely candidate, we create a "staging" resource (CPU-accessible), copy the GPU texture data to it, map it, and save it.
    // Inside hkExecuteCommandLists
    void WINAPI hkExecuteCommandLists(ID3D12CommandQueue* pQueue, UINT NumCommandLists, ID3D12CommandList* const* ppCommandLists) {
        bool isCaptureKeyPressed = (GetAsyncKeyState(VK_INSERT) & 0x8000);
    
        if (isCaptureKeyPressed && NumCommandLists > 0) {
            // Iterate through the command lists submitted
            for (UINT i = 0; i < NumCommandLists; ++i) {
                ID3D12GraphicsCommandList* pCmdList = (ID3D12GraphicsCommandList*)ppCommandLists[i];
                
                // This is the tricky part: we need to inspect the command list.
                // A full implementation requires a complex command list parser.
                // A simpler (but less reliable) approach is to find resources transitioned
                // to a shader resource state.
                
                // For now, let's assume we have a way to get a list of resources
                // used in this command list. This usually requires deep RE of the engine.
                
                // --- SIMPLIFIED CONCEPT: FINDING THE TEXTURE ---
                // A more practical approach with less RE is to hook CreateCommittedResource
                // and log all textures that match our desired fingerprint (e.g. 2048x2048 BC7)
                // and then dump one of them when the key is pressed.
                
                // Let's assume we have found our target texture resource:
                // ID3D12Resource* pTargetTexture = ...;
    
                // --- THE DUMPING CODE ---
                // (Assuming pTargetTexture is a valid pointer to the livery texture)
                
                ID3D12Device* pDevice;
                pQueue->GetDevice(__uuidof(ID3D12Device), (void**)&pDevice);
    
                D3D12_RESOURCE_DESC textureDesc = pTargetTexture->GetDesc();
                
                // Create a staging resource (CPU-readable)
                D3D12_HEAP_PROPERTIES heapProps;
                heapProps.Type = D3D12_HEAP_TYPE_READBACK;
                heapProps.CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_UNKNOWN;
                heapProps.MemoryPoolPreference = D3D12_MEMORY_POOL_UNKNOWN;
                heapProps.CreationNodeMask = 1;
                heapProps.VisibleNodeMask = 1;
    
                D3D12_RESOURCE_DESC bufferDesc = {};
                // Setup buffer desc for the staging resource
                // ... see DirectXTex documentation for SaveToDDSFile
    
                ID3D12Resource* pStagingTexture = nullptr;
                pDevice->CreateCommittedResource(
                    &heapProps,
                    D3D12_HEAP_FLAG_NONE,
                    &textureDesc, // Use same desc as target
                    D3D12_RESOURCE_STATE_COPY_DEST,
                    nullptr,
                    __uuidof(ID3D12Resource),
                    (void**)&pStagingTexture
                );
    
                if (pStagingTexture) {
                    // We need to issue a copy command. The current command list is likely closed.
                    // We need to create our own command allocator and list.
                    ID3D12CommandAllocator* pCmdAllocator;
                    pDevice->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, __uuidof(ID3D12CommandAllocator), (void**)&pCmdAllocator);
                    
                    ID3D12GraphicsCommandList* pCopyCmdList;
                    pDevice->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, pCmdAllocator, nullptr, __uuidof(ID3D12GraphicsCommandList), (void**)&pCopyCmdList);
    
                    // Command to copy from GPU texture to staging texture
                    pCopyCmdList->CopyResource(pStagingTexture, pTargetTexture);
                    pCopyCmdList->Close();
    
                    // Execute our new command list
                    ID3D12CommandList* ppLists[] = { pCopyCmdList };
                    pQueue->ExecuteCommandLists(1, ppLists);
    
                    // We need to wait for the GPU to finish the copy.
                    // This requires creating a fence.
                    ID3D12Fence* pFence;
                    pDevice->CreateFence(0, D3D12_FENCE_FLAG_NONE, __uuidof(ID3D12Fence), (void**)&pFence);
                    HANDLE hFenceEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
                    UINT64 fenceValue = 1;
    
                    pQueue->Signal(pFence, fenceValue);
                    pFence->SetEventOnCompletion(fenceValue, hFenceEvent);
                    WaitForSingleObject(hFenceEvent, INFINITE);
    
                    // Now the data is on the CPU side, save it using DirectXTex
                    ScratchImage image;
                    CaptureTexture(pStagingTexture, image); // Fictional helper, you'd implement this
                    SaveToDDSFile(image.GetImages(), image.GetImageCount(), image.GetMetadata(), DDS_FLAGS_NONE, L"C:\\temp\\LiveryRip.dds");
    
                    // Cleanup
                    pStagingTexture->Release();
                    pCmdAllocator->Release();
                    pCopyCmdList->Release();
                    pFence->Release();
                    CloseHandle(hFenceEvent);
                }
                pDevice->Release();
            }
        }
    
        // ALWAYS call the original function, or the game will freeze/crash
        return oExecuteCommandLists(pQueue, NumCommandLists, ppCommandLists);
    }
    

    How to find pTargetTexture? This is the real RE challenge. Hooking CreateCommittedResource is your best bet.

    1. Hook ID3D12Device::CreateCommittedResource.
    2. In your hook, check the D3D12_RESOURCE_DESC parameter.
    3. If Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE2D and the width/height/format match your expectations (e.g., 4096x4096, BC7), log the returned ID3D12Resource* pointer to a global list.
    4. In your hkExecuteCommandLists key-press logic, grab the last pointer added to that list and attempt to dump it. This is trial and error. You will dump many textures (UI elements, light maps) before you find the right one.

    Phase 3: Deployment and Execution

    1. Compile: Compile your project as a 64-bit DLL.
    2. Placement:
      • Go to your Forza Horizon 5 installation directory (e.g., ...\Steam\steamapps\common\ForzaHorizon5).
      • Find the original d3d12.dll in C:\Windows\System32\.
      • Copy the original d3d12.dll to the game's root folder and rename it to d3d12_original.dll.
      • Copy your compiled DLL to the game's root folder and name it d3d12.dll.
    3. Launch: Start the game through Steam. If it launches, your proxy is working. If it crashes immediately, there's an error in your proxy setup or initialization.
    4. Test: Go into the game, load your car with the custom livery, enter Forzavista or a solo race, and press the INSERT key. Check your output folder for a .dds file.

    This is a monumental task, but this plan outlines the exact, professional-level steps required to approach it. Good luck.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.