Fix for latest update

This commit is contained in:
xen 2025-02-21 02:17:01 +02:00
parent 4fc43bc272
commit 4abd6edcd2
2 changed files with 67 additions and 56 deletions

View File

@ -152,74 +152,74 @@ static struct SrcdsPatch
// 0: game_ui should not apply FL_ONTRAIN flag, else client prediction turns off // 0: game_ui should not apply FL_ONTRAIN flag, else client prediction turns off
{ {
"_ZN7CGameUI5ThinkEv", "_ZN7CGameUI5ThinkEv",
(unsigned char *)"\xC7\x44\x24\x04\x10\x00\x00\x00\x89\x34\x24\xE8\x00\x00\x00\x00", (unsigned char *)"\x0F\x82\xC4\x03\x00\x00\x83\xEC\x08\x6A\x10\x53\xE8\x91\x00\xF5\xFF",
"xxxxxxxxxxxx????", "xx????xx?x?xx????",
(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\x90\x90\x90\x90\x90",
"cstrike/bin/server_srv.so" "cstrike/bin/server_srv.so"
}, },
// 1: player_speedmod should not turn off flashlight // 1: player_speedmod should not turn off flashlight
{ {
"_ZN17CMovementSpeedMod13InputSpeedModER11inputdata_t", "_ZN17CMovementSpeedMod13InputSpeedModER11inputdata_t",
(unsigned char *)"\xFF\x90\x8C\x05\x00\x00\x85\xC0\x0F\x85\x85\x02\x00\x00", (unsigned char *)"\x0F\x85\x00\x00\x00\x00\x83\xEC\x0C\x57\xE8\x1D\xFF\xFF\xFF\x83\xC4\x10\x09\x83",
"xxxxxxxxxxxxxx", "xx????xx?xx????xx?xx",
(unsigned char *)"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90", (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" "cstrike/bin/server_srv.so"
}, },
// 2: only select CT spawnpoints // 2: only select CT spawnpoints
{ {
"_ZN9CCSPlayer19EntSelectSpawnPointEv", "_ZN9CCSPlayer19EntSelectSpawnPointEv",
(unsigned char *)"\x89\x1C\x24\xE8\x00\x00\x00\x00\x83\xF8\x03\x74\x6B", (unsigned char *)"\x74\x57\x83\xEC\x0C\x53\xE8\x6E\x34\xCA\xFF\x83\xC4\x10\x83\xF8\x02\x0F\x84",
"xxxx????xxxxx", "x?xx?xx????xx?xx?xx",
(unsigned char *)"\x89\x1C\x24\x90\x90\x90\x90\x90\x90\x90\x90\xEB\x6B", (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" "cstrike/bin/server_srv.so"
}, },
// 3: don't check if we have T spawns // 3: don't check if we have T spawns
{ {
"_ZN12CCSGameRules18NeededPlayersCheckERb", "_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", (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",
"xxxxxxxxxxxxxxxx????????????", "xxxx????xxx?xx?x????x????xx",
(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 *)"\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" "cstrike/bin/server_srv.so"
}, },
// 5: disable alive check in point_viewcontrol->Disable // 5: disable alive check in point_viewcontrol->Disable
{ {
"_ZN14CTriggerCamera7DisableEv", "_ZN14CTriggerCamera7DisableEv",
(unsigned char *)"\x8B\x10\x89\x04\x24\xFF\x92\x08\x01\x00\x00\x84\xC0\x0F\x84\x58\xFF\xFF\xFF", (unsigned char *)"\x0F\x84\x47\x02\x00\x00\xF6\x83\x40\x01\x00\x00\x20\x0F\x85",
"xxxxxxx??xxxxxx?xxx", "xx????xx?????xx",
(unsigned char *)"\x8B\x10\x89\x04\x24\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90", (unsigned char *)"\x90\x90\x90\x90\x90\x90\xF6\x83\x40\x01\x00\x00\x20\x0F\x85",
"cstrike/bin/server_srv.so" "cstrike/bin/server_srv.so"
}, },
// 6: disable player->m_takedamage = DAMAGE_NO in point_viewcontrol->Enable // 6: disable player->m_takedamage = DAMAGE_NO in point_viewcontrol->Enable
{ {
"_ZN14CTriggerCamera6EnableEv", "_ZN14CTriggerCamera6EnableEv",
(unsigned char *)"\xC6\x86\x00\x00\x00\x00\x00\x8B\x83\x00\x00\x00\x00\xA8\x20", (unsigned char *)"\xC6\x80\xFD\x00\x00\x00\x00\x8B\x83",
"xx?????xx????xx", "xxxxxxxxx",
(unsigned char *)"\x90\x90\x90\x90\x90\x90\x90\x8B\x83\x00\x00\x00\x00\xA8\x20", (unsigned char *)"\x90\x90\x90\x90\x90\x90\x90\x8B\x83",
"cstrike/bin/server_srv.so", "cstrike/bin/server_srv.so",
0x600 0x600
}, },
// 7: disable player->m_takedamage = m_nOldTakeDamage in point_viewcontrol->Disable // 7: disable player->m_takedamage = m_nOldTakeDamage in point_viewcontrol->Disable
{ {
"_ZN14CTriggerCamera7DisableEv", "_ZN14CTriggerCamera7DisableEv",
(unsigned char *)"\x89\xF9\x38\x8E\xFD\x00\x00\x00\x0F\x84\xCA\xFD\xFF\xFF", (unsigned char *)"\x74\x1A\x8B\x16\x8B\x92\x04\x02\x00\x00\x81\xFA\x30\xF9\x29\x00\x0F\x85",
"xxxx?xxxxxxxxx", "x?xxxx????xx????xx",
(unsigned char *)"\x89\xF9\x38\x8E\xFD\x00\x00\x00\x90\xE9\xCA\xFD\xFF\xFF", (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" "cstrike/bin/server_srv.so"
}, },
// 8: userinfo stringtable don't write fakeclient field // 8: userinfo stringtable don't write fakeclient field
{ {
"_ZN11CBaseClient12FillUserInfoER13player_info_s", "_ZN11CBaseClient12FillUserInfoER13player_info_s",
(unsigned char *)"\xFF\x50\x70\x88\x46\x6C", (unsigned char *)"\x88\x46\x6C",
"xxxxxx", "xxx",
(unsigned char *)"\x90\x90\x90\x90\x90\x90", (unsigned char *)"\x90\x90\x90",
"bin/engine_srv.so" "bin/engine_srv.so"
}, },
// 9: dont reset cash to 16000 when buying an item // 9: dont reset cash to 16000 when buying an item
{ {
"_ZN9CCSPlayer10AddAccountEibbPKc", "_ZN9CCSPlayer10AddAccountEibbPKc",
(unsigned char *)"\x3D\x80\x3E\x00\x00\x0F\x8F\xE8\x00\x00\x00", (unsigned char *)"\x3D\x80\x3E\x00\x00\x0F\x8F\x00\x00\x00\x00\x8D\x65",
"xxxxxxxxxxx", "x????xx????xx",
(unsigned char *)"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90", (unsigned char *)"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x8D\x65",
"cstrike/bin/server_srv.so" "cstrike/bin/server_srv.so"
}, },
// 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
@ -243,6 +243,7 @@ static struct SrcdsPatch
true, "bin/libtier0_srv.so" true, "bin/libtier0_srv.so"
}, },
// 12: Always transmit point_viewcontrol (for debugging) // 12: Always transmit point_viewcontrol (for debugging)
/*
{ {
"_ZN14CTriggerCamera19UpdateTransmitStateEv", "_ZN14CTriggerCamera19UpdateTransmitStateEv",
(unsigned char *)"\x74\x16", (unsigned char *)"\x74\x16",
@ -250,20 +251,22 @@ static struct SrcdsPatch
(unsigned char *)"\xEB\x16", (unsigned char *)"\xEB\x16",
"cstrike/bin/server_srv.so" "cstrike/bin/server_srv.so"
}, },
*/
// 13: CTriggerCamera::FollowTarget: Don't early return when the player handle is null // 13: CTriggerCamera::FollowTarget: Don't early return when the player handle is null
{ {
"_ZN14CTriggerCamera12FollowTargetEv", "_ZN14CTriggerCamera12FollowTargetEv",
(unsigned char *)"\x74\x1B\x89\xD0\x25\x00\x00\x00\x00\xC1\xE0\x04", (unsigned char *)"\x0F\x84\xD6\x02\x00\x00\x83\xFA\xFF",
"xxxxx????xxx", "xxxxxxxxx",
(unsigned char *)"\xEB\x23\x89\xD0\x25\x00\x00\x00\x00\xC1\xE0\x04", (unsigned char *)"\x90\x90\x90\x90\x90\x90\x83\xFA\xFF",
"cstrike/bin/server_srv.so" "cstrike/bin/server_srv.so"
}, },
// 14: CGameMovement::LadderMove NOP out player->SetGravity( 0 ); // 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", "_ZN13CGameMovement12CheckFallingEv",
(unsigned char *)"\xC7\x80\x78\x02\x00\x00\x00\x00\x00\x00", (unsigned char *)"\xC7\x80\xA4\x02\x00\x00\x00\x00\x00\x00\x8B\x03\x8B\x80",
"xxxxxxx???", "xx????????xxxx",
(unsigned char *)"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90", (unsigned char *)"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x8B\x03\x8B\x80",
"cstrike/bin/server_srv.so" "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. //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", "_ZN12CCSGameRules16GoToIntermissionEv",
(unsigned char *)"\x89\x04\x24\xE8\x6C\xA5\xFC\xFF", (unsigned char *)"\x74\x0E\x83\xEC\x08\x6A\x40\x50",
"xxxxxxxx", "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" "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", "_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", "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" "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); DETOUR_MEMBER_CALL(DETOUR_CTraceFilterSimple)(passedict, collisionGroup, pExtraShouldHitFunc);
// If we're in FindUseEntity right now then switch out the VTable // If we're in FindUseEntity right now then switch out the VTable
if(g_InFindUseEntity) if (g_InFindUseEntity)
*(uintptr_t *)this = g_CTraceFilterNoNPCsOrPlayer; *(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_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); g_SH_SimpleShouldHitEntity = SH_ADD_DVPHOOK(CTraceFilterSimple, ShouldHitEntity, g_CTraceFilterSimple, SH_STATIC(ShouldHitEntity), true);
bool bSuccess = true;
// Apply all patches // Apply all patches
for(size_t i = 0; i < sizeof(gs_Patches) / sizeof(*gs_Patches); i++) 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); void *pBinary = dlopen(pPatch->pLibrary, RTLD_NOW);
if(!pBinary) if(!pBinary)
{ {
snprintf(error, maxlength, "Could not dlopen %s", pPatch->pLibrary); g_pSM->LogError(myself, "Could not dlopen %s", pPatch->pLibrary);
SDK_OnUnload(); bSuccess = false;
return false; continue;
} }
pPatch->pAddress = (uintptr_t)memutils->ResolveSymbol(pBinary, pPatch->pSignature); pPatch->pAddress = (uintptr_t)memutils->ResolveSymbol(pBinary, pPatch->pSignature);
dlclose(pBinary); dlclose(pBinary);
if(!pPatch->pAddress) 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); pPatch->pSignature, pPatch->pLibrary, pBinary);
SDK_OnUnload(); bSuccess = false;
return false; continue;
} }
SrcdsPatch::Restore **ppRestore = &pPatch->pRestore; 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); void *pFunctionBinary = dlopen(pPatch->pFunctionLibrary, RTLD_NOW);
if(!pFunctionBinary) if(!pFunctionBinary)
{ {
snprintf(error, maxlength, "Could not dlopen %s", pPatch->pFunctionLibrary); g_pSM->LogError(myself, "Could not dlopen %s", pPatch->pFunctionLibrary);
SDK_OnUnload(); bSuccess = false;
return false; continue;
} }
pPatch->pSignatureAddress = (uintptr_t)memutils->ResolveSymbol(pFunctionBinary, (char *)pPatch->pPatchSignature); pPatch->pSignatureAddress = (uintptr_t)memutils->ResolveSymbol(pFunctionBinary, (char *)pPatch->pPatchSignature);
dlclose(pFunctionBinary); dlclose(pFunctionBinary);
if(!pPatch->pSignatureAddress) 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); (char *)pPatch->pPatchSignature, pPatch->pFunctionLibrary, pFunctionBinary);
SDK_OnUnload(); bSuccess = false;
return false; continue;
} }
} }
@ -906,9 +911,9 @@ bool CSSFixes::SDK_OnLoad(char *error, size_t maxlength, bool late)
if(found) if(found)
break; break;
snprintf(error, maxlength, "Could not find patch signature for symbol: %s", pPatch->pSignature); g_pSM->LogError(myself, "Could not find patch signature for symbol: %s", pPatch->pSignature);
SDK_OnUnload(); bSuccess = false;
return false; continue;
} }
ofs = pPatchAddress - pPatch->pAddress + PatchLen; 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; return true;
} }

View File

@ -40,7 +40,7 @@
/* Basic information exposed publicly */ /* Basic information exposed publicly */
#define SMEXT_CONF_NAME "CSSFixes" #define SMEXT_CONF_NAME "CSSFixes"
#define SMEXT_CONF_DESCRIPTION "Patches bugs in the CSS server binary and more..." #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_AUTHOR "BotoX"
#define SMEXT_CONF_URL "" #define SMEXT_CONF_URL ""
#define SMEXT_CONF_LOGTAG "CSSFIXES" #define SMEXT_CONF_LOGTAG "CSSFIXES"