aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-12-26 02:29:27 +0000
committerBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-12-26 02:29:27 +0000
commit4bf3def2ac5719fdba37bd0f0d3383f67abe6516 (patch)
tree8769c6ebfe7287e9fd98d93b3ff5ca9c0da1aa3b
parent81ae893c31fe462650b9793076df2467fd897181 (diff)
downloadNorthstarLauncher-4bf3def2ac5719fdba37bd0f0d3383f67abe6516.tar.gz
NorthstarLauncher-4bf3def2ac5719fdba37bd0f0d3383f67abe6516.zip
add setplaylistvaroverride command for setting overrides on dedi from commandline
-rw-r--r--NorthstarDedicatedTest/playlist.cpp23
-rw-r--r--NorthstarDedicatedTest/serverauthentication.cpp2
2 files changed, 24 insertions, 1 deletions
diff --git a/NorthstarDedicatedTest/playlist.cpp b/NorthstarDedicatedTest/playlist.cpp
index b853a40a..ef399347 100644
--- a/NorthstarDedicatedTest/playlist.cpp
+++ b/NorthstarDedicatedTest/playlist.cpp
@@ -5,6 +5,7 @@
#include "gameutils.h"
#include "hookutils.h"
#include "dedicated.h"
+#include "squirrel.h"
typedef char(*Onclc_SetPlaylistVarOverrideType)(void* a1, void* a2);
Onclc_SetPlaylistVarOverrideType Onclc_SetPlaylistVarOverride;
@@ -21,6 +22,14 @@ void SetPlaylistCommand(const CCommand& args)
SetCurrentPlaylist(args.Arg(1));
}
+void SetPlaylistVarOverrideCommand(const CCommand& args)
+{
+ if (args.ArgC() < 3)
+ return;
+
+ SetPlaylistVarOverride(args.Arg(1), args.Arg(2));
+}
+
char Onclc_SetPlaylistVarOverrideHook(void* a1, void* a2)
{
// the private_match playlist is the only situation where there should be any legitimate sending of this netmessage
@@ -42,6 +51,7 @@ void SetPlaylistVarOverrideHook(const char* varName, const char* value)
void InitialisePlaylistHooks(HMODULE baseAddress)
{
RegisterConCommand("setplaylist", SetPlaylistCommand, "Sets the current playlist", FCVAR_NONE);
+ RegisterConCommand("setplaylistvaroverride", SetPlaylistVarOverrideCommand, "sets a playlist var override", FCVAR_NONE);
// note: clc_SetPlaylistVarOverride is pretty insecure, since it allows for entirely arbitrary playlist var overrides to be sent to the server
// this is somewhat restricted on custom servers to prevent it being done outside of private matches, but ideally it should be disabled altogether, since the custom menus won't use it anyway
// this should only really be accepted if you want vanilla client compatibility
@@ -58,4 +68,17 @@ void InitialisePlaylistHooks(HMODULE baseAddress)
TempReadWrite rw(ptr);
*((char*)ptr) = 0xC3; // jmp => ret
}
+
+ if (IsDedicated())
+ {
+ // patch to allow setplaylistvaroverride to be called before map init on dedicated
+ void* ptr = (char*)baseAddress + 0x18ED17;
+ TempReadWrite rw(ptr);
+ *((char*)ptr) = (char)0x90;
+ *((char*)ptr + 1) = (char)0x90;
+ *((char*)ptr + 2) = (char)0x90;
+ *((char*)ptr + 3) = (char)0x90;
+ *((char*)ptr + 4) = (char)0x90;
+ *((char*)ptr + 5) = (char)0x90;
+ }
} \ No newline at end of file
diff --git a/NorthstarDedicatedTest/serverauthentication.cpp b/NorthstarDedicatedTest/serverauthentication.cpp
index 21be404c..5351dfdc 100644
--- a/NorthstarDedicatedTest/serverauthentication.cpp
+++ b/NorthstarDedicatedTest/serverauthentication.cpp
@@ -437,7 +437,7 @@ void InitialiseServerAuthentication(HMODULE baseAddress)
Cvar_net_chan_limit_mode = RegisterConVar("net_chan_limit_mode", "0", FCVAR_GAMEDLL, "The mode for netchan processing limits: 0 = none, 1 = kick, 2 = log");
Cvar_net_chan_limit_msec_per_sec = RegisterConVar("net_chan_limit_msec_per_sec", "0", FCVAR_GAMEDLL, "Netchannel processing is limited to so many milliseconds, abort connection if exceeding budget");
Cvar_ns_player_auth_port = RegisterConVar("ns_player_auth_port", "8081", FCVAR_GAMEDLL, "");
- Cvar_sv_querylimit_per_sec = RegisterConVar("sv_querylimit_per_sec", "10", FCVAR_GAMEDLL, "");
+ Cvar_sv_querylimit_per_sec = RegisterConVar("sv_querylimit_per_sec", "15", FCVAR_GAMEDLL, "");
HookEnabler hook;
ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x114430, &CBaseServer__ConnectClientHook, reinterpret_cast<LPVOID*>(&CBaseServer__ConnectClient));