diff options
author | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2022-05-26 03:16:46 +0100 |
---|---|---|
committer | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2022-05-26 03:16:46 +0100 |
commit | cc7b0ded08e3dc26fc970169a79c74c54e4f923b (patch) | |
tree | 6de8896695ab89534adaa912b9fdfac9d6bf396c /NorthstarDedicatedTest/clientchathooks.cpp | |
parent | 93d540dd37298b9e9a6c1f07b5c4a8dc46a2787d (diff) | |
download | NorthstarLauncher-cc7b0ded08e3dc26fc970169a79c74c54e4f923b.tar.gz NorthstarLauncher-cc7b0ded08e3dc26fc970169a79c74c54e4f923b.zip |
lots of cleanup and starting moving to new hooking macros
Diffstat (limited to 'NorthstarDedicatedTest/clientchathooks.cpp')
-rw-r--r-- | NorthstarDedicatedTest/clientchathooks.cpp | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/NorthstarDedicatedTest/clientchathooks.cpp b/NorthstarDedicatedTest/clientchathooks.cpp index a5daa2be..f778c6ee 100644 --- a/NorthstarDedicatedTest/clientchathooks.cpp +++ b/NorthstarDedicatedTest/clientchathooks.cpp @@ -1,20 +1,14 @@ #include "pch.h" -#include "hooks.h" -#include <rapidjson/document.h> #include "squirrel.h" #include "serverchathooks.h" #include "localchatwriter.h" -struct ChatTags -{ - bool whisper; - bool team; - bool dead; -}; +#include <rapidjson/document.h> -typedef void(__fastcall* CHudChat__AddGameLineType)(void* self, const char* message, int fromPlayerId, bool isteam, bool isdead); -CHudChat__AddGameLineType CHudChat__AddGameLine; -static void CHudChat__AddGameLineHook(void* self, const char* message, int inboxId, bool isTeam, bool isDead) +AUTOHOOK_INIT() + +AUTOHOOK(CHudChat__AddGameLine, client.dll + 0x22E580, +void,, (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) @@ -51,7 +45,7 @@ static void CHudChat__AddGameLineHook(void* self, const char* message, int inbox CHudChat__AddGameLine(hud, message, inboxId, isTeam, isDead); } } -} +}) // void NSChatWrite( int context, string str ) static SQRESULT SQ_ChatWrite(void* sqvm) @@ -85,8 +79,7 @@ static SQRESULT SQ_ChatWriteLine(void* sqvm) ON_DLL_LOAD_CLIENT_RELIESON("client.dll", ClientChatHooks, ClientSquirrel, [](HMODULE baseAddress) { - HookEnabler hook; - ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x22E580, &CHudChat__AddGameLineHook, reinterpret_cast<LPVOID*>(&CHudChat__AddGameLine)); + AUTOHOOK_DISPATCH() g_pClientSquirrel->AddFuncRegistration("void", "NSChatWrite", "int context, string text", "", SQ_ChatWrite); g_pClientSquirrel->AddFuncRegistration("void", "NSChatWriteRaw", "int context, string text", "", SQ_ChatWriteRaw); |