aboutsummaryrefslogtreecommitdiff
path: root/src/demorec.c
diff options
context:
space:
mode:
authorGravatar Michael Smith <mikesmiffy128@gmail.com> 2025-04-16 21:28:45 +0100
committerGravatar Michael Smith <mikesmiffy128@gmail.com> 2025-04-16 21:31:20 +0100
commit0b40d4d9ea1cbfbb92795e0d6f26cf108f2dec5f (patch)
tree3caf7789a3141a369575c0749124089dbc08e916 /src/demorec.c
parent7dcdcd0f62c7c103148b17aed8376a457aad6d8a (diff)
downloadsst-0b40d4d9ea1cbfbb92795e0d6f26cf108f2dec5f.tar.gz
sst-0b40d4d9ea1cbfbb92795e0d6f26cf108f2dec5f.zip
Add missing REQUIRE_GAMEDATA things to demorec
These gamedata entries are always available, but there's no reason not to check for them in case that changes in future. As-is now, the checks will be trivial for the compiler to optimise out.
Diffstat (limited to 'src/demorec.c')
-rw-r--r--src/demorec.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/demorec.c b/src/demorec.c
index a14798a..5aacf06 100644
--- a/src/demorec.c
+++ b/src/demorec.c
@@ -36,7 +36,10 @@
#include "x86util.h"
FEATURE("improved demo recording")
+REQUIRE_GAMEDATA(vtidx_SetSignonState)
+REQUIRE_GAMEDATA(vtidx_StartRecording)
REQUIRE_GAMEDATA(vtidx_StopRecording)
+REQUIRE_GAMEDATA(vtidx_RecordPacket)
DEF_FEAT_CVAR(sst_autorecord,
"Continuously record demos even after reconnecting", 1, CON_ARCHIVE)
@@ -56,7 +59,9 @@ DEF_PREDICATE(DemoControlAllowed)
DEF_EVENT(DemoRecordStarting)
DEF_EVENT(DemoRecordStopped, int)
-typedef void (*VCALLCONV SetSignonState_func)(void *, int);
+DECL_VCALL_DYN(SetSignonState, int)
+
+//typedef void (*VCALLCONV SetSignonState_func)(void *, int);
static SetSignonState_func orig_SetSignonState;
static void VCALLCONV hook_SetSignonState(void *this_, int state) {
struct CDemoRecorder *this = this_;
@@ -293,7 +298,7 @@ END {
if_hot (!sst_userunloaded) return;
// avoid dumb edge case if someone somehow records and immediately unloads
if (*recording && *demonum == 0) *demonum = 1;
- void **vtable = *(void ***)demorecorder;
+ void **vtable = mem_loadptr(demorecorder);
unhook_vtable(vtable, vtidx_SetSignonState, (void *)orig_SetSignonState);
unhook_vtable(vtable, vtidx_StopRecording, (void *)orig_StopRecording);
cmd_record->cb = orig_record_cb;