From 829dece47f305979bd1375300ebc14fc2e264c0a Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Thu, 12 May 2022 16:38:53 +0100 Subject: Rerun L4D1 console spam fix after config loading This was the simplest way I could think of to solve this issue. Thanks again Aciidz for pointing the issue out, and thanks Turtle Rock for shipping such a broken game. --- src/sst.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/sst.c') diff --git a/src/sst.c b/src/sst.c index 5a7ca31..edd083f 100644 --- a/src/sst.c +++ b/src/sst.c @@ -160,6 +160,15 @@ static const char *VCALLCONV GetStringForSymbol_hook(void *this, int s) { return ret; } +// by hooking stuffcmds, we get a callback after the last of the startup +// commands have run (the command line ones) +static struct con_cmd *cmd_stuffcmds = 0; +static con_cmdcb orig_stuffcmds_cb; +static void hook_stuffcmds_cb(const struct con_cmdargs *args) { + orig_stuffcmds_cb(args); + fixes_tryagainlater(); +} + // vstdlib symbol, only currently used in l4d2 but exists everywhere so oh well IMPORT void *KeyValuesSystem(void); @@ -277,6 +286,12 @@ static bool do_load(ifacefactory enginef, ifacefactory serverf) { (void *)GetStringForSymbol_hook); } + cmd_stuffcmds = con_findcmd("stuffcmds"); + if (cmd_stuffcmds) { + orig_stuffcmds_cb = cmd_stuffcmds->cb; + cmd_stuffcmds->cb = hook_stuffcmds_cb; + } + e: con_colourmsg(RGBA(64, 255, 64, 255), LONGNAME " v" VERSION " successfully loaded"); con_colourmsg(RGBA(255, 255, 255, 255), " for game "); @@ -338,6 +353,7 @@ static void do_unload(void) { if (orig_GetStringForSymbol) { unhook_vtable(kvsvt, 4, (void *)orig_GetStringForSymbol); } + if (cmd_stuffcmds) cmd_stuffcmds->cb = orig_stuffcmds_cb; } static bool VCALLCONV Load(void *this, ifacefactory enginef, -- cgit v1.2.3