From 261fcdaec4467dd4fdde4907cf7863f308ec344d Mon Sep 17 00:00:00 2001 From: Jack <66967891+ASpoonPlaysGames@users.noreply.github.com> Date: Mon, 2 Sep 2024 18:47:38 +0100 Subject: engine: Remove uses of Autohook from `host.cpp` (#802) Removes the AUTOHOOK macro from `host.cpp` and replaces it with HookAttach. --- primedev/engine/host.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'primedev/engine') diff --git a/primedev/engine/host.cpp b/primedev/engine/host.cpp index dacb8fc1..e414908b 100644 --- a/primedev/engine/host.cpp +++ b/primedev/engine/host.cpp @@ -6,15 +6,11 @@ #include "r2engine.h" #include "core/tier0.h" -AUTOHOOK_INIT() - -// clang-format off -AUTOHOOK(Host_Init, engine.dll + 0x155EA0, -void, __fastcall, (bool bDedicated)) -// clang-format on +static void(__fastcall* o_pHost_Init)(bool bDedicated) = nullptr; +static void __fastcall h_Host_Init(bool bDedicated) { spdlog::info("Host_Init()"); - Host_Init(bDedicated); + o_pHost_Init(bDedicated); FixupCvarFlags(); // need to initialise these after host_init since they do stuff to preexisting concommands/convars without being client/server specific InitialiseCommandPrint(); @@ -29,5 +25,6 @@ void, __fastcall, (bool bDedicated)) ON_DLL_LOAD("engine.dll", Host_Init, (CModule module)) { - AUTOHOOK_DISPATCH() + o_pHost_Init = module.Offset(0x155EA0).RCast(); + HookAttach(&(PVOID&)o_pHost_Init, (PVOID)h_Host_Init); } -- cgit v1.2.3