From a44b5174ca815ee601e303e652fa1531a5732a34 Mon Sep 17 00:00:00 2001 From: BotoX Date: Mon, 19 Dec 2016 03:31:42 +0100 Subject: [PATCH] Only change info_player_terrorist to info_player_counterterrorist. Try stupid malloc thing because fucking dlclose doesn't unload the library?!?!?!?!?!?!?? --- extension.cpp | 13 ++++++++++--- smsdk_config.h | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/extension.cpp b/extension.cpp index 6849d86..19d3c09 100644 --- a/extension.cpp +++ b/extension.cpp @@ -123,6 +123,7 @@ DETOUR_DECL_MEMBER1(InputTestActivator, void, inputdata_t *, inputdata) DETOUR_MEMBER_CALL(InputTestActivator)(inputdata); } +char *g_pInfoPlayerCounterterroristStr = NULL; DETOUR_DECL_MEMBER1(PostConstructor, void, const char *, szClassname) { if(strncasecmp(szClassname, "info_player_", 12) == 0) @@ -133,7 +134,9 @@ DETOUR_DECL_MEMBER1(PostConstructor, void, const char *, szClassname) typedescription_t *td = gamehelpers->FindInDataMap(pMap, "m_iEFlags"); *(uint32 *)((intptr_t)pEntity + td->fieldOffset[TD_OFFSET_NORMAL]) |= (1<<9); // EFL_SERVER_ONLY - szClassname = "info_player_counterterrorist"; + + if(strcasecmp(szClassname, "info_player_terrorist") == 0) + szClassname = g_pInfoPlayerCounterterroristStr; } DETOUR_MEMBER_CALL(PostConstructor)(szClassname); @@ -145,9 +148,9 @@ DETOUR_DECL_MEMBER2(KeyValue, bool, const char *, szKeyName, const char *, szVal szKeyName = "angles"; else if(strcasecmp(szKeyName, "classname") == 0 && - strncasecmp(szValue, "info_player_", 12) == 0) + strcasecmp(szValue, "info_player_terrorist") == 0) { - szValue = "info_player_counterterrorist"; + szValue = g_pInfoPlayerCounterterroristStr; } return DETOUR_MEMBER_CALL(KeyValue)(szKeyName, szValue); @@ -331,6 +334,10 @@ bool CSSFixes::SDK_OnLoad(char *error, size_t maxlength, bool late) g_pOnRunThinkFunctions = forwards->CreateForward("OnRunThinkFunctions", ET_Ignore, 1, NULL, Param_Cell); g_pOnRunThinkFunctionsPost = forwards->CreateForward("OnRunThinkFunctionsPost", ET_Ignore, 1, NULL, Param_Cell); + const char aStr[] = "info_player_counterterrorist"; + g_pInfoPlayerCounterterroristStr = (char *)malloc(sizeof(aStr)); + memcpy(g_pInfoPlayerCounterterroristStr, aStr, sizeof(aStr)); + return true; } diff --git a/smsdk_config.h b/smsdk_config.h index cb756eb..01d4ee0 100644 --- a/smsdk_config.h +++ b/smsdk_config.h @@ -40,7 +40,7 @@ /* Basic information exposed publicly */ #define SMEXT_CONF_NAME "CSSFixes" #define SMEXT_CONF_DESCRIPTION "Patches bugs in the CSS server binary." -#define SMEXT_CONF_VERSION "1.4" +#define SMEXT_CONF_VERSION "1.4.2" #define SMEXT_CONF_AUTHOR "BotoX" #define SMEXT_CONF_URL "" #define SMEXT_CONF_LOGTAG "CSSFIXES"