From 4abd6edcd2a73a4a8920dea7f5d018eb7f69802c Mon Sep 17 00:00:00 2001 From: xen Date: Fri, 21 Feb 2025 02:17:01 +0200 Subject: [PATCH] Fix for latest update --- extension.cpp | 121 +++++++++++++++++++++++++++---------------------- smsdk_config.h | 2 +- 2 files changed, 67 insertions(+), 56 deletions(-) diff --git a/extension.cpp b/extension.cpp index 679223f..f7dc822 100644 --- a/extension.cpp +++ b/extension.cpp @@ -152,74 +152,74 @@ static struct SrcdsPatch // 0: game_ui should not apply FL_ONTRAIN flag, else client prediction turns off { "_ZN7CGameUI5ThinkEv", - (unsigned char *)"\xC7\x44\x24\x04\x10\x00\x00\x00\x89\x34\x24\xE8\x00\x00\x00\x00", - "xxxxxxxxxxxx????", - (unsigned char *)"\xC7\x44\x24\x04\x10\x00\x00\x00\x89\x34\x24\x90\x90\x90\x90\x90", + (unsigned char *)"\x0F\x82\xC4\x03\x00\x00\x83\xEC\x08\x6A\x10\x53\xE8\x91\x00\xF5\xFF", + "xx????xx?x?xx????", + (unsigned char *)"\x0F\x82\xC4\x03\x00\x00\x83\xEC\x08\x6A\x10\x53\x90\x90\x90\x90\x90", "cstrike/bin/server_srv.so" }, // 1: player_speedmod should not turn off flashlight { "_ZN17CMovementSpeedMod13InputSpeedModER11inputdata_t", - (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", + (unsigned char *)"\x0F\x85\x00\x00\x00\x00\x83\xEC\x0C\x57\xE8\x1D\xFF\xFF\xFF\x83\xC4\x10\x09\x83", + "xx????xx?xx????xx?xx", + (unsigned char *)"\x90\x90\x90\x90\x90\x90\x83\xEC\x0C\x57\xE8\x1D\xFF\xFF\xFF\x83\xC4\x10\x09\x83", "cstrike/bin/server_srv.so" }, // 2: only select CT spawnpoints { "_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\x6B", + (unsigned char *)"\x74\x57\x83\xEC\x0C\x53\xE8\x6E\x34\xCA\xFF\x83\xC4\x10\x83\xF8\x02\x0F\x84", + "x?xx?xx????xx?xx?xx", + (unsigned char *)"\xEB\x57\x83\xEC\x0C\x53\xE8\x6E\x34\xCA\xFF\x83\xC4\x10\x83\xF8\x02\x0F\x84", "cstrike/bin/server_srv.so" }, // 3: don't check if we have T spawns { "_ZN12CCSGameRules18NeededPlayersCheckERb", - (unsigned char *)"\x74\x0E\x8B\x83\x80\x02\x00\x00\x85\xC0\x0F\x85\x9E\x00\x00\x00\xC7\x04\x24\xAC\xF7\x87\x00\xE8\xC2\x82\x91\x00", - "xxxxxxxxxxxxxxxx????????????", - (unsigned char *)"\x0F\x85\xA8\x00\x00\x00\x8B\x83\x80\x02\x00\x00\x85\xC0\x0F\x85\x9A\x00\x00\x00\x90\x90\x90\x90\x90\x90\x90\x90", + (unsigned char *)"\x74\x0A\x8B\x83\x94\x02\x00\x00\x85\xC0\x75\x4A\x83\xEC\x0C\x68\xE8\xCF\x93\x00\xE8\xA9\x46\x52\x00\x5A\x59", + "xxxx????xxx?xx?x????x????xx", + (unsigned char *)"\x75\x54\x8B\x83\x94\x02\x00\x00\x85\xC0\x75\x4A\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90", "cstrike/bin/server_srv.so" }, // 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", - (unsigned char *)"\x8B\x10\x89\x04\x24\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90", + (unsigned char *)"\x0F\x84\x47\x02\x00\x00\xF6\x83\x40\x01\x00\x00\x20\x0F\x85", + "xx????xx?????xx", + (unsigned char *)"\x90\x90\x90\x90\x90\x90\xF6\x83\x40\x01\x00\x00\x20\x0F\x85", "cstrike/bin/server_srv.so" }, // 6: disable player->m_takedamage = DAMAGE_NO in point_viewcontrol->Enable { "_ZN14CTriggerCamera6EnableEv", - (unsigned char *)"\xC6\x86\x00\x00\x00\x00\x00\x8B\x83\x00\x00\x00\x00\xA8\x20", - "xx?????xx????xx", - (unsigned char *)"\x90\x90\x90\x90\x90\x90\x90\x8B\x83\x00\x00\x00\x00\xA8\x20", + (unsigned char *)"\xC6\x80\xFD\x00\x00\x00\x00\x8B\x83", + "xxxxxxxxx", + (unsigned char *)"\x90\x90\x90\x90\x90\x90\x90\x8B\x83", "cstrike/bin/server_srv.so", 0x600 }, // 7: disable player->m_takedamage = m_nOldTakeDamage in point_viewcontrol->Disable { "_ZN14CTriggerCamera7DisableEv", - (unsigned char *)"\x89\xF9\x38\x8E\xFD\x00\x00\x00\x0F\x84\xCA\xFD\xFF\xFF", - "xxxx?xxxxxxxxx", - (unsigned char *)"\x89\xF9\x38\x8E\xFD\x00\x00\x00\x90\xE9\xCA\xFD\xFF\xFF", + (unsigned char *)"\x74\x1A\x8B\x16\x8B\x92\x04\x02\x00\x00\x81\xFA\x30\xF9\x29\x00\x0F\x85", + "x?xxxx????xx????xx", + (unsigned char *)"\xEB\x1A\x8B\x16\x8B\x92\x04\x02\x00\x00\x81\xFA\x30\xF9\x29\x00\x0F\x85", "cstrike/bin/server_srv.so" }, // 8: userinfo stringtable don't write fakeclient field { "_ZN11CBaseClient12FillUserInfoER13player_info_s", - (unsigned char *)"\xFF\x50\x70\x88\x46\x6C", - "xxxxxx", - (unsigned char *)"\x90\x90\x90\x90\x90\x90", + (unsigned char *)"\x88\x46\x6C", + "xxx", + (unsigned char *)"\x90\x90\x90", "bin/engine_srv.so" }, // 9: dont reset cash to 16000 when buying an item { "_ZN9CCSPlayer10AddAccountEibbPKc", - (unsigned char *)"\x3D\x80\x3E\x00\x00\x0F\x8F\xE8\x00\x00\x00", - "xxxxxxxxxxx", - (unsigned char *)"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90", + (unsigned char *)"\x3D\x80\x3E\x00\x00\x0F\x8F\x00\x00\x00\x00\x8D\x65", + "x????xx????xx", + (unsigned char *)"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x8D\x65", "cstrike/bin/server_srv.so" }, // 10: fix server lagging resulting from too many ConMsgs due to packet spam @@ -243,6 +243,7 @@ static struct SrcdsPatch true, "bin/libtier0_srv.so" }, // 12: Always transmit point_viewcontrol (for debugging) + /* { "_ZN14CTriggerCamera19UpdateTransmitStateEv", (unsigned char *)"\x74\x16", @@ -250,20 +251,22 @@ static struct SrcdsPatch (unsigned char *)"\xEB\x16", "cstrike/bin/server_srv.so" }, + */ // 13: CTriggerCamera::FollowTarget: Don't early return when the player handle is null { "_ZN14CTriggerCamera12FollowTargetEv", - (unsigned char *)"\x74\x1B\x89\xD0\x25\x00\x00\x00\x00\xC1\xE0\x04", - "xxxxx????xxx", - (unsigned char *)"\xEB\x23\x89\xD0\x25\x00\x00\x00\x00\xC1\xE0\x04", + (unsigned char *)"\x0F\x84\xD6\x02\x00\x00\x83\xFA\xFF", + "xxxxxxxxx", + (unsigned char *)"\x90\x90\x90\x90\x90\x90\x83\xFA\xFF", "cstrike/bin/server_srv.so" }, // 14: CGameMovement::LadderMove NOP out player->SetGravity( 0 ); + // This is in a cloned function which has a weird symbol (_ZN13CGameMovement10LadderMoveEv_part_0) so I went with the function right before it { - "_ZN13CGameMovement10LadderMoveEv", - (unsigned char *)"\xC7\x80\x78\x02\x00\x00\x00\x00\x00\x00", - "xxxxxxx???", - (unsigned char *)"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90", + "_ZN13CGameMovement12CheckFallingEv", + (unsigned char *)"\xC7\x80\xA4\x02\x00\x00\x00\x00\x00\x00\x8B\x03\x8B\x80", + "xx????????xxxx", + (unsigned char *)"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x8B\x03\x8B\x80", "cstrike/bin/server_srv.so" }, @@ -303,17 +306,17 @@ static struct SrcdsPatch //this change is desired for the new mapvoting feature so that people can still freely move at the end of the map while the vote is running. { "_ZN12CCSGameRules16GoToIntermissionEv", - (unsigned char *)"\x89\x04\x24\xE8\x6C\xA5\xFC\xFF", + (unsigned char *)"\x74\x0E\x83\xEC\x08\x6A\x40\x50", "xxxxxxxx", - (unsigned char *)"\x90\x90\x90\x90\x90\x90\x90\x90", + (unsigned char *)"\xEB\x0E\x83\xEC\x08\x6A\x40\x50", "cstrike/bin/server_srv.so" }, - //17 also NOP out boolean = true // freeze players while in intermission m_bFreezePeriod = true; + //17 also jump over boolean = true // freeze players while in intermission m_bFreezePeriod = true; { "_ZN12CCSGameRules16GoToIntermissionEv", - (unsigned char *)"\x8B\x45\x08\xC6\x80\x45\x02\x00\x00\x01", + (unsigned char *)"\x75\x0F\xE8\x69\xCE\xDA\xFF\x8B\x45\x08", "xxxxxxxxxx", - (unsigned char *)"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90", + (unsigned char *)"\xEB\x0F\xE8\x69\xCE\xDA\xFF\x8B\x45\x08", "cstrike/bin/server_srv.so" }, }; @@ -568,7 +571,7 @@ DETOUR_DECL_MEMBER3(DETOUR_CTraceFilterSimple, void, const IHandleEntity *, pass DETOUR_MEMBER_CALL(DETOUR_CTraceFilterSimple)(passedict, collisionGroup, pExtraShouldHitFunc); // If we're in FindUseEntity right now then switch out the VTable - if(g_InFindUseEntity) + if (g_InFindUseEntity) *(uintptr_t *)this = g_CTraceFilterNoNPCsOrPlayer; } @@ -844,6 +847,8 @@ bool CSSFixes::SDK_OnLoad(char *error, size_t maxlength, bool late) g_SH_SkipTwoEntitiesShouldHitEntity = SH_ADD_DVPHOOK(CTraceFilterSkipTwoEntities, ShouldHitEntity, g_CTraceFilterSkipTwoEntities, SH_STATIC(ShouldHitEntity), true); g_SH_SimpleShouldHitEntity = SH_ADD_DVPHOOK(CTraceFilterSimple, ShouldHitEntity, g_CTraceFilterSimple, SH_STATIC(ShouldHitEntity), true); + bool bSuccess = true; + // Apply all patches for(size_t i = 0; i < sizeof(gs_Patches) / sizeof(*gs_Patches); i++) { @@ -853,19 +858,19 @@ bool CSSFixes::SDK_OnLoad(char *error, size_t maxlength, bool late) void *pBinary = dlopen(pPatch->pLibrary, RTLD_NOW); if(!pBinary) { - snprintf(error, maxlength, "Could not dlopen %s", pPatch->pLibrary); - SDK_OnUnload(); - return false; + g_pSM->LogError(myself, "Could not dlopen %s", pPatch->pLibrary); + bSuccess = false; + continue; } pPatch->pAddress = (uintptr_t)memutils->ResolveSymbol(pBinary, pPatch->pSignature); dlclose(pBinary); if(!pPatch->pAddress) { - snprintf(error, maxlength, "Could not find symbol: %s in %s (%p)", + g_pSM->LogError(myself, "Could not find symbol: %s in %s (%p)", pPatch->pSignature, pPatch->pLibrary, pBinary); - SDK_OnUnload(); - return false; + bSuccess = false; + continue; } SrcdsPatch::Restore **ppRestore = &pPatch->pRestore; @@ -875,19 +880,19 @@ bool CSSFixes::SDK_OnLoad(char *error, size_t maxlength, bool late) void *pFunctionBinary = dlopen(pPatch->pFunctionLibrary, RTLD_NOW); if(!pFunctionBinary) { - snprintf(error, maxlength, "Could not dlopen %s", pPatch->pFunctionLibrary); - SDK_OnUnload(); - return false; + g_pSM->LogError(myself, "Could not dlopen %s", pPatch->pFunctionLibrary); + bSuccess = false; + continue; } pPatch->pSignatureAddress = (uintptr_t)memutils->ResolveSymbol(pFunctionBinary, (char *)pPatch->pPatchSignature); dlclose(pFunctionBinary); if(!pPatch->pSignatureAddress) { - snprintf(error, maxlength, "Could not find patch signature symbol: %s in %s (%p)", + g_pSM->LogError(myself, "Could not find patch signature symbol: %s in %s (%p)", (char *)pPatch->pPatchSignature, pPatch->pFunctionLibrary, pFunctionBinary); - SDK_OnUnload(); - return false; + bSuccess = false; + continue; } } @@ -906,9 +911,9 @@ 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); - SDK_OnUnload(); - return false; + g_pSM->LogError(myself, "Could not find patch signature for symbol: %s", pPatch->pSignature); + bSuccess = false; + continue; } ofs = pPatchAddress - pPatch->pAddress + PatchLen; @@ -930,6 +935,12 @@ bool CSSFixes::SDK_OnLoad(char *error, size_t maxlength, bool late) } } + if (!bSuccess) + { + SDK_OnUnload(); + return false; + } + return true; } diff --git a/smsdk_config.h b/smsdk_config.h index c30d65b..7dc0254 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 and more..." -#define SMEXT_CONF_VERSION "1.19" +#define SMEXT_CONF_VERSION "1.2" #define SMEXT_CONF_AUTHOR "BotoX" #define SMEXT_CONF_URL "" #define SMEXT_CONF_LOGTAG "CSSFIXES"