diff options
Diffstat (limited to 'src/sst.c')
-rw-r--r-- | src/sst.c | 63 |
1 files changed, 31 insertions, 32 deletions
@@ -266,22 +266,23 @@ static bool do_load(ifacefactory enginef, ifacefactory serverf) { } factory_engine = enginef; factory_server = serverf; +#ifdef _WIN32 + void *inputsystemlib = GetModuleHandleW(L"inputsystem.dll"); +#else + // TODO(linux): assuming the above doesn't apply to this; check if it does! + // ... actually, there's a good chance this assumption is now wrong! + void *inputsystemlib = dlopen("bin/libinputsystem.so", + RTLD_NOW | RLTD_NOLOAD); + if (inputsystemlib) dlclose(inputsystemlib); // blegh +#endif + if (!inputsystemlib) { + errmsg_warndl("couldn't get the input system library"); + } + else if (!(factory_inputsystem = (ifacefactory)os_dlsym(inputsystemlib, + "CreateInterface"))) { + errmsg_warndl("couldn't get input system's CreateInterface"); + } if (!engineapi_init(ifacever)) return false; - - const void **p = vtable_firstdiff; - if (GAMETYPE_MATCHES(Portal2)) *p++ = (void *)&nop_p_v; // ClientFullyConnect - *p++ = (void *)&nop_p_v; // ClientDisconnect - *p++ = (void *)&nop_pp_v; // ClientPutInServer - *p++ = (void *)&SetCommandClient; // SetCommandClient - *p++ = (void *)&nop_p_v; // ClientSettingsChanged - *p++ = (void *)&nop_5pi_i; // ClientConnect - *p++ = ifacever > 1 ? (void *)&nop_pp_i : (void *)&nop_p_i; // ClientCommand - // remaining stuff here is backwards compatible, so added unconditionally - *p++ = (void *)&nop_pp_i; // NetworkIDValidated - *p++ = (void *)&nop_ipipp_v; // OnQueryCvarValueFinished (002+) - *p++ = (void *)&nop_p_v; // OnEdictAllocated - *p = (void *)&nop_p_v; // OnEdictFreed - #ifdef _WIN32 clientlib = GetModuleHandleW(gameinfo_clientlib); #else @@ -298,22 +299,20 @@ static bool do_load(ifacefactory enginef, ifacefactory serverf) { "CreateInterface"))) { errmsg_warndl("couldn't get client's CreateInterface"); } -#ifdef _WIN32 - void *inputsystemlib = GetModuleHandleW(L"inputsystem.dll"); -#else - // TODO(linux): assuming the above doesn't apply to this; check if it does! - // ... actually, there's a good chance this assumption is now wrong! - void *inputsystemlib = dlopen("bin/libinputsystem.so", - RTLD_NOW | RLTD_NOLOAD); - if (inputsystemlib) dlclose(inputsystemlib); // blegh -#endif - if (!inputsystemlib) { - errmsg_warndl("couldn't get the input system library"); - } - else if (!(factory_inputsystem = (ifacefactory)os_dlsym(inputsystemlib, - "CreateInterface"))) { - errmsg_warndl("couldn't get input system's CreateInterface"); - } + + const void **p = vtable_firstdiff; + if (GAMETYPE_MATCHES(Portal2)) *p++ = (void *)&nop_p_v; // ClientFullyConnect + *p++ = (void *)&nop_p_v; // ClientDisconnect + *p++ = (void *)&nop_pp_v; // ClientPutInServer + *p++ = (void *)&SetCommandClient; // SetCommandClient + *p++ = (void *)&nop_p_v; // ClientSettingsChanged + *p++ = (void *)&nop_5pi_i; // ClientConnect + *p++ = ifacever > 1 ? (void *)&nop_pp_i : (void *)&nop_p_i; // ClientCommand + // remaining stuff here is backwards compatible, so added unconditionally + *p++ = (void *)&nop_pp_i; // NetworkIDValidated + *p++ = (void *)&nop_ipipp_v; // OnQueryCvarValueFinished (002+) + *p++ = (void *)&nop_p_v; // OnEdictAllocated + *p = (void *)&nop_p_v; // OnEdictFreed // NOTE: this is technically redundant for early versions but I CBA writing // a version check; it's easier to just do this unilaterally. @@ -467,7 +466,7 @@ static const void *vtable[MAX_VTABLE_FUNCS] = { (void *)&GetPluginDescription, (void *)&nop_p_v, // LevelInit (void *)&nop_pii_v, // ServerActivate - (void *)&GameFrame, // GameFrame + (void *)&GameFrame, (void *)&nop_v_v, // LevelShutdown (void *)&ClientActive // At this point, Alien Swarm and Portal 2 add ClientFullyConnect, so we |