aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/hooks.cpp
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2022-03-18 09:37:03 +0000
committerGitHub <noreply@github.com>2022-03-18 09:37:03 +0000
commit92f77b231ac324cc1326bef31251fc6b86df1f3b (patch)
tree1d5a2843af2db31305a96c194e8b21280dccd340 /NorthstarDedicatedTest/hooks.cpp
parent50e69bde548c5a1af3385f0eff6aa14c088c21c5 (diff)
downloadNorthstarLauncher-92f77b231ac324cc1326bef31251fc6b86df1f3b.tar.gz
NorthstarLauncher-92f77b231ac324cc1326bef31251fc6b86df1f3b.zip
refactor dll load callbacks to lower number of dedicated.h includes (#109)
Diffstat (limited to 'NorthstarDedicatedTest/hooks.cpp')
-rw-r--r--NorthstarDedicatedTest/hooks.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/NorthstarDedicatedTest/hooks.cpp b/NorthstarDedicatedTest/hooks.cpp
index f44f1745..4c403872 100644
--- a/NorthstarDedicatedTest/hooks.cpp
+++ b/NorthstarDedicatedTest/hooks.cpp
@@ -2,6 +2,7 @@
#include "hooks.h"
#include "hookutils.h"
#include "sigscanning.h"
+#include "dedicated.h"
#include <wchar.h>
#include <iostream>
@@ -128,6 +129,32 @@ void AddDllLoadCallback(std::string dll, DllLoadCallbackFuncType callback)
dllLoadCallbacks.push_back(callbackStruct);
}
+void AddDllLoadCallbackForDedicatedServer(std::string dll, DllLoadCallbackFuncType callback)
+{
+ if (!IsDedicated())
+ return;
+
+ DllLoadCallback* callbackStruct = new DllLoadCallback;
+ callbackStruct->dll = dll;
+ callbackStruct->callback = callback;
+ callbackStruct->called = false;
+
+ dllLoadCallbacks.push_back(callbackStruct);
+}
+
+void AddDllLoadCallbackForClient(std::string dll, DllLoadCallbackFuncType callback)
+{
+ if (IsDedicated())
+ return;
+
+ DllLoadCallback* callbackStruct = new DllLoadCallback;
+ callbackStruct->dll = dll;
+ callbackStruct->callback = callback;
+ callbackStruct->called = false;
+
+ dllLoadCallbacks.push_back(callbackStruct);
+}
+
void CallLoadLibraryACallbacks(LPCSTR lpLibFileName, HMODULE moduleAddress)
{
for (auto& callbackStruct : dllLoadCallbacks)