aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/miscclientfixes.cpp
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2022-05-09 00:40:53 +0100
committerBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2022-05-09 00:40:53 +0100
commitf230156cbebc1b93db5e254410ee2ab3a8dcb27c (patch)
treee98c72fabbff37a55e7f9216c52e4f8ef2084073 /NorthstarDedicatedTest/miscclientfixes.cpp
parent6c8112a6c368dd36d21fd94689e9682bc3b012a5 (diff)
downloadNorthstarLauncher-f230156cbebc1b93db5e254410ee2ab3a8dcb27c.tar.gz
NorthstarLauncher-f230156cbebc1b93db5e254410ee2ab3a8dcb27c.zip
use in-file macros rather than global funcs for registering dll load callbacks
Diffstat (limited to 'NorthstarDedicatedTest/miscclientfixes.cpp')
-rw-r--r--NorthstarDedicatedTest/miscclientfixes.cpp31
1 files changed, 25 insertions, 6 deletions
diff --git a/NorthstarDedicatedTest/miscclientfixes.cpp b/NorthstarDedicatedTest/miscclientfixes.cpp
index 62ffd4a4..68f83550 100644
--- a/NorthstarDedicatedTest/miscclientfixes.cpp
+++ b/NorthstarDedicatedTest/miscclientfixes.cpp
@@ -1,12 +1,16 @@
#include "pch.h"
+#include "hooks.h"
#include "miscclientfixes.h"
+#include "convar.h"
#include "hookutils.h"
-#include "dedicated.h"
+#include "NSMem.h"
typedef void* (*CrashingWeaponActivityFuncType)(void* a1);
CrashingWeaponActivityFuncType CrashingWeaponActivityFunc0;
CrashingWeaponActivityFuncType CrashingWeaponActivityFunc1;
+ConVar* Cvar_ns_cl_move_always_send;
+
void* CrashingWeaponActivityFunc0Hook(void* a1)
{
// this return is safe, other functions that use this value seemingly dont care about it being null
@@ -25,11 +29,8 @@ void* CrashingWeaponActivityFunc1Hook(void* a1)
return CrashingWeaponActivityFunc1(a1);
}
-void InitialiseMiscClientFixes(HMODULE baseAddress)
+ON_DLL_LOAD_CLIENT_RELIESON("client.dll", MiscClientFixes, ConVar, (HMODULE baseAddress)
{
- if (IsDedicated())
- return;
-
HookEnabler hook;
// these functions will occasionally pass a null pointer on respawn, unsure what causes this but seems easiest just to return null if
@@ -46,4 +47,22 @@ void InitialiseMiscClientFixes(HMODULE baseAddress)
void* ptr = (char*)baseAddress + 0x275F9D9;
*((char*)ptr) = (char)0;
}
-} \ No newline at end of file
+
+ // allow demo recording on loopback
+ NSMem::NOP((uintptr_t)GetModuleHandleA("engine.dll") + 0x8E1B1, 2);
+ NSMem::NOP((uintptr_t)GetModuleHandleA("engine.dll") + 0x56CC3, 2);
+
+ // change default values of demo cvars to enable them by default, but not autorecord
+ // this is before Host_Init, the setvalue calls here will get overwritten by custom cfgs/launch options
+ ConVar* Cvar_demo_enableDemos = g_pCVar->FindVar("demo_enabledemos");
+ Cvar_demo_enableDemos->m_pszDefaultValue = "1";
+ Cvar_demo_enableDemos->SetValue(true);
+
+ ConVar* Cvar_demo_writeLocalFile = g_pCVar->FindVar("demo_writeLocalFile");
+ Cvar_demo_writeLocalFile->m_pszDefaultValue = "1";
+ Cvar_demo_writeLocalFile->SetValue(true);
+
+ ConVar* Cvar_demo_autoRecord = g_pCVar->FindVar("demo_autoRecord");
+ Cvar_demo_autoRecord->m_pszDefaultValue = "0";
+ Cvar_demo_autoRecord->SetValue(false);
+}) \ No newline at end of file