aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/clientchathooks.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'NorthstarDedicatedTest/clientchathooks.cpp')
-rw-r--r--NorthstarDedicatedTest/clientchathooks.cpp21
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);