From efb7c36408c9f80b8ae9e330362c3a3d5692d51f Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Fri, 20 May 2022 11:52:19 +0200 Subject: [PATCH] Light project restructure Moved server/client headers and implementations into dedicated subfolder. Renamed Some classes to match the game binary (e.g. CBaseClient is now CClient). Removed redundant files. --- r5dev/client/cdll_engine_int.cpp | 2 +- r5dev/client/client.h | 17 --- r5dev/common/opcodes.cpp | 8 +- r5dev/core/init.cpp | 13 +- r5dev/engine/baseserver.cpp | 57 -------- r5dev/engine/baseserver.h | 26 ---- r5dev/engine/{ => client}/cl_main.h | 0 r5dev/engine/{ => client}/cl_rcon.cpp | 2 +- r5dev/engine/{ => client}/cl_rcon.h | 0 .../{baseclient.cpp => client/client.cpp} | 58 ++++---- .../engine/{baseclient.h => client/client.h} | 46 +++---- .../clientstate.cpp} | 24 ++-- .../clientstate.h} | 30 ++--- r5dev/engine/host_state.cpp | 8 +- r5dev/engine/net.cpp | 4 +- r5dev/engine/net.h | 2 +- r5dev/engine/net_chan.h | 2 +- r5dev/engine/server/server.cpp | 125 ++++++++++++++++++ r5dev/engine/server/server.h | 81 ++++++++++++ r5dev/engine/server/sv_main.cpp | 26 ++++ r5dev/engine/{ => server}/sv_main.h | 3 + r5dev/engine/{ => server}/sv_rcon.cpp | 2 +- r5dev/engine/{ => server}/sv_rcon.h | 0 r5dev/engine/sv_main.cpp | 4 - r5dev/engine/sys_utils.cpp | 2 +- r5dev/game/server/gameinterface.cpp | 2 +- r5dev/gameui/IBrowser.cpp | 2 +- r5dev/launcher/IApplication.cpp | 2 +- r5dev/public/bansystem.cpp | 4 +- r5dev/public/include/edict.h | 2 +- r5dev/server/server.cpp | 87 ------------ r5dev/server/server.h | 72 ---------- r5dev/server/vengineserver_impl.cpp | 14 +- r5dev/squirrel/sqinit.cpp | 2 +- r5dev/squirrel/sqvm.cpp | 2 +- r5dev/vgui/vgui_baseui_interface.h | 2 +- r5dev/vgui/vgui_debugpanel.cpp | 4 +- r5dev/vproj/clientsdk.vcxproj | 15 +-- r5dev/vproj/clientsdk.vcxproj.filters | 48 +++---- r5dev/vproj/dedicated.vcxproj | 21 ++- r5dev/vproj/dedicated.vcxproj.filters | 69 +++++----- r5dev/vproj/gamesdk.vcxproj | 25 ++-- r5dev/vproj/gamesdk.vcxproj.filters | 81 ++++++------ r5dev/vstdlib/callback.cpp | 26 ++-- 44 files changed, 488 insertions(+), 534 deletions(-) delete mode 100644 r5dev/client/client.h delete mode 100644 r5dev/engine/baseserver.cpp delete mode 100644 r5dev/engine/baseserver.h rename r5dev/engine/{ => client}/cl_main.h (100%) rename r5dev/engine/{ => client}/cl_rcon.cpp (99%) rename r5dev/engine/{ => client}/cl_rcon.h (100%) rename r5dev/engine/{baseclient.cpp => client/client.cpp} (79%) rename r5dev/engine/{baseclient.h => client/client.h} (73%) rename r5dev/engine/{baseclientstate.cpp => client/clientstate.cpp} (75%) rename r5dev/engine/{baseclientstate.h => client/clientstate.h} (86%) create mode 100644 r5dev/engine/server/server.cpp create mode 100644 r5dev/engine/server/server.h create mode 100644 r5dev/engine/server/sv_main.cpp rename r5dev/engine/{ => server}/sv_main.h (95%) rename r5dev/engine/{ => server}/sv_rcon.cpp (99%) rename r5dev/engine/{ => server}/sv_rcon.h (100%) delete mode 100644 r5dev/engine/sv_main.cpp delete mode 100644 r5dev/server/server.cpp delete mode 100644 r5dev/server/server.h diff --git a/r5dev/client/cdll_engine_int.cpp b/r5dev/client/cdll_engine_int.cpp index b46b51eb..d0e31fd5 100644 --- a/r5dev/client/cdll_engine_int.cpp +++ b/r5dev/client/cdll_engine_int.cpp @@ -11,7 +11,7 @@ #include "client/vengineclient_impl.h" #include "client/cdll_engine_int.h" #include "engine/net_chan.h" -#include "engine/cl_rcon.h" +#include "engine/client/cl_rcon.h" #include "public/include/bansystem.h" #include "vpc/keyvalues.h" #include "gameui/IConsole.h" diff --git a/r5dev/client/client.h b/r5dev/client/client.h deleted file mode 100644 index c3e15e05..00000000 --- a/r5dev/client/client.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef CLIENT_H -#define CLIENT_H - -/////////////////////////////////////////////////////////////////////////////// -class VClient : public IDetour -{ - virtual void GetAdr(void) const { } - virtual void GetFun(void) const { } - virtual void GetVar(void) const { } - virtual void GetCon(void) const { } - virtual void Attach(void) const { } - virtual void Detach(void) const { } -}; -/////////////////////////////////////////////////////////////////////////////// - -REGISTER(VClient); -#endif // CLIENT_H diff --git a/r5dev/common/opcodes.cpp b/r5dev/common/opcodes.cpp index c0ca7fa7..260472ed 100644 --- a/r5dev/common/opcodes.cpp +++ b/r5dev/common/opcodes.cpp @@ -12,15 +12,15 @@ #include "engine/gl_screen.h" #include "engine/gl_matsysiface.h" #include "engine/modelloader.h" -#include "engine/cl_main.h" -#include "engine/sv_main.h" +#include "engine/server/sv_main.h" +#include "engine/client/cl_main.h" +#include "engine/client/client.h" +#include "engine/client/clientstate.h" #include "engine/sys_getmodes.h" -#include "engine/baseclientstate.h" #include "game/server/ai_networkmanager.h" #include "game/server/fairfight_impl.h" #include "rtech/rtech_game.h" #include "rtech/rui/rui.h" -#include "client/client.h" #include "client/cdll_engine_int.h" #include "materialsystem/cmaterialsystem.h" #include "studiorender/studiorendercontext.h" diff --git a/r5dev/core/init.cpp b/r5dev/core/init.cpp index 7019ada1..5d6b3213 100644 --- a/r5dev/core/init.cpp +++ b/r5dev/core/init.cpp @@ -43,11 +43,10 @@ #include "vgui/vgui_fpspanel.h" #include "vguimatsurface/MatSystemSurface.h" #endif // !DEDICATED -#include "client/client.h" #include "client/cdll_engine_int.h" #include "client/vengineclient_impl.h" #ifndef CLIENT_DLL -#include "server/server.h" +#include "engine/server/server.h" #include "server/vengineserver_impl.h" #endif // !CLIENT_DLL #include "squirrel/sqinit.h" @@ -59,10 +58,11 @@ #include "rtech/rtech_utils.h" #include "rtech/stryder/stryder.h" #include "rtech/rui/rui.h" -#include "engine/baseclient.h" -#include "engine/baseclientstate.h" +#include "engine/client/cl_main.h" +#include "engine/client/client.h" +#include "engine/client/clientstate.h" #ifndef CLIENT_DLL -#include "engine/baseserver.h" +#include "engine/server/server.h" #endif // !CLIENT_DLL #include "engine/common.h" #include "engine/cmodel_bsp.h" @@ -72,9 +72,8 @@ #include "engine/modelloader.h" #include "engine/net.h" #include "engine/net_chan.h" -#include "engine/cl_main.h" #ifndef CLIENT_DLL -#include "engine/sv_main.h" +#include "engine/server/sv_main.h" #endif // !CLIENT_DLL #include "engine/sys_dll.h" #include "engine/sys_dll2.h" diff --git a/r5dev/engine/baseserver.cpp b/r5dev/engine/baseserver.cpp deleted file mode 100644 index 8c25dc5d..00000000 --- a/r5dev/engine/baseserver.cpp +++ /dev/null @@ -1,57 +0,0 @@ -//=============================================================================// -// -// Purpose: -// -// $NoKeywords: $ -// -//=============================================================================// -// baseserver.cpp: implementation of the CBaseServer class. -// -///////////////////////////////////////////////////////////////////////////////// -#include "core/stdafx.h" -#include "common/protocol.h" -#include "engine/baseserver.h" -#include "engine/baseclient.h" -#include "public/include/edict.h" - -//--------------------------------------------------------------------------------- -// Purpose: Gets the number of human players on the server -// Output : int -//--------------------------------------------------------------------------------- -int CBaseServer::GetNumHumanPlayers(void) const -{ - int nHumans = 0; - for (int i = 0; i < g_ServerGlobalVariables->m_nMaxClients; i++) - { - CBaseClient* pClient = g_pClient->GetClient(i); - if (!pClient) - continue; - - if (pClient->IsHumanPlayer()) - nHumans++; - } - - return nHumans; -} - -//--------------------------------------------------------------------------------- -// Purpose: Gets the number of fake clients on the server -// Output : int -//--------------------------------------------------------------------------------- -int CBaseServer::GetNumFakeClients(void) const -{ - int nBots = 0; - for (int i = 0; i < g_ServerGlobalVariables->m_nMaxClients; i++) - { - CBaseClient* pClient = g_pClient->GetClient(i); - if (!pClient) - continue; - - if (pClient->IsConnected() && pClient->IsFakeClient()) - nBots++; - } - - return nBots; -} - -CBaseServer* g_pServer = new CBaseServer(); // !TODO: Replace with engine global if found. diff --git a/r5dev/engine/baseserver.h b/r5dev/engine/baseserver.h deleted file mode 100644 index 260ab20f..00000000 --- a/r5dev/engine/baseserver.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -class CBaseServer -{ -public: - int GetNumHumanPlayers(void) const; - int GetNumFakeClients(void) const; -}; -extern CBaseServer* g_pServer; - -/////////////////////////////////////////////////////////////////////////////// -class VBaseServer : public IDetour -{ - virtual void GetAdr(void) const - { - //spdlog::debug("+----------------------------------------------------------------+\n"); - } - virtual void GetFun(void) const { } - virtual void GetVar(void) const { } - virtual void GetCon(void) const { } - virtual void Attach(void) const { } - virtual void Detach(void) const { } -}; -/////////////////////////////////////////////////////////////////////////////// - -REGISTER(VBaseServer); diff --git a/r5dev/engine/cl_main.h b/r5dev/engine/client/cl_main.h similarity index 100% rename from r5dev/engine/cl_main.h rename to r5dev/engine/client/cl_main.h diff --git a/r5dev/engine/cl_rcon.cpp b/r5dev/engine/client/cl_rcon.cpp similarity index 99% rename from r5dev/engine/cl_rcon.cpp rename to r5dev/engine/client/cl_rcon.cpp index 95608327..faab96a3 100644 --- a/r5dev/engine/cl_rcon.cpp +++ b/r5dev/engine/client/cl_rcon.cpp @@ -10,7 +10,7 @@ #include "tier1/cvar.h" #include "protoc/sv_rcon.pb.h" #include "protoc/cl_rcon.pb.h" -#include "engine/cl_rcon.h" +#include "engine/client/cl_rcon.h" #include "engine/sys_utils.h" #include "squirrel/sqvm.h" #include "common/igameserverdata.h" diff --git a/r5dev/engine/cl_rcon.h b/r5dev/engine/client/cl_rcon.h similarity index 100% rename from r5dev/engine/cl_rcon.h rename to r5dev/engine/client/cl_rcon.h diff --git a/r5dev/engine/baseclient.cpp b/r5dev/engine/client/client.cpp similarity index 79% rename from r5dev/engine/baseclient.cpp rename to r5dev/engine/client/client.cpp index 359c80eb..c19b09e2 100644 --- a/r5dev/engine/baseclient.cpp +++ b/r5dev/engine/client/client.cpp @@ -5,25 +5,25 @@ // $NoKeywords: $ // //===============================================================================// -// baseclient.cpp: implementation of the CBaseClient class. +// client.cpp: implementation of the CClient class. // /////////////////////////////////////////////////////////////////////////////////// #include "core/stdafx.h" -#include "engine/baseclient.h" -#include "engine/baseserver.h" +#include "engine/client/client.h" +#include "engine/server/server.h" //--------------------------------------------------------------------------------- // Purpose: gets the client from buffer by index //--------------------------------------------------------------------------------- -CBaseClient* CBaseClient::GetClient(int nIndex) const +CClient* CClient::GetClient(int nIndex) const { - return (CBaseClient*)(std::uintptr_t)(g_pClientBuffer.GetPtr() + (nIndex * sizeof(CBaseClient))); + return (CClient*)(std::uintptr_t)(g_pClientBuffer.GetPtr() + (nIndex * sizeof(CClient))); } //--------------------------------------------------------------------------------- // Purpose: gets the userID of this client //--------------------------------------------------------------------------------- -std::int32_t CBaseClient::GetUserID(void) const +std::int32_t CClient::GetUserID(void) const { return m_nUserID; } @@ -31,7 +31,7 @@ std::int32_t CBaseClient::GetUserID(void) const //--------------------------------------------------------------------------------- // Purpose: gets the userID of this client //--------------------------------------------------------------------------------- -std::int64_t CBaseClient::GetOriginID(void) const +std::int64_t CClient::GetOriginID(void) const { return m_nOriginID; } @@ -39,7 +39,7 @@ std::int64_t CBaseClient::GetOriginID(void) const //--------------------------------------------------------------------------------- // Purpose: gets the signon state of this client //--------------------------------------------------------------------------------- -SIGNONSTATE CBaseClient::GetSignonState(void) const +SIGNONSTATE CClient::GetSignonState(void) const { return m_nSignonState; } @@ -47,7 +47,7 @@ SIGNONSTATE CBaseClient::GetSignonState(void) const //--------------------------------------------------------------------------------- // Purpose: gets the persistence state of this client //--------------------------------------------------------------------------------- -PERSISTENCE CBaseClient::GetPersistenceState(void) const +PERSISTENCE CClient::GetPersistenceState(void) const { return m_nPersistenceState; } @@ -55,7 +55,7 @@ PERSISTENCE CBaseClient::GetPersistenceState(void) const //--------------------------------------------------------------------------------- // Purpose: gets the net channel of this client //--------------------------------------------------------------------------------- -CNetChan* CBaseClient::GetNetChan(void) const +CNetChan* CClient::GetNetChan(void) const { return m_NetChannel; } @@ -63,7 +63,7 @@ CNetChan* CBaseClient::GetNetChan(void) const //--------------------------------------------------------------------------------- // Purpose: sets the userID of this client //--------------------------------------------------------------------------------- -void CBaseClient::SetUserID(std::int32_t nUserID) +void CClient::SetUserID(std::int32_t nUserID) { m_nUserID = nUserID; } @@ -71,7 +71,7 @@ void CBaseClient::SetUserID(std::int32_t nUserID) //--------------------------------------------------------------------------------- // Purpose: sets the originID of this client //--------------------------------------------------------------------------------- -void CBaseClient::SetOriginID(std::int64_t nOriginID) +void CClient::SetOriginID(std::int64_t nOriginID) { m_nOriginID = nOriginID; } @@ -79,7 +79,7 @@ void CBaseClient::SetOriginID(std::int64_t nOriginID) //--------------------------------------------------------------------------------- // Purpose: sets the signon state of this client //--------------------------------------------------------------------------------- -void CBaseClient::SetSignonState(SIGNONSTATE nSignonState) +void CClient::SetSignonState(SIGNONSTATE nSignonState) { m_nSignonState = nSignonState; } @@ -87,7 +87,7 @@ void CBaseClient::SetSignonState(SIGNONSTATE nSignonState) //--------------------------------------------------------------------------------- // Purpose: sets the persistence state of this client //--------------------------------------------------------------------------------- -void CBaseClient::SetPersistenceState(PERSISTENCE nPersistenceState) +void CClient::SetPersistenceState(PERSISTENCE nPersistenceState) { m_nPersistenceState = nPersistenceState; } @@ -96,7 +96,7 @@ void CBaseClient::SetPersistenceState(PERSISTENCE nPersistenceState) // Purpose: sets the net channel of this client // !TODO : Remove this and rebuild INetChannel //--------------------------------------------------------------------------------- -void CBaseClient::SetNetChan(CNetChan* pNetChan) +void CClient::SetNetChan(CNetChan* pNetChan) { m_NetChannel = pNetChan; } @@ -105,7 +105,7 @@ void CBaseClient::SetNetChan(CNetChan* pNetChan) // Purpose: checks if client is connected to server // Output : true if connected, false otherwise //--------------------------------------------------------------------------------- -bool CBaseClient::IsConnected(void) const +bool CClient::IsConnected(void) const { return m_nSignonState >= SIGNONSTATE::SIGNONSTATE_CONNECTED; } @@ -114,7 +114,7 @@ bool CBaseClient::IsConnected(void) const // Purpose: checks if client is spawned to server // Output : true if connected, false otherwise //--------------------------------------------------------------------------------- -bool CBaseClient::IsSpawned(void) const +bool CClient::IsSpawned(void) const { return m_nSignonState >= SIGNONSTATE::SIGNONSTATE_NEW; } @@ -123,7 +123,7 @@ bool CBaseClient::IsSpawned(void) const // Purpose: checks if client is active to server // Output : true if connected, false otherwise //--------------------------------------------------------------------------------- -bool CBaseClient::IsActive(void) const +bool CClient::IsActive(void) const { return m_nSignonState == SIGNONSTATE::SIGNONSTATE_FULL; } @@ -132,7 +132,7 @@ bool CBaseClient::IsActive(void) const // Purpose: checks if client's persistence data is available // Output : true if available, false otherwise //--------------------------------------------------------------------------------- -bool CBaseClient::IsPersistenceAvailable(void) const +bool CClient::IsPersistenceAvailable(void) const { return m_nPersistenceState >= PERSISTENCE::PERSISTENCE_AVAILABLE; } @@ -141,7 +141,7 @@ bool CBaseClient::IsPersistenceAvailable(void) const // Purpose: checks if client's persistence data is ready // Output : true if ready, false otherwise //--------------------------------------------------------------------------------- -bool CBaseClient::IsPersistenceReady(void) const +bool CClient::IsPersistenceReady(void) const { return m_nPersistenceState == PERSISTENCE::PERSISTENCE_READY; } @@ -150,7 +150,7 @@ bool CBaseClient::IsPersistenceReady(void) const // Purpose: checks if client is a fake client // Output : true if connected, false otherwise //--------------------------------------------------------------------------------- -bool CBaseClient::IsFakeClient(void) const +bool CClient::IsFakeClient(void) const { return m_bFakePlayer; } @@ -159,7 +159,7 @@ bool CBaseClient::IsFakeClient(void) const // Purpose: checks if this client is an actual human player // Output : true if human, false otherwise //--------------------------------------------------------------------------------- -bool CBaseClient::IsHumanPlayer(void) const +bool CClient::IsHumanPlayer(void) const { if (!IsConnected()) return false; @@ -174,7 +174,7 @@ bool CBaseClient::IsHumanPlayer(void) const // Purpose: throw away any residual garbage in the channel // Input : *pBaseClient - //--------------------------------------------------------------------------------- -void CBaseClient::Clear(CBaseClient* pBaseClient) +void CClient::Clear(CClient* pBaseClient) { CBaseClient_Clear(pBaseClient); } @@ -190,7 +190,7 @@ void CBaseClient::Clear(CBaseClient* pBaseClient) // nMessageSize - // Output : true if connection was succesfull, false otherwise //--------------------------------------------------------------------------------- -bool CBaseClient::Connect(CBaseClient* pClient, const char* szName, void* pNetChannel, bool bFakePlayer, void* a5, char* szMessage, int nMessageSize) +bool CClient::Connect(CClient* pClient, const char* szName, void* pNetChannel, bool bFakePlayer, void* a5, char* szMessage, int nMessageSize) { return CBaseClient_Connect(pClient, szName, pNetChannel, bFakePlayer, a5, szMessage, nMessageSize); } @@ -198,14 +198,14 @@ bool CBaseClient::Connect(CBaseClient* pClient, const char* szName, void* pNetCh /////////////////////////////////////////////////////////////////////////////////// void CBaseClient_Attach() { - DetourAttach((LPVOID*)&CBaseClient_Clear, &CBaseClient::Clear); - DetourAttach((LPVOID*)&CBaseClient_Connect, &CBaseClient::Connect); + DetourAttach((LPVOID*)&CBaseClient_Clear, &CClient::Clear); + DetourAttach((LPVOID*)&CBaseClient_Connect, &CClient::Connect); } void CBaseClient_Detach() { - DetourDetach((LPVOID*)&CBaseClient_Clear, &CBaseClient::Clear); - DetourDetach((LPVOID*)&CBaseClient_Connect, &CBaseClient::Connect); + DetourDetach((LPVOID*)&CBaseClient_Clear, &CClient::Clear); + DetourDetach((LPVOID*)&CBaseClient_Connect, &CClient::Connect); } /////////////////////////////////////////////////////////////////////////////// -CBaseClient* g_pClient = nullptr; \ No newline at end of file +CClient* g_pClient = nullptr; \ No newline at end of file diff --git a/r5dev/engine/baseclient.h b/r5dev/engine/client/client.h similarity index 73% rename from r5dev/engine/baseclient.h rename to r5dev/engine/client/client.h index 9aef72c3..61b42dc4 100644 --- a/r5dev/engine/baseclient.h +++ b/r5dev/engine/client/client.h @@ -7,16 +7,16 @@ //----------------------------------------------------------------------------- // Forward declarations //----------------------------------------------------------------------------- -class CBaseServer; -class CBaseClient; +class CServer; +class CClient; /////////////////////////////////////////////////////////////////////////////// -extern CBaseClient* g_pClient; +extern CClient* g_pClient; -class CBaseClient : INetChannelHandler, IClientMessageHandler +class CClient : INetChannelHandler, IClientMessageHandler { public: - CBaseClient* GetClient(int nIndex) const; + CClient* GetClient(int nIndex) const; int32_t GetUserID(void) const; int64_t GetOriginID(void) const; SIGNONSTATE GetSignonState(void) const; @@ -34,8 +34,8 @@ public: bool IsPersistenceReady(void) const; bool IsFakeClient(void) const; bool IsHumanPlayer(void) const; - static bool Connect(CBaseClient* pClient, const char* szName, void* pNetChannel, bool bFakePlayer, void* a5, char* szMessage, int nMessageSize); - static void Clear(CBaseClient* pBaseClient); + static bool Connect(CClient* pClient, const char* szName, void* pNetChannel, bool bFakePlayer, void* a5, char* szMessage, int nMessageSize); + static void Clear(CClient* pBaseClient); private: int32_t m_nUserID; //0x0010 @@ -44,7 +44,7 @@ private: char pad_0015[768]; //0x0060 KeyValues* m_ConVars; //0x0360 char pad_0368[8]; //0x0368 - CBaseServer* m_Server; //0x0370 + CServer* m_pServer; //0x0370 char pad_0378[40]; //0x0378 CNetChan* m_NetChannel; //0x03A0 char pad_03A8[8]; //0x03A8 @@ -73,39 +73,31 @@ private: #if defined (GAMEDLL_S0) || defined (GAMEDLL_S1) static_assert(sizeof(CBaseClient) == 0x4A440); #else -static_assert(sizeof(CBaseClient) == 0x4A4C0); +static_assert(sizeof(CClient) == 0x4A4C0); #endif /* ==== CBASECLIENT ===================================================================================================================================================== */ inline CMemory p_CBaseClient_Connect; -inline auto CBaseClient_Connect = p_CBaseClient_Connect.RCast(); +inline auto CBaseClient_Connect = p_CBaseClient_Connect.RCast(); inline CMemory p_CBaseClient_Clear; -inline auto CBaseClient_Clear = p_CBaseClient_Clear.RCast(); +inline auto CBaseClient_Clear = p_CBaseClient_Clear.RCast(); inline CMemory g_pClientBuffer; -extern CBaseClient* g_pClient; - -// Notes for earlier seasons. -#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1) -inline const std::uintptr_t g_dwCClientSize = 0x4A440; -inline const std::uintptr_t g_dwPersistenceVar = 0x5B4; -inline const std::uintptr_t g_dwCClientPadding = 0x49E88; -#endif - +extern CClient* g_pClient; /////////////////////////////////////////////////////////////////////////////// void CBaseClient_Attach(); void CBaseClient_Detach(); /////////////////////////////////////////////////////////////////////////////// -class VBaseClient : public IDetour +class VClient : public IDetour { virtual void GetAdr(void) const { - spdlog::debug("| FUN: CBaseClient::Connect : {:#18x} |\n", p_CBaseClient_Connect.GetPtr()); - spdlog::debug("| FUN: CBaseClient::Clear : {:#18x} |\n", p_CBaseClient_Clear.GetPtr()); + spdlog::debug("| FUN: CClient::Connect : {:#18x} |\n", p_CBaseClient_Connect.GetPtr()); + spdlog::debug("| FUN: CClient::Clear : {:#18x} |\n", p_CBaseClient_Clear.GetPtr()); spdlog::debug("| VAR: g_pClient : {:#18x} |\n", reinterpret_cast(g_pClient)); spdlog::debug("+----------------------------------------------------------------+\n"); } @@ -114,14 +106,14 @@ class VBaseClient : public IDetour p_CBaseClient_Connect = g_mGameDll.FindPatternSIMD(reinterpret_cast("\x40\x53\x41\x56\x41\x57\x48\x83\xEC\x20\x48\x8B\xD9\x48\x89\x74"), "xxxxxxxxxxxxxxxx"); p_CBaseClient_Clear = g_mGameDll.FindPatternSIMD(reinterpret_cast("\x40\x53\x41\x56\x41\x57\x48\x83\xEC\x20\x48\x8B\xD9\x48\x89\x74"), "xxxxxxxxxxxxxxxx"); - CBaseClient_Connect = p_CBaseClient_Connect.RCast(); /*40 53 41 56 41 57 48 83 EC 20 48 8B D9 48 89 74*/ - CBaseClient_Clear = p_CBaseClient_Clear.RCast(); /*40 53 41 56 41 57 48 83 EC 20 48 8B D9 48 89 74*/ + CBaseClient_Connect = p_CBaseClient_Connect.RCast(); /*40 53 41 56 41 57 48 83 EC 20 48 8B D9 48 89 74*/ + CBaseClient_Clear = p_CBaseClient_Clear.RCast(); /*40 53 41 56 41 57 48 83 EC 20 48 8B D9 48 89 74*/ } virtual void GetVar(void) const { g_pClientBuffer = g_mGameDll.FindPatternSIMD(reinterpret_cast("\x3B\x15\x00\x00\x00\x00\x7D\x33"), "xx????xx") .FindPatternSelf("48 8D 0D", CMemory::Direction::DOWN, 150).ResolveRelativeAddressSelf(0x3, 0x7); - g_pClient = g_pClientBuffer.RCast(); + g_pClient = g_pClientBuffer.RCast(); } virtual void GetCon(void) const { } virtual void Attach(void) const { } @@ -129,4 +121,4 @@ class VBaseClient : public IDetour }; /////////////////////////////////////////////////////////////////////////////// -REGISTER(VBaseClient); +REGISTER(VClient); diff --git a/r5dev/engine/baseclientstate.cpp b/r5dev/engine/client/clientstate.cpp similarity index 75% rename from r5dev/engine/baseclientstate.cpp rename to r5dev/engine/client/clientstate.cpp index 6204e96a..aafd3bab 100644 --- a/r5dev/engine/baseclientstate.cpp +++ b/r5dev/engine/client/clientstate.cpp @@ -1,19 +1,23 @@ -//===========================================================================// +//=============================================================================// // -// Purpose: Implementation of the CBaseClient class. +// Purpose: // -//===========================================================================// - +// $NoKeywords: $ +// +//=============================================================================// +// clientstate.cpp: implementation of the CClientState class. +// +///////////////////////////////////////////////////////////////////////////////// #include "core/stdafx.h" #include "client/cdll_engine_int.h" #include "engine/debugoverlay.h" -#include "engine/baseclientstate.h" +#include "engine/client/clientstate.h" //------------------------------------------------------------------------------ // Purpose: returns true if client simulation is paused //------------------------------------------------------------------------------ -bool CBaseClientState::IsPaused() +bool CClientState::IsPaused() { return *cl_m_bPaused; } @@ -22,7 +26,7 @@ bool CBaseClientState::IsPaused() // Purpose: gets the client time // Technically doesn't belong here //------------------------------------------------------------------------------ -float CBaseClientState::GetClientTime() +float CClientState::GetClientTime() { if (*cl_time_use_host_tickcount) { @@ -37,7 +41,7 @@ float CBaseClientState::GetClientTime() //------------------------------------------------------------------------------ // Purpose: gets the client simulation tick count //------------------------------------------------------------------------------ -int CBaseClientState::GetClientTickCount() const +int CClientState::GetClientTickCount() const { return *cl_host_tickcount; } @@ -45,9 +49,9 @@ int CBaseClientState::GetClientTickCount() const //------------------------------------------------------------------------------ // Purpose: sets the client simulation tick count //------------------------------------------------------------------------------ -void CBaseClientState::SetClientTickCount(int tick) +void CClientState::SetClientTickCount(int tick) { *cl_host_tickcount = tick; } -CBaseClientState* g_pBaseClientState = nullptr; +CClientState* g_pBaseClientState = nullptr; diff --git a/r5dev/engine/baseclientstate.h b/r5dev/engine/client/clientstate.h similarity index 86% rename from r5dev/engine/baseclientstate.h rename to r5dev/engine/client/clientstate.h index f3f6032c..adb4da62 100644 --- a/r5dev/engine/baseclientstate.h +++ b/r5dev/engine/client/clientstate.h @@ -27,7 +27,7 @@ struct CS_INetChannelHandler : INetChannelHandler /////////////////////////////////////////////////////////////////////////////// -class CBaseClientState : CS_INetChannelHandler, IConnectionlessPacketHandler, IServerMessageHandler, CClientSnapshotManager +class CClientState : CS_INetChannelHandler, IConnectionlessPacketHandler, IServerMessageHandler, CClientSnapshotManager { public: bool IsPaused(); @@ -170,21 +170,21 @@ public: char byte34A38; char field_34A39[7]; }; -extern CBaseClientState* g_pBaseClientState; +extern CClientState* g_pBaseClientState; /* ==== CCLIENTSTATE ==================================================================================================================================================== */ inline CMemory p_CClientState__RunFrame; -inline auto CClientState__RunFrame = p_CClientState__RunFrame.RCast(); +inline auto CClientState__RunFrame = p_CClientState__RunFrame.RCast(); inline CMemory p_CClientState__CheckForResend; /*48 89 5C 24 ?? 56 57 41 57 ?? 81 EC 20 04 ?? 00 45 0F B6 F9 ?? ?? ?? ?? 8B F1 48*/ -inline auto CClientState__CheckForResend = p_CClientState__CheckForResend.RCast(); +inline auto CClientState__CheckForResend = p_CClientState__CheckForResend.RCast(); inline CMemory p_CClientState__Disconnect; /*48 89 5C 24 ?? 55 57 41 56 48 83 EC 30 0F B6 EA*/ -inline auto CClientState__Disconnect = p_CClientState__Disconnect.RCast(); +inline auto CClientState__Disconnect = p_CClientState__Disconnect.RCast(); /////////////////////////////////////////////////////////////////////////////// -class VBaseClientState : public IDetour +class VClientState : public IDetour { virtual void GetAdr(void) const { @@ -199,26 +199,26 @@ class VBaseClientState : public IDetour { #if defined (GAMEDLL_S0) || defined (GAMEDLL_S1) p_CClientState__RunFrame = g_mGameDll.FindPatternSIMD(reinterpret_cast("\x48\x89\x4C\x24\x00\x57\x48\x81\xEC\x00\x00\x00\x00\x83\xB9\x00\x00\x00\x00\x00"), "xxxx?xxxx????xx?????"); - CClientState__RunFrame = p_CClientState__RunFrame.RCast(); + CClientState__RunFrame = p_CClientState__RunFrame.RCast(); p_CClientState__CheckForResend = g_mGameDll.FindPatternSIMD(reinterpret_cast("\x48\x89\x5C\x24\x00\x56\x57\x41\x57\x00\x81\xEC\x20\x04\x00\x00\x45\x0F\xB6\xF9\x00\x00\x00\x00\x8B\xF1\x48"), "xxxx?xxxx?xxxx?xxxxx????xxx"); - CClientState__CheckForResend = p_CClientState__CheckForResend.RCast(); /*48 89 5C 24 ?? 56 57 41 57 ?? 81 EC 20 04 ?? 00 45 0F B6 F9 ?? ?? ?? ?? 8B F1 48*/ + CClientState__CheckForResend = p_CClientState__CheckForResend.RCast(); /*48 89 5C 24 ?? 56 57 41 57 ?? 81 EC 20 04 ?? 00 45 0F B6 F9 ?? ?? ?? ?? 8B F1 48*/ p_CClientState__Disconnect = g_mGameDll.FindPatternSIMD(reinterpret_cast("\x48\x89\x5C\x24\x00\x55\x57\x41\x56\x48\x83\xEC\x30\x0F\xB6\xEA"), "xxxx?xxxxxxxxxxx"); - CClientState__Disconnect = p_CClientState__Disconnect.RCast(); /*48 89 5C 24 ?? 55 57 41 56 48 83 EC 30 0F B6 EA*/ + CClientState__Disconnect = p_CClientState__Disconnect.RCast(); /*48 89 5C 24 ?? 55 57 41 56 48 83 EC 30 0F B6 EA*/ #elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3) p_CClientState__RunFrame = g_mGameDll.FindPatternSIMD(reinterpret_cast("\x40\x53\x48\x81\xEC\x00\x00\x00\x00\x83\xB9\x00\x00\x00\x00\x00\x48\x8B\xD9\x7D\x0B"), "xxxxx????xx?????xxxxx"); - CClientState__RunFrame = p_CClientState__RunFrame.RCast(); + CClientState__RunFrame = p_CClientState__RunFrame.RCast(); p_CClientState__Disconnect = g_mGameDll.FindPatternSIMD(reinterpret_cast("\x40\x56\x57\x41\x54\x41\x55\x41\x57\x48\x83\xEC\x30\x44\x0F\xB6\xFA"), "xxxxxxxxxxxxxxxxx"); - CClientState__Disconnect = p_CClientState__Disconnect.RCast(); /*40 56 57 41 54 41 55 41 57 48 83 EC 30 44 0F B6 FA*/ + CClientState__Disconnect = p_CClientState__Disconnect.RCast(); /*40 56 57 41 54 41 55 41 57 48 83 EC 30 44 0F B6 FA*/ #endif #if defined (GAMEDLL_S2) p_CClientState__CheckForResend = g_mGameDll.FindPatternSIMD(reinterpret_cast("\x48\x89\x5C\x24\x00\x48\x89\x74\x24\x00\x48\x89\x7C\x24\x00\x41\x56\x48\x81\xEC\x00\x00\x00\x00\x45\x0F\xB6"), "xxxx?xxxx?xxxx?xxxxx????xxx"); - CClientState__CheckForResend = p_CClientState__CheckForResend.RCast(); /*48 89 5C 24 ?? 48 89 74 24 ?? 48 89 7C 24 ?? 41 56 48 81 EC ?? ?? ?? ?? 45 0F B6*/ + CClientState__CheckForResend = p_CClientState__CheckForResend.RCast(); /*48 89 5C 24 ?? 48 89 74 24 ?? 48 89 7C 24 ?? 41 56 48 81 EC ?? ?? ?? ?? 45 0F B6*/ #elif defined (GAMEDLL_S3) p_CClientState__CheckForResend = g_mGameDll.FindPatternSIMD(reinterpret_cast("\x48\x89\x5C\x24\x00\x48\x89\x74\x24\x00\x48\x89\x7C\x24\x00\x41\x56\x48\x81\xEC\x00\x00\x00\x00\x48\x8B\x32"), "xxxx?xxxx?xxxx?xxxxx????xxx"); - CClientState__CheckForResend = p_CClientState__CheckForResend.RCast(); /*48 89 5C 24 ?? 48 89 74 24 ?? 48 89 7C 24 ?? 41 56 48 81 EC ?? ?? ?? ?? 48 8B 32*/ + CClientState__CheckForResend = p_CClientState__CheckForResend.RCast(); /*48 89 5C 24 ?? 48 89 74 24 ?? 48 89 7C 24 ?? 41 56 48 81 EC ?? ?? ?? ?? 48 8B 32*/ #endif } virtual void GetVar(void) const @@ -246,7 +246,7 @@ class VBaseClientState : public IDetour virtual void GetCon(void) const { #ifndef DEDICATED - g_pBaseClientState = g_mGameDll.FindPatternSIMD(reinterpret_cast("\x0F\x84\x00\x00\x00\x00\x48\x8D\x0D\x00\x00\x00\x00\x48\x83\xC4\x28"), "xx????xxx????xxxx").FindPatternSelf("48 8D").ResolveRelativeAddressSelf(0x3, 0x7).RCast(); /*0F 84 ? ? ? ? 48 8D 0D ? ? ? ? 48 83 C4 28*/ + g_pBaseClientState = g_mGameDll.FindPatternSIMD(reinterpret_cast("\x0F\x84\x00\x00\x00\x00\x48\x8D\x0D\x00\x00\x00\x00\x48\x83\xC4\x28"), "xx????xxx????xxxx").FindPatternSelf("48 8D").ResolveRelativeAddressSelf(0x3, 0x7).RCast(); /*0F 84 ? ? ? ? 48 8D 0D ? ? ? ? 48 83 C4 28*/ #endif } virtual void Attach(void) const { } @@ -254,4 +254,4 @@ class VBaseClientState : public IDetour }; /////////////////////////////////////////////////////////////////////////////// -REGISTER(VBaseClientState); +REGISTER(VClientState); diff --git a/r5dev/engine/host_state.cpp b/r5dev/engine/host_state.cpp index 7ebec74a..2061aabd 100644 --- a/r5dev/engine/host_state.cpp +++ b/r5dev/engine/host_state.cpp @@ -15,10 +15,10 @@ #include "vpc/keyvalues.h" #include "datacache/mdlcache.h" #ifdef DEDICATED -#include "engine/sv_rcon.h" +#include "engine/server/sv_rcon.h" #else // -#include "engine/cl_rcon.h" -#include "engine/cl_main.h" +#include "engine/client/cl_rcon.h" +#include "engine/client/cl_main.h" #endif // DEDICATED #include "engine/net.h" #include "engine/gl_screen.h" @@ -30,7 +30,7 @@ #include "engine/modelloader.h" #include "engine/cmodel_bsp.h" #ifndef CLIENT_DLL -#include "engine/baseserver.h" +#include "engine/server/server.h" #endif // !CLIENT_DLL #include "rtech/rtech_game.h" #include "rtech/rtech_utils.h" diff --git a/r5dev/engine/net.cpp b/r5dev/engine/net.cpp index b4265159..74a80f5b 100644 --- a/r5dev/engine/net.cpp +++ b/r5dev/engine/net.cpp @@ -15,7 +15,7 @@ #include "engine/net.h" #include "engine/net_chan.h" #ifndef CLIENT_DLL -#include "engine/baseclient.h" +#include "engine/client/client.h" #endif // !CLIENT_DLL #endif // !NETCONSOLE @@ -152,7 +152,7 @@ void NET_Shutdown(void* thisptr, const char* szReason, uint8_t bBadRep, bool bRe // bBadRep - // bRemoveNow - //----------------------------------------------------------------------------- -void NET_DisconnectClient(CBaseClient* pClient, int nIndex, const char* szReason, uint8_t bBadRep, bool bRemoveNow) +void NET_DisconnectClient(CClient* pClient, int nIndex, const char* szReason, uint8_t bBadRep, bool bRemoveNow) { #ifndef CLIENT_DLL if (!pClient || std::strlen(szReason) == NULL || !pClient->GetNetChan()) diff --git a/r5dev/engine/net.h b/r5dev/engine/net.h index 1806e1a2..3a7716fb 100644 --- a/r5dev/engine/net.h +++ b/r5dev/engine/net.h @@ -32,7 +32,7 @@ void NET_SetKey(const string& svNetKey); void NET_GenerateKey(); void NET_PrintFunc(const char* fmt, ...); void NET_Shutdown(void* thisptr, const char* szReason, uint8_t bBadRep, bool bRemoveNow); -void NET_DisconnectClient(CBaseClient* pClient, int nIndex, const char* szReason, uint8_t unk1, bool bRemoveNow); +void NET_DisconnectClient(CClient* pClient, int nIndex, const char* szReason, uint8_t unk1, bool bRemoveNow); void NET_Attach(); void NET_Detach(); diff --git a/r5dev/engine/net_chan.h b/r5dev/engine/net_chan.h index 9c92b58d..ccb1a9b3 100644 --- a/r5dev/engine/net_chan.h +++ b/r5dev/engine/net_chan.h @@ -21,7 +21,7 @@ //----------------------------------------------------------------------------- // Purpose: forward declarations //----------------------------------------------------------------------------- -class CBaseClient; +class CClient; //----------------------------------------------------------------------------- struct netframe_t diff --git a/r5dev/engine/server/server.cpp b/r5dev/engine/server/server.cpp new file mode 100644 index 00000000..84696dc7 --- /dev/null +++ b/r5dev/engine/server/server.cpp @@ -0,0 +1,125 @@ +//=============================================================================// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// +// server.cpp: implementation of the CServer class. +// +///////////////////////////////////////////////////////////////////////////////// +#include "core/stdafx.h" +#include "common/protocol.h" +#include "tier1/cvar.h" +#include "engine/sys_utils.h" +#include "engine/server/sv_main.h" +#include "engine/server/server.h" +#include "engine/client/client.h" +#include "networksystem/r5net.h" +#include "public/include/edict.h" +#include "public/include/bansystem.h" + +//--------------------------------------------------------------------------------- +// Purpose: Gets the number of human players on the server +// Output : int +//--------------------------------------------------------------------------------- +int CServer::GetNumHumanPlayers(void) const +{ + int nHumans = 0; + for (int i = 0; i < g_ServerGlobalVariables->m_nMaxClients; i++) + { + CClient* pClient = g_pClient->GetClient(i); + if (!pClient) + continue; + + if (pClient->IsHumanPlayer()) + nHumans++; + } + + return nHumans; +} + +//--------------------------------------------------------------------------------- +// Purpose: Gets the number of fake clients on the server +// Output : int +//--------------------------------------------------------------------------------- +int CServer::GetNumFakeClients(void) const +{ + int nBots = 0; + for (int i = 0; i < g_ServerGlobalVariables->m_nMaxClients; i++) + { + CClient* pClient = g_pClient->GetClient(i); + if (!pClient) + continue; + + if (pClient->IsConnected() && pClient->IsFakeClient()) + nBots++; + } + + return nBots; +} + +//----------------------------------------------------------------------------- +// Purpose: client to server authentication +// Input : *this - +// *pInpacket - +// Output : pointer to client instance on success, nullptr on failure +//----------------------------------------------------------------------------- +CClient* CServer::Authenticate(CServer* pServer, user_creds* pInpacket) +{ + std::string svIpAddress = pInpacket->m_nAddr.GetAddress(); + if (sv_showconnecting->GetBool()) + { + DevMsg(eDLL_T::SERVER, "\n"); + DevMsg(eDLL_T::SERVER, "______________________________________________________________\n"); + DevMsg(eDLL_T::SERVER, "] AUTHENTICATION ---------------------------------------------\n"); + DevMsg(eDLL_T::SERVER, "] UID : | '%s'\n", pInpacket->m_nUserID); + DevMsg(eDLL_T::SERVER, "] OID : | '%lld'\n", pInpacket->m_nNucleusID); + DevMsg(eDLL_T::SERVER, "] ADR : | '%s'\n", svIpAddress.c_str()); + DevMsg(eDLL_T::SERVER, "--------------------------------------------------------------\n"); + } + + if (g_pBanSystem->IsBanListValid()) // Is the banlist vector valid? + { + if (g_pBanSystem->IsBanned(svIpAddress, pInpacket->m_nNucleusID)) // Is the client trying to connect banned? + { + v_CServer_RejectConnection(pServer, *(unsigned int*)((std::uintptr_t)pServer + 0xC), pInpacket, "You have been banned from this server."); // RejectConnection for the client. + + if (sv_showconnecting->GetBool()) + { + Warning(eDLL_T::SERVER, "Connection rejected for '%s' ('%lld' is banned from this server!)\n", svIpAddress.c_str(), pInpacket->m_nNucleusID); + } + return nullptr; + } + } + if (sv_showconnecting->GetBool()) + { + DevMsg(eDLL_T::SERVER, "\n"); + } + + if (g_bCheckCompBanDB) + { + if (g_pR5net) + { + std::thread th(SV_IsClientBanned, g_pR5net, svIpAddress, pInpacket->m_nNucleusID); + th.detach(); + } + } + + return v_CServer_Authenticate(pServer, pInpacket); +} + +/////////////////////////////////////////////////////////////////////////////// +void CServer_Attach() +{ + DetourAttach((LPVOID*)&v_CServer_Authenticate, &CServer::Authenticate); +} + +void CServer_Detach() +{ + DetourDetach((LPVOID*)&v_CServer_Authenticate, &CServer::Authenticate); +} + +/////////////////////////////////////////////////////////////////////////////// +bool g_bCheckCompBanDB = true; +CServer* g_pServer = new CServer(); // !TODO: Replace with engine global if found. \ No newline at end of file diff --git a/r5dev/engine/server/server.h b/r5dev/engine/server/server.h new file mode 100644 index 00000000..5a8853a1 --- /dev/null +++ b/r5dev/engine/server/server.h @@ -0,0 +1,81 @@ +#pragma once +#include "tier1/NetAdr2.h" +#include "networksystem/r5net.h" +#include "engine/client/client.h" + +struct user_creds +{ + v_netadr_t m_nAddr; + int32_t m_nProtocolVer; + int32_t m_nchallenge; + uint8_t gap2[8]; + int64_t m_nNucleusID; + int64_t m_nUserID; +}; + +class CServer +{ +public: + int GetNumHumanPlayers(void) const; + int GetNumFakeClients(void) const; + static CClient* Authenticate(CServer* pServer, user_creds* pInpacket); +}; +extern CServer* g_pServer; + +/* ==== CSERVER ========================================================================================================================================================= */ +inline CMemory p_CServer_Think; +inline auto v_CServer_Think = p_CServer_Think.RCast(); + +inline CMemory p_CServer_Authenticate; +inline auto v_CServer_Authenticate = p_CServer_Authenticate.RCast(); + +inline CMemory p_CServer_RejectConnection; +inline auto v_CServer_RejectConnection = p_CServer_RejectConnection.RCast(); + +inline int* sv_m_nTickCount = nullptr; + +void CServer_Attach(); +void CServer_Detach(); + +void SV_IsClientBanned(R5Net::Client* r5net, const std::string ipaddr, std::int64_t nucleus_id); + +extern bool g_bCheckCompBanDB; + +/////////////////////////////////////////////////////////////////////////////// +class VServer : public IDetour +{ + virtual void GetAdr(void) const + { + spdlog::debug("| FUN: CServer::Think : {:#18x} |\n", p_CServer_Think.GetPtr()); + spdlog::debug("| FUN: CServer::Authenticate : {:#18x} |\n", p_CServer_Authenticate.GetPtr()); + spdlog::debug("| FUN: CServer::RejectConnection : {:#18x} |\n", p_CServer_RejectConnection.GetPtr()); + spdlog::debug("| VAR: sv_m_nTickCount : {:#18x} |\n", reinterpret_cast(sv_m_nTickCount)); + spdlog::debug("+----------------------------------------------------------------+\n"); + } + virtual void GetFun(void) const + { + p_CServer_Think = g_mGameDll.FindPatternSIMD(reinterpret_cast("\x48\x89\x5C\x24\x00\x48\x89\x74\x24\x00\x57\x48\x81\xEC\x00\x00\x00\x00\x80\x3D\x00\x00\x00\x00\x00"), "xxxx?xxxx?xxxx????xx?????"); +#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1) + p_CServer_Authenticate = g_mGameDll.FindPatternSIMD(reinterpret_cast("\x44\x89\x44\x24\x00\x55\x56\x57\x48\x8D\xAC\x24\x00\x00\x00\x00"), "xxxx?xxxxxxx????"); +#elif defined (GAMEDLL_S2) + p_CServer_Authenticate = g_mGameDll.FindPatternSIMD(reinterpret_cast("\x44\x89\x44\x24\x00\x56\x57\x48\x81\xEC\x00\x00\x00\x00"), "xxxx?xxxxx????"); +#else + p_CServer_Authenticate = g_mGameDll.FindPatternSIMD(reinterpret_cast("\x40\x55\x57\x41\x55\x41\x57\x48\x8D\xAC\x24\x00\x00\x00\x00"), "xxxxxxxxxxx????"); +#endif + p_CServer_RejectConnection = g_mGameDll.FindPatternSIMD(reinterpret_cast("\x4C\x89\x4C\x24\x00\x53\x55\x56\x57\x48\x81\xEC\x00\x00\x00\x00\x49\x8B\xD9"), "xxxx?xxxxxxx????xxx"); + + v_CServer_Think = p_CServer_Think.RCast(); /*48 89 5C 24 ?? 48 89 74 24 ?? 57 48 81 EC ?? ?? ?? ?? 80 3D ?? ?? ?? ?? ??*/ + v_CServer_Authenticate = p_CServer_Authenticate.RCast(); /*40 55 57 41 55 41 57 48 8D AC 24 ?? ?? ?? ??*/ + v_CServer_RejectConnection = p_CServer_RejectConnection.RCast(); /*4C 89 4C 24 ?? 53 55 56 57 48 81 EC ?? ?? ?? ?? 49 8B D9*/ + } + virtual void GetVar(void) const + { + sv_m_nTickCount = p_CServer_Think.Offset(0xB0).FindPatternSelf("8B 15", CMemory::Direction::DOWN).ResolveRelativeAddressSelf(0x2, 0x6).RCast(); + } + virtual void GetCon(void) const { } + virtual void Attach(void) const { } + virtual void Detach(void) const { } +}; +/////////////////////////////////////////////////////////////////////////////// + +REGISTER(VServer); diff --git a/r5dev/engine/server/sv_main.cpp b/r5dev/engine/server/sv_main.cpp new file mode 100644 index 00000000..ee7053cc --- /dev/null +++ b/r5dev/engine/server/sv_main.cpp @@ -0,0 +1,26 @@ +#include "core/stdafx.h" +#include "engine/sys_utils.h" +#include "engine/server/sv_main.h" +#include "networksystem/r5net.h" +#include "public/include/bansystem.h" + +//----------------------------------------------------------------------------- +// Purpose: checks if particular client is banned on the comp server +//----------------------------------------------------------------------------- +void SV_IsClientBanned(R5Net::Client* pR5net, const std::string svIPAddr, std::int64_t nNucleusID) +{ + std::string svError = std::string(); + bool bCompBanned = pR5net->GetClientIsBanned(svIPAddr, nNucleusID, svError); + if (bCompBanned) + { + DevMsg(eDLL_T::SERVER, "\n"); + DevMsg(eDLL_T::SERVER, "______________________________________________________________\n"); + DevMsg(eDLL_T::SERVER, "] PYLON_NOTICE -----------------------------------------------\n"); + DevMsg(eDLL_T::SERVER, "] OriginID : | '%lld' IS PYLON BANNED.\n", nNucleusID); + DevMsg(eDLL_T::SERVER, "--------------------------------------------------------------\n"); + DevMsg(eDLL_T::SERVER, "\n"); + g_pBanSystem->AddConnectionRefuse(svError, nNucleusID); // Add to the vector. + } +} + +/////////////////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/r5dev/engine/sv_main.h b/r5dev/engine/server/sv_main.h similarity index 95% rename from r5dev/engine/sv_main.h rename to r5dev/engine/server/sv_main.h index 82ace527..3c070c00 100644 --- a/r5dev/engine/sv_main.h +++ b/r5dev/engine/server/sv_main.h @@ -1,4 +1,6 @@ #pragma once +#include "networksystem/r5net.h" +#include "public/include/bansystem.h" /////////////////////////////////////////////////////////////////////////////// @@ -19,6 +21,7 @@ inline bool* s_bDedicated = nullptr; /////////////////////////////////////////////////////////////////////////////// +void SV_IsClientBanned(R5Net::Client* pR5net, const std::string svIPAddr, std::int64_t nNucleusID); /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// diff --git a/r5dev/engine/sv_rcon.cpp b/r5dev/engine/server/sv_rcon.cpp similarity index 99% rename from r5dev/engine/sv_rcon.cpp rename to r5dev/engine/server/sv_rcon.cpp index c03dd38f..9d97ac84 100644 --- a/r5dev/engine/sv_rcon.cpp +++ b/r5dev/engine/server/sv_rcon.cpp @@ -11,7 +11,7 @@ #include "tier1/NetAdr2.h" #include "tier2/socketcreator.h" #include "engine/sys_utils.h" -#include "engine/sv_rcon.h" +#include "engine/server/sv_rcon.h" #include "protoc/sv_rcon.pb.h" #include "protoc/cl_rcon.pb.h" #include "mathlib/sha256.h" diff --git a/r5dev/engine/sv_rcon.h b/r5dev/engine/server/sv_rcon.h similarity index 100% rename from r5dev/engine/sv_rcon.h rename to r5dev/engine/server/sv_rcon.h diff --git a/r5dev/engine/sv_main.cpp b/r5dev/engine/sv_main.cpp deleted file mode 100644 index 900050ac..00000000 --- a/r5dev/engine/sv_main.cpp +++ /dev/null @@ -1,4 +0,0 @@ -#include "core/stdafx.h" -#include "engine/sv_main.h" - -/////////////////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/r5dev/engine/sys_utils.cpp b/r5dev/engine/sys_utils.cpp index f3a32848..746cfdde 100644 --- a/r5dev/engine/sys_utils.cpp +++ b/r5dev/engine/sys_utils.cpp @@ -10,7 +10,7 @@ #include "tier1/cvar.h" #include "engine/sys_utils.h" #ifdef DEDICATED -#include "engine/sv_rcon.h" +#include "engine/server/sv_rcon.h" #else #include "vgui/vgui_debugpanel.h" #include "gameui/IConsole.h" diff --git a/r5dev/game/server/gameinterface.cpp b/r5dev/game/server/gameinterface.cpp index 599dae3b..af5d1e6d 100644 --- a/r5dev/game/server/gameinterface.cpp +++ b/r5dev/game/server/gameinterface.cpp @@ -6,7 +6,7 @@ //=============================================================================// #include "core/stdafx.h" -#include "engine/sv_main.h" +#include "engine/server/sv_main.h" #include "game/server/gameinterface.h" //----------------------------------------------------------------------------- diff --git a/r5dev/gameui/IBrowser.cpp b/r5dev/gameui/IBrowser.cpp index 6057f71a..511f05e9 100644 --- a/r5dev/gameui/IBrowser.cpp +++ b/r5dev/gameui/IBrowser.cpp @@ -23,11 +23,11 @@ History: #include "engine/net.h" #include "engine/sys_utils.h" #include "engine/host_state.h" +#include "engine/server/server.h" #include "networksystem/serverlisting.h" #include "networksystem/r5net.h" #include "squirrel/sqinit.h" #include "squirrel/sqapi.h" -#include "server/server.h" #include "client/vengineclient_impl.h" #include "vpc/keyvalues.h" #include "vstdlib/callback.h" diff --git a/r5dev/launcher/IApplication.cpp b/r5dev/launcher/IApplication.cpp index 70e64ca7..def5343a 100644 --- a/r5dev/launcher/IApplication.cpp +++ b/r5dev/launcher/IApplication.cpp @@ -11,8 +11,8 @@ #include "ebisusdk/EbisuSDK.h" #include "engine/sys_engine.h" #include "engine/sys_dll2.h" -#include "engine/sv_main.h" #include "engine/host_cmd.h" +#include "engine/server/sv_main.h" #include "server/vengineserver_impl.h" #include "client/cdll_engine_int.h" #ifndef DEDICATED diff --git a/r5dev/public/bansystem.cpp b/r5dev/public/bansystem.cpp index 43540b57..675beb50 100644 --- a/r5dev/public/bansystem.cpp +++ b/r5dev/public/bansystem.cpp @@ -8,7 +8,7 @@ #include "core/stdafx.h" #include "engine/net.h" #include "engine/sys_utils.h" -#include "engine/baseclient.h" +#include "engine/client/client.h" #include "public/include/bansystem.h" //----------------------------------------------------------------------------- @@ -201,7 +201,7 @@ void CBanSystem::BanListCheck(void) { for (int c = 0; c < MAX_PLAYERS; c++) // Loop through all possible client instances. { - CBaseClient* pClient = g_pClient->GetClient(c); + CClient* pClient = g_pClient->GetClient(c); CNetChan* pNetChan = pClient->GetNetChan(); if (!pClient || !pNetChan) diff --git a/r5dev/public/include/edict.h b/r5dev/public/include/edict.h index b26d1a43..1f9098de 100644 --- a/r5dev/public/include/edict.h +++ b/r5dev/public/include/edict.h @@ -4,7 +4,7 @@ #endif // !DEDICATED #include "public/include/globalvars_base.h" #ifndef CLIENT_DLL -#include "engine/sv_main.h" +#include "engine/server/sv_main.h" #endif // !CLIENT_DLL diff --git a/r5dev/server/server.cpp b/r5dev/server/server.cpp deleted file mode 100644 index 9572581b..00000000 --- a/r5dev/server/server.cpp +++ /dev/null @@ -1,87 +0,0 @@ -#include "core/stdafx.h" -#include "tier1/cvar.h" -#include "engine/sys_utils.h" -#include "server/server.h" -#include "engine/baseclient.h" -#include "networksystem/r5net.h" -#include "public/include/bansystem.h" - -//----------------------------------------------------------------------------- -// Purpose: checks if particular client is banned on the comp server -//----------------------------------------------------------------------------- -void IsClientBanned(R5Net::Client* pR5net, const std::string svIPAddr, std::int64_t nNucleusID) -{ - std::string svError = std::string(); - bool bCompBanned = pR5net->GetClientIsBanned(svIPAddr, nNucleusID, svError); - if (bCompBanned) - { - DevMsg(eDLL_T::SERVER, "\n"); - DevMsg(eDLL_T::SERVER, "______________________________________________________________\n"); - DevMsg(eDLL_T::SERVER, "] PYLON_NOTICE -----------------------------------------------\n"); - DevMsg(eDLL_T::SERVER, "] OriginID : | '%lld' IS PYLON BANNED.\n", nNucleusID); - DevMsg(eDLL_T::SERVER, "--------------------------------------------------------------\n"); - DevMsg(eDLL_T::SERVER, "\n"); - g_pBanSystem->AddConnectionRefuse(svError, nNucleusID); // Add to the vector. - } -} - -//----------------------------------------------------------------------------- -// Purpose: client to server authentication -//----------------------------------------------------------------------------- -void* HCServer_Authenticate(void* pServer, user_creds* pInpacket) -{ - std::string svIpAddress = pInpacket->m_nAddr.GetAddress(); - if (sv_showconnecting->GetBool()) - { - DevMsg(eDLL_T::SERVER, "\n"); - DevMsg(eDLL_T::SERVER, "______________________________________________________________\n"); - DevMsg(eDLL_T::SERVER, "] AUTHENTICATION ---------------------------------------------\n"); - DevMsg(eDLL_T::SERVER, "] UID : | '%s'\n", pInpacket->m_nUserID); - DevMsg(eDLL_T::SERVER, "] OID : | '%lld'\n", pInpacket->m_nNucleusID); - DevMsg(eDLL_T::SERVER, "] ADR : | '%s'\n", svIpAddress.c_str()); - DevMsg(eDLL_T::SERVER, "--------------------------------------------------------------\n"); - } - - if (g_pBanSystem->IsBanListValid()) // Is the banlist vector valid? - { - if (g_pBanSystem->IsBanned(svIpAddress, pInpacket->m_nNucleusID)) // Is the client trying to connect banned? - { - CServer_RejectConnection(pServer, *(unsigned int*)((std::uintptr_t)pServer + 0xC), pInpacket, "You have been banned from this server."); // RejectConnection for the client. - - if (sv_showconnecting->GetBool()) - { - Warning(eDLL_T::SERVER, "Connection rejected for '%s' ('%lld' is banned from this server!)\n", svIpAddress.c_str(), pInpacket->m_nNucleusID); - } - return nullptr; - } - } - if (sv_showconnecting->GetBool()) - { - DevMsg(eDLL_T::SERVER, "\n"); - } - - if (g_bCheckCompBanDB) - { - if (g_pR5net) - { - std::thread th(IsClientBanned, g_pR5net, svIpAddress, pInpacket->m_nNucleusID); - th.detach(); - } - } - - return CServer_Authenticate(pServer, pInpacket); -} - -/////////////////////////////////////////////////////////////////////////////// -void CServer_Attach() -{ - DetourAttach((LPVOID*)&CServer_Authenticate, &HCServer_Authenticate); -} - -void CServer_Detach() -{ - DetourDetach((LPVOID*)&CServer_Authenticate, &HCServer_Authenticate); -} - -/////////////////////////////////////////////////////////////////////////////// -bool g_bCheckCompBanDB = true; \ No newline at end of file diff --git a/r5dev/server/server.h b/r5dev/server/server.h deleted file mode 100644 index f38b8a79..00000000 --- a/r5dev/server/server.h +++ /dev/null @@ -1,72 +0,0 @@ -#pragma once -#include "tier1/NetAdr2.h" -#include "networksystem/r5net.h" - -struct user_creds -{ - v_netadr_t m_nAddr; - int32_t m_nProtocolVer; - int32_t m_nchallenge; - uint8_t gap2[8]; - int64_t m_nNucleusID; - int64_t m_nUserID; -}; - -/* ==== CSERVER ========================================================================================================================================================= */ -inline CMemory p_CServer_Think; -inline auto CServer_Think = p_CServer_Think.RCast(); - -inline CMemory p_CServer_Authenticate; -inline auto CServer_Authenticate = p_CServer_Authenticate.RCast(); - -inline CMemory p_CServer_RejectConnection; -inline auto CServer_RejectConnection = p_CServer_RejectConnection.RCast(); - -inline int* sv_m_nTickCount = nullptr; - -void CServer_Attach(); -void CServer_Detach(); - -void IsClientBanned(R5Net::Client* r5net, const std::string ipaddr, std::int64_t nucleus_id); -void* HCServer_Authenticate(void* cserver, user_creds* inpacket); - -extern bool g_bCheckCompBanDB; - -/////////////////////////////////////////////////////////////////////////////// -class VServer : public IDetour -{ - virtual void GetAdr(void) const - { - spdlog::debug("| FUN: CServer::Think : {:#18x} |\n", p_CServer_Think.GetPtr()); - spdlog::debug("| FUN: CServer::Authenticate : {:#18x} |\n", p_CServer_Authenticate.GetPtr()); - spdlog::debug("| FUN: CServer::RejectConnection : {:#18x} |\n", p_CServer_RejectConnection.GetPtr()); - spdlog::debug("| VAR: sv_m_nTickCount : {:#18x} |\n", reinterpret_cast(sv_m_nTickCount)); - spdlog::debug("+----------------------------------------------------------------+\n"); - } - virtual void GetFun(void) const - { - p_CServer_Think = g_mGameDll.FindPatternSIMD(reinterpret_cast("\x48\x89\x5C\x24\x00\x48\x89\x74\x24\x00\x57\x48\x81\xEC\x00\x00\x00\x00\x80\x3D\x00\x00\x00\x00\x00"), "xxxx?xxxx?xxxx????xx?????"); -#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1) - p_CServer_Authenticate = g_mGameDll.FindPatternSIMD(reinterpret_cast("\x44\x89\x44\x24\x00\x55\x56\x57\x48\x8D\xAC\x24\x00\x00\x00\x00"), "xxxx?xxxxxxx????"); -#elif defined (GAMEDLL_S2) - p_CServer_Authenticate = g_mGameDll.FindPatternSIMD(reinterpret_cast("\x44\x89\x44\x24\x00\x56\x57\x48\x81\xEC\x00\x00\x00\x00"), "xxxx?xxxxx????"); -#else - p_CServer_Authenticate = g_mGameDll.FindPatternSIMD(reinterpret_cast("\x40\x55\x57\x41\x55\x41\x57\x48\x8D\xAC\x24\x00\x00\x00\x00"), "xxxxxxxxxxx????"); -#endif - p_CServer_RejectConnection = g_mGameDll.FindPatternSIMD(reinterpret_cast("\x4C\x89\x4C\x24\x00\x53\x55\x56\x57\x48\x81\xEC\x00\x00\x00\x00\x49\x8B\xD9"), "xxxx?xxxxxxx????xxx"); - - CServer_Think = p_CServer_Think.RCast(); /*48 89 5C 24 ?? 48 89 74 24 ?? 57 48 81 EC ?? ?? ?? ?? 80 3D ?? ?? ?? ?? ??*/ - CServer_Authenticate = p_CServer_Authenticate.RCast(); /*40 55 57 41 55 41 57 48 8D AC 24 ?? ?? ?? ??*/ - CServer_RejectConnection = p_CServer_RejectConnection.RCast(); /*4C 89 4C 24 ?? 53 55 56 57 48 81 EC ?? ?? ?? ?? 49 8B D9*/ - } - virtual void GetVar(void) const - { - sv_m_nTickCount = p_CServer_Think.Offset(0xB0).FindPatternSelf("8B 15", CMemory::Direction::DOWN).ResolveRelativeAddressSelf(0x2, 0x6).RCast(); - } - virtual void GetCon(void) const { } - virtual void Attach(void) const { } - virtual void Detach(void) const { } -}; -/////////////////////////////////////////////////////////////////////////////// - -REGISTER(VServer); diff --git a/r5dev/server/vengineserver_impl.cpp b/r5dev/server/vengineserver_impl.cpp index 0fa1546e..10751679 100644 --- a/r5dev/server/vengineserver_impl.cpp +++ b/r5dev/server/vengineserver_impl.cpp @@ -8,18 +8,18 @@ #include "tier1/cvar.h" #include "common/protocol.h" #include "engine/sys_utils.h" -#include "engine/baseclient.h" +#include "engine/client/client.h" #include "server/vengineserver_impl.h" //----------------------------------------------------------------------------- // Purpose: sets the persistence var in the CClient instance to 'ready' //----------------------------------------------------------------------------- -bool HIVEngineServer__PersistenceAvailable(void* entidx, int clientidx) +bool HIVEngineServer__PersistenceAvailable(void* entidx, int clienthandle) { - CBaseClient* pClient = g_pClient->GetClient(clientidx); // Get client instance. + CClient* pClient = g_pClient->GetClient(clienthandle); // Get client instance. pClient->SetPersistenceState(PERSISTENCE::PERSISTENCE_READY); // Set the client instance to 'ready'. - if (!g_bIsPersistenceVarSet[clientidx] && sv_showconnecting->GetBool()) + if (!g_bIsPersistenceVarSet[clienthandle] && sv_showconnecting->GetBool()) { CNetChan* pNetChan = pClient->GetNetChan(); @@ -29,16 +29,16 @@ bool HIVEngineServer__PersistenceAvailable(void* entidx, int clientidx) DevMsg(eDLL_T::SERVER, "______________________________________________________________\n"); DevMsg(eDLL_T::SERVER, "+- NetChannel:\n"); - DevMsg(eDLL_T::SERVER, " |- IDX : | '#%d'\n", clientidx); + DevMsg(eDLL_T::SERVER, " |- IDX : | '#%d'\n", clienthandle); DevMsg(eDLL_T::SERVER, " |- UID : | '%s'\n", svClientName.c_str()); DevMsg(eDLL_T::SERVER, " |- OID : | '%lld'\n", nOriginID); DevMsg(eDLL_T::SERVER, " |- ADR : | '%s'\n", svIpAddress.c_str()); DevMsg(eDLL_T::SERVER, " -------------------------------------------------------------\n"); - g_bIsPersistenceVarSet[clientidx] = true; + g_bIsPersistenceVarSet[clienthandle] = true; } /////////////////////////////////////////////////////////////////////////// - return IVEngineServer__PersistenceAvailable(entidx, clientidx); + return IVEngineServer__PersistenceAvailable(entidx, clienthandle); } void IVEngineServer_Attach() diff --git a/r5dev/squirrel/sqinit.cpp b/r5dev/squirrel/sqinit.cpp index 007e6e9b..11118238 100644 --- a/r5dev/squirrel/sqinit.cpp +++ b/r5dev/squirrel/sqinit.cpp @@ -13,7 +13,7 @@ #include "core/stdafx.h" #include "engine/sys_utils.h" -#include "engine/baseserver.h" +#include "engine/server/server.h" #include "squirrel/sqtype.h" #include "squirrel/sqapi.h" #include "squirrel/sqinit.h" diff --git a/r5dev/squirrel/sqvm.cpp b/r5dev/squirrel/sqvm.cpp index 94741e61..77cd1a42 100644 --- a/r5dev/squirrel/sqvm.cpp +++ b/r5dev/squirrel/sqvm.cpp @@ -11,7 +11,7 @@ #include "tier1/IConVar.h" #include "engine/sys_utils.h" #ifdef DEDICATED -#include "engine/sv_rcon.h" +#include "engine/server/sv_rcon.h" #else // DEDICATED #include "client/cdll_engine_int.h" #include "vgui/vgui_debugpanel.h" diff --git a/r5dev/vgui/vgui_baseui_interface.h b/r5dev/vgui/vgui_baseui_interface.h index 07bc414f..08aed4c5 100644 --- a/r5dev/vgui/vgui_baseui_interface.h +++ b/r5dev/vgui/vgui_baseui_interface.h @@ -1,5 +1,5 @@ #pragma once -#include +#include enum class PaintMode_t { diff --git a/r5dev/vgui/vgui_debugpanel.cpp b/r5dev/vgui/vgui_debugpanel.cpp index cd668922..719cf6d0 100644 --- a/r5dev/vgui/vgui_debugpanel.cpp +++ b/r5dev/vgui/vgui_debugpanel.cpp @@ -14,8 +14,8 @@ #include #include #include -#include -#include +#include +#include //----------------------------------------------------------------------------- // Purpose: diff --git a/r5dev/vproj/clientsdk.vcxproj b/r5dev/vproj/clientsdk.vcxproj index 63307960..f1e329bd 100644 --- a/r5dev/vproj/clientsdk.vcxproj +++ b/r5dev/vproj/clientsdk.vcxproj @@ -26,10 +26,10 @@ - - + + + - @@ -119,7 +119,6 @@ - @@ -139,11 +138,11 @@ - - + + + + - - diff --git a/r5dev/vproj/clientsdk.vcxproj.filters b/r5dev/vproj/clientsdk.vcxproj.filters index 22065d42..4983c5c2 100644 --- a/r5dev/vproj/clientsdk.vcxproj.filters +++ b/r5dev/vproj/clientsdk.vcxproj.filters @@ -208,6 +208,9 @@ {21ddddef-3a13-4f1d-9aa9-29c6b1bb24e1} + + {01d3645a-16c3-4910-ac95-049e112cd2b8} + @@ -231,12 +234,6 @@ sdk\engine - - sdk\engine - - - sdk\engine - sdk\gameui @@ -354,9 +351,6 @@ sdk\engine - - sdk\engine - sdk\tier2 @@ -489,6 +483,15 @@ sdk\tier0 + + sdk\engine\client + + + sdk\engine\client + + + sdk\engine\client + @@ -500,9 +503,6 @@ sdk\ebisusdk - - sdk\engine - sdk\engine @@ -518,9 +518,6 @@ sdk\engine - - sdk\engine - sdk\gameui @@ -1016,9 +1013,6 @@ sdk\engine - - sdk\engine - sdk\mathlib @@ -1064,9 +1058,6 @@ sdk\studiorender - - sdk\engine - sdk\engine @@ -1250,9 +1241,6 @@ sdk\engine - - sdk\client - sdk\vstdlib @@ -1466,6 +1454,18 @@ sdk\squirrel + + sdk\engine\client + + + sdk\engine\client + + + sdk\engine\client + + + sdk\engine\client + diff --git a/r5dev/vproj/dedicated.vcxproj b/r5dev/vproj/dedicated.vcxproj index 303d43e8..3d34b114 100644 --- a/r5dev/vproj/dedicated.vcxproj +++ b/r5dev/vproj/dedicated.vcxproj @@ -126,7 +126,6 @@ - @@ -146,10 +145,9 @@ - - + + - @@ -163,8 +161,9 @@ - - + + + @@ -218,7 +217,6 @@ - @@ -438,8 +436,7 @@ - - + @@ -448,8 +445,9 @@ - - + + + @@ -488,7 +486,6 @@ - diff --git a/r5dev/vproj/dedicated.vcxproj.filters b/r5dev/vproj/dedicated.vcxproj.filters index 2bb5ed96..ab8b879a 100644 --- a/r5dev/vproj/dedicated.vcxproj.filters +++ b/r5dev/vproj/dedicated.vcxproj.filters @@ -181,6 +181,12 @@ {ec4e73bc-3627-4184-afaa-47535aa00982} + + {b8f37659-c83d-4b75-81ea-5a4cafeea264} + + + {98975892-5379-4f6c-8c7e-35d92d2bc5e5} + @@ -219,9 +225,6 @@ sdk\engine - - sdk\engine - sdk\launcher @@ -582,9 +585,6 @@ sdk\squirrel - - sdk\server - sdk\tier0 @@ -633,12 +633,6 @@ sdk\engine - - sdk\engine - - - sdk\engine - sdk\tier2 @@ -684,9 +678,6 @@ sdk\studiorender - - sdk\engine - sdk\engine @@ -831,9 +822,6 @@ sdk\rtech\stryder - - sdk\engine - sdk\materialsystem @@ -888,9 +876,6 @@ sdk\engine - - sdk\client - sdk\vstdlib @@ -1086,6 +1071,21 @@ sdk\squirrel + + sdk\engine\client + + + sdk\engine\client + + + sdk\engine\server + + + sdk\engine\server + + + sdk\engine\server + @@ -1118,9 +1118,6 @@ sdk\engine - - sdk\engine - sdk\launcher @@ -1163,9 +1160,6 @@ sdk\squirrel - - sdk\server - sdk\vpklib @@ -1208,12 +1202,6 @@ sdk\engine - - sdk\engine - - - sdk\engine - sdk\tier2 @@ -1268,9 +1256,6 @@ sdk\rtech\stryder - - sdk\engine - sdk\tier1 @@ -1331,6 +1316,18 @@ sdk\tier0 + + sdk\engine\client + + + sdk\engine\server + + + sdk\engine\server + + + sdk\engine\server + diff --git a/r5dev/vproj/gamesdk.vcxproj b/r5dev/vproj/gamesdk.vcxproj index fe01eb8d..96ae3b5e 100644 --- a/r5dev/vproj/gamesdk.vcxproj +++ b/r5dev/vproj/gamesdk.vcxproj @@ -26,11 +26,10 @@ - - - + + + - @@ -40,7 +39,8 @@ - + + @@ -86,7 +86,6 @@ - @@ -127,7 +126,6 @@ - @@ -147,12 +145,11 @@ - - - + + + + - - @@ -169,7 +166,8 @@ - + + @@ -237,7 +235,6 @@ - diff --git a/r5dev/vproj/gamesdk.vcxproj.filters b/r5dev/vproj/gamesdk.vcxproj.filters index 1f05d9fe..9ddd4f9b 100644 --- a/r5dev/vproj/gamesdk.vcxproj.filters +++ b/r5dev/vproj/gamesdk.vcxproj.filters @@ -214,6 +214,12 @@ {205ae17f-10d4-4628-a794-066c81984b6f} + + {8ce676f2-dc88-4fb5-b747-6eb863033d07} + + + {b7e33427-fd37-44b1-8530-651ae5f4fde1} + @@ -240,12 +246,6 @@ sdk\engine - - sdk\engine - - - sdk\engine - sdk\gameui @@ -324,9 +324,6 @@ sdk\squirrel - - sdk\server - sdk\vpklib @@ -366,15 +363,9 @@ sdk\vpc - - sdk\engine - sdk\engine - - sdk\engine - sdk\tier2 @@ -447,9 +438,6 @@ sdk\rtech\stryder - - sdk\engine - sdk\tier1 @@ -519,6 +507,21 @@ sdk\tier0 + + sdk\engine\server + + + sdk\engine\server + + + sdk\engine\client + + + sdk\engine\client + + + sdk\engine\client + @@ -533,9 +536,6 @@ sdk\ebisusdk - - sdk\engine - sdk\engine @@ -551,9 +551,6 @@ sdk\engine - - sdk\engine - sdk\gameui @@ -995,9 +992,6 @@ core - - sdk\server - sdk\mathlib @@ -1049,15 +1043,9 @@ core - - sdk\engine - sdk\engine - - sdk\engine - sdk\mathlib @@ -1103,9 +1091,6 @@ sdk\studiorender - - sdk\engine - sdk\engine @@ -1256,9 +1241,6 @@ sdk\rtech\stryder - - sdk\engine - sdk\squirrel @@ -1310,9 +1292,6 @@ sdk\engine - - sdk\client - sdk\vstdlib @@ -1529,6 +1508,24 @@ sdk\squirrel + + sdk\engine\server + + + sdk\engine\server + + + sdk\engine\client + + + sdk\engine\client + + + sdk\engine\client + + + sdk\engine\client + diff --git a/r5dev/vstdlib/callback.cpp b/r5dev/vstdlib/callback.cpp index ce78000a..a367e386 100644 --- a/r5dev/vstdlib/callback.cpp +++ b/r5dev/vstdlib/callback.cpp @@ -9,11 +9,11 @@ #include "tier1/cvar.h" #include "tier1/IConVar.h" #ifndef DEDICATED -#include "engine/cl_rcon.h" +#include "engine/client/cl_rcon.h" #endif // !DEDICATED +#include "engine/client/client.h" #include "engine/net.h" #include "engine/sys_utils.h" -#include "engine/baseclient.h" #include "rtech/rtech_game.h" #include "rtech/rtech_utils.h" #include "filesystem/basefilesystem.h" @@ -79,7 +79,7 @@ void Host_Kick_f(const CCommand& args) for (int i = 0; i < MAX_PLAYERS; i++) { - CBaseClient* pClient = g_pClient->GetClient(i); + CClient* pClient = g_pClient->GetClient(i); CNetChan* pNetChan = pClient->GetNetChan(); if (!pClient || !pNetChan) { @@ -119,7 +119,7 @@ void Host_KickID_f(const CCommand& args) bool bOnlyDigits = args.HasOnlyDigits(1); for (int i = 0; i < MAX_PLAYERS; i++) { - CBaseClient* pClient = g_pClient->GetClient(i); + CClient* pClient = g_pClient->GetClient(i); CNetChan* pNetChan = pClient->GetNetChan(); if (!pClient || !pNetChan) @@ -183,7 +183,7 @@ void Host_Ban_f(const CCommand& args) for (int i = 0; i < MAX_PLAYERS; i++) { - CBaseClient* pClient = g_pClient->GetClient(i); + CClient* pClient = g_pClient->GetClient(i); CNetChan* pNetChan = pClient->GetNetChan(); if (!pClient || !pNetChan) @@ -228,7 +228,7 @@ void Host_BanID_f(const CCommand& args) bool bOnlyDigits = args.HasOnlyDigits(1); for (int i = 0; i < MAX_PLAYERS; i++) { - CBaseClient* pClient = g_pClient->GetClient(i); + CClient* pClient = g_pClient->GetClient(i); CNetChan* pNetChan = pClient->GetNetChan(); if (!pClient || !pNetChan) @@ -378,11 +378,11 @@ void Pak_RequestUnload_f(const CCommand& args) RPakLoadedInfo_t* pakInfo = g_pRTech->GetPakLoadedInfo(nPakId); if (!pakInfo) { - throw std::exception("Found no Pak entry for specified ID."); + throw std::exception("Found no pak entry for specified ID."); } string pakName = pakInfo->m_pszFileName; - !pakName.empty() ? DevMsg(eDLL_T::RTECH, "Requested Pak Unload for '%s'\n", pakName.c_str()) : DevMsg(eDLL_T::RTECH, "Requested Pak Unload for '%d'\n", nPakId); + !pakName.empty() ? DevMsg(eDLL_T::RTECH, "Requested pak unload for '%s'\n", pakName.c_str()) : DevMsg(eDLL_T::RTECH, "Requested Pak Unload for '%d'\n", nPakId); g_pakLoadApi->Unload(nPakId); } else @@ -390,10 +390,10 @@ void Pak_RequestUnload_f(const CCommand& args) RPakLoadedInfo_t* pakInfo = g_pRTech->GetPakLoadedInfo(args.Arg(1)); if (!pakInfo) { - throw std::exception("Found no Pak entry for specified name."); + throw std::exception("Found no pak entry for specified name."); } - DevMsg(eDLL_T::RTECH, "Requested Pak Unload for '%s'\n", args.Arg(1)); + DevMsg(eDLL_T::RTECH, "Requested pak unload for '%s'\n", args.Arg(1)); g_pakLoadApi->Unload(pakInfo->m_nPakId); } } @@ -434,7 +434,7 @@ void Pak_Swap_f(const CCommand& args) pakInfo = g_pRTech->GetPakLoadedInfo(nPakId); if (!pakInfo) { - throw std::exception("Found no Pak entry for specified ID."); + throw std::exception("Found no pak entry for specified ID."); } pakName = pakInfo->m_pszFileName; @@ -445,13 +445,13 @@ void Pak_Swap_f(const CCommand& args) pakInfo = g_pRTech->GetPakLoadedInfo(args.Arg(1)); if (!pakInfo) { - throw std::exception("Found no Pak entry for specified name."); + throw std::exception("Found no pak entry for specified name."); } nPakId = pakInfo->m_nPakId; } - !pakName.empty() ? DevMsg(eDLL_T::RTECH, "Requested Pak Swap for '%s'\n", pakName.c_str()) : DevMsg(eDLL_T::RTECH, "Requested Pak Swap for '%d'\n", nPakId); + !pakName.empty() ? DevMsg(eDLL_T::RTECH, "Requested pak swap for '%s'\n", pakName.c_str()) : DevMsg(eDLL_T::RTECH, "Requested pak swap for '%d'\n", nPakId); g_pakLoadApi->Unload(nPakId);