Here's a step-by-step plan to extract your FH5 livery using a custom DLL approach, given your constraints:
- Reverse Engineering Phase
- Use x64dbg/IDA Pro to analyze FH5's texture loading
- Look for patterns like:
- HTTP requests to Forza's content servers (liveries are streamed)
- DirectX 12 texture creation calls (CreateCommittedResource)
- Texture metadata strings containing "livery" or car model names
- Development Environment Setup
# Required tools
Visual Studio 2022 (with C++ workload)
Windows SDK 10.0.19041+
DirectX SDK (June 2010)
MinHook library (https://github.com/TsudaKaiden/MinHook)
- DLL Main Code Structure
#include <windows.h>
#include <d3d12.h>
#include <dxgi1_4.h>
#include <wrl.h>
#include "MinHook.h"
using namespace Microsoft::WRL;
typedef HRESULT (WINAPI* PresentHook)(IDXGISwapChain3*, UINT, UINT);
PresentHook TruePresent;
// Texture capture variables
ID3D12Device* pDevice = nullptr;
std::vector<ID3D12Resource*> capturedTextures;
// Custom texture filter flags
bool bLiveryMode = true;
std::string targetCar = "CAR_XXX"; // Replace with your car ID
// Texture capture logic
void CaptureTexture(ID3D12Resource* texture) {
// Implement texture analysis here
// Check dimensions/format for livery specs (usually 2048x2048 BC7)
if (bLiveryMode && IsLiveryTexture(texture)) {
SaveDDSTextureToFile(texture, L"livery_dump.dds");
}
}
// D3D12 CreateResource hook
HRESULT (WINAPI* TrueCreateResource)(ID3D12Device*,
const D3D12_RESOURCE_DESC*,
D3D12_RESOURCE_STATES,
const D3D12_CLEAR_VALUE*,
REFIID, void**) = nullptr;
HRESULT WINAPI HookedCreateResource(
ID3D12Device* pDevice,
const D3D12_RESOURCE_DESC* pDesc,
D3D12_RESOURCE_STATES InitialState,
const D3D12_CLEAR_VALUE* pOptimizedClearValue,
REFIID riidResource, void** ppvResource)
{
HRESULT hr = TrueCreateResource(pDevice, pDesc, InitialState,
pOptimizedClearValue, riidResource, ppvResource);
if (SUCCEEDED(hr) && pDesc->Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE2D) {
CaptureTexture(static_cast<ID3D12Resource*>(*ppvResource));
}
return hr;
}
// DLL Entry Point
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
if (ul_reason_for_call == DLL_PROCESS_ATTACH) {
MH_Initialize();
// Hook D3D12CreateDevice first to get device pointer
// Then hook CreateResource/CreateCommittedResource
}
return TRUE;
}
- Texture Analysis Implementation
bool IsLiveryTexture(ID3D12Resource* texture) {
D3D12_RESOURCE_DESC desc = texture->GetDesc();
// Common livery texture dimensions
if (desc.Dimension != D3D12_RESOURCE_DIMENSION_TEXTURE2D ||
desc.Width < 1024 || desc.Width > 8192 ||
desc.Height < 1024 || desc.Height > 8192) {
return false;
}
// Check for BC7 compression (common for FH5 liveries)
if (desc.Format != DXGI_FORMAT_BC7_UNORM &&
desc.Format != DXGI_FORMAT_BC7_UNORM_SRGB) {
return false;
}
// Add memory pattern scanning here for livery-specific signatures
return true;
}
-
Implementation Steps
-
Compile the DLL with debug logging
-
Use a loader like Dll Injector to inject into FH5 process
-
Drive your livery-equipped car through the livery inspection area
-
Monitor output directory for dumped DDS files
-
Convert DDS to PNG using nVidia Texture Tools or Photoshop
-
Alternative Approaches
// Scan for texture signatures in memory
void ScanForLiveryMemory() {
SYSTEM_INFO si;
GetSystemInfo(&si);
BYTE* start = (BYTE*)si.lpMinimumApplicationAddress;
BYTE* end = (BYTE*)si.lpMaximumApplicationAddress;
// Signature pattern for livery metadata
BYTE pattern[] = {0x4C, 0x8B, 0xDC, 0x49, 0x89, 0x5B, 0x08};
for (BYTE* ptr = start; ptr < end; ptr += 0x1000) {
if (memcmp(ptr, pattern, sizeof(pattern)) == 0) {
// Found potential livery memory region
SaveMemoryRegion(ptr, 0x200000, L"livery_mem.bin");
}
}
}
- Post-Processing Tips
- Use libyuv to convert texture formats if needed
- Implement automatic naming based on car ID
- Add ImGui UI for real-time monitoring
- Implement texture filtering by reference string
Important Notes:
- FH5 uses Easy Anti-Cheat - ensure your DLL doesn't trigger detections
- Liveries might be encrypted in memory - check for obfuscation patterns
- You may need to hook additional functions like CreateCommittedResource
- Use GPUView to analyze texture upload timelines
If RenderDoc isn't working:
- Check FH5 launch options for debug flags
- Try Dx12Capture layer:
// Enable D3D12 debug layer
D3D12GetDebugInterface(IID_PPV_ARGS(&debugController));
debugController->EnableDebugLayer();
Remember to:
- Back up your saves before injection
- Test with non-essential cars first
- Clean up hooks properly to avoid crashes
Would you like me to expand on any particular section or provide more specific implementation details?