mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
* Fixed bug where multiple of the same entries get added to the global ban/refuse list. * Fixed bug where we still use the client instance after deleting it in 'CBanSystem::BanListCheck()'. * Load banlist at a later state (not at construction of class), this is needed for a future change of adapting the 'business' code to feature the game's FileSystem. * CServer cleanup. * More detailed ban messages (banned, added to refused list, removed from slot, etc..). * Use localization key for banned message ("#Valve_Reject_Banned"). * Add const qualifiers to all CPylon methods. Note: * This commit requires changes on the master server, these changes are already performed, however the new master server isn't live yet until we publish the new release.
68 lines
4.1 KiB
C++
68 lines
4.1 KiB
C++
#pragma once
|
|
#include "networksystem/pylon.h"
|
|
#include "networksystem/bansystem.h"
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
/* ==== SV_MAIN ======================================================================================================================================================= */
|
|
inline CMemory p_SV_InitGameDLL;
|
|
inline auto SV_InitGameDLL = p_SV_InitGameDLL.RCast<void(*)(void)>();
|
|
|
|
inline CMemory p_SV_ShutdownGameDLL;
|
|
inline auto SV_ShutdownGameDLL = p_SV_ShutdownGameDLL.RCast<void(*)(void)>();
|
|
|
|
inline CMemory p_SV_CreateBaseline;
|
|
inline auto SV_CreateBaseline = p_SV_CreateBaseline.RCast<bool(*)(void)>();
|
|
|
|
inline CMemory p_CGameServer__SpawnServer;
|
|
inline auto CGameServer__SpawnServer = p_CGameServer__SpawnServer.RCast<bool(*)(void* thisptr, const char* pszMapName, const char* pszMapGroupName)>();
|
|
|
|
inline bool* s_bDedicated = nullptr;
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
void SV_IsClientBanned(const string& svIPAddr, const uint64_t nNucleusID);
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
class HSV_Main : public IDetour
|
|
{
|
|
virtual void GetAdr(void) const
|
|
{
|
|
spdlog::debug("| FUN: SV_InitGameDLL : {:#18x} |\n", p_SV_InitGameDLL.GetPtr());
|
|
spdlog::debug("| FUN: SV_ShutdownGameDLL : {:#18x} |\n", p_SV_ShutdownGameDLL.GetPtr());
|
|
spdlog::debug("| FUN: SV_CreateBaseline : {:#18x} |\n", p_SV_CreateBaseline.GetPtr());
|
|
spdlog::debug("| FUN: CGameServer::SpawnServer : {:#18x} |\n", p_CGameServer__SpawnServer.GetPtr());
|
|
spdlog::debug("| VAR: s_bDedicated : {:#18x} |\n", reinterpret_cast<uintptr_t>(s_bDedicated));
|
|
spdlog::debug("+----------------------------------------------------------------+\n");
|
|
}
|
|
virtual void GetFun(void) const
|
|
{
|
|
p_SV_InitGameDLL = g_GameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x48\x81\xEC\x00\x00\x00\x00\xE8\x00\x00\x00\x00\x80\x3D\x00\x00\x00\x00\x00\x0F\x85\x00\x00\x00\x00"), "xxx????x????xx?????xx????");
|
|
p_SV_ShutdownGameDLL = g_GameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x48\x83\xEC\x28\x80\x3D\x00\x00\x00\x00\x00\x0F\x84\x00\x00\x00\x00\x48\x8B\x0D\x00\x00\x00\x00\x48"), "xxxxxx?????xx????xxx????x");
|
|
p_SV_CreateBaseline = g_GameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x48\x83\xEC\x28\x48\x8B\x0D\x00\x00\x00\x00\x48\x85\xC9\x75\x07"), "xxxxxxx????xxxxx");
|
|
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
|
|
p_CGameServer__SpawnServer = g_GameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x40\x53\x55\x56\x57\x41\x55\x41\x56\x41\x57\x48\x81\xEC\x00\x00\x00\x00"), "xxxxxxxxxxxxxx????");
|
|
#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
|
|
p_CGameServer__SpawnServer = g_GameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x48\x8B\xC4\x53\x55\x56\x57\x41\x54\x41\x55\x41\x57"), "xxxxxxxxxxxxx");
|
|
// 0x140312D80 // 48 8B C4 53 55 56 57 41 54 41 55 41 57 //
|
|
#endif
|
|
SV_InitGameDLL = p_SV_InitGameDLL.RCast<void(*)(void)>();
|
|
SV_ShutdownGameDLL = p_SV_ShutdownGameDLL.RCast<void(*)(void)>();
|
|
SV_CreateBaseline = p_SV_CreateBaseline.RCast<bool(*)(void)>();
|
|
CGameServer__SpawnServer = p_CGameServer__SpawnServer.RCast<bool(*)(void*, const char*, const char*)>();
|
|
}
|
|
virtual void GetVar(void) const
|
|
{
|
|
s_bDedicated = g_GameDll.FindPatternSIMD(reinterpret_cast<rsig_t>(
|
|
"\x48\x89\x4C\x24\x00\x48\x89\x54\x24\x00\x4C\x89\x44\x24\x00\x4C\x89\x4C\x24\x00\x53\x57\xB8\x00\x00\x00\x00\xE8\x00\x00\x00\x00\x48\x2B\xE0\x48\x8B\xD9\x48\x8D\xBC\x24\x00\x00\x00\x00\xE8\x00\x00\x00\x00\x48\x89\x7C\x24\x00\x48\x8D\x54\x24\x00\x33\xFF"),
|
|
"xxxx?xxxx?xxxx?xxxx?xxx????x????xxxxxxxxxx????x????xxxx?xxxx?xx").FindPatternSelf("40 38 3D", CMemory::Direction::DOWN).ResolveRelativeAddressSelf(0x3, 0x7).RCast<bool*>();
|
|
}
|
|
virtual void GetCon(void) const { }
|
|
virtual void Attach(void) const { }
|
|
virtual void Detach(void) const { }
|
|
};
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
REGISTER(HSV_Main);
|