add vprof nodes to entity creation detours
This commit is contained in:
parent
caec6f46fe
commit
1074db2711
@ -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)))
|
||||||
@ -341,6 +344,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);
|
||||||
@ -370,6 +375,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
|
||||||
@ -423,15 +430,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
|
||||||
@ -472,8 +487,12 @@ DETOUR_DECL_MEMBER2(DETOUR_KeyValue, bool, const char *, szKeyName, const char *
|
|||||||
Vector *vecAbsVelocity = (Vector*)((uint8_t*)pEntity + m_AbsVelocity_offset);
|
Vector *vecAbsVelocity = (Vector*)((uint8_t*)pEntity + m_AbsVelocity_offset);
|
||||||
vecAbsVelocity->Init(tmp[0], tmp[1], tmp[2]);
|
vecAbsVelocity->Init(tmp[0], tmp[1], tmp[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool bHandled = DETOUR_MEMBER_CALL(DETOUR_KeyValue)(szKeyName, szValue);
|
||||||
|
|
||||||
|
VPROF_EXIT_SCOPE();
|
||||||
|
|
||||||
return DETOUR_MEMBER_CALL(DETOUR_KeyValue)(szKeyName, szValue);
|
return bHandled;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ignore players in +USE trace */
|
/* Ignore players in +USE trace */
|
||||||
|
Loading…
Reference in New Issue
Block a user