aboutsummaryrefslogtreecommitdiff
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
parent4c4d605d10109e02708984755405bbe0947ef5c4 (diff)
downloadNorthstarLauncher-51d3d4a40c8579e29571bc80d35bbb62fa50661b.tar.gz
NorthstarLauncher-51d3d4a40c8579e29571bc80d35bbb62fa50661b.zip
add temp console support
-rw-r--r--NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj2
-rw-r--r--NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj.filters9
-rw-r--r--NorthstarDedicatedTest/concommand.h0
-rw-r--r--NorthstarDedicatedTest/dedicated.cpp7
-rw-r--r--NorthstarDedicatedTest/sourceconsole.cpp33
-rw-r--r--NorthstarDedicatedTest/sourceconsole.h2
-rw-r--r--NorthstarDedicatedTest/sourceinterface.cpp13
-rw-r--r--NorthstarDedicatedTest/sourceinterface.h12
8 files changed, 53 insertions, 25 deletions
diff --git a/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj b/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj
index 8af2d3e0..078b2548 100644
--- a/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj
+++ b/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj
@@ -170,6 +170,7 @@
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
+ <ClInclude Include="concommand.h" />
<ClInclude Include="context.h" />
<ClInclude Include="dedicated.h" />
<ClInclude Include="hooks.h" />
@@ -199,7 +200,6 @@
</ClCompile>
<ClCompile Include="sigscanning.cpp" />
<ClCompile Include="sourceconsole.cpp" />
- <ClCompile Include="sourceinterface.cpp" />
<ClCompile Include="squirrel.cpp" />
<ClCompile Include="tier0.cpp" />
</ItemGroup>
diff --git a/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj.filters b/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj.filters
index e9e523e8..1a2de381 100644
--- a/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj.filters
+++ b/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj.filters
@@ -40,6 +40,9 @@
<Filter Include="Header Files\Client">
<UniqueIdentifier>{ca657be5-c2d8-4322-a689-1154aaafe57b}</UniqueIdentifier>
</Filter>
+ <Filter Include="Header Files\Shared\ConVar">
+ <UniqueIdentifier>{9751b551-5886-45d4-a039-cbd10445263d}</UniqueIdentifier>
+ </Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="pch.h">
@@ -81,6 +84,9 @@
<ClInclude Include="sourceinterface.h">
<Filter>Header Files\Shared</Filter>
</ClInclude>
+ <ClInclude Include="concommand.h">
+ <Filter>Header Files\Shared\ConVar</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp">
@@ -116,8 +122,5 @@
<ClCompile Include="context.cpp">
<Filter>Source Files\Shared</Filter>
</ClCompile>
- <ClCompile Include="sourceinterface.cpp">
- <Filter>Source Files\Shared</Filter>
- </ClCompile>
</ItemGroup>
</Project> \ No newline at end of file
diff --git a/NorthstarDedicatedTest/concommand.h b/NorthstarDedicatedTest/concommand.h
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/NorthstarDedicatedTest/concommand.h
diff --git a/NorthstarDedicatedTest/dedicated.cpp b/NorthstarDedicatedTest/dedicated.cpp
index ce4723cb..0999e614 100644
--- a/NorthstarDedicatedTest/dedicated.cpp
+++ b/NorthstarDedicatedTest/dedicated.cpp
@@ -7,6 +7,7 @@
bool IsDedicated()
{
// temp: should get this from commandline
+ //return true;
return false;
}
@@ -69,6 +70,12 @@ void InitialiseDedicated(HMODULE engineAddress)
// ptr to ptr
*ptr = (intptr_t)doublePtr;
+
+ // extra potential patches:
+ // nop engine.dll+1c67cd1 and +1c67d8 to skip videomode creategamewindow
+ // also look into launcher.dll+d381, seems to cause renderthread to get made
+ // this crashes HARD if no window which makes sense tbh
+ // also look into materialsystem + 5B344 since it seems to be the base of all the renderthread stuff
}
void Sys_Printf(CDedicatedExports* dedicated, char* msg)
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
diff --git a/NorthstarDedicatedTest/sourceconsole.h b/NorthstarDedicatedTest/sourceconsole.h
index 7f494dca..7815cd03 100644
--- a/NorthstarDedicatedTest/sourceconsole.h
+++ b/NorthstarDedicatedTest/sourceconsole.h
@@ -87,4 +87,4 @@ public:
CConsoleDialog* m_pConsole;
};
-extern SourceInterface<CGameConsole>* g_SourceGameConsole; \ No newline at end of file
+extern SourceInterface<CGameConsole>* g_pSourceGameConsole; \ No newline at end of file
diff --git a/NorthstarDedicatedTest/sourceinterface.cpp b/NorthstarDedicatedTest/sourceinterface.cpp
deleted file mode 100644
index 49a2f164..00000000
--- a/NorthstarDedicatedTest/sourceinterface.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-#include "pch.h"
-#include "sourceinterface.h"
-#include <string>
-#include "tier0.h"
-
-template<typename T> SourceInterface<T>::SourceInterface(const std::string& moduleName, const std::string& interfaceName)
-{
- HMODULE handle = GetModuleHandleA(moduleName.c_str());
- CreateInterfaceFn createInterface = (CreateInterfaceFn)GetProcAddress(handle, interfaceName.c_str());
- m_interface = (T*)createInterface(interfaceName.c_str(), NULL);
- if (m_interface == nullptr)
- Error("Failed to call CreateInterface for %s in %s", interfaceName, moduleName);
-} \ No newline at end of file
diff --git a/NorthstarDedicatedTest/sourceinterface.h b/NorthstarDedicatedTest/sourceinterface.h
index bc4767f5..b6e9b92a 100644
--- a/NorthstarDedicatedTest/sourceinterface.h
+++ b/NorthstarDedicatedTest/sourceinterface.h
@@ -1,5 +1,6 @@
#pragma once
#include <string>
+#include "tier0.h"
// literally just copied from ttf2sdk definition
typedef void* (*CreateInterfaceFn)(const char* pName, int* pReturnCode);
@@ -10,7 +11,14 @@ private:
T* m_interface;
public:
- SourceInterface(const std::string& moduleName, const std::string& interfaceName);
+ SourceInterface(const std::string& moduleName, const std::string& interfaceName)
+ {
+ HMODULE handle = GetModuleHandleA(moduleName.c_str());
+ CreateInterfaceFn createInterface = (CreateInterfaceFn)GetProcAddress(handle, "CreateInterface");
+ m_interface = (T*)createInterface(interfaceName.c_str(), NULL);
+ if (m_interface == nullptr)
+ Error("Failed to call CreateInterface for %s in %s", interfaceName, moduleName);
+ }
T* operator->() const
{
@@ -21,4 +29,4 @@ public:
{
return m_interface;
}
-};
+}; \ No newline at end of file