diff options
author | 2025-08-02 14:43:19 +0100 | |
---|---|---|
committer | 2025-08-02 14:43:19 +0100 | |
commit | 0d905d7998a031c2d7a1cdc5d0d1148b55b610a2 (patch) | |
tree | ea73c7cadd583a8c95b4a7ba6edaa10e99067098 /src/chatrate.c | |
parent | f2f9f18a893527ee80260a2d57bca3023f8fd44f (diff) | |
download | sst-0d905d7998a031c2d7a1cdc5d0d1148b55b610a2.tar.gz sst-0d905d7998a031c2d7a1cdc5d0d1148b55b610a2.zip |
Make additional use of untyped command callbacks
Diffstat (limited to 'src/chatrate.c')
-rw-r--r-- | src/chatrate.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/chatrate.c b/src/chatrate.c index ba14ea1..9c1f40c 100644 --- a/src/chatrate.c +++ b/src/chatrate.c @@ -32,18 +32,16 @@ static uchar *patchedbyte; // So, instead of adding 0.66 to the current time, we subtract it, and that // means we can always chat immediately. -static inline bool find_ratelimit_insn(con_cmdcb say_cb) { - // Find the add instruction - uchar *insns = (uchar *)say_cb; - for (uchar *p = insns; p - insns < 128;) { +static inline bool find_ratelimit_insn(const uchar *insns) { + for (const uchar *p = insns; p - insns < 128;) { // find FADD if (p[0] == X86_FLTBLK5 && p[1] == X86_MODRM(0, 0, 5)) { - patchedbyte = p + 1; + patchedbyte = (uchar *)p + 1; return true; } // Portal 2, L4D2 2125-2134, L4D:S all use SSE2, so try finding ADDSD if (p[0] == X86_PFX_REPN && p[1] == X86_2BYTE & p[2] == X86_2B_ADD) { - patchedbyte = p + 2; + patchedbyte = (uchar *)p + 2; return true; } NEXT_INSN(p, "chat rate limit"); @@ -72,7 +70,7 @@ static inline void unpatch_ratelimit_insn() { INIT { struct con_cmd *cmd_say = con_findcmd("say"); if_cold (!cmd_say) return FEAT_INCOMPAT; // should never happen! - if (!find_ratelimit_insn(cmd_say->cb)) { + if (!find_ratelimit_insn(cmd_say->cb_insns)) { errmsg_errorx("couldn't find chat rate limit instruction"); return FEAT_INCOMPAT; } |