aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/sourceconsole.cpp
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-07-11 20:17:11 +0100
committerBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-07-11 20:17:11 +0100
commit51d3d4a40c8579e29571bc80d35bbb62fa50661b (patch)
tree08d690a887e98c8110e9b76b2d4927a4bdc7afdc /NorthstarDedicatedTest/sourceconsole.cpp
parent4c4d605d10109e02708984755405bbe0947ef5c4 (diff)
downloadNorthstarLauncher-51d3d4a40c8579e29571bc80d35bbb62fa50661b.tar.gz
NorthstarLauncher-51d3d4a40c8579e29571bc80d35bbb62fa50661b.zip
add temp console support
Diffstat (limited to 'NorthstarDedicatedTest/sourceconsole.cpp')
-rw-r--r--NorthstarDedicatedTest/sourceconsole.cpp33
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