mirror of
https://github.com/rehlds/reapi.git
synced 2024-12-29 08:05:36 +03:00
Implement GetEntityInit hook (#215)
Co-authored-by: Sergey Shorokhov <wopox1337@ya.ru>
This commit is contained in:
parent
c5fb2919b4
commit
3543e90fdf
@ -55,6 +55,11 @@ enum EngineFunc
|
||||
RH_SV_WriteFullClientUpdate,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Params: (const classname[])
|
||||
*/
|
||||
RH_GetEntityInit,
|
||||
|
||||
* Description: Called after processing a client connection request.
|
||||
* Params: (const client)
|
||||
*/
|
||||
|
@ -189,6 +189,26 @@ typedef IHookChainRegistry<int, enum sv_delta_s, IGameClient *, struct packet_en
|
||||
typedef IHookChain<bool, edict_t *, IGameClient *, int, const char*, float, float, int, int, int, const float*> IRehldsHook_SV_EmitSound2;
|
||||
typedef IHookChainRegistry<bool, edict_t *, IGameClient *, int, const char*, float, float, int, int, int, const float*> IRehldsHookRegistry_SV_EmitSound2;
|
||||
|
||||
//CreateFakeClient hook
|
||||
typedef IHookChain<edict_t *, const char *> IRehldsHook_CreateFakeClient;
|
||||
typedef IHookChainRegistry<edict_t *, const char *> IRehldsHookRegistry_CreateFakeClient;
|
||||
|
||||
//SV_CheckConnectionLessRateLimits
|
||||
typedef IHookChain<bool, netadr_t &, const uint8_t *, int> IRehldsHook_SV_CheckConnectionLessRateLimits;
|
||||
typedef IHookChainRegistry<bool, netadr_t &, const uint8_t *, int> IRehldsHookRegistry_SV_CheckConnectionLessRateLimits;
|
||||
|
||||
//SV_Frame hook
|
||||
typedef IVoidHookChain<> IRehldsHook_SV_Frame;
|
||||
typedef IVoidHookChainRegistry<> IRehldsHookRegistry_SV_Frame;
|
||||
|
||||
//SV_ShouldSendConsistencyList hook
|
||||
typedef IHookChain<bool, IGameClient *, bool> IRehldsHook_SV_ShouldSendConsistencyList;
|
||||
typedef IHookChainRegistry<bool, IGameClient *, bool> IRehldsHookRegistry_SV_ShouldSendConsistencyList;
|
||||
|
||||
//GetEntityInit hook
|
||||
typedef IHookChain<struct entvars_s *, char *> IRehldsHook_GetEntityInit;
|
||||
typedef IHookChainRegistry<struct entvars_s *, char *> IRehldsHookRegistry_GetEntityInit;
|
||||
|
||||
class IRehldsHookchains {
|
||||
public:
|
||||
virtual ~IRehldsHookchains() { }
|
||||
@ -231,6 +251,11 @@ public:
|
||||
virtual IRehldsHookRegistry_SV_Spawn_f* SV_Spawn_f() = 0;
|
||||
virtual IRehldsHookRegistry_SV_CreatePacketEntities* SV_CreatePacketEntities() = 0;
|
||||
virtual IRehldsHookRegistry_SV_EmitSound2* SV_EmitSound2() = 0;
|
||||
virtual IRehldsHookRegistry_CreateFakeClient* CreateFakeClient() = 0;
|
||||
virtual IRehldsHookRegistry_SV_CheckConnectionLessRateLimits* SV_CheckConnectionLessRateLimits() = 0;
|
||||
virtual IRehldsHookRegistry_SV_Frame* SV_Frame() = 0;
|
||||
virtual IRehldsHookRegistry_SV_ShouldSendConsistencyList* SV_ShouldSendConsistencyList() = 0;
|
||||
virtual IRehldsHookRegistry_GetEntityInit* GetEntityInit() = 0;
|
||||
};
|
||||
|
||||
struct RehldsFuncs_t {
|
||||
|
@ -63,6 +63,16 @@ void SV_WriteFullClientUpdate(IRehldsHook_SV_WriteFullClientUpdate *chain, IGame
|
||||
SV_WriteFullClientUpdate_AMXX(&data, client, (size_t)buffer, receiver);
|
||||
}
|
||||
|
||||
entvars_t *GetEntityInit(IRehldsHook_GetEntityInit *chain, char *classname)
|
||||
{
|
||||
auto original = [chain](char *_classname)
|
||||
{
|
||||
return (entvars_t *)chain->callNext(_classname);
|
||||
};
|
||||
|
||||
return callForward<entvars_t *>(RH_GetEntityInit, original, classname);
|
||||
}
|
||||
|
||||
void ClientConnected(IRehldsHook_ClientConnected* chain, IGameClient* cl)
|
||||
{
|
||||
auto original = [chain](int client)
|
||||
|
@ -344,6 +344,7 @@ struct SV_WriteFullClientUpdate_args_t
|
||||
using SV_WriteFullClientUpdate_t = hookdata_t<IRehldsHook_SV_WriteFullClientUpdate *, SV_WriteFullClientUpdate_args_t &>;
|
||||
void SV_WriteFullClientUpdate_AMXX(SV_WriteFullClientUpdate_t *data, IGameClient *client, size_t buffer, IGameClient *receiver);
|
||||
void SV_WriteFullClientUpdate(IRehldsHook_SV_WriteFullClientUpdate *chain, IGameClient *client, char *buffer, size_t maxlen, sizebuf_t *sb, IGameClient *receiver);
|
||||
entvars_s *GetEntityInit(IRehldsHook_GetEntityInit *chain, char *classname);
|
||||
|
||||
// regamedll functions
|
||||
int GetForceCamera(IReGameHook_GetForceCamera *chain, CBasePlayer *pObserver);
|
||||
|
@ -87,6 +87,7 @@ hook_t hooklist_engine[] = {
|
||||
ENG(SV_ActivateServer),
|
||||
ENG(Cvar_DirectSet),
|
||||
ENG(SV_WriteFullClientUpdate, _AMXX),
|
||||
ENG(GetEntityInit),
|
||||
ENG(ClientConnected)
|
||||
};
|
||||
|
||||
|
@ -98,6 +98,7 @@ enum EngineFunc
|
||||
RH_SV_ActivateServer,
|
||||
RH_Cvar_DirectSet,
|
||||
RH_SV_WriteFullClientUpdate,
|
||||
RH_GetEntityInit,
|
||||
RH_ClientConnected
|
||||
|
||||
// [...]
|
||||
|
Loading…
Reference in New Issue
Block a user