2
0
mirror of https://github.com/rehlds/rehlds.git synced 2024-12-27 07:05:43 +03:00

Add SV_SendResources hook (#1024)

* Implement `SV_AddResources` hook
This commit is contained in:
Adrian Cirstea 2024-05-10 14:15:22 +03:00 committed by GitHub
parent 693b51c883
commit 82a3d1d084
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 23 additions and 2 deletions

View File

@ -461,6 +461,7 @@ void SV_QueryMovevarsChanged(void);
void SV_SendServerinfo(sizebuf_t *msg, client_t *client);
void SV_SendServerinfo_internal(sizebuf_t *msg, client_t *client);
void SV_SendResources(sizebuf_t *msg);
void SV_SendResources_internal(sizebuf_t *msg);
void SV_WriteClientdataToMessage(client_t *client, sizebuf_t *msg);
void SV_WriteSpawn(sizebuf_t *msg);
void SV_SendUserReg(sizebuf_t *msg);

View File

@ -1199,6 +1199,11 @@ void SV_SendServerinfo_internal(sizebuf_t *msg, client_t *client)
}
void SV_SendResources(sizebuf_t *msg)
{
g_RehldsHookchains.m_SV_SendResources.callChain(SV_SendResources_internal, msg);
}
void EXT_FUNC SV_SendResources_internal(sizebuf_t *msg)
{
unsigned char nullbuffer[32];
Q_memset(nullbuffer, 0, sizeof(nullbuffer));

View File

@ -37,7 +37,7 @@
#include "pr_dlls.h"
#define REHLDS_API_VERSION_MAJOR 3
#define REHLDS_API_VERSION_MINOR 13
#define REHLDS_API_VERSION_MINOR 14
//Steam_NotifyClientConnect hook
typedef IHookChain<qboolean, IGameClient*, const void*, unsigned int> IRehldsHook_Steam_NotifyClientConnect;
@ -259,6 +259,10 @@ typedef IVoidHookChainRegistry<const char *> IRehldsHookRegistry_SV_ClientPrintf
typedef IHookChain<bool, edict_t*, edict_t*> IRehldsHook_SV_AllowPhysent;
typedef IHookChainRegistry<bool, edict_t*, edict_t*> IRehldsHookRegistry_SV_AllowPhysent;
//SV_SendResources hook
typedef IVoidHookChain<sizebuf_t *> IRehldsHook_SV_SendResources;
typedef IVoidHookChainRegistry<sizebuf_t *> IRehldsHookRegistry_SV_SendResources;
class IRehldsHookchains {
public:
virtual ~IRehldsHookchains() { }
@ -318,6 +322,7 @@ public:
virtual IRehldsHookRegistry_SV_AddResource* SV_AddResource() = 0;
virtual IRehldsHookRegistry_SV_ClientPrintf* SV_ClientPrintf() = 0;
virtual IRehldsHookRegistry_SV_AllowPhysent* SV_AllowPhysent() = 0;
virtual IRehldsHookRegistry_SV_SendResources* SV_SendResources() = 0;
};
struct RehldsFuncs_t {

View File

@ -885,6 +885,10 @@ IRehldsHookRegistry_SV_AllowPhysent* CRehldsHookchains::SV_AllowPhysent() {
return &m_SV_AllowPhysent;
}
IRehldsHookRegistry_SV_SendResources* CRehldsHookchains::SV_SendResources() {
return &m_SV_SendResources;
}
int EXT_FUNC CRehldsApi::GetMajorVersion()
{
return REHLDS_API_VERSION_MAJOR;

View File

@ -254,6 +254,10 @@ typedef IVoidHookChainRegistryImpl<const char*> CRehldsHookRegistry_SV_ClientPri
typedef IHookChainImpl<bool, edict_t*, edict_t*> CRehldsHook_SV_AllowPhysent;
typedef IHookChainRegistryImpl<bool, edict_t*, edict_t*> CRehldsHookRegistry_SV_AllowPhysent;
//SV_SendResources hook
typedef IVoidHookChainImpl<sizebuf_t *> CRehldsHook_SV_SendResources;
typedef IVoidHookChainRegistryImpl<sizebuf_t *> CRehldsHookRegistry_SV_SendResources;
class CRehldsHookchains : public IRehldsHookchains {
public:
CRehldsHookRegistry_Steam_NotifyClientConnect m_Steam_NotifyClientConnect;
@ -311,6 +315,7 @@ public:
CRehldsHookRegistry_SV_AddResource m_SV_AddResource;
CRehldsHookRegistry_SV_ClientPrintf m_SV_ClientPrintf;
CRehldsHookRegistry_SV_AllowPhysent m_SV_AllowPhysent;
CRehldsHookRegistry_SV_SendResources m_SV_SendResources;
public:
EXT_FUNC virtual IRehldsHookRegistry_Steam_NotifyClientConnect* Steam_NotifyClientConnect();
@ -368,6 +373,7 @@ public:
EXT_FUNC virtual IRehldsHookRegistry_SV_AddResource* SV_AddResource();
EXT_FUNC virtual IRehldsHookRegistry_SV_ClientPrintf* SV_ClientPrintf();
EXT_FUNC virtual IRehldsHookRegistry_SV_AllowPhysent* SV_AllowPhysent();
EXT_FUNC virtual IRehldsHookRegistry_SV_SendResources* SV_SendResources();
};
extern CRehldsHookchains g_RehldsHookchains;

View File

@ -6,5 +6,5 @@
#pragma once
#define VERSION_MAJOR 3
#define VERSION_MINOR 13
#define VERSION_MINOR 14
#define VERSION_MAINTENANCE 0