forked from CSSZombieEscape/sm-ext-CSSFixes
Add forwards for Physics_RunThinkFunctions
This commit is contained in:
parent
04b749e985
commit
7f56360ee9
@ -90,11 +90,15 @@ SMEXT_LINK(&g_Interface);
|
|||||||
|
|
||||||
IGameConfig *g_pGameConf = NULL;
|
IGameConfig *g_pGameConf = NULL;
|
||||||
|
|
||||||
|
IForward *g_pOnRunThinkFunctions = NULL;
|
||||||
|
IForward *g_pOnRunThinkFunctionsPost = NULL;
|
||||||
|
|
||||||
CDetour *detourInputTestActivator = NULL;
|
CDetour *detourInputTestActivator = NULL;
|
||||||
CDetour *detourPostConstructor = NULL;
|
CDetour *detourPostConstructor = NULL;
|
||||||
CDetour *detourFindUseEntity = NULL;
|
CDetour *detourFindUseEntity = NULL;
|
||||||
CDetour *detourCTraceFilterSimple = NULL;
|
CDetour *detourCTraceFilterSimple = NULL;
|
||||||
CDetour *detourMultiWaitOver = NULL;
|
CDetour *detourMultiWaitOver = NULL;
|
||||||
|
CDetour *detourRunThinkFunctions = NULL;
|
||||||
|
|
||||||
DETOUR_DECL_MEMBER1(InputTestActivator, void, inputdata_t *, inputdata)
|
DETOUR_DECL_MEMBER1(InputTestActivator, void, inputdata_t *, inputdata)
|
||||||
{
|
{
|
||||||
@ -150,6 +154,17 @@ DETOUR_DECL_MEMBER0(MultiWaitOver, void)
|
|||||||
DETOUR_MEMBER_CALL(MultiWaitOver)();
|
DETOUR_MEMBER_CALL(MultiWaitOver)();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DETOUR_DECL_STATIC1(RunThinkFunctions, void, bool, simulating)
|
||||||
|
{
|
||||||
|
g_pOnRunThinkFunctions->PushCell(simulating);
|
||||||
|
g_pOnRunThinkFunctions->Execute();
|
||||||
|
|
||||||
|
DETOUR_STATIC_CALL(RunThinkFunctions)(simulating);
|
||||||
|
|
||||||
|
g_pOnRunThinkFunctionsPost->PushCell(simulating);
|
||||||
|
g_pOnRunThinkFunctionsPost->Execute();
|
||||||
|
}
|
||||||
|
|
||||||
bool CSSFixes::SDK_OnLoad(char *error, size_t maxlength, bool late)
|
bool CSSFixes::SDK_OnLoad(char *error, size_t maxlength, bool late)
|
||||||
{
|
{
|
||||||
char conf_error[255] = "";
|
char conf_error[255] = "";
|
||||||
@ -167,41 +182,56 @@ bool CSSFixes::SDK_OnLoad(char *error, size_t maxlength, bool late)
|
|||||||
if(detourInputTestActivator == NULL)
|
if(detourInputTestActivator == NULL)
|
||||||
{
|
{
|
||||||
snprintf(error, maxlength, "Could not create detour for CBaseFilter_InputTestActivator");
|
snprintf(error, maxlength, "Could not create detour for CBaseFilter_InputTestActivator");
|
||||||
|
SDK_OnUnload();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
detourInputTestActivator->EnableDetour();
|
|
||||||
|
|
||||||
detourPostConstructor = DETOUR_CREATE_MEMBER(PostConstructor, "CBaseEntity_PostConstructor");
|
detourPostConstructor = DETOUR_CREATE_MEMBER(PostConstructor, "CBaseEntity_PostConstructor");
|
||||||
if(detourPostConstructor == NULL)
|
if(detourPostConstructor == NULL)
|
||||||
{
|
{
|
||||||
snprintf(error, maxlength, "Could not create detour for CBaseEntity_PostConstructor");
|
snprintf(error, maxlength, "Could not create detour for CBaseEntity_PostConstructor");
|
||||||
|
SDK_OnUnload();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
detourPostConstructor->EnableDetour();
|
|
||||||
|
|
||||||
detourFindUseEntity = DETOUR_CREATE_MEMBER(FindUseEntity, "CBasePlayer_FindUseEntity");
|
detourFindUseEntity = DETOUR_CREATE_MEMBER(FindUseEntity, "CBasePlayer_FindUseEntity");
|
||||||
if(detourFindUseEntity == NULL)
|
if(detourFindUseEntity == NULL)
|
||||||
{
|
{
|
||||||
snprintf(error, maxlength, "Could not create detour for CBasePlayer_FindUseEntity");
|
snprintf(error, maxlength, "Could not create detour for CBasePlayer_FindUseEntity");
|
||||||
|
SDK_OnUnload();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
detourFindUseEntity->EnableDetour();
|
|
||||||
|
|
||||||
detourCTraceFilterSimple = DETOUR_CREATE_MEMBER(CTraceFilterSimple, "CTraceFilterSimple_CTraceFilterSimple");
|
detourCTraceFilterSimple = DETOUR_CREATE_MEMBER(CTraceFilterSimple, "CTraceFilterSimple_CTraceFilterSimple");
|
||||||
if(detourCTraceFilterSimple == NULL)
|
if(detourCTraceFilterSimple == NULL)
|
||||||
{
|
{
|
||||||
snprintf(error, maxlength, "Could not create detour for CTraceFilterSimple_CTraceFilterSimple");
|
snprintf(error, maxlength, "Could not create detour for CTraceFilterSimple_CTraceFilterSimple");
|
||||||
|
SDK_OnUnload();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
detourCTraceFilterSimple->EnableDetour();
|
|
||||||
|
|
||||||
detourMultiWaitOver = DETOUR_CREATE_MEMBER(MultiWaitOver, "CTriggerMultiple_MultiWaitOver");
|
detourMultiWaitOver = DETOUR_CREATE_MEMBER(MultiWaitOver, "CTriggerMultiple_MultiWaitOver");
|
||||||
if(detourMultiWaitOver == NULL)
|
if(detourMultiWaitOver == NULL)
|
||||||
{
|
{
|
||||||
snprintf(error, maxlength, "Could not create detour for CTriggerMultiple_MultiWaitOver");
|
snprintf(error, maxlength, "Could not create detour for CTriggerMultiple_MultiWaitOver");
|
||||||
|
SDK_OnUnload();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
detourRunThinkFunctions = DETOUR_CREATE_STATIC(RunThinkFunctions, "Physics_RunThinkFunctions");
|
||||||
|
if(detourRunThinkFunctions == NULL)
|
||||||
|
{
|
||||||
|
snprintf(error, maxlength, "Could not create detour for Physics_RunThinkFunctions");
|
||||||
|
SDK_OnUnload();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
detourInputTestActivator->EnableDetour();
|
||||||
|
detourPostConstructor->EnableDetour();
|
||||||
|
detourFindUseEntity->EnableDetour();
|
||||||
|
detourCTraceFilterSimple->EnableDetour();
|
||||||
detourMultiWaitOver->EnableDetour();
|
detourMultiWaitOver->EnableDetour();
|
||||||
|
detourRunThinkFunctions->EnableDetour();
|
||||||
|
|
||||||
// Find VTable for CTraceFilterNoNPCsOrPlayer
|
// Find VTable for CTraceFilterNoNPCsOrPlayer
|
||||||
uintptr_t pCTraceFilterNoNPCsOrPlayer;
|
uintptr_t pCTraceFilterNoNPCsOrPlayer;
|
||||||
@ -218,6 +248,7 @@ bool CSSFixes::SDK_OnLoad(char *error, size_t maxlength, bool late)
|
|||||||
if(!pServerSo)
|
if(!pServerSo)
|
||||||
{
|
{
|
||||||
snprintf(error, maxlength, "Could not dlopen server_srv.so");
|
snprintf(error, maxlength, "Could not dlopen server_srv.so");
|
||||||
|
SDK_OnUnload();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,6 +289,9 @@ bool CSSFixes::SDK_OnLoad(char *error, size_t maxlength, bool late)
|
|||||||
|
|
||||||
dlclose(pServerSo);
|
dlclose(pServerSo);
|
||||||
|
|
||||||
|
g_pOnRunThinkFunctions = forwards->CreateForward("OnRunThinkFunctions", ET_Ignore, 1, NULL, Param_Cell);
|
||||||
|
g_pOnRunThinkFunctionsPost = forwards->CreateForward("OnRunThinkFunctionsPost", ET_Ignore, 1, NULL, Param_Cell);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,6 +327,24 @@ void CSSFixes::SDK_OnUnload()
|
|||||||
detourMultiWaitOver = NULL;
|
detourMultiWaitOver = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(detourRunThinkFunctions != NULL)
|
||||||
|
{
|
||||||
|
detourRunThinkFunctions->Destroy();
|
||||||
|
detourRunThinkFunctions = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(g_pOnRunThinkFunctions != NULL)
|
||||||
|
{
|
||||||
|
forwards->ReleaseForward(g_pOnRunThinkFunctions);
|
||||||
|
g_pOnRunThinkFunctions = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(g_pOnRunThinkFunctionsPost != NULL)
|
||||||
|
{
|
||||||
|
forwards->ReleaseForward(g_pOnRunThinkFunctionsPost);
|
||||||
|
g_pOnRunThinkFunctionsPost = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
gameconfs->CloseGameConfigFile(g_pGameConf);
|
gameconfs->CloseGameConfigFile(g_pGameConf);
|
||||||
|
|
||||||
// Revert all applied patches
|
// Revert all applied patches
|
||||||
|
@ -39,6 +39,12 @@
|
|||||||
"library" "server"
|
"library" "server"
|
||||||
"linux" "@_ZN16CTriggerMultiple13MultiWaitOverEv"
|
"linux" "@_ZN16CTriggerMultiple13MultiWaitOverEv"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"Physics_RunThinkFunctions"
|
||||||
|
{
|
||||||
|
"library" "server"
|
||||||
|
"linux" "@_Z25Physics_RunThinkFunctionsb"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
29
include/CSSFixes.inc
Normal file
29
include/CSSFixes.inc
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#if defined _cssfixes_included
|
||||||
|
#endinput
|
||||||
|
#endif
|
||||||
|
#define _cssfixes_included
|
||||||
|
|
||||||
|
forward void OnRunThinkFunctions(bool simulating);
|
||||||
|
forward void OnRunThinkFunctionsPost(bool simulating);
|
||||||
|
|
||||||
|
public Extension:__ext_CSSFixes =
|
||||||
|
{
|
||||||
|
name = "CSSFixes",
|
||||||
|
file = "CSSFixes.ext",
|
||||||
|
#if defined AUTOLOAD_EXTENSIONS
|
||||||
|
autoload = 1,
|
||||||
|
#else
|
||||||
|
autoload = 0,
|
||||||
|
#endif
|
||||||
|
#if defined REQUIRE_EXTENSIONS
|
||||||
|
required = 1,
|
||||||
|
#else
|
||||||
|
required = 0,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
#if !defined REQUIRE_EXTENSIONS
|
||||||
|
public __ext_CSSFixes_SetNTVOptional()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#endif
|
@ -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."
|
#define SMEXT_CONF_DESCRIPTION "Patches bugs in the CSS server binary."
|
||||||
#define SMEXT_CONF_VERSION "1.2"
|
#define SMEXT_CONF_VERSION "1.3"
|
||||||
#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"
|
||||||
@ -59,7 +59,7 @@
|
|||||||
#define SMEXT_CONF_METAMOD
|
#define SMEXT_CONF_METAMOD
|
||||||
|
|
||||||
/** Enable interfaces you want to use here by uncommenting lines */
|
/** Enable interfaces you want to use here by uncommenting lines */
|
||||||
//#define SMEXT_ENABLE_FORWARDSYS
|
#define SMEXT_ENABLE_FORWARDSYS
|
||||||
//#define SMEXT_ENABLE_HANDLESYS
|
//#define SMEXT_ENABLE_HANDLESYS
|
||||||
//#define SMEXT_ENABLE_PLAYERHELPERS
|
//#define SMEXT_ENABLE_PLAYERHELPERS
|
||||||
//#define SMEXT_ENABLE_DBMANAGER
|
//#define SMEXT_ENABLE_DBMANAGER
|
||||||
|
Loading…
Reference in New Issue
Block a user