diff options
author | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2022-08-24 00:32:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-24 00:32:31 +0100 |
commit | f9bc3c9d1834cb8bd5f872b749b057c33e8b0102 (patch) | |
tree | e96e2da0d95798dd42eddf644a82a74555db858f /NorthstarDedicatedTest/sourceinterface.cpp | |
parent | 812893d8219daa60f5b5b7fd22cbd6b175603399 (diff) | |
download | NorthstarLauncher-f9bc3c9d1834cb8bd5f872b749b057c33e8b0102.tar.gz NorthstarLauncher-f9bc3c9d1834cb8bd5f872b749b057c33e8b0102.zip |
Adjust folder structure (#242)
* Adjust folder structure
* change launcher directory name
Diffstat (limited to 'NorthstarDedicatedTest/sourceinterface.cpp')
-rw-r--r-- | NorthstarDedicatedTest/sourceinterface.cpp | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/NorthstarDedicatedTest/sourceinterface.cpp b/NorthstarDedicatedTest/sourceinterface.cpp deleted file mode 100644 index 56020e5e..00000000 --- a/NorthstarDedicatedTest/sourceinterface.cpp +++ /dev/null @@ -1,82 +0,0 @@ -#include "pch.h" -#include "sourceinterface.h" -#include "hooks.h" -#include "hookutils.h" - -#include "sourceconsole.h" -#include "context.h" -#include "convar.h" -#include <iostream> - -// really wanted to do a modular callback system here but honestly couldn't be bothered so hardcoding stuff for now: todo later - -CreateInterfaceFn clientCreateInterfaceOriginal; -void* ClientCreateInterfaceHook(const char* pName, int* pReturnCode) -{ - void* ret = clientCreateInterfaceOriginal(pName, pReturnCode); - - spdlog::info("CreateInterface CLIENT {}", pName); - if (!strcmp(pName, "GameClientExports001")) - InitialiseConsoleOnInterfaceCreation(); - - return ret; -} - -CreateInterfaceFn serverCreateInterfaceOriginal; -void* ServerCreateInterfaceHook(const char* pName, int* pReturnCode) -{ - void* ret = serverCreateInterfaceOriginal(pName, pReturnCode); - - std::cout << "CreateInterface SERVER " << pName << std::endl; - - return ret; -} - -CreateInterfaceFn engineCreateInterfaceOriginal; -void* EngineCreateInterfaceHook(const char* pName, int* pReturnCode) -{ - void* ret = engineCreateInterfaceOriginal(pName, pReturnCode); - - std::cout << "CreateInterface ENGINE " << pName << std::endl; - - return ret; -} - -void HookClientCreateInterface(HMODULE baseAddress) -{ - HookEnabler hook; - ENABLER_CREATEHOOK( - hook, - reinterpret_cast<void*>(GetProcAddress(baseAddress, "CreateInterface")), - &ClientCreateInterfaceHook, - reinterpret_cast<LPVOID*>(&clientCreateInterfaceOriginal)); -} - -void HookServerCreateInterface(HMODULE baseAddress) -{ - HookEnabler hook; - ENABLER_CREATEHOOK( - hook, - reinterpret_cast<void*>(GetProcAddress(baseAddress, "CreateInterface")), - &ServerCreateInterfaceHook, - reinterpret_cast<LPVOID*>(&serverCreateInterfaceOriginal)); -} - -void HookEngineCreateInterface(HMODULE baseAddress) -{ - HookEnabler hook; - ENABLER_CREATEHOOK( - hook, - reinterpret_cast<void*>(GetProcAddress(baseAddress, "CreateInterface")), - &EngineCreateInterfaceHook, - reinterpret_cast<LPVOID*>(&engineCreateInterfaceOriginal)); -} - -void InitialiseInterfaceCreationHooks() -{ - AddDllLoadCallback("client.dll", HookClientCreateInterface); - - // not used atm - // AddDllLoadCallback("server.dll", HookServerCreateInterface); - // AddDllLoadCallback("engine.dll", HookEngineCreateInterface); -} |