mirror of
https://github.com/rehlds/rehlds.git
synced 2024-12-28 07:35:47 +03:00
API: Add hooks "ED_<Alloc|Free>" (#867)
* Update pr_edict.h * Update pr_edict.cpp * Update rehlds_api_impl.cpp * Update rehlds_api_impl.h * Update rehlds_api.h * Update pr_edict.h * Update pr_edict.cpp * Update rehlds_api_impl.cpp * Update rehlds_api_impl.h * Update rehlds_api.h * Update pr_edict.cpp
This commit is contained in:
parent
aaffe43e3e
commit
04ddafe637
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -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<qboolean, IGameClient*, const void*, unsigned int> IRehldsHook_Steam_NotifyClientConnect;
|
||||
@ -211,6 +211,14 @@ typedef IHookChainRegistry<bool, IGameClient *, bool> IRehldsHookRegistry_SV_Sho
|
||||
typedef IHookChain<ENTITYINIT, char *> IRehldsHook_GetEntityInit;
|
||||
typedef IHookChainRegistry<ENTITYINIT, char *> IRehldsHookRegistry_GetEntityInit;
|
||||
|
||||
//ED_Alloc hook
|
||||
typedef IHookChain<edict_t *> IRehldsHook_ED_Alloc;
|
||||
typedef IHookChainRegistry<edict_t *> IRehldsHookRegistry_ED_Alloc;
|
||||
|
||||
//ED_Free hook
|
||||
typedef IVoidHookChain<edict_t *> IRehldsHook_ED_Free;
|
||||
typedef IVoidHookChainRegistry<edict_t *> 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 {
|
||||
|
@ -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;
|
||||
|
@ -206,6 +206,14 @@ typedef IHookChainRegistryImpl<bool, IGameClient *, bool> CRehldsHookRegistry_SV
|
||||
typedef IHookChainImpl<ENTITYINIT, char *> CRehldsHook_GetEntityInit;
|
||||
typedef IHookChainRegistryImpl<ENTITYINIT, char *> CRehldsHookRegistry_GetEntityInit;
|
||||
|
||||
//ED_Alloc hook
|
||||
typedef IHookChainImpl<edict_t *> CRehldsHook_ED_Alloc;
|
||||
typedef IHookChainRegistryImpl<edict_t *> CRehldsHookRegistry_ED_Alloc;
|
||||
|
||||
//ED_Free hook
|
||||
typedef IVoidHookChainImpl<edict_t *> CRehldsHook_ED_Free;
|
||||
typedef IVoidHookChainRegistryImpl<edict_t *> 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;
|
||||
|
Loading…
Reference in New Issue
Block a user