From a1385f0a3347e0e1509a2a2211b6e4bb459ed0cb Mon Sep 17 00:00:00 2001 From: RektInator Date: Tue, 25 Dec 2018 22:47:10 +0100 Subject: [PATCH] [Renderer] Enhance material debug information --- src/Components/Modules/Renderer.cpp | 10 ++++++++++ src/Components/Modules/Renderer.hpp | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/Components/Modules/Renderer.cpp b/src/Components/Modules/Renderer.cpp index bc5b3fa9..c5379905 100644 --- a/src/Components/Modules/Renderer.cpp +++ b/src/Components/Modules/Renderer.cpp @@ -160,6 +160,12 @@ namespace Components } } + int Renderer::DrawTechsetForMaterial(int a1, float a2, float a3, const char* material, Game::vec4_t* color, int a6) + { + auto mat = Game::DB_FindXAssetHeader(Game::XAssetType::ASSET_TYPE_MATERIAL, Utils::String::VA("wc/%s", material)).material; + return Utils::Hook::Call(0x005033E0)(a1, a2, a3, Utils::String::VA("%s (^3%s^7)", mat->info.name, mat->techniqueSet->name), color, a6); + } + Renderer::Renderer() { if (Dedicated::IsEnabled()) return; @@ -196,6 +202,10 @@ namespace Components Utils::Hook(0x0054CAAA, Renderer::StoreGfxBufContextPtrStub1, HOOK_JUMP).install()->quick(); Utils::Hook(0x0054CF8D, Renderer::StoreGfxBufContextPtrStub2, HOOK_JUMP).install()->quick(); + // Enhance cg_drawMaterial + Utils::Hook::Set(0x005086DA, "^3solid^7"); + Utils::Hook(0x00580F53, Renderer::DrawTechsetForMaterial, HOOK_CALL).install()->quick(); + // Frame hook Utils::Hook(0x5ACB99, Renderer::FrameStub, HOOK_CALL).install()->quick(); diff --git a/src/Components/Modules/Renderer.hpp b/src/Components/Modules/Renderer.hpp index b9923729..040eb6ba 100644 --- a/src/Components/Modules/Renderer.hpp +++ b/src/Components/Modules/Renderer.hpp @@ -33,6 +33,8 @@ namespace Components static void StoreGfxBufContextPtrStub1(); static void StoreGfxBufContextPtrStub2(); + static int DrawTechsetForMaterial(int a1, float a2, float a3, const char* material, Game::vec4_t* color, int a6); + static Utils::Signal EndRecoverDeviceSignal; static Utils::Signal BeginRecoverDeviceSignal;