Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove uses of Autohook from host.cpp #802

Merged
merged 2 commits into from
Sep 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions primedev/engine/host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
}
Loading