aboutsummaryrefslogtreecommitdiff
path: root/src/l4d1democompat.c
diff options
context:
space:
mode:
authorGravatar Michael Smith <mikesmiffy128@gmail.com> 2025-08-02 14:43:19 +0100
committerGravatar Michael Smith <mikesmiffy128@gmail.com> 2025-08-02 14:43:19 +0100
commit0d905d7998a031c2d7a1cdc5d0d1148b55b610a2 (patch)
treeea73c7cadd583a8c95b4a7ba6edaa10e99067098 /src/l4d1democompat.c
parentf2f9f18a893527ee80260a2d57bca3023f8fd44f (diff)
downloadsst-0d905d7998a031c2d7a1cdc5d0d1148b55b610a2.tar.gz
sst-0d905d7998a031c2d7a1cdc5d0d1148b55b610a2.zip
Make additional use of untyped command callbacks
Diffstat (limited to 'src/l4d1democompat.c')
-rw-r--r--src/l4d1democompat.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/l4d1democompat.c b/src/l4d1democompat.c
index 1cfe959..105b812 100644
--- a/src/l4d1democompat.c
+++ b/src/l4d1democompat.c
@@ -50,9 +50,8 @@ static GetHostVersion_func orig_GetHostVersion;
typedef void (*VCALLCONV ReadDemoHeader_func)(void *);
static ReadDemoHeader_func orig_ReadDemoHeader;
-static inline bool find_ReadDemoHeader(con_cmdcb listdemo_cb) {
+static inline bool find_ReadDemoHeader(const uchar *insns) {
// Find the call to ReadDemoHeader in the listdemo callback
- const uchar *insns = (const uchar *)listdemo_cb;
for (const uchar *p = insns; p - insns < 192;) {
if (p[0] == X86_LEA && p[1] == X86_MODRM(2, 1, 4) && p[2] == 0x24 &&
p[7] == X86_CALL && p[12] == X86_LEA &&
@@ -138,7 +137,7 @@ static int hook_midpoint() {
INIT {
struct con_cmd *cmd_listdemo = con_findcmd("listdemo");
if_cold (!cmd_listdemo) return FEAT_INCOMPAT; // should never happen!
- if_cold (!find_ReadDemoHeader(cmd_listdemo->cb)) {
+ if_cold (!find_ReadDemoHeader(cmd_listdemo->cb_insns)) {
errmsg_errorx("couldn't find ReadDemoHeader function");
return FEAT_INCOMPAT;
}