aboutsummaryrefslogtreecommitdiff
path: root/src/l4d1democompat.c
diff options
context:
space:
mode:
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;
}