aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/playlist.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'NorthstarDedicatedTest/playlist.cpp')
-rw-r--r--NorthstarDedicatedTest/playlist.cpp23
1 files changed, 23 insertions, 0 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