summaryrefslogtreecommitdiffhomepage
path: root/src/sst.c
diff options
context:
space:
mode:
authorMichael Smith <mikesmiffy128@gmail.com>2023-06-02 17:03:47 +0100
committerMichael Smith <mikesmiffy128@gmail.com>2023-06-03 13:25:12 +0100
commit602a18977d500ad068fd63fbedcafb630c29ee72 (patch)
tree84ef367d7b0dd2870520c3cdb141e41ec2ca212b /src/sst.c
parent2ba71f27c46dc38b76e932b1b1967d96a9b9f107 (diff)
Adapt vote reset code into fast campaign resetting
This is kind of a breaking change but the other code was obviously never released or relied on by anyone - it will be pushed at the same time as this in fact. It still seems worth having the original committed separately to show the progression of development of the feature, however. Technically the standalone vote cooldown resetting could also be added back if ever desired however there doesn't seem to be that much of a use case for that at the moment. This feature ought to be a lot more convenient now as it allows for resetting back to a set starting point no matter where the player is in a run. It isn't universally useful as All Campaigns Legacy solo runs require switching to a different type of server and Main Campaigns co-op runs require restarting the game after Swamp Fever to work around the god mode bug, however it is still useful in a good few situations. Unfortunately this turned out to be pretty complex to implement, first requiring a bunch of interop with valve's rather wacky KeyValues stuff, and then requiring a bunch of especially difficult reverse engineering of L4D1 v1.0.0.5 because it doesn't use said KeyValues stuff and does something else completely different instead. A side effect of all this work is that the nag removal hack is now part of the KeyValues stuff in kvsys.c, which is kind of a comfier place for it than just kind of dumped in the middle of sst.c.
Diffstat (limited to 'src/sst.c')
-rw-r--r--src/sst.c36
1 files changed, 0 insertions, 36 deletions
diff --git a/src/sst.c b/src/sst.c
index 5d21f06..a0f926d 100644
--- a/src/sst.c
+++ b/src/sst.c
@@ -143,23 +143,6 @@ DEF_CCMD_HERE(sst_printversion, "Display plugin version information", 0) {
con_msg("v" VERSION "\n");
}
-// HACK: later versions of L4D2 show an annoying dialog on every plugin_load.
-// We can suppress this by catching the message string that's passed from
-// engine.dll to gameui.dll through KeyValuesSystem in vstdlib.dll and just
-// replacing it with some other arbitrary garbage string. This makes gameui fail
-// to match the message and thus do nothing. :)
-static void **kvsvt;
-typedef const char *(*VCALLCONV GetStringForSymbol_func)(void *this, int s);
-static GetStringForSymbol_func orig_GetStringForSymbol = 0;
-static const char *VCALLCONV GetStringForSymbol_hook(void *this, int s) {
- const char *ret = orig_GetStringForSymbol(this, s);
- if (!strcmp(ret, "OnClientPluginWarning")) ret = "sstBlockedThisEvent";
- return ret;
-}
-
-// vstdlib symbol, only currently used in l4d2 but exists everywhere so oh well
-IMPORT void *KeyValuesSystem(void);
-
// most plugin callbacks are unused - define dummy functions for each signature
static void VCALLCONV nop_v_v(void *this) {}
static void VCALLCONV nop_p_v(void *this, void *p) {}
@@ -317,21 +300,6 @@ static bool do_load(ifacefactory enginef, ifacefactory serverf) {
*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.
- if (GAMETYPE_MATCHES(L4D2x)) {
- void *kvs = KeyValuesSystem();
- kvsvt = *(void ***)kvs;
- if (!os_mprot(kvsvt + 4, sizeof(void *), PAGE_READWRITE)) {
- errmsg_warnx("couldn't make KeyValuesSystem vtable writable");
- errmsg_note("won't be able to prevent any nag messages");
- }
- else {
- orig_GetStringForSymbol = (GetStringForSymbol_func)hook_vtable(
- kvsvt, 4, (void *)GetStringForSymbol_hook);
- }
- }
-
if (!deferinit()) do_featureinit();
return true;
}
@@ -378,10 +346,6 @@ static void do_unload(void) {
if (clientlib) dlclose(clientlib);
#endif
con_disconnect();
-
- if (orig_GetStringForSymbol) {
- unhook_vtable(kvsvt, 4, (void *)orig_GetStringForSymbol);
- }
}
static bool VCALLCONV Load(void *this, ifacefactory enginef,