From 2cc7803f402bbee948fa96bb177c357368bb2fc6 Mon Sep 17 00:00:00 2001 From: zaCade Date: Thu, 23 May 2024 13:11:22 +0200 Subject: [PATCH] Fix Formatting C: --- AMBuilder | 2 +- Makefile | 3 +-- configure.py | 2 +- extension.cpp | 48 +++++++++++++++++++++---------------------- extension.h | 2 +- gamedata/CSSFixes.txt | 2 +- 6 files changed, 29 insertions(+), 30 deletions(-) diff --git a/AMBuilder b/AMBuilder index 7059e5e..ddb8fb1 100644 --- a/AMBuilder +++ b/AMBuilder @@ -2,7 +2,7 @@ import os if not "SM" in globals(): - SM = Extension + SM = Extension projectName = 'CSSFixes' diff --git a/Makefile b/Makefile index 956b14d..0022f93 100644 --- a/Makefile +++ b/Makefile @@ -120,7 +120,7 @@ ifeq "$(USEMETA)" "true" LINK += $(LINK_HL2) INCLUDE += -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 -I$(METAMOD) \ - -I$(METAMOD)/sourcehook + -I$(METAMOD)/sourcehook CFLAGS += -DSE_EPISODEONE=1 -DSE_DARKMESSIAH=2 -DSE_ORANGEBOX=3 -DSE_BLOODYGOODTIME=4 -DSE_EYE=5 \ -DSE_CSS=6 -DSE_ORANGEBOXVALVE=7 -DSE_LEFT4DEAD=8 -DSE_LEFT4DEAD2=9 -DSE_ALIENSWARM=10 \ -DSE_PORTAL2=11 -DSE_CSGO=12 @@ -230,4 +230,3 @@ default: all clean: check rm -rf $(BIN_DIR)/*.o rm -rf $(BIN_DIR)/$(BINARY) - diff --git a/configure.py b/configure.py index 57910e8..3d07dc1 100755 --- a/configure.py +++ b/configure.py @@ -7,7 +7,7 @@ from ambuild2 import run builder = run.PrepareBuild(sourcePath = sys.path[0]) builder.options.add_option('--hl2sdk-root', type=str, dest='hl2sdk_root', default=None, - help='Root search folder for HL2SDKs') + help='Root search folder for HL2SDKs') builder.options.add_option('--mms-path', type=str, dest='mms_path', default=None, help='Path to Metamod:Source') builder.options.add_option('--sm-path', type=str, dest='sm_path', default=None, diff --git a/extension.cpp b/extension.cpp index a3c3c79..cf4609e 100644 --- a/extension.cpp +++ b/extension.cpp @@ -258,7 +258,7 @@ static struct SrcdsPatch (unsigned char *)"\xEB\x23\x89\xD0\x25\x00\x00\x00\x00\xC1\xE0\x04", "cstrike/bin/server_srv.so" }, - // 14: CGameMovement::LadderMove NOP out player->SetGravity( 0 ); + // 14: CGameMovement::LadderMove NOP out player->SetGravity( 0 ); { "_ZN13CGameMovement10LadderMoveEv", (unsigned char *)"\xC7\x80\x78\x02\x00\x00\x00\x00\x00\x00", @@ -267,13 +267,13 @@ static struct SrcdsPatch "cstrike/bin/server_srv.so" }, - // 15: I CUtlLinkedList::AllocInternal( bool multilist ) - //skip CUtlLinkedList overflow! (exhausted memory allocator) and CUtlLinkedList overflow! (exhausted index range) - //this avoids crashing when loading over 64k strings into stringpool. Custom assets in maps lead towards the limit. jenz- December 2023 - // \x90 prevent green, - // \xEB prevent red - /* - { + // 15: I CUtlLinkedList::AllocInternal( bool multilist ) + //skip CUtlLinkedList overflow! (exhausted memory allocator) and CUtlLinkedList overflow! (exhausted index range) + //this avoids crashing when loading over 64k strings into stringpool. Custom assets in maps lead towards the limit. jenz- December 2023 + // \x90 prevent green, + // \xEB prevent red + /* + { "_ZN14CUtlLinkedListI16CUtlKeyValuePairI19CUtlConstStringBaseIcE7empty_tEtLb0Et10CUtlMemoryI19UtlLinkedListElem_tIS4_tEtEE13AllocInternalEb", (unsigned char *)"\x74\x0C", "xx", @@ -298,7 +298,7 @@ static struct SrcdsPatch "bin/dedicated_srv.so" }, - */ + */ }; class CBaseEntity; @@ -368,7 +368,7 @@ DETOUR_DECL_MEMBER1(DETOUR_InputTestActivator, void, inputdata_t *, inputdata) DETOUR_MEMBER_CALL(DETOUR_InputTestActivator)(inputdata); } -const char *pszNonEdicts[] = +const char *pszNonEdicts[] = { "game_score", "game_text", @@ -388,11 +388,11 @@ DETOUR_DECL_MEMBER1(DETOUR_PostConstructor, void, const char *, szClassname) VPROF_ENTER_SCOPE("CSSFixes::DETOUR_PostConstructor"); CBaseEntity *pEntity = (CBaseEntity *)this; - + static datamap_t *pMap = gamehelpers->GetDataMap(pEntity); static typedescription_t *td = gamehelpers->FindInDataMap(pMap, "m_iEFlags"); static uint32 offset = td->fieldOffset[TD_OFFSET_NORMAL]; - + if(strncasecmp(szClassname, "info_player_", 12) == 0) { // Spawnpoints don't need edicts... @@ -401,11 +401,11 @@ DETOUR_DECL_MEMBER1(DETOUR_PostConstructor, void, const char *, szClassname) // Only CT spawnpoints if(strcasecmp(szClassname, "info_player_terrorist") == 0) szClassname = "info_player_counterterrorist"; - + DETOUR_MEMBER_CALL(DETOUR_PostConstructor)(szClassname); return; } - + // Remove edicts for a bunch of entities that REALLY don't need them for (int i = 0; i < sizeof(pszNonEdicts)/sizeof(*pszNonEdicts); i++) { @@ -416,7 +416,7 @@ DETOUR_DECL_MEMBER1(DETOUR_PostConstructor, void, const char *, szClassname) } DETOUR_MEMBER_CALL(DETOUR_PostConstructor)(szClassname); - + VPROF_EXIT_SCOPE(); } @@ -488,7 +488,7 @@ DETOUR_DECL_MEMBER2(DETOUR_KeyValue, bool, const char *, szKeyName, const char * { VPROF_ENTER_SCOPE("CSSFixes::DETOUR_KeyValue"); - CBaseEntity *pEntity = (CBaseEntity *)this; + CBaseEntity *pEntity = (CBaseEntity *)this; // Fix crash bug in engine if(strcasecmp(szKeyName, "angle") == 0) @@ -509,9 +509,9 @@ DETOUR_DECL_MEMBER2(DETOUR_KeyValue, bool, const char *, szKeyName, const char * if(pClassname && strcasecmp(pClassname, "func_buyzone") == 0) szValue = "3"; } - else if(strcasecmp(szKeyName, "absvelocity") == 0) - { - static int m_AbsVelocity_offset = 0; + else if(strcasecmp(szKeyName, "absvelocity") == 0) + { + static int m_AbsVelocity_offset = 0; if (!m_AbsVelocity_offset) { @@ -527,10 +527,10 @@ DETOUR_DECL_MEMBER2(DETOUR_KeyValue, bool, const char *, szKeyName, const char * Vector *vecAbsVelocity = (Vector*)((uint8_t*)pEntity + m_AbsVelocity_offset); vecAbsVelocity->Init(tmp[0], tmp[1], tmp[2]); - } - + } + bool bHandled = DETOUR_MEMBER_CALL(DETOUR_KeyValue)(szKeyName, szValue); - + VPROF_EXIT_SCOPE(); return bHandled; @@ -696,7 +696,7 @@ bool CSSFixes::SDK_OnLoad(char *error, size_t maxlength, bool late) { srand((unsigned int)time(NULL)); - g_iMaxPlayers = playerhelpers->GetMaxClients(); + g_iMaxPlayers = playerhelpers->GetMaxClients(); char conf_error[255] = ""; if(!gameconfs->LoadGameConfigFile("CSSFixes", &g_pGameConf, conf_error, sizeof(conf_error))) @@ -889,7 +889,7 @@ bool CSSFixes::SDK_OnLoad(char *error, size_t maxlength, bool late) if(found) break; - snprintf(error, maxlength, "Could not find patch signature for symbol: %s", pPatch->pSignature); + snprintf(error, maxlength, "Could not find patch signature for symbol: %s", pPatch->pSignature); SDK_OnUnload(); return false; } diff --git a/extension.h b/extension.h index 58ad077..f3af444 100644 --- a/extension.h +++ b/extension.h @@ -8,7 +8,7 @@ * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License, version 3.0, as published by the * Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more diff --git a/gamedata/CSSFixes.txt b/gamedata/CSSFixes.txt index e20b7f2..b04b961 100644 --- a/gamedata/CSSFixes.txt +++ b/gamedata/CSSFixes.txt @@ -15,7 +15,7 @@ "library" "server" "linux" "@_ZN11CBaseEntity15PostConstructorEPKc" } - + "CBaseFilter_PassesFilterImpl" { "library" "server"