aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/playlist.cpp
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-09-30 20:48:53 +0100
committerBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-09-30 20:48:53 +0100
commit2497b700379205ea01c1aa0c55a19be523233be1 (patch)
treee1951f2e526663c6290e318cbcf807a0c018bb64 /NorthstarDedicatedTest/playlist.cpp
parent06a59c70c1239de114e9bc0ce5c4ee8deabd1b6b (diff)
downloadNorthstarLauncher-2497b700379205ea01c1aa0c55a19be523233be1.tar.gz
NorthstarLauncher-2497b700379205ea01c1aa0c55a19be523233be1.zip
add spewfunc, setplaylistvaroverride, dedicated changes
Diffstat (limited to 'NorthstarDedicatedTest/playlist.cpp')
-rw-r--r--NorthstarDedicatedTest/playlist.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/NorthstarDedicatedTest/playlist.cpp b/NorthstarDedicatedTest/playlist.cpp
index 2a730ee1..096f4f3d 100644
--- a/NorthstarDedicatedTest/playlist.cpp
+++ b/NorthstarDedicatedTest/playlist.cpp
@@ -4,6 +4,7 @@
#include "convar.h"
#include "gameutils.h"
#include "hookutils.h"
+#include "dedicated.h"
typedef char(*Onclc_SetPlaylistVarOverrideType)(void* a1, void* a2);
Onclc_SetPlaylistVarOverrideType Onclc_SetPlaylistVarOverride;
@@ -18,6 +19,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
@@ -31,6 +40,7 @@ char Onclc_SetPlaylistVarOverrideHook(void* a1, void* a2)
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
@@ -46,4 +56,19 @@ void InitialisePlaylistHooks(HMODULE baseAddress)
TempReadWrite rw(ptr);
*((char*)ptr) = 0xC3; // jmp => ret
}
+
+ // on dedicated servers, force SetPlaylistVarOverride to always set the server's override list, irregardless of whether server is running yet
+ if (IsDedicated())
+ {
+ // SetPlaylistVarOverride
+ void* ptr = (char*)baseAddress + 0x18ED17;
+ TempReadWrite rw(ptr);
+
+ *((char*)ptr) = 0x90; // jl => nop
+ *((char*)ptr + 1) = 0x90;
+ *((char*)ptr + 2) = 0x90;
+ *((char*)ptr + 3) = 0x90;
+ *((char*)ptr + 4) = 0x90;
+ *((char*)ptr + 5) = 0x90;
+ }
} \ No newline at end of file