mirror of
https://github.com/rehlds/rehlds.git
synced 2025-01-01 01:25:38 +03:00
ReHLDS API: Implemented SV_DropClient hook
This commit is contained in:
parent
8aa0f4cc19
commit
67e8a5b646
@ -442,40 +442,44 @@ void Host_ClientCommands(const char *fmt, ...)
|
||||
va_end(argptr);
|
||||
}
|
||||
|
||||
void EXT_FUNC SV_DropClient_hook(IGameClient* cl, bool crash, const char *string)
|
||||
{
|
||||
SV_DropClient_internal(cl->GetClient(), crash ? TRUE : FALSE, string);
|
||||
}
|
||||
|
||||
void EXT_FUNC SV_DropClient_api(IGameClient* cl, bool crash, const char* fmt, ...)
|
||||
{
|
||||
char buf[1024];
|
||||
va_list argptr;
|
||||
|
||||
va_start(argptr, fmt);
|
||||
|
||||
Q_vsnprintf(buf, ARRAYSIZE(buf) - 1, fmt, (va_list)argptr);
|
||||
Q_vsnprintf(buf, ARRAYSIZE(buf) - 1, fmt, argptr);
|
||||
va_end(argptr);
|
||||
buf[ARRAYSIZE(buf) - 1] = 0;
|
||||
|
||||
SV_DropClient(cl->GetClient(), crash ? TRUE : FALSE, "%s", buf);
|
||||
g_RehldsHookchains.m_SV_DropClient.callChain(SV_DropClient_hook, cl, crash, buf);
|
||||
}
|
||||
|
||||
void SV_DropClient(client_t *cl, qboolean crash, const char *fmt, ...)
|
||||
{
|
||||
char buf[1024];
|
||||
va_list argptr;
|
||||
|
||||
va_start(argptr, fmt);
|
||||
Q_vsnprintf(buf, ARRAYSIZE(buf) - 1, fmt, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
g_RehldsHookchains.m_SV_DropClient.callChain(SV_DropClient_hook, GetRehldsApiClient(cl), crash != FALSE, buf);
|
||||
}
|
||||
|
||||
/* <35f4e> ../engine/host.c:673 */
|
||||
void SV_DropClient(client_t *cl, qboolean crash, const char *fmt, ...)
|
||||
void SV_DropClient_internal(client_t *cl, qboolean crash, const char *string)
|
||||
{
|
||||
int i;
|
||||
char string[1024];
|
||||
unsigned char final[512];
|
||||
float connection_time;
|
||||
va_list argptr;
|
||||
|
||||
va_start(argptr, fmt);
|
||||
i = 0;
|
||||
|
||||
#ifdef REHLDS_CHECKS
|
||||
Q_vsnprintf(string, sizeof(string) - 1, fmt, (va_list)argptr);
|
||||
string[sizeof(string) - 1] = 0;
|
||||
#else
|
||||
Q_vsnprintf(string, sizeof(string), fmt, (va_list)argptr);
|
||||
#endif // REHLDS_CHECKS
|
||||
|
||||
va_end(argptr);
|
||||
|
||||
if (!crash)
|
||||
{
|
||||
if (!cl->fakeclient)
|
||||
|
@ -136,6 +136,7 @@ void SV_BroadcastPrintf(const char *fmt, ...);
|
||||
void Host_ClientCommands(const char *fmt, ...);
|
||||
void SV_DropClient_api(IGameClient* cl, bool crash, const char* fmt, ...);
|
||||
void SV_DropClient(client_t *cl, qboolean crash, const char *fmt, ...);
|
||||
void SV_DropClient_internal(client_t *cl, qboolean crash, const char *string);
|
||||
void Host_ClearClients(qboolean bFramesOnly);
|
||||
void Host_ShutdownServer(qboolean crash);
|
||||
void SV_ClearClientStates(void);
|
||||
|
@ -145,6 +145,10 @@ typedef IVoidHookChainRegistry<IGameClient *, char *, size_t, sizebuf_t *, IGame
|
||||
typedef IHookChain<bool, IGameClient *, resource_t *, uint32> IRehldsHook_SV_CheckConsistencyResponce;
|
||||
typedef IHookChainRegistry<bool, IGameClient *, resource_t *, uint32> IRehldsHookRegistry_SV_CheckConsistencyResponce;
|
||||
|
||||
//SV_DropClient hook
|
||||
typedef IVoidHookChain<IGameClient*, bool, const char*> IRehldsHook_SV_DropClient;
|
||||
typedef IVoidHookChainRegistry<IGameClient*, bool, const char*> IRehldsHookRegistry_SV_DropClient;
|
||||
|
||||
class IRehldsHookchains {
|
||||
public:
|
||||
virtual ~IRehldsHookchains() { }
|
||||
@ -176,6 +180,7 @@ public:
|
||||
virtual IRehldsHookRegistry_PF_BuildSoundMsg_I* PF_BuildSoundMsg_I() = 0;
|
||||
virtual IRehldsHookRegistry_SV_WriteFullClientUpdate* SV_WriteFullClientUpdate() = 0;
|
||||
virtual IRehldsHookRegistry_SV_CheckConsistencyResponce* SV_CheckConsistencyResponce() = 0;
|
||||
virtual IRehldsHookRegistry_SV_DropClient* SV_DropClient() = 0;
|
||||
};
|
||||
|
||||
struct RehldsFuncs_t {
|
||||
|
@ -264,6 +264,10 @@ IRehldsHookRegistry_SV_CheckConsistencyResponce* CRehldsHookchains::SV_CheckCons
|
||||
return &m_SV_CheckConsistencyResponce;
|
||||
}
|
||||
|
||||
IRehldsHookRegistry_SV_DropClient* CRehldsHookchains::SV_DropClient() {
|
||||
return &m_SV_DropClient;
|
||||
}
|
||||
|
||||
int EXT_FUNC CRehldsApi::GetMajorVersion()
|
||||
{
|
||||
return REHLDS_API_VERSION_MAJOR;
|
||||
|
@ -139,6 +139,10 @@ typedef IVoidHookChainRegistryImpl<IGameClient *, char *, size_t, sizebuf_t *, I
|
||||
typedef IHookChainImpl<bool, IGameClient *, resource_t *, uint32> CRehldsHook_SV_CheckConsistencyResponce;
|
||||
typedef IHookChainRegistryImpl<bool, IGameClient *, resource_t *, uint32> CRehldsHookRegistry_SV_CheckConsistencyResponce;
|
||||
|
||||
//SV_DropClient hook
|
||||
typedef IVoidHookChainImpl<IGameClient*, bool, const char*> CRehldsHook_SV_DropClient;
|
||||
typedef IVoidHookChainRegistryImpl<IGameClient*, bool, const char*> CRehldsHookRegistry_SV_DropClient;
|
||||
|
||||
class CRehldsHookchains : public IRehldsHookchains {
|
||||
public:
|
||||
CRehldsHookRegistry_Steam_NotifyClientConnect m_Steam_NotifyClientConnect;
|
||||
@ -168,6 +172,7 @@ public:
|
||||
CRehldsHookRegistry_PF_BuildSoundMsg_I m_PF_BuildSoundMsg_I;
|
||||
CRehldsHookRegistry_SV_WriteFullClientUpdate m_SV_WriteFullClientUpdate;
|
||||
CRehldsHookRegistry_SV_CheckConsistencyResponce m_SV_CheckConsistencyResponce;
|
||||
CRehldsHookRegistry_SV_DropClient m_SV_DropClient;
|
||||
|
||||
public:
|
||||
virtual IRehldsHookRegistry_Steam_NotifyClientConnect* Steam_NotifyClientConnect();
|
||||
@ -197,6 +202,7 @@ public:
|
||||
virtual IRehldsHookRegistry_PF_BuildSoundMsg_I* PF_BuildSoundMsg_I();
|
||||
virtual IRehldsHookRegistry_SV_WriteFullClientUpdate* SV_WriteFullClientUpdate();
|
||||
virtual IRehldsHookRegistry_SV_CheckConsistencyResponce* SV_CheckConsistencyResponce();
|
||||
virtual IRehldsHookRegistry_SV_DropClient* SV_DropClient();
|
||||
};
|
||||
|
||||
extern CRehldsHookchains g_RehldsHookchains;
|
||||
|
Loading…
Reference in New Issue
Block a user