From 6a4dc69ef7a77b0ece35e7d072187530df5d0931 Mon Sep 17 00:00:00 2001 From: asmodai Date: Sat, 26 Dec 2015 21:15:50 +0300 Subject: [PATCH] Added Steam_GSGetSteamID hook --- 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, 17 insertions(+), 2 deletions(-) diff --git a/rehlds/engine/sv_main.cpp b/rehlds/engine/sv_main.cpp index bae6b38..1ff3402 100644 --- a/rehlds/engine/sv_main.cpp +++ b/rehlds/engine/sv_main.cpp @@ -2480,7 +2480,7 @@ void SVC_GetChallenge(void) int challenge = SV_GetChallenge(net_from); if (steam) - Q_snprintf(data, sizeof(data), "\xFF\xFF\xFF\xFF%c00000000 %u 3 %lld %d\n", S2C_CHALLENGE, challenge, Steam_GSGetSteamID(), Steam_GSBSecure()); + Q_snprintf(data, sizeof(data), "\xFF\xFF\xFF\xFF%c00000000 %u 3 %lld %d\n", S2C_CHALLENGE, challenge, g_RehldsHookchains.m_Steam_GSGetSteamID.callChain(Steam_GSGetSteamID), Steam_GSBSecure()); else { Con_DPrintf("Server requiring authentication\n"); diff --git a/rehlds/public/rehlds/rehlds_api.h b/rehlds/public/rehlds/rehlds_api.h index b5b14de..f0580ff 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 2 -#define REHLDS_API_VERSION_MINOR 4 +#define REHLDS_API_VERSION_MINOR 5 //Steam_NotifyClientConnect hook typedef IHookChain IRehldsHook_Steam_NotifyClientConnect; @@ -157,6 +157,10 @@ typedef IVoidHookChainRegistry IRehldsHookRegistry_SV_ActivateServer; typedef IVoidHookChain IRehldsHook_SV_WriteVoiceCodec; typedef IVoidHookChainRegistry IRehldsHookRegistry_SV_WriteVoiceCodec; +//Steam_GSGetSteamID hook +typedef IHookChain IRehldsHook_Steam_GSGetSteamID; +typedef IHookChainRegistry IRehldsHookRegistry_Steam_GSGetSteamID; + class IRehldsHookchains { public: virtual ~IRehldsHookchains() { } @@ -191,6 +195,7 @@ public: virtual IRehldsHookRegistry_SV_DropClient* SV_DropClient() = 0; virtual IRehldsHookRegistry_SV_ActivateServer* SV_ActivateServer() = 0; virtual IRehldsHookRegistry_SV_WriteVoiceCodec* SV_WriteVoiceCodec() = 0; + virtual IRehldsHookRegistry_Steam_GSGetSteamID* Steam_GSGetSteamID() = 0; }; struct RehldsFuncs_t { diff --git a/rehlds/rehlds/rehlds_api_impl.cpp b/rehlds/rehlds/rehlds_api_impl.cpp index 50f6531..5e5cb72 100644 --- a/rehlds/rehlds/rehlds_api_impl.cpp +++ b/rehlds/rehlds/rehlds_api_impl.cpp @@ -345,6 +345,10 @@ IRehldsHookRegistry_SV_WriteVoiceCodec* CRehldsHookchains::SV_WriteVoiceCodec() return &m_SV_WriteVoiceCodec; } +CRehldsHookRegistry_Steam_GSGetSteamID* CRehldsHookchains::Steam_GSGetSteamID() { + return &m_Steam_GSGetSteamID; +} + 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 1bdc9f0..afaaa15 100644 --- a/rehlds/rehlds/rehlds_api_impl.h +++ b/rehlds/rehlds/rehlds_api_impl.h @@ -151,6 +151,10 @@ typedef IVoidHookChainRegistryImpl CRehldsHookRegistry_SV_ActivateServer; typedef IVoidHookChainImpl CRehldsHook_SV_WriteVoiceCodec; typedef IVoidHookChainRegistryImpl CRehldsHookRegistry_SV_WriteVoiceCodec; +//Steam_GSGetSteamID hook +typedef IHookChainImpl CRehldsHook_Steam_GSGetSteamID; +typedef IHookChainRegistryImpl CRehldsHookRegistry_Steam_GSGetSteamID; + class CRehldsHookchains : public IRehldsHookchains { public: CRehldsHookRegistry_Steam_NotifyClientConnect m_Steam_NotifyClientConnect; @@ -183,6 +187,7 @@ public: CRehldsHookRegistry_SV_DropClient m_SV_DropClient; CRehldsHookRegistry_SV_ActivateServer m_SV_ActivateServer; CRehldsHookRegistry_SV_WriteVoiceCodec m_SV_WriteVoiceCodec; + CRehldsHookRegistry_Steam_GSGetSteamID m_Steam_GSGetSteamID; public: virtual IRehldsHookRegistry_Steam_NotifyClientConnect* Steam_NotifyClientConnect(); @@ -215,6 +220,7 @@ public: virtual IRehldsHookRegistry_SV_DropClient* SV_DropClient(); virtual IRehldsHookRegistry_SV_ActivateServer* SV_ActivateServer(); virtual IRehldsHookRegistry_SV_WriteVoiceCodec* SV_WriteVoiceCodec(); + virtual CRehldsHookRegistry_Steam_GSGetSteamID* Steam_GSGetSteamID(); }; extern CRehldsHookchains g_RehldsHookchains;