aboutsummaryrefslogtreecommitdiff
path: root/primedev/client
diff options
context:
space:
mode:
authorJack <66967891+ASpoonPlaysGames@users.noreply.github.com>2024-08-30 08:00:55 +0100
committerGitHub <noreply@github.com>2024-08-30 09:00:55 +0200
commitdb353e683777e698fb8445354d17becd50e5c379 (patch)
tree0a09aeb4271fa354263dfb05d54d6b871159e413 /primedev/client
parent46478a36afd0ce85eecf80caafb8092fa4cff62e (diff)
downloadNorthstarLauncher-db353e683777e698fb8445354d17becd50e5c379.tar.gz
NorthstarLauncher-db353e683777e698fb8445354d17becd50e5c379.zip
client: Remove uses of Autohook from `rejectconnectionfixes.cpp` (#793)
Removes AUTOHOOK macro from `rejectconnectionfixes.cpp`.
Diffstat (limited to 'primedev/client')
-rw-r--r--primedev/client/rejectconnectionfixes.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/primedev/client/rejectconnectionfixes.cpp b/primedev/client/rejectconnectionfixes.cpp
index 1b326a3c..adfd772c 100644
--- a/primedev/client/rejectconnectionfixes.cpp
+++ b/primedev/client/rejectconnectionfixes.cpp
@@ -1,12 +1,8 @@
#include "engine/r2engine.h"
-AUTOHOOK_INIT()
-
// this is called from when our connection is rejected, this is the only case we're hooking this for
-// clang-format off
-AUTOHOOK(COM_ExplainDisconnection, engine.dll + 0x1342F0,
-void,, (bool a1, const char* fmt, ...))
-// clang-format on
+static void (*o_pCOM_ExplainDisconnection)(bool a1, const char* fmt, ...) = nullptr;
+static void h_COM_ExplainDisconnection(bool a1, const char* fmt, ...)
{
va_list va;
va_start(va, fmt);
@@ -25,10 +21,11 @@ void,, (bool a1, const char* fmt, ...))
Cbuf_AddText(Cbuf_GetCurrentPlayer(), "disconnect", cmd_source_t::kCommandSrcCode);
}
- return COM_ExplainDisconnection(a1, "%s", buf);
+ return o_pCOM_ExplainDisconnection(a1, "%s", buf);
}
ON_DLL_LOAD_CLIENT("engine.dll", RejectConnectionFixes, (CModule module))
{
- AUTOHOOK_DISPATCH()
+ o_pCOM_ExplainDisconnection = module.Offset(0x1342F0).RCast<decltype(o_pCOM_ExplainDisconnection)>();
+ HookAttach(&(PVOID&)o_pCOM_ExplainDisconnection, (PVOID)h_COM_ExplainDisconnection);
}