mirror of
https://github.com/rehlds/rehlds.git
synced 2025-01-03 18:45:46 +03:00
Merge pull request #186 from s1lentq/rehlds_api_establish
ReHLDS API: Add hook on SV_EstablishTimeBase
This commit is contained in:
commit
39516ccfb3
@ -1464,8 +1464,18 @@ void SV_ParseDelta(client_t *pSenderClient)
|
||||
host_client->delta_sequence = MSG_ReadByte();
|
||||
}
|
||||
|
||||
/* <c03df> ../engine/sv_user.c:1790 */
|
||||
void EXT_FUNC SV_EstablishTimeBase_mod(IGameClient *cl, usercmd_t *cmds, int dropped, int numbackup, int numcmds)
|
||||
{
|
||||
SV_EstablishTimeBase_internal(cl->GetClient(), cmds, dropped, numbackup, numcmds);
|
||||
}
|
||||
|
||||
void SV_EstablishTimeBase(client_t *cl, usercmd_t *cmds, int dropped, int numbackup, int numcmds)
|
||||
{
|
||||
return g_RehldsHookchains.m_SV_EstablishTimeBase.callChain(SV_EstablishTimeBase_mod, GetRehldsApiClient(cl), cmds, dropped, numbackup, numcmds);
|
||||
}
|
||||
|
||||
/* <c03df> ../engine/sv_user.c:1790 */
|
||||
void SV_EstablishTimeBase_internal(client_t *cl, usercmd_t *cmds, int dropped, int numbackup, int numcmds)
|
||||
{
|
||||
int cmdnum;
|
||||
double runcmd_time;
|
||||
|
@ -144,6 +144,7 @@ void SV_RestoreMove(client_t *_host_client);
|
||||
void SV_ParseStringCommand(client_t *pSenderClient);
|
||||
void SV_ParseDelta(client_t *pSenderClient);
|
||||
void SV_EstablishTimeBase(client_t *cl, usercmd_t *cmds, int dropped, int numbackup, int numcmds);
|
||||
void SV_EstablishTimeBase_internal(client_t *cl, usercmd_t *cmds, int dropped, int numbackup, int numcmds);
|
||||
void SV_ParseMove(client_t *pSenderClient);
|
||||
void SV_ParseVoiceData(client_t *cl);
|
||||
void SV_IgnoreHLTV(client_t *cl);
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "model.h"
|
||||
|
||||
#define REHLDS_API_VERSION_MAJOR 2
|
||||
#define REHLDS_API_VERSION_MINOR 9
|
||||
#define REHLDS_API_VERSION_MINOR 10
|
||||
|
||||
//Steam_NotifyClientConnect hook
|
||||
typedef IHookChain<qboolean, IGameClient*, const void*, unsigned int> IRehldsHook_Steam_NotifyClientConnect;
|
||||
@ -173,6 +173,10 @@ typedef IHookChainRegistry<bool, uint64, const char *, uint32> IRehldsHookRegist
|
||||
typedef IVoidHookChain<struct cvar_s *, const char *> IRehldsHook_Cvar_DirectSet;
|
||||
typedef IVoidHookChainRegistry<struct cvar_s *, const char *> IRehldsHookRegistry_Cvar_DirectSet;
|
||||
|
||||
//SV_EstablishTimeBase hook
|
||||
typedef IVoidHookChain<IGameClient *, usercmd_t *, int, int, int> IRehldsHook_SV_EstablishTimeBase;
|
||||
typedef IVoidHookChainRegistry<IGameClient *, usercmd_t *, int, int, int> IRehldsHookRegistry_SV_EstablishTimeBase;
|
||||
|
||||
class IRehldsHookchains {
|
||||
public:
|
||||
virtual ~IRehldsHookchains() { }
|
||||
@ -211,6 +215,7 @@ public:
|
||||
virtual IRehldsHookRegistry_SV_TransferConsistencyInfo* SV_TransferConsistencyInfo() = 0;
|
||||
virtual IRehldsHookRegistry_Steam_GSBUpdateUserData* Steam_GSBUpdateUserData() = 0;
|
||||
virtual IRehldsHookRegistry_Cvar_DirectSet* Cvar_DirectSet() = 0;
|
||||
virtual IRehldsHookRegistry_SV_EstablishTimeBase* SV_EstablishTimeBase() = 0;
|
||||
};
|
||||
|
||||
struct RehldsFuncs_t {
|
||||
|
@ -71,6 +71,7 @@ public:
|
||||
virtual void SetLastVoiceTime(double time) = 0;
|
||||
virtual double GetLastVoiceTime() = 0;
|
||||
virtual bool GetLoopback() = 0;
|
||||
virtual struct usercmd_s *GetLastCmd() = 0;
|
||||
|
||||
// this must be the last virtual function in class
|
||||
#ifdef REHLDS_SELF
|
||||
|
@ -364,6 +364,10 @@ IRehldsHookRegistry_Cvar_DirectSet* CRehldsHookchains::Cvar_DirectSet() {
|
||||
return &m_Cvar_DirectSet;
|
||||
}
|
||||
|
||||
IRehldsHookRegistry_SV_EstablishTimeBase* CRehldsHookchains::SV_EstablishTimeBase() {
|
||||
return &m_SV_EstablishTimeBase;
|
||||
}
|
||||
|
||||
int EXT_FUNC CRehldsApi::GetMajorVersion()
|
||||
{
|
||||
return REHLDS_API_VERSION_MAJOR;
|
||||
|
@ -167,6 +167,10 @@ typedef IHookChainRegistryImpl<bool, uint64, const char *, uint32> CRehldsHookRe
|
||||
typedef IVoidHookChainImpl<struct cvar_s *, const char *> CRehldsHook_Cvar_DirectSet;
|
||||
typedef IVoidHookChainRegistryImpl<struct cvar_s *, const char *> CRehldsHookRegistry_Cvar_DirectSet;
|
||||
|
||||
//SV_EstablishTimeBase hook
|
||||
typedef IVoidHookChainImpl<IGameClient *, usercmd_t *, int, int, int> CRehldsHook_SV_EstablishTimeBase;
|
||||
typedef IVoidHookChainRegistryImpl<IGameClient *, usercmd_t *, int, int, int> CRehldsHookRegistry_SV_EstablishTimeBase;
|
||||
|
||||
class CRehldsHookchains : public IRehldsHookchains {
|
||||
public:
|
||||
CRehldsHookRegistry_Steam_NotifyClientConnect m_Steam_NotifyClientConnect;
|
||||
@ -203,6 +207,7 @@ public:
|
||||
CRehldsHookRegistry_SV_TransferConsistencyInfo m_SV_TransferConsistencyInfo;
|
||||
CRehldsHookRegistry_Steam_GSBUpdateUserData m_Steam_GSBUpdateUserData;
|
||||
CRehldsHookRegistry_Cvar_DirectSet m_Cvar_DirectSet;
|
||||
CRehldsHookRegistry_SV_EstablishTimeBase m_SV_EstablishTimeBase;
|
||||
|
||||
public:
|
||||
virtual IRehldsHookRegistry_Steam_NotifyClientConnect* Steam_NotifyClientConnect();
|
||||
@ -239,6 +244,7 @@ public:
|
||||
virtual IRehldsHookRegistry_SV_TransferConsistencyInfo* SV_TransferConsistencyInfo();
|
||||
virtual IRehldsHookRegistry_Steam_GSBUpdateUserData* Steam_GSBUpdateUserData();
|
||||
virtual IRehldsHookRegistry_Cvar_DirectSet* Cvar_DirectSet();
|
||||
virtual IRehldsHookRegistry_SV_EstablishTimeBase* SV_EstablishTimeBase();
|
||||
};
|
||||
|
||||
extern CRehldsHookchains g_RehldsHookchains;
|
||||
|
@ -43,6 +43,11 @@ int EXT_FUNC CGameClient::GetId()
|
||||
return m_Id;
|
||||
}
|
||||
|
||||
struct usercmd_s* EXT_FUNC CGameClient::GetLastCmd()
|
||||
{
|
||||
return &m_pClient->lastcmd;
|
||||
}
|
||||
|
||||
bool EXT_FUNC CGameClient::IsActive()
|
||||
{
|
||||
return m_pClient->active != 0;
|
||||
|
@ -92,6 +92,7 @@ public:
|
||||
virtual void SetLastVoiceTime(double time);
|
||||
virtual double GetLastVoiceTime();
|
||||
virtual bool GetLoopback();
|
||||
virtual struct usercmd_s *GetLastCmd();
|
||||
|
||||
virtual client_t* GetClient();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user