From 0b40d4d9ea1cbfbb92795e0d6f26cf108f2dec5f Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Wed, 16 Apr 2025 21:28:45 +0100 Subject: 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. --- src/demorec.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/demorec.c') 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; -- cgit v1.2.3-54-g00ecf