diff options
author | Michael Smith <mikesmiffy128@gmail.com> | 2022-05-12 16:38:53 +0100 |
---|---|---|
committer | Michael Smith <mikesmiffy128@gmail.com> | 2022-05-12 16:38:53 +0100 |
commit | 829dece47f305979bd1375300ebc14fc2e264c0a (patch) | |
tree | ece92f21916bcdc893ff21034ab8599d895c0071 /src/sst.c | |
parent | a0138ff3772e71f338d04668076ec1eb9d44f8f4 (diff) |
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.
Diffstat (limited to 'src/sst.c')
-rw-r--r-- | src/sst.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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, |