From 1c4318331663b152b0b298bd2c9e5c971506a86b Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Sat, 10 Jun 2023 16:44:19 +0100 Subject: Prune some comments and tidy up other minor things --- src/sst.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) (limited to 'src/sst.c') diff --git a/src/sst.c b/src/sst.c index a0f926d..afe7eb3 100644 --- a/src/sst.c +++ b/src/sst.c @@ -170,11 +170,10 @@ static const char *updatenotes = "\ * various internal cleanup\n\ "; -#include +#include // generated by build/codegen.c static void do_featureinit(void) { initfeatures(); - fixes_apply(); // if we're autoloaded and the external autoupdate script downloaded a new // version, let the user know about the cool new stuff! @@ -200,25 +199,20 @@ static VGuiConnect_func orig_VGuiConnect; static void VCALLCONV hook_VGuiConnect(void *this) { orig_VGuiConnect(this); do_featureinit(); - unhook_vtable(*(void ***)vgui, vtidx_VGuiConnect, - (void *)orig_VGuiConnect); + fixes_apply(); + unhook_vtable(*(void ***)vgui, vtidx_VGuiConnect, (void *)orig_VGuiConnect); } DECL_VFUNC_DYN(bool, VGuiIsInitialized) // --- Magical deferred load order hack nonsense! --- -// The engine loads VDF plugins basically right after server.dll, but long -// before most other stuff, which makes hooking certain other stuff a pain. We -// still want to be able to load via VDF as it's the only reasonable way to get -// in before config.cfg, which is needed for any kind of configuration to work -// correctly. -// -// So here, we hook CEngineVGui::Connect() which is one the very last things -// to get called on startup, and use that hook to defer feature init till after -// most of the rest of the game is up and running. That allows us to touch -// pretty much any engine stuff without worrying about load order nonsense. +// VDF plugins load right after server.dll, but long before most other stuff. We +// want to be able to load via VDF so archived cvars in config.cfg can get set, +// but don't want to be so early that most of the game's interfaces haven't been +// brought up yet. Hook CEngineVGui::Connect(), which is called very late in +// startup, in order to init the features properly. // -// Route credit to Bill for helping figure a lot of this out - mike +// Route credit to bill for helping figure a lot of this out - mike static bool deferinit(void) { if (!vgui) { errmsg_warnx("can't use VEngineVGui for deferred feature setup"); @@ -300,7 +294,7 @@ static bool do_load(ifacefactory enginef, ifacefactory serverf) { *p++ = (void *)&nop_p_v; // OnEdictAllocated *p = (void *)&nop_p_v; // OnEdictFreed - if (!deferinit()) do_featureinit(); + if (!deferinit()) { do_featureinit(); fixes_apply(); } return true; } @@ -428,6 +422,6 @@ EXPORT const void *CreateInterface(const char *name, int *ret) { } // no better place to put this lol -#include +#include // generated by src/build/codegen.c // vi: sw=4 ts=4 noet tw=80 cc=80 -- cgit v1.2.3