diff options
Diffstat (limited to 'NorthstarDedicatedTest/sourceconsole.cpp')
-rw-r--r-- | NorthstarDedicatedTest/sourceconsole.cpp | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/NorthstarDedicatedTest/sourceconsole.cpp b/NorthstarDedicatedTest/sourceconsole.cpp index c862356e..775ec856 100644 --- a/NorthstarDedicatedTest/sourceconsole.cpp +++ b/NorthstarDedicatedTest/sourceconsole.cpp @@ -1,14 +1,37 @@ #include "pch.h" #include "sourceconsole.h" #include "sourceinterface.h" +#include "hookutils.h" +#include <iostream> -SourceInterface<CGameConsole>* g_SourceGameConsole; +SourceInterface<CGameConsole>* g_pSourceGameConsole; + +typedef void(*weaponlisttype)(); +weaponlisttype weaponlist; +void CommandWeaponListHook() +{ + std::cout << "TEMP: toggling console... REPLACE THIS WITH ACTUAL CONCOMMAND SUPPORT SOON" << std::endl; + + (*g_pSourceGameConsole)->Activate(); +} + +CreateInterfaceFn createInterface; +void* __fastcall InitialiseConsoleOnUIInit(const char* pName, int* pReturnCode) +{ + std::cout << pName << std::endl; + void* ret = createInterface(pName, pReturnCode); + + if (!strcmp(pName, "GameClientExports001")) + (*g_pSourceGameConsole)->Initialize(); + + return ret; +} void InitialiseSourceConsole(HMODULE baseAddress) { - SourceInterface<CGameConsole> console = SourceInterface<CGameConsole>("client.dll", "CGameConsole"); - console->Initialize(); - console->Activate(); + g_pSourceGameConsole = new SourceInterface<CGameConsole>("client.dll", "GameConsole004"); - g_SourceGameConsole = &console; + HookEnabler hook; + ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x73BA00, &InitialiseConsoleOnUIInit, reinterpret_cast<LPVOID*>(&createInterface)); + ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x10C080, &CommandWeaponListHook, reinterpret_cast<LPVOID*>(&weaponlist)); }
\ No newline at end of file |