From e4d8e0ae96e457d87dadda419fd4c98444882f45 Mon Sep 17 00:00:00 2001 From: WPMGPRoSToTeMa Date: Wed, 15 Jul 2015 12:25:55 +0300 Subject: [PATCH] Added PrepareUserInfoToTransmit callback to ReHLDS API --- rehlds/engine/sv_main.cpp | 2 ++ rehlds/public/rehlds/rehlds_api.h | 7 ++++++- rehlds/rehlds/rehlds_api_impl.cpp | 4 ++++ rehlds/rehlds/rehlds_api_impl.h | 6 ++++++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/rehlds/engine/sv_main.cpp b/rehlds/engine/sv_main.cpp index 7d13556..4276185 100644 --- a/rehlds/engine/sv_main.cpp +++ b/rehlds/engine/sv_main.cpp @@ -3713,6 +3713,8 @@ void SV_FullClientUpdate(client_t *cl, sizebuf_t *sb) info[sizeof(info) - 1] = 0; Info_RemovePrefixedKeys(info, '_'); + g_RehldsHookchains.m_PrepareUserInfoToTransmit.callChain(nullptr, GetRehldsApiClient(cl), info); + MD5Init(&ctx); MD5Update(&ctx, (unsigned char*)cl->hashedcdkey, sizeof(cl->hashedcdkey)); MD5Final(digest, &ctx); diff --git a/rehlds/public/rehlds/rehlds_api.h b/rehlds/public/rehlds/rehlds_api.h index 57e5c43..cf5d67b 100644 --- a/rehlds/public/rehlds/rehlds_api.h +++ b/rehlds/public/rehlds/rehlds_api.h @@ -35,7 +35,7 @@ #include "model.h" #define REHLDS_API_VERSION_MAJOR 1 -#define REHLDS_API_VERSION_MINOR 3 +#define REHLDS_API_VERSION_MINOR 4 //Steam_NotifyClientConnect hook typedef IHookChain IRehldsHook_Steam_NotifyClientConnect; @@ -137,6 +137,10 @@ typedef IVoidHookChainRegistry IRehldsHookRegistry_PF_Remove_I; typedef IVoidHookChain IRehldsHook_PF_BuildSoundMsg_I; typedef IVoidHookChainRegistry IRehldsHookRegistry_PF_BuildSoundMsg_I; +// PrepareUserInfoToTransmit hook +typedef IVoidHookChain IRehldsHook_PrepareUserInfoToTransmit; +typedef IVoidHookChainRegistry IRehldsHookRegistry_PrepareUserInfoToTransmit; + class IRehldsHookchains { public: virtual ~IRehldsHookchains() { } @@ -166,6 +170,7 @@ public: virtual IRehldsHookRegistry_SV_StartSound* SV_StartSound() = 0; virtual IRehldsHookRegistry_PF_Remove_I* PF_Remove_I() = 0; virtual IRehldsHookRegistry_PF_BuildSoundMsg_I* PF_BuildSoundMsg_I() = 0; + virtual IRehldsHookRegistry_PrepareUserInfoToTransmit* PrepareUserInfoToTransmit() = 0; }; struct RehldsFuncs_t { diff --git a/rehlds/rehlds/rehlds_api_impl.cpp b/rehlds/rehlds/rehlds_api_impl.cpp index 7b56673..c0b2000 100644 --- a/rehlds/rehlds/rehlds_api_impl.cpp +++ b/rehlds/rehlds/rehlds_api_impl.cpp @@ -249,6 +249,10 @@ IRehldsHookRegistry_PF_BuildSoundMsg_I* CRehldsHookchains::PF_BuildSoundMsg_I() return &m_PF_BuildSoundMsg_I; } +IRehldsHookRegistry_PrepareUserInfoToTransmit* CRehldsHookchains::PrepareUserInfoToTransmit() { + return &m_PrepareUserInfoToTransmit; +} + int EXT_FUNC CRehldsApi::GetMajorVersion() { return REHLDS_API_VERSION_MAJOR; diff --git a/rehlds/rehlds/rehlds_api_impl.h b/rehlds/rehlds/rehlds_api_impl.h index fdfdc9b..101c668 100644 --- a/rehlds/rehlds/rehlds_api_impl.h +++ b/rehlds/rehlds/rehlds_api_impl.h @@ -131,6 +131,10 @@ typedef IVoidHookChainRegistryImpl CRehldsHookRegistry_PF_Remove_I; typedef IVoidHookChainImpl CRehldsHook_PF_BuildSoundMsg_I; typedef IVoidHookChainRegistryImpl CRehldsHookRegistry_PF_BuildSoundMsg_I; +// PrepareUserInfoToTransmit hook +typedef IVoidHookChainImpl CRehldsHook_PrepareUserInfoToTransmit; +typedef IVoidHookChainRegistryImpl CRehldsHookRegistry_PrepareUserInfoToTransmit; + class CRehldsHookchains : public IRehldsHookchains { public: CRehldsHookRegistry_Steam_NotifyClientConnect m_Steam_NotifyClientConnect; @@ -158,6 +162,7 @@ public: CRehldsHookRegistry_SV_StartSound m_SV_StartSound; CRehldsHookRegistry_PF_Remove_I m_PF_Remove_I; CRehldsHookRegistry_PF_BuildSoundMsg_I m_PF_BuildSoundMsg_I; + CRehldsHookRegistry_PrepareUserInfoToTransmit m_PrepareUserInfoToTransmit; public: virtual IRehldsHookRegistry_Steam_NotifyClientConnect* Steam_NotifyClientConnect(); @@ -185,6 +190,7 @@ public: virtual IRehldsHookRegistry_SV_StartSound* SV_StartSound(); virtual IRehldsHookRegistry_PF_Remove_I* PF_Remove_I(); virtual IRehldsHookRegistry_PF_BuildSoundMsg_I* PF_BuildSoundMsg_I(); + virtual IRehldsHookRegistry_PrepareUserInfoToTransmit* PrepareUserInfoToTransmit(); }; extern CRehldsHookchains g_RehldsHookchains;