mirror of
https://github.com/srcdslab/sm-ext-cssfixes.git
synced 2025-12-06 18:18:24 +00:00
fix: signatures for CS:S 18.2.25 update, broken bsp pakfile (#9)
Some checks failed
Build AlliedModders Extension / build-release-extension (push) Has been cancelled
Some checks failed
Build AlliedModders Extension / build-release-extension (push) Has been cancelled
Co-authored-by: xen <24222257+xen-000@users.noreply.github.com> Co-authored-by: The Imposter <41658916+headshotz@users.noreply.github.com> Co-authored-by: Rushaway <rushaway@hotmail.fr>
This commit is contained in:
parent
d6f595ea6f
commit
d5c807a7bf
12
README.md
12
README.md
@ -31,4 +31,14 @@ void CMovementSpeedMod::InputSpeedMod(inputdata_t &data)
|
|||||||
[...]
|
[...]
|
||||||
```
|
```
|
||||||
|
|
||||||
**NOP**'d out the block.
|
**NOP**'d out the block.
|
||||||
|
|
||||||
|
# Configuration
|
||||||
|
In cstrike/cfg/server.cfg add this
|
||||||
|
```
|
||||||
|
//============================================================================
|
||||||
|
// Late load support - since multiples things need to be init before load it
|
||||||
|
// The upcoming extensions can not use autoload file
|
||||||
|
|
||||||
|
sm exts load CSSFixes
|
||||||
|
```
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
1.18.1
|
1.18.2
|
||||||
|
|||||||
@ -1,33 +1,33 @@
|
|||||||
/**
|
/**
|
||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod Sample Extension
|
* SourceMod Sample Extension
|
||||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* 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
|
* the terms of the GNU General Public License, version 3.0, as published by the
|
||||||
* Free Software Foundation.
|
* Free Software Foundation.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* 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
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
* details.
|
* details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* As a special exception, AlliedModders LLC gives you permission to link the
|
* As a special exception, AlliedModders LLC gives you permission to link the
|
||||||
* code of this program (as well as its derivative works) to "Half-Life 2," the
|
* code of this program (as well as its derivative works) to "Half-Life 2," the
|
||||||
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
|
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
|
||||||
* by the Valve Corporation. You must obey the GNU General Public License in
|
* by the Valve Corporation. You must obey the GNU General Public License in
|
||||||
* all respects for all other code used. Additionally, AlliedModders LLC grants
|
* all respects for all other code used. Additionally, AlliedModders LLC grants
|
||||||
* this exception to all derivative works. AlliedModders LLC defines further
|
* this exception to all derivative works. AlliedModders LLC defines further
|
||||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||||
* or <http://www.sourcemod.net/license.php>.
|
* or <http://www.sourcemod.net/license.php>.
|
||||||
*
|
*
|
||||||
* Version: $Id$
|
* Version: $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "extension.h"
|
#include "extension.h"
|
||||||
#include "CDetour/detours.h"
|
#include "CDetour/detours.h"
|
||||||
@ -40,6 +40,9 @@
|
|||||||
#include <utlvector.h>
|
#include <utlvector.h>
|
||||||
#include <string_t.h>
|
#include <string_t.h>
|
||||||
|
|
||||||
|
#define VPROF_ENABLED
|
||||||
|
#include <tier0/vprof.h>
|
||||||
|
|
||||||
#define SetBit(A,I) ((A)[(I) >> 5] |= (1 << ((I) & 31)))
|
#define SetBit(A,I) ((A)[(I) >> 5] |= (1 << ((I) & 31)))
|
||||||
#define ClearBit(A,I) ((A)[(I) >> 5] &= ~(1 << ((I) & 31)))
|
#define ClearBit(A,I) ((A)[(I) >> 5] &= ~(1 << ((I) & 31)))
|
||||||
#define CheckBit(A,I) !!((A)[(I) >> 5] & (1 << ((I) & 31)))
|
#define CheckBit(A,I) !!((A)[(I) >> 5] & (1 << ((I) & 31)))
|
||||||
@ -149,69 +152,77 @@ 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 *)"\x8B\x90\xA4\x05\x00\x00\x81\xFA\x10\x6E\x3E\x00\x0F\x85\xC7\x02\x00\x00\x8B\x80\xA0\x05\x00\x00\x3D\x00\x6E\x3E\x00\x0F\x85\xEE\x02\x00\x00",
|
||||||
"xxxxxxxxxxxxxx",
|
"xx????xx????xx????xx????x????xx????",
|
||||||
(unsigned char *)"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90",
|
(unsigned char *)"\x8B\x90\xA4\x05\x00\x00\x81\xFA\x10\x6E\x3E\x00\x0F\x84\xC7\x02\x00\x00\x8B\x80\xA0\x05\x00\x00\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90",
|
||||||
"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: fix server lagging resulting from too many ConMsgs due to packet spam
|
// 9: dont reset cash to 16000 when buying an item
|
||||||
|
{
|
||||||
|
"_ZN9CCSPlayer10AddAccountEibbPKc",
|
||||||
|
(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
|
||||||
{
|
{
|
||||||
"_ZN8CNetChan19ProcessPacketHeaderEP11netpacket_s",
|
"_ZN8CNetChan19ProcessPacketHeaderEP11netpacket_s",
|
||||||
(unsigned char *)"_Z6ConMsgPKcz",
|
(unsigned char *)"_Z6ConMsgPKcz",
|
||||||
@ -221,7 +232,7 @@ static struct SrcdsPatch
|
|||||||
0x7d1, 100,
|
0x7d1, 100,
|
||||||
true, "bin/libtier0_srv.so"
|
true, "bin/libtier0_srv.so"
|
||||||
},
|
},
|
||||||
// 10: fix server lagging resulting from too many ConMsgs due to packet spam
|
// 11: fix server lagging resulting from too many ConMsgs due to packet spam
|
||||||
{
|
{
|
||||||
"_Z11NET_GetLongiP11netpacket_s",
|
"_Z11NET_GetLongiP11netpacket_s",
|
||||||
(unsigned char *)"Msg",
|
(unsigned char *)"Msg",
|
||||||
@ -231,7 +242,8 @@ static struct SrcdsPatch
|
|||||||
0x800, 100,
|
0x800, 100,
|
||||||
true, "bin/libtier0_srv.so"
|
true, "bin/libtier0_srv.so"
|
||||||
},
|
},
|
||||||
// 11: Always transmit point_viewcontrol (for debugging)
|
// 12: Always transmit point_viewcontrol (for debugging)
|
||||||
|
/*
|
||||||
{
|
{
|
||||||
"_ZN14CTriggerCamera19UpdateTransmitStateEv",
|
"_ZN14CTriggerCamera19UpdateTransmitStateEv",
|
||||||
(unsigned char *)"\x74\x16",
|
(unsigned char *)"\x74\x16",
|
||||||
@ -239,22 +251,32 @@ static struct SrcdsPatch
|
|||||||
(unsigned char *)"\xEB\x16",
|
(unsigned char *)"\xEB\x16",
|
||||||
"cstrike/bin/server_srv.so"
|
"cstrike/bin/server_srv.so"
|
||||||
},
|
},
|
||||||
// 12: 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"
|
||||||
},
|
},
|
||||||
// 13: 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"
|
||||||
},
|
},
|
||||||
|
// 18: Remove weird filename handle check in CZipPackFile::GetFileInfo that broke loading mixed case files in bsp pakfiles
|
||||||
|
{
|
||||||
|
"_ZN12CZipPackFile11GetFileInfoEPKcRiRxS2_S2_Rt",
|
||||||
|
(unsigned char *)"\x75\x00\x8B\x09",
|
||||||
|
"x?xx",
|
||||||
|
(unsigned char *)"\x90\x90\x8B\x09",
|
||||||
|
"bin/dedicated_srv.so"
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
class CBaseEntity;
|
class CBaseEntity;
|
||||||
@ -288,9 +310,9 @@ uintptr_t FindPattern(uintptr_t BaseAddr, const unsigned char *pData, const char
|
|||||||
uintptr_t FindFunctionCall(uintptr_t BaseAddr, uintptr_t Function, size_t MaxSize);
|
uintptr_t FindFunctionCall(uintptr_t BaseAddr, uintptr_t Function, size_t MaxSize);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file extension.cpp
|
* @file extension.cpp
|
||||||
* @brief Implement extension code here.
|
* @brief Implement extension code here.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CSSFixes g_Interface;
|
CSSFixes g_Interface;
|
||||||
SMEXT_LINK(&g_Interface);
|
SMEXT_LINK(&g_Interface);
|
||||||
@ -326,7 +348,6 @@ DETOUR_DECL_MEMBER1(DETOUR_InputTestActivator, void, inputdata_t *, inputdata)
|
|||||||
|
|
||||||
const char *pszNonEdicts[] =
|
const char *pszNonEdicts[] =
|
||||||
{
|
{
|
||||||
"ambient_generic",
|
|
||||||
"game_score",
|
"game_score",
|
||||||
"game_text",
|
"game_text",
|
||||||
"game_ui",
|
"game_ui",
|
||||||
@ -342,6 +363,8 @@ const char *pszNonEdicts[] =
|
|||||||
|
|
||||||
DETOUR_DECL_MEMBER1(DETOUR_PostConstructor, void, const char *, szClassname)
|
DETOUR_DECL_MEMBER1(DETOUR_PostConstructor, void, const char *, szClassname)
|
||||||
{
|
{
|
||||||
|
VPROF_ENTER_SCOPE("CSSFixes::DETOUR_PostConstructor");
|
||||||
|
|
||||||
CBaseEntity *pEntity = (CBaseEntity *)this;
|
CBaseEntity *pEntity = (CBaseEntity *)this;
|
||||||
|
|
||||||
static datamap_t *pMap = gamehelpers->GetDataMap(pEntity);
|
static datamap_t *pMap = gamehelpers->GetDataMap(pEntity);
|
||||||
@ -371,6 +394,8 @@ DETOUR_DECL_MEMBER1(DETOUR_PostConstructor, void, const char *, szClassname)
|
|||||||
}
|
}
|
||||||
|
|
||||||
DETOUR_MEMBER_CALL(DETOUR_PostConstructor)(szClassname);
|
DETOUR_MEMBER_CALL(DETOUR_PostConstructor)(szClassname);
|
||||||
|
|
||||||
|
VPROF_EXIT_SCOPE();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implementation for custom filter entities
|
// Implementation for custom filter entities
|
||||||
@ -424,15 +449,23 @@ DETOUR_DECL_MEMBER2(DETOUR_PassesFilterImpl, bool, CBaseEntity*, pCaller, CBaseE
|
|||||||
// Switch new entity classnames to ones that can be instantiated while keeping the classname keyvalue intact so it can be used later
|
// Switch new entity classnames to ones that can be instantiated while keeping the classname keyvalue intact so it can be used later
|
||||||
DETOUR_DECL_STATIC2(DETOUR_CreateEntityByName, CBaseEntity*, const char*, className, int, iForceEdictIndex)
|
DETOUR_DECL_STATIC2(DETOUR_CreateEntityByName, CBaseEntity*, const char*, className, int, iForceEdictIndex)
|
||||||
{
|
{
|
||||||
|
VPROF_ENTER_SCOPE("CSSFixes::DETOUR_CreateEntityByName");
|
||||||
|
|
||||||
// Nice of valve to expose CBaseFilter as filter_base :)
|
// Nice of valve to expose CBaseFilter as filter_base :)
|
||||||
if (strcasecmp(className, "filter_activator_context") == 0)
|
if (strcasecmp(className, "filter_activator_context") == 0)
|
||||||
className = "filter_base";
|
className = "filter_base";
|
||||||
|
|
||||||
return DETOUR_STATIC_CALL(DETOUR_CreateEntityByName)(className, iForceEdictIndex);
|
CBaseEntity *pEntity = DETOUR_STATIC_CALL(DETOUR_CreateEntityByName)(className, iForceEdictIndex);
|
||||||
|
|
||||||
|
VPROF_EXIT_SCOPE();
|
||||||
|
|
||||||
|
return pEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
DETOUR_DECL_MEMBER2(DETOUR_KeyValue, bool, const char *, szKeyName, const char *, szValue)
|
DETOUR_DECL_MEMBER2(DETOUR_KeyValue, bool, const char *, szKeyName, const char *, szValue)
|
||||||
{
|
{
|
||||||
|
VPROF_ENTER_SCOPE("CSSFixes::DETOUR_KeyValue");
|
||||||
|
|
||||||
CBaseEntity *pEntity = (CBaseEntity *)this;
|
CBaseEntity *pEntity = (CBaseEntity *)this;
|
||||||
|
|
||||||
// Fix crash bug in engine
|
// Fix crash bug in engine
|
||||||
@ -474,7 +507,11 @@ DETOUR_DECL_MEMBER2(DETOUR_KeyValue, bool, const char *, szKeyName, const char *
|
|||||||
vecAbsVelocity->Init(tmp[0], tmp[1], tmp[2]);
|
vecAbsVelocity->Init(tmp[0], tmp[1], tmp[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return DETOUR_MEMBER_CALL(DETOUR_KeyValue)(szKeyName, szValue);
|
bool bHandled = DETOUR_MEMBER_CALL(DETOUR_KeyValue)(szKeyName, szValue);
|
||||||
|
|
||||||
|
VPROF_EXIT_SCOPE();
|
||||||
|
|
||||||
|
return bHandled;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ignore players in +USE trace */
|
/* Ignore players in +USE trace */
|
||||||
@ -492,7 +529,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -768,6 +805,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++)
|
||||||
{
|
{
|
||||||
@ -781,9 +820,9 @@ bool CSSFixes::SDK_OnLoad(char *error, size_t maxlength, bool late)
|
|||||||
#endif
|
#endif
|
||||||
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);
|
||||||
@ -794,10 +833,10 @@ bool CSSFixes::SDK_OnLoad(char *error, size_t maxlength, bool late)
|
|||||||
#endif
|
#endif
|
||||||
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;
|
||||||
@ -811,9 +850,9 @@ bool CSSFixes::SDK_OnLoad(char *error, size_t maxlength, bool late)
|
|||||||
#endif
|
#endif
|
||||||
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);
|
||||||
@ -824,10 +863,10 @@ bool CSSFixes::SDK_OnLoad(char *error, size_t maxlength, bool late)
|
|||||||
#endif
|
#endif
|
||||||
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -846,9 +885,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;
|
||||||
|
|
||||||
@ -870,6 +909,12 @@ bool CSSFixes::SDK_OnLoad(char *error, size_t maxlength, bool late)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!bSuccess)
|
||||||
|
{
|
||||||
|
SDK_OnUnload();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user