From f84d44d2a9139f3c5b58d7875bc5ef0d94881008 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Sat, 10 Jun 2023 17:01:56 +0100 Subject: Remove some paranoia about missing commands There's absolutely no reason these ever wouldn't be there. --- src/alias.c | 4 ---- src/bind.c | 4 ---- src/demorec.c | 11 +---------- 3 files changed, 1 insertion(+), 18 deletions(-) (limited to 'src') diff --git a/src/alias.c b/src/alias.c index c660367..6af7467 100644 --- a/src/alias.c +++ b/src/alias.c @@ -94,10 +94,6 @@ INIT { if (GAMETYPE_MATCHES(Portal2)) return false; struct con_cmd *cmd_alias = con_findcmd("alias"); - if (!cmd_alias) { - errmsg_warnx("couldn't find \"alias\" command"); - return false; - } if (!find_alias_head(con_getcmdcb(cmd_alias))) { errmsg_warnx("couldn't find alias list"); return false; diff --git a/src/bind.c b/src/bind.c index 37a34ea..a1481bb 100644 --- a/src/bind.c +++ b/src/bind.c @@ -56,10 +56,6 @@ static bool find_keyinfo(con_cmdcb klbc_cb) { INIT { struct con_cmd *cmd_key_listboundkeys = con_findcmd("key_listboundkeys"); - if (!cmd_key_listboundkeys) { - errmsg_errorx("couldn't find key_listboundkeys command"); - return false; - } con_cmdcb cb = con_getcmdcb(cmd_key_listboundkeys); if (!find_keyinfo(cb)) { errmsg_warnx("couldn't find key binding list"); diff --git a/src/demorec.c b/src/demorec.c index 07e51d1..e176ab3 100644 --- a/src/demorec.c +++ b/src/demorec.c @@ -246,23 +246,14 @@ bool demorec_recording(void) { INIT { cmd_record = con_findcmd("record"); - if (!cmd_record) { // can *this* even happen? I hope not! - errmsg_errorx("couldn't find \"record\" command"); - return false; - } orig_record_cb = con_getcmdcb(cmd_record); cmd_stop = con_findcmd("stop"); - if (!cmd_stop) { - errmsg_errorx("couldn't find \"stop\" command"); - return false; - } orig_stop_cb = con_getcmdcb(cmd_stop); if (!find_demorecorder()) { errmsg_errorx("couldn't find demo recorder instance"); return false; } - - void **vtable = *(void ***)demorecorder; + void **vtable = mem_loadptr(demorecorder); // XXX: 16 is totally arbitrary here! figure out proper bounds later if (!os_mprot(vtable, 16 * sizeof(void *), PAGE_READWRITE)) { errmsg_errorsys("couldn't make virtual table writable"); -- cgit v1.2.3