From ac7e7d0f21978afc70fe3ef76db69d575742b974 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Tue, 17 Jun 2025 20:18:48 +0100 Subject: Separate our command callbacks from Source's This improves the ergonomics of a few different things, and sets us up somewhat for the fact OE had a different interface for commands too (it was v1 only and had a separate API call for getting the args). --- src/bind.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/bind.c') diff --git a/src/bind.c b/src/bind.c index a746ef5..7fafdb1 100644 --- a/src/bind.c +++ b/src/bind.c @@ -36,9 +36,8 @@ static struct keyinfo *keyinfo; // engine keybinds list (s_pKeyInfo[]) const char *bind_get(int keycode) { return keyinfo[keycode].binding; } -static bool find_keyinfo(con_cmdcb klbc_cb) { +static bool find_keyinfo(const uchar *insns) { #ifdef _WIN32 - const uchar *insns = (const uchar *)klbc_cb; for (const uchar *p = insns; p - insns < 64;) { // key_listboundkeys loops through each index, moving into a register: // mov , dword ptr [ * 8 + s_pKeyInfo] @@ -57,8 +56,7 @@ static bool find_keyinfo(con_cmdcb klbc_cb) { INIT { struct con_cmd *cmd_key_listboundkeys = con_findcmd("key_listboundkeys"); - con_cmdcb cb = con_getcmdcb(cmd_key_listboundkeys); - if_cold (!find_keyinfo(cb)) { + if_cold (!find_keyinfo(cmd_key_listboundkeys->cb_insns)) { errmsg_warnx("couldn't find key binding list"); return FEAT_INCOMPAT; } -- cgit v1.2.3-54-g00ecf