Skip to content

Commit

Permalink
Remove uses of Autohook from gl_matsysiface.cpp (#801)
Browse files Browse the repository at this point in the history
Removes AUTOHOOK macro from gl_matsysiface.cpp and replaces it with HookAttach
  • Loading branch information
ASpoonPlaysGames authored Sep 1, 2024
1 parent f2d07f5 commit 96c34f6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions primedev/engine/gl_matsysiface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

CMaterialGlue* (*GetMaterialAtCrossHair)();

AUTOHOOK_INIT()

AUTOHOOK(CC_mat_crosshair_printmaterial_f, engine.dll + 0xB3C40, void, __fastcall, (const CCommand& args))
static void(__fastcall* o_pCC_mat_crosshair_printmaterial_f)(const CCommand& args) = nullptr;
static void __fastcall h_CC_mat_crosshair_printmaterial_f(const CCommand& args)
{
CMaterialGlue* pMat = GetMaterialAtCrossHair();

Expand Down Expand Up @@ -44,7 +43,8 @@ AUTOHOOK(CC_mat_crosshair_printmaterial_f, engine.dll + 0xB3C40, void, __fastcal

ON_DLL_LOAD("engine.dll", GlMatSysIFace, (CModule module))
{
AUTOHOOK_DISPATCH()
o_pCC_mat_crosshair_printmaterial_f = module.Offset(0xB3C40).RCast<decltype(o_pCC_mat_crosshair_printmaterial_f)>();
HookAttach(&(PVOID&)o_pCC_mat_crosshair_printmaterial_f, (PVOID)h_CC_mat_crosshair_printmaterial_f);

GetMaterialAtCrossHair = module.Offset(0xB37D0).RCast<CMaterialGlue* (*)()>();
}

0 comments on commit 96c34f6

Please sign in to comment.