aboutsummaryrefslogtreecommitdiff
path: root/primedev/engine/host.cpp
diff options
context:
space:
mode:
authorJack <66967891+ASpoonPlaysGames@users.noreply.github.com>2024-09-02 18:47:38 +0100
committerGitHub <noreply@github.com>2024-09-02 19:47:38 +0200
commit261fcdaec4467dd4fdde4907cf7863f308ec344d (patch)
treeccb96e56c3884a89fb4b336a824b53f3acce7d96 /primedev/engine/host.cpp
parentce21abe9c4c58d7c7d986fb01824ab107081ad2f (diff)
downloadNorthstarLauncher-261fcdaec4467dd4fdde4907cf7863f308ec344d.tar.gz
NorthstarLauncher-261fcdaec4467dd4fdde4907cf7863f308ec344d.zip
engine: Remove uses of Autohook from `host.cpp` (#802)v1.27.7-rc1
Removes the AUTOHOOK macro from `host.cpp` and replaces it with HookAttach.
Diffstat (limited to 'primedev/engine/host.cpp')
-rw-r--r--primedev/engine/host.cpp13
1 files changed, 5 insertions, 8 deletions
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<decltype(o_pHost_Init)>();
+ HookAttach(&(PVOID&)o_pHost_Init, (PVOID)h_Host_Init);
}