diff options
Diffstat (limited to 'primedev/client')
-rw-r--r-- | primedev/client/debugoverlay.cpp | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/primedev/client/debugoverlay.cpp b/primedev/client/debugoverlay.cpp index 7f2e0901..9cfc1612 100644 --- a/primedev/client/debugoverlay.cpp +++ b/primedev/client/debugoverlay.cpp @@ -5,8 +5,6 @@ #include "core/math/vector.h" #include "server/ai_helper.h" -AUTOHOOK_INIT() - enum OverlayType_t { OVERLAY_BOX = 0, @@ -122,10 +120,8 @@ OverlayBase_t** s_pOverlays; int* g_nRenderTickCount; int* g_nOverlayTickCount; -// clang-format off -AUTOHOOK(DrawOverlay, engine.dll + 0xABCB0, -void, __fastcall, (OverlayBase_t * pOverlay)) -// clang-format on +static void(__fastcall* o_pDrawOverlay)(OverlayBase_t* pOverlay) = nullptr; +static void __fastcall h_DrawOverlay(OverlayBase_t* pOverlay) { EnterCriticalSection(s_OverlayMutex); @@ -205,10 +201,8 @@ void, __fastcall, (OverlayBase_t * pOverlay)) LeaveCriticalSection(s_OverlayMutex); } -// clang-format off -AUTOHOOK(DrawAllOverlays, engine.dll + 0xAB780, -void, __fastcall, (bool bRender)) -// clang-format on +static void(__fastcall* o_pDrawAllOverlays)(bool bRender) = nullptr; +static void __fastcall h_DrawAllOverlays(bool bRender) { EnterCriticalSection(s_OverlayMutex); @@ -259,10 +253,7 @@ void, __fastcall, (bool bRender)) if (bShouldDraw && bRender && (Cvar_enable_debug_overlays->GetBool() || pCurrOverlay->m_Type == OVERLAY_SMARTAMMO)) { - // call the new function, not the original - // note: if there is a beter way to call the hooked version of an - // autohook func then that would be better than this - __autohookfuncDrawOverlay(pCurrOverlay); + h_DrawOverlay(pCurrOverlay); } pPrevOverlay = pCurrOverlay; @@ -280,7 +271,11 @@ void, __fastcall, (bool bRender)) ON_DLL_LOAD_CLIENT_RELIESON("engine.dll", DebugOverlay, ConVar, (CModule module)) { - AUTOHOOK_DISPATCH() + o_pDrawOverlay = module.Offset(0xABCB0).RCast<decltype(o_pDrawOverlay)>(); + HookAttach(&(PVOID&)o_pDrawOverlay, (PVOID)h_DrawOverlay); + + o_pDrawAllOverlays = module.Offset(0xAB780).RCast<decltype(o_pDrawAllOverlays)>(); + HookAttach(&(PVOID&)o_pDrawAllOverlays, (PVOID)h_DrawAllOverlays); OverlayBase_t__IsDead = module.Offset(0xACAC0).RCast<decltype(OverlayBase_t__IsDead)>(); OverlayBase_t__DestroyOverlay = module.Offset(0xAB680).RCast<decltype(OverlayBase_t__DestroyOverlay)>(); |