mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Initial fake client (bot) implementation
New bots can be added using 'sv_addbot <name> <teamid>'.
This commit is contained in:
parent
39920283c0
commit
68f197dcef
@ -13,6 +13,9 @@ inline auto IVEngineServer__GetNumHumanPlayers = p_IVEngineServer__GetNumHumanPl
|
||||
inline CMemory p_IVEngineServer__GetNumFakeClients;
|
||||
inline auto IVEngineServer__GetNumFakeClients = p_IVEngineServer__GetNumFakeClients.RCast<int64_t(*)(void)>();
|
||||
|
||||
inline CMemory p_IVEngineServer__CreateFakeClient;
|
||||
inline auto IVEngineServer__CreateFakeClient = p_IVEngineServer__CreateFakeClient.RCast<int64_t(*)(void* es, const char* name, int team)>();
|
||||
|
||||
//inline CMemory p_RunFrameServer;
|
||||
//inline auto v_RunFrameServer = p_RunFrameServer.RCast<void(*)(double flFrameTime, bool bRunOverlays, bool bUniformUpdate)>();
|
||||
|
||||
@ -62,6 +65,7 @@ class HVEngineServer : public IDetour
|
||||
spdlog::debug("| FUN: IVEngineServer::IsDedicatedServer : {:#18x} |\n", p_IVEngineServer__IsDedicatedServer.GetPtr());
|
||||
spdlog::debug("| FUN: IVEngineServer::GetNumHumanPlayers : {:#18x} |\n", p_IVEngineServer__GetNumHumanPlayers.GetPtr());
|
||||
spdlog::debug("| FUN: IVEngineServer::GetNumFakeClients : {:#18x} |\n", p_IVEngineServer__GetNumFakeClients.GetPtr());
|
||||
spdlog::debug("| FUN: IVEngineServer::CreateFakeClient : {:#18x} |\n", p_IVEngineServer__CreateFakeClient.GetPtr());
|
||||
//spdlog::debug("| FUN: RunFrameServer : {:#18x} |\n", p_RunFrameServer.GetPtr());
|
||||
spdlog::debug("| VAR: g_bDedicated : {:#18x} |\n", reinterpret_cast<uintptr_t>(g_bDedicated));
|
||||
spdlog::debug("+----------------------------------------------------------------+\n");
|
||||
@ -72,13 +76,15 @@ class HVEngineServer : public IDetour
|
||||
p_IVEngineServer__IsDedicatedServer = g_GameDll.FindPatternSIMD("0F B6 05 ?? ?? ?? ?? C3 CC CC CC CC CC CC CC CC 48 8B 05 ?? ?? ?? ?? C3 CC CC CC CC CC CC CC CC 40 53");
|
||||
p_IVEngineServer__GetNumHumanPlayers = g_GameDll.FindPatternSIMD("8B 15 ?? ?? ?? ?? 33 C0 85 D2 7E 24");
|
||||
p_IVEngineServer__GetNumFakeClients = g_GameDll.FindPatternSIMD("8B 05 ?? ?? ?? ?? 33 C9 85 C0 7E 2D");
|
||||
p_IVEngineServer__CreateFakeClient = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 74 24 ?? 57 48 83 EC 20 48 8B F2 41 8B F8"));
|
||||
// p_RunFrameServer = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 57 48 83 EC 30 0F 29 74 24 ?? 48 8D 0D ?? ?? ?? ??");
|
||||
|
||||
IVEngineServer__PersistenceAvailable = p_IVEngineServer__PersistenceAvailable.RCast<bool (*)(void*, int)>(); /*3B 15 ?? ?? ?? ?? 7D 33*/
|
||||
IVEngineServer__IsDedicatedServer = p_IVEngineServer__IsDedicatedServer.RCast<bool (*)(void)>(); /*0F B6 05 ?? ?? ?? ?? C3 CC CC CC CC CC CC CC CC 48 8B 05 ?? ?? ?? ?? C3 CC CC CC CC CC CC CC CC 40 53*/
|
||||
IVEngineServer__GetNumHumanPlayers = p_IVEngineServer__GetNumHumanPlayers.RCast<int64_t(*)(void)>(); /*8B 15 ?? ?? ?? ?? 33 C0 85 D2 7E 24*/
|
||||
IVEngineServer__GetNumFakeClients = p_IVEngineServer__GetNumFakeClients.RCast<int64_t(*)(void)>(); /*8B 05 ?? ?? ?? ?? 33 C9 85 C0 7E 2D*/
|
||||
// v_RunFrameServer = p_RunFrameServer.RCast<void(*)(double, bool, bool)>(); /*48 89 5C 24 ?? 57 48 83 EC 30 0F 29 74 24 ?? 48 8D 0D ?? ?? ?? ??*/
|
||||
IVEngineServer__PersistenceAvailable = p_IVEngineServer__PersistenceAvailable.RCast<bool (*)(void*, int)>(); /*3B 15 ?? ?? ?? ?? 7D 33*/
|
||||
IVEngineServer__IsDedicatedServer = p_IVEngineServer__IsDedicatedServer.RCast<bool (*)(void)>(); /*0F B6 05 ?? ?? ?? ?? C3 CC CC CC CC CC CC CC CC 48 8B 05 ?? ?? ?? ?? C3 CC CC CC CC CC CC CC CC 40 53*/
|
||||
IVEngineServer__GetNumHumanPlayers = p_IVEngineServer__GetNumHumanPlayers.RCast<int64_t(*)(void)>(); /*8B 15 ?? ?? ?? ?? 33 C0 85 D2 7E 24*/
|
||||
IVEngineServer__GetNumFakeClients = p_IVEngineServer__GetNumFakeClients.RCast<int64_t(*)(void)>(); /*8B 05 ?? ?? ?? ?? 33 C9 85 C0 7E 2D*/
|
||||
IVEngineServer__CreateFakeClient = p_IVEngineServer__CreateFakeClient.RCast<int64_t(*)(void*, const char*, int)>();/*48 89 5C 24 ?? 48 89 74 24 ?? 57 48 83 EC 20 48 8B F2 41 8B F8*/
|
||||
// v_RunFrameServer = p_RunFrameServer.RCast<void(*)(double, bool, bool)>(); /*48 89 5C 24 ?? 57 48 83 EC 30 0F 29 74 24 ?? 48 8D 0D ?? ?? ?? ??*/
|
||||
}
|
||||
virtual void GetVar(void) const
|
||||
{
|
||||
|
@ -343,7 +343,7 @@ void ConCommand::Init(void)
|
||||
ConCommand::Create("sv_banid", "Bans a client from the server by handle, nucleus id or ip address | Usage: sv_banid \"<HandleID>\"/\"<NucleusID>/<IPAddress>\".", FCVAR_RELEASE, Host_BanID_f, nullptr);
|
||||
ConCommand::Create("sv_unban", "Unbans a client from the server by nucleus id or ip address | Usage: sv_unban \"<NucleusID>\"/\"<IPAddress>\".", FCVAR_RELEASE, Host_Unban_f, nullptr);
|
||||
ConCommand::Create("sv_reloadbanlist", "Reloads the banned list.", FCVAR_RELEASE, Host_ReloadBanList_f, nullptr);
|
||||
|
||||
ConCommand::Create("sv_addbot", "Creates a bot on the server.", FCVAR_RELEASE, CC_CreateFakePlayer_f, nullptr);
|
||||
ConCommand::Create("navmesh_hotswap", "Hot swap the NavMesh for all hulls.", FCVAR_DEVELOPMENTONLY, Detour_HotSwap_f, nullptr);
|
||||
#endif // !CLIENT_DLL
|
||||
#ifndef DEDICATED
|
||||
|
@ -1230,3 +1230,23 @@ void CVFlag_f(const CCommand& args)
|
||||
{
|
||||
cv->CvarFindFlags_f(args);
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
CC_CreateFakePlayer_f
|
||||
|
||||
Creates a fake player
|
||||
on the server
|
||||
=====================
|
||||
*/
|
||||
void CC_CreateFakePlayer_f(const CCommand& args)
|
||||
{
|
||||
#ifndef CLIENT_DLL
|
||||
if (args.ArgC() < 3)
|
||||
{
|
||||
DevMsg(eDLL_T::SERVER, "usage: sv_addbot name teamid\n");
|
||||
return;
|
||||
}
|
||||
IVEngineServer__CreateFakeClient(nullptr, args.Arg(1), std::stoi(args.Arg(2)));
|
||||
#endif // !CLIENT_DLL
|
||||
}
|
@ -70,6 +70,8 @@ void CVHelp_f(const CCommand& args);
|
||||
void CVList_f(const CCommand& args);
|
||||
void CVDiff_f(const CCommand& args);
|
||||
void CVFlag_f(const CCommand& args);
|
||||
|
||||
void CC_CreateFakePlayer_f(const CCommand& args);
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class VCallback : public IDetour
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user