From deca47cb54e41010d1df432b699654212eb2710f Mon Sep 17 00:00:00 2001 From: hubdom <26039831+hubdom@users.noreply.github.com> Date: Wed, 2 Jun 2021 23:10:57 +0200 Subject: [PATCH 1/5] fix server lagging as a result from too many ConMsgs due to packet spam --- AMBuildScript | 4 ++-- extension.cpp | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/AMBuildScript b/AMBuildScript index 2506d84..5bfb63d 100644 --- a/AMBuildScript +++ b/AMBuildScript @@ -158,7 +158,7 @@ class ExtensionConfig(object): '-fvisibility=hidden', ] cxx.cxxflags += [ - '-std=c++11', + '-std=c++14', '-fno-exceptions', '-fno-threadsafe-statics', '-Wno-non-virtual-dtor', @@ -260,7 +260,7 @@ class ExtensionConfig(object): def configure_windows(self, cxx): cxx.defines += ['WIN32', '_WINDOWS'] - + def ConfigureForExtension(self, context, compiler): compiler.cxxincludes += [ os.path.join(context.currentSourcePath), diff --git a/extension.cpp b/extension.cpp index 1eb283e..9cf62c7 100644 --- a/extension.cpp +++ b/extension.cpp @@ -206,6 +206,14 @@ static struct SrcdsPatch "xxxxxxxxxxx", (unsigned char *)"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90", 0, 0, 0, false + }, + // 10: fix server lagging resulting from too many ConMsgs due to packet spam + { + "_ZN8CNetChan19ProcessPacketHeaderEP11netpacket_s", + (unsigned char *)"\x89\x44\x24\x04\x89\x5C\x24\x0C\x89\x54\x24\x08\xE8\xE0\xAB\x22\x00", + "xxxxxxxxxxxxx????", + (unsigned char *)"\x89\x44\x24\x04\x89\x5C\x24\x0C\x89\x54\x24\x08\x90\x90\x90\x90\x90", + 0, 0, 0, true } }; @@ -724,7 +732,7 @@ bool CSSFixes::SDK_OnLoad(char *error, size_t maxlength, bool late) return false; } - pPatch->pPatchAddress = FindPattern(pPatch->pAddress, pPatch->pPatchSignature, pPatch->pPatchPattern, 1024); + pPatch->pPatchAddress = FindPattern(pPatch->pAddress, pPatch->pPatchSignature, pPatch->pPatchPattern, 4096); if(!pPatch->pPatchAddress) { snprintf(error, maxlength, "Could not find patch signature for symbol: %s", pPatch->pSignature); From b523c933eef51ef1493c282cc29d646418a458cb Mon Sep 17 00:00:00 2001 From: hubdom <26039831+hubdom@users.noreply.github.com> Date: Thu, 3 Jun 2021 00:44:32 +0200 Subject: [PATCH 2/5] fix server lagging resulting from too many ConMsgs due to packet spam ("Invalid split packet length %i\n") --- extension.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/extension.cpp b/extension.cpp index 9cf62c7..e9fcd91 100644 --- a/extension.cpp +++ b/extension.cpp @@ -207,13 +207,21 @@ static struct SrcdsPatch (unsigned char *)"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90", 0, 0, 0, false }, - // 10: fix server lagging resulting from too many ConMsgs due to packet spam + // 10: fix server lagging resulting from too many ConMsgs due to packet spam ("%s:corrupted packet %i at %i\n") { "_ZN8CNetChan19ProcessPacketHeaderEP11netpacket_s", (unsigned char *)"\x89\x44\x24\x04\x89\x5C\x24\x0C\x89\x54\x24\x08\xE8\xE0\xAB\x22\x00", "xxxxxxxxxxxxx????", (unsigned char *)"\x89\x44\x24\x04\x89\x5C\x24\x0C\x89\x54\x24\x08\x90\x90\x90\x90\x90", 0, 0, 0, true + }, + // 11: fix server lagging resulting from too many ConMsgs due to packet spam ("Invalid split packet length %i\n") + { + "_Z11NET_GetLongiP11netpacket_s", + (unsigned char *)"\xE8\xFE\x20\x22\x00\x89\xF8\x8B\x5D\xF4\x8B\x75\xF8\x8B\x7D\xFC", + "x????xxxxxxxxxxx", + (unsigned char *)"\x90\x90\x90\x90\x90\x89\xF8\x8B\x5D\xF4\x8B\x75\xF8\x8B\x7D\xFC", + 0, 0, 0, true } }; From e71ac09ae758bd6a56f17b01586dcd1a3c3cae43 Mon Sep 17 00:00:00 2001 From: hubdom <26039831+hubdom@users.noreply.github.com> Date: Thu, 3 Jun 2021 11:59:00 +0200 Subject: [PATCH 3/5] actually pick a unqiue signature... --- extension.cpp | 6 +++--- smsdk_config.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/extension.cpp b/extension.cpp index e9fcd91..0e28d17 100644 --- a/extension.cpp +++ b/extension.cpp @@ -218,9 +218,9 @@ static struct SrcdsPatch // 11: fix server lagging resulting from too many ConMsgs due to packet spam ("Invalid split packet length %i\n") { "_Z11NET_GetLongiP11netpacket_s", - (unsigned char *)"\xE8\xFE\x20\x22\x00\x89\xF8\x8B\x5D\xF4\x8B\x75\xF8\x8B\x7D\xFC", - "x????xxxxxxxxxxx", - (unsigned char *)"\x90\x90\x90\x90\x90\x89\xF8\x8B\x5D\xF4\x8B\x75\xF8\x8B\x7D\xFC", + (unsigned char *)"\x89\x44\x24\x04\xC7\x04\x24\x98\x64\x24\x00\xE8\xFE\x20\x22\x00\x89\xF8\x8B\x5D\xF4\x8B\x75\xF8\x8B\x7D\xFC", + "xxxx???????x????xxxxxxxxxxx", + (unsigned char *)"\x89\x44\x24\x04\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x89\xF8\x8B\x5D\xF4\x8B\x75\xF8\x8B\x7D\xFC", 0, 0, 0, true } }; diff --git a/smsdk_config.h b/smsdk_config.h index c1141c5..067543b 100644 --- a/smsdk_config.h +++ b/smsdk_config.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 @@ -40,14 +40,14 @@ /* Basic information exposed publicly */ #define SMEXT_CONF_NAME "CSSFixes" #define SMEXT_CONF_DESCRIPTION "Patches bugs in the CSS server binary and more..." -#define SMEXT_CONF_VERSION "1.16" +#define SMEXT_CONF_VERSION "1.17" #define SMEXT_CONF_AUTHOR "BotoX" #define SMEXT_CONF_URL "" #define SMEXT_CONF_LOGTAG "CSSFIXES" #define SMEXT_CONF_LICENSE "GPL" #define SMEXT_CONF_DATESTRING __DATE__ -/** +/** * @brief Exposes plugin's main interface. */ #define SMEXT_LINK(name) SDKExtension *g_pExtensionIface = name; From 8564c6e069f30446e7c4c66ecaba72e0fa2563b4 Mon Sep 17 00:00:00 2001 From: Pan32 Date: Sat, 3 Jul 2021 01:09:11 +0100 Subject: [PATCH 4/5] fixed patch 1 and 2, disabled everything after 3 because I havent checked yet --- extension.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/extension.cpp b/extension.cpp index 0e28d17..d5d7ed0 100644 --- a/extension.cpp +++ b/extension.cpp @@ -146,7 +146,7 @@ static struct SrcdsPatch // 1: player_speedmod should not turn off flashlight { "_ZN17CMovementSpeedMod13InputSpeedModER11inputdata_t", - (unsigned char *)"\xFF\x90\x8C\x05\x00\x00\x85\xC0\x0F\x85\x75\x02\x00\x00", + (unsigned char *)"\xFF\x90\x8C\x05\x00\x00\x85\xC0\x0F\x85\x85\x02\x00\x00", "xxxxxxxxxxxxxx", (unsigned char *)"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90", 0, 0, 0, false @@ -154,7 +154,7 @@ static struct SrcdsPatch // 2: only select CT spawnpoints { "_ZN9CCSPlayer19EntSelectSpawnPointEv", - (unsigned char *)"\x89\x1C\x24\xE8\x00\x00\x00\x00\x83\xF8\x03\x74\x4B", + (unsigned char *)"\x89\x1C\x24\xE8\x00\x00\x00\x00\x83\xF8\x03\x74\x6B", "xxxx????xxxxx", (unsigned char *)"\x89\x1C\x24\x90\x90\x90\x90\x90\x90\x90\x90\xEB\x4B", 0, 0, 0, false @@ -168,7 +168,7 @@ static struct SrcdsPatch 0, 0, 0, false }, // 5: disable alive check in point_viewcontrol->Disable - { + /*{ "_ZN14CTriggerCamera7DisableEv", (unsigned char *)"\x8B\x10\x89\x04\x24\xFF\x92\x08\x01\x00\x00\x84\xC0\x0F\x84\x58\xFF\xFF\xFF", "xxxxxxx??xxxxxx?xxx", @@ -222,7 +222,7 @@ static struct SrcdsPatch "xxxx???????x????xxxxxxxxxxx", (unsigned char *)"\x89\x44\x24\x04\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x89\xF8\x8B\x5D\xF4\x8B\x75\xF8\x8B\x7D\xFC", 0, 0, 0, true - } + }*/ }; class CBaseEntity; From dfddfbd45430f9df2b6f5f0a4c26be3e0931af00 Mon Sep 17 00:00:00 2001 From: Pan32 Date: Sat, 3 Jul 2021 01:21:50 +0100 Subject: [PATCH 5/5] maybe? --- extension.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extension.cpp b/extension.cpp index d5d7ed0..c406e88 100644 --- a/extension.cpp +++ b/extension.cpp @@ -156,7 +156,7 @@ static struct SrcdsPatch "_ZN9CCSPlayer19EntSelectSpawnPointEv", (unsigned char *)"\x89\x1C\x24\xE8\x00\x00\x00\x00\x83\xF8\x03\x74\x6B", "xxxx????xxxxx", - (unsigned char *)"\x89\x1C\x24\x90\x90\x90\x90\x90\x90\x90\x90\xEB\x4B", + (unsigned char *)"\x89\x1C\x24\x90\x90\x90\x90\x90\x90\x90\x90\xEB\x6B", 0, 0, 0, false }, // 3: don't check if we have T spawns