diff --git a/rehlds/engine/pr_edict.cpp b/rehlds/engine/pr_edict.cpp index 0768a56..2d380c5 100644 --- a/rehlds/engine/pr_edict.cpp +++ b/rehlds/engine/pr_edict.cpp @@ -37,6 +37,11 @@ void ED_ClearEdict(edict_t *e) } edict_t *ED_Alloc(void) +{ + return g_RehldsHookchains.m_ED_Alloc.callChain(ED_Alloc_internal); +} + +edict_t *EXT_FUNC ED_Alloc_internal(void) { int i; edict_t *e; @@ -71,6 +76,11 @@ edict_t *ED_Alloc(void) } void ED_Free(edict_t *ed) +{ + g_RehldsHookchains.m_ED_Free.callChain(ED_Free_internal, ed); +} + +void EXT_FUNC ED_Free_internal(edict_t *ed) { if (!ed->free) { diff --git a/rehlds/engine/pr_edict.h b/rehlds/engine/pr_edict.h index 0c6be5e..da69eca 100644 --- a/rehlds/engine/pr_edict.h +++ b/rehlds/engine/pr_edict.h @@ -35,7 +35,9 @@ void ED_ClearEdict(edict_t *e); edict_t *ED_Alloc(void); +edict_t *ED_Alloc_internal(void); void ED_Free(edict_t *ed); +void ED_Free_internal(edict_t *ed); NOXREF void ED_Count(void); char *ED_NewString(const char *string); char *ED_ParseEdict(char *data, edict_t *ent); diff --git a/rehlds/public/rehlds/rehlds_api.h b/rehlds/public/rehlds/rehlds_api.h index 4d0a74e..3b384ea 100644 --- a/rehlds/public/rehlds/rehlds_api.h +++ b/rehlds/public/rehlds/rehlds_api.h @@ -37,7 +37,7 @@ #include "pr_dlls.h" #define REHLDS_API_VERSION_MAJOR 3 -#define REHLDS_API_VERSION_MINOR 10 +#define REHLDS_API_VERSION_MINOR 11 //Steam_NotifyClientConnect hook typedef IHookChain IRehldsHook_Steam_NotifyClientConnect; @@ -211,6 +211,14 @@ typedef IHookChainRegistry IRehldsHookRegistry_SV_Sho typedef IHookChain IRehldsHook_GetEntityInit; typedef IHookChainRegistry IRehldsHookRegistry_GetEntityInit; +//ED_Alloc hook +typedef IHookChain IRehldsHook_ED_Alloc; +typedef IHookChainRegistry IRehldsHookRegistry_ED_Alloc; + +//ED_Free hook +typedef IVoidHookChain IRehldsHook_ED_Free; +typedef IVoidHookChainRegistry IRehldsHookRegistry_ED_Free; + class IRehldsHookchains { public: @@ -259,6 +267,8 @@ public: virtual IRehldsHookRegistry_SV_Frame* SV_Frame() = 0; virtual IRehldsHookRegistry_SV_ShouldSendConsistencyList* SV_ShouldSendConsistencyList() = 0; virtual IRehldsHookRegistry_GetEntityInit* GetEntityInit() = 0; + virtual IRehldsHookRegistry_ED_Alloc* ED_Alloc() = 0; + virtual IRehldsHookRegistry_ED_Free* ED_Free() = 0; }; struct RehldsFuncs_t { diff --git a/rehlds/rehlds/rehlds_api_impl.cpp b/rehlds/rehlds/rehlds_api_impl.cpp index 7cfe15e..c1274b5 100644 --- a/rehlds/rehlds/rehlds_api_impl.cpp +++ b/rehlds/rehlds/rehlds_api_impl.cpp @@ -835,6 +835,14 @@ IRehldsHookRegistry_GetEntityInit* CRehldsHookchains::GetEntityInit() { return &m_GetEntityInit; } +IRehldsHookRegistry_ED_Alloc* CRehldsHookchains::ED_Alloc() { + return &m_ED_Alloc; +} + +IRehldsHookRegistry_ED_Free* CRehldsHookchains::ED_Free() { + return &m_ED_Free; +} + int EXT_FUNC CRehldsApi::GetMajorVersion() { return REHLDS_API_VERSION_MAJOR; diff --git a/rehlds/rehlds/rehlds_api_impl.h b/rehlds/rehlds/rehlds_api_impl.h index 835a24b..6438f7b 100644 --- a/rehlds/rehlds/rehlds_api_impl.h +++ b/rehlds/rehlds/rehlds_api_impl.h @@ -206,6 +206,14 @@ typedef IHookChainRegistryImpl CRehldsHookRegistry_SV typedef IHookChainImpl CRehldsHook_GetEntityInit; typedef IHookChainRegistryImpl CRehldsHookRegistry_GetEntityInit; +//ED_Alloc hook +typedef IHookChainImpl CRehldsHook_ED_Alloc; +typedef IHookChainRegistryImpl CRehldsHookRegistry_ED_Alloc; + +//ED_Free hook +typedef IVoidHookChainImpl CRehldsHook_ED_Free; +typedef IVoidHookChainRegistryImpl CRehldsHookRegistry_ED_Free; + class CRehldsHookchains : public IRehldsHookchains { public: CRehldsHookRegistry_Steam_NotifyClientConnect m_Steam_NotifyClientConnect; @@ -251,6 +259,8 @@ public: CRehldsHookRegistry_SV_Frame m_SV_Frame; CRehldsHookRegistry_SV_ShouldSendConsistencyList m_SV_ShouldSendConsistencyList; CRehldsHookRegistry_GetEntityInit m_GetEntityInit; + CRehldsHookRegistry_ED_Alloc m_ED_Alloc; + CRehldsHookRegistry_ED_Free m_ED_Free; public: EXT_FUNC virtual IRehldsHookRegistry_Steam_NotifyClientConnect* Steam_NotifyClientConnect(); @@ -296,6 +306,8 @@ public: EXT_FUNC virtual IRehldsHookRegistry_SV_Frame* SV_Frame(); EXT_FUNC virtual IRehldsHookRegistry_SV_ShouldSendConsistencyList* SV_ShouldSendConsistencyList(); EXT_FUNC virtual IRehldsHookRegistry_GetEntityInit* GetEntityInit(); + EXT_FUNC virtual IRehldsHookRegistry_ED_Alloc* ED_Alloc(); + EXT_FUNC virtual IRehldsHookRegistry_ED_Free* ED_Free(); }; extern CRehldsHookchains g_RehldsHookchains;