mirror of
https://github.com/rehlds/rehlds.git
synced 2025-02-05 02:00:34 +03:00
Implement SV_EmitPings()
hook (#858)
* Implement SV_EmitPings hook * Change REHLDS_API_VERSION_MINOR Co-authored-by: Sergey Shorokhov <wopox1337@ya.ru>
This commit is contained in:
parent
2118e8f052
commit
ed83cb6c50
@ -558,6 +558,7 @@ NOXREF qboolean SV_HasEventsInQueue(client_t *client);
|
||||
void SV_GetNetInfo(client_t *client, int *ping, int *packet_loss);
|
||||
int SV_CheckVisibility(edict_t *entity, unsigned char *pset);
|
||||
void SV_EmitPings(client_t* client, sizebuf_t* msg);
|
||||
void SV_EmitPings_internal(client_t*client, sizebuf_t *msg);
|
||||
void SV_WriteEntitiesToClient(client_t *client, sizebuf_t *msg);
|
||||
void SV_CleanupEnts(void);
|
||||
qboolean SV_SendClientDatagram(client_t *client);
|
||||
|
@ -4566,7 +4566,16 @@ int EXT_FUNC SV_CheckVisibility(edict_t *entity, unsigned char *pset)
|
||||
}
|
||||
}
|
||||
|
||||
void SV_EmitPings(client_t *client, sizebuf_t *msg)
|
||||
void EXT_FUNC SV_EmitPings_hook(IGameClient *cl, sizebuf_t *msg)
|
||||
{
|
||||
SV_EmitPings_internal(cl->GetClient(), msg);
|
||||
}
|
||||
|
||||
void SV_EmitPings(client_t* client, sizebuf_t* msg) {
|
||||
g_RehldsHookchains.m_SV_EmitPings.callChain(SV_EmitPings_hook, GetRehldsApiClient(client), msg);
|
||||
}
|
||||
|
||||
void EXT_FUNC SV_EmitPings_internal(client_t* client, sizebuf_t* msg)
|
||||
{
|
||||
int ping;
|
||||
int packet_loss;
|
||||
|
@ -211,6 +211,10 @@ typedef IHookChainRegistry<bool, IGameClient *, bool> IRehldsHookRegistry_SV_Sho
|
||||
typedef IHookChain<ENTITYINIT, char *> IRehldsHook_GetEntityInit;
|
||||
typedef IHookChainRegistry<ENTITYINIT, char *> IRehldsHookRegistry_GetEntityInit;
|
||||
|
||||
//SV_EmitPings hook
|
||||
typedef IHookChain<void, IGameClient *, sizebuf_t *> IRehldsHook_SV_EmitPings;
|
||||
typedef IHookChainRegistry<void, IGameClient *, sizebuf_t *> IRehldsHookRegistry_SV_EmitPings;
|
||||
|
||||
//ED_Alloc hook
|
||||
typedef IHookChain<edict_t *> IRehldsHook_ED_Alloc;
|
||||
typedef IHookChainRegistry<edict_t *> IRehldsHookRegistry_ED_Alloc;
|
||||
@ -267,6 +271,7 @@ public:
|
||||
virtual IRehldsHookRegistry_SV_Frame* SV_Frame() = 0;
|
||||
virtual IRehldsHookRegistry_SV_ShouldSendConsistencyList* SV_ShouldSendConsistencyList() = 0;
|
||||
virtual IRehldsHookRegistry_GetEntityInit* GetEntityInit() = 0;
|
||||
virtual IRehldsHookRegistry_SV_EmitPings* SV_EmitPings() = 0;
|
||||
virtual IRehldsHookRegistry_ED_Alloc* ED_Alloc() = 0;
|
||||
virtual IRehldsHookRegistry_ED_Free* ED_Free() = 0;
|
||||
};
|
||||
|
@ -835,6 +835,10 @@ IRehldsHookRegistry_GetEntityInit* CRehldsHookchains::GetEntityInit() {
|
||||
return &m_GetEntityInit;
|
||||
}
|
||||
|
||||
IRehldsHookRegistry_SV_EmitPings* CRehldsHookchains::SV_EmitPings() {
|
||||
return &m_SV_EmitPings;
|
||||
}
|
||||
|
||||
IRehldsHookRegistry_ED_Alloc* CRehldsHookchains::ED_Alloc() {
|
||||
return &m_ED_Alloc;
|
||||
}
|
||||
|
@ -206,6 +206,10 @@ typedef IHookChainRegistryImpl<bool, IGameClient *, bool> CRehldsHookRegistry_SV
|
||||
typedef IHookChainImpl<ENTITYINIT, char *> CRehldsHook_GetEntityInit;
|
||||
typedef IHookChainRegistryImpl<ENTITYINIT, char *> CRehldsHookRegistry_GetEntityInit;
|
||||
|
||||
//SV_EmitPings hook
|
||||
typedef IHookChainImpl<void, IGameClient *, sizebuf_t *> CRehldsHook_SV_EmitPings;
|
||||
typedef IHookChainRegistryImpl<void, IGameClient *, sizebuf_t *> CRehldsHookRegistry_SV_EmitPings;
|
||||
|
||||
//ED_Alloc hook
|
||||
typedef IHookChainImpl<edict_t *> CRehldsHook_ED_Alloc;
|
||||
typedef IHookChainRegistryImpl<edict_t *> CRehldsHookRegistry_ED_Alloc;
|
||||
@ -259,6 +263,7 @@ public:
|
||||
CRehldsHookRegistry_SV_Frame m_SV_Frame;
|
||||
CRehldsHookRegistry_SV_ShouldSendConsistencyList m_SV_ShouldSendConsistencyList;
|
||||
CRehldsHookRegistry_GetEntityInit m_GetEntityInit;
|
||||
CRehldsHookRegistry_SV_EmitPings m_SV_EmitPings;
|
||||
CRehldsHookRegistry_ED_Alloc m_ED_Alloc;
|
||||
CRehldsHookRegistry_ED_Free m_ED_Free;
|
||||
|
||||
@ -306,6 +311,7 @@ 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_SV_EmitPings* SV_EmitPings();
|
||||
EXT_FUNC virtual IRehldsHookRegistry_ED_Alloc* ED_Alloc();
|
||||
EXT_FUNC virtual IRehldsHookRegistry_ED_Free* ED_Free();
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user