diff options
author | GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> | 2024-11-12 17:11:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-12 17:11:31 +0100 |
commit | 6509283abd620038bf48f0d90ba23b8fa17feec7 (patch) | |
tree | a4186aef12d8c44e3bc71868f2e1556068e4a6dd /primedev/scripts/client/clientchathooks.cpp | |
parent | a4b09bc42d5f79ef86697c893efc9e3b7d966502 (diff) | |
parent | 13344f3910befa2cd15bfd306ba2c5e42e6c80ec (diff) | |
download | NorthstarLauncher-6509283abd620038bf48f0d90ba23b8fa17feec7.tar.gz NorthstarLauncher-6509283abd620038bf48f0d90ba23b8fa17feec7.zip |
Merge branch 'main' into feat/overhaul-mod-loading-locationsfeat/overhaul-mod-loading-locations
Diffstat (limited to 'primedev/scripts/client/clientchathooks.cpp')
-rw-r--r-- | primedev/scripts/client/clientchathooks.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/primedev/scripts/client/clientchathooks.cpp b/primedev/scripts/client/clientchathooks.cpp index e084f47e..c0a06dd2 100644 --- a/primedev/scripts/client/clientchathooks.cpp +++ b/primedev/scripts/client/clientchathooks.cpp @@ -6,12 +6,8 @@ #include <rapidjson/document.h> -AUTOHOOK_INIT() - -// clang-format off -AUTOHOOK(CHudChat__AddGameLine, client.dll + 0x22E580, -void, __fastcall, (void* self, const char* message, int inboxId, bool isTeam, bool isDead)) -// clang-format on +static void(__fastcall* o_pCHudChat__AddGameLine)(void* self, const char* message, int inboxId, bool isTeam, bool isDead) = nullptr; +static void __fastcall h_CHudChat__AddGameLine(void* self, const char* message, int inboxId, bool isTeam, bool isDead) { // This hook is called for each HUD, but we only want our logic to run once. if (self != *CHudChat::allHuds) @@ -36,7 +32,7 @@ void, __fastcall, (void* self, const char* message, int inboxId, bool isTeam, bo "CHudChat_ProcessMessageStartThread", static_cast<int>(senderId) - 1, payload, isTeam, isDead, type); if (result == SQRESULT_ERROR) for (CHudChat* hud = *CHudChat::allHuds; hud != NULL; hud = hud->next) - CHudChat__AddGameLine(hud, message, inboxId, isTeam, isDead); + o_pCHudChat__AddGameLine(hud, message, inboxId, isTeam, isDead); } ADD_SQFUNC("void", NSChatWrite, "int context, string text", "", ScriptContext::CLIENT) @@ -68,5 +64,6 @@ ADD_SQFUNC("void", NSChatWriteLine, "int context, string text", "", ScriptContex ON_DLL_LOAD_CLIENT("client.dll", ClientChatHooks, (CModule module)) { - AUTOHOOK_DISPATCH() + o_pCHudChat__AddGameLine = module.Offset(0x22E580).RCast<decltype(o_pCHudChat__AddGameLine)>(); + HookAttach(&(PVOID&)o_pCHudChat__AddGameLine, (PVOID)h_CHudChat__AddGameLine); } |