Move and rename ConCommand callbacks appropriately

This commit is contained in:
Kawe Mazidjatari 2022-05-16 21:15:25 +02:00
parent d1402a7465
commit 6dff43bc75
8 changed files with 884 additions and 893 deletions

View File

@ -9,7 +9,7 @@
#ifndef NETCONSOLE
#include "core/logdef.h"
#include "tier1/cvar.h"
#include "vstdlib/completion.h"
#include "vstdlib/callback.h"
#include "mathlib/color.h"
#include "engine/sys_utils.h"
#include "engine/net.h"
@ -140,7 +140,7 @@ void NET_PrintFunc(const char* fmt, ...)
//-----------------------------------------------------------------------------
void NET_Shutdown(void* thisptr, const char* szReason, uint8_t bBadRep, bool bRemoveNow)
{
_DownloadPlaylists_f_CompletionFunc(); // Re-load playlist from disk after getting disconnected from the server.
_DownloadPlaylists_f(); // Re-load playlist from disk after getting disconnected from the server.
v_NET_Shutdown(thisptr, szReason, bBadRep, bRemoveNow);
}

View File

@ -47,8 +47,8 @@ class VBaseFileSystem : public IDetour
p_CBaseFileSystem_LoadFromCache = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x40\x53\x48\x81\xEC\x00\x00\x00\x00\x80\x3D\x00\x00\x00\x00\x00\x49\x8B\xD8"), "xxxxx????xx?????xxx");
CBaseFileSystem_Warning = p_CBaseFileSystem_Warning.RCast<void(*)(CBaseFileSystem*, FileWarningLevel_t, const char*, ...)>(); /*4C 89 4C 24 20 C3 ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 48*/
CBaseFileSystem_LoadFromVPK = p_CBaseFileSystem_LoadFromVPK.RCast<FileHandle_t(*)(CBaseFileSystem*, void*, char*)>(); /*48 89 5C 24 ? 57 48 81 EC ? ? ? ? 49 8B C0 4C 8D 8C 24 ? ? ? ?*/
CBaseFileSystem_LoadFromCache = p_CBaseFileSystem_LoadFromCache.RCast<bool(*)(CBaseFileSystem*, char*, void*)>(); /*40 53 48 81 EC ? ? ? ? 80 3D ? ? ? ? ? 49 8B D8*/
CBaseFileSystem_LoadFromVPK = p_CBaseFileSystem_LoadFromVPK.RCast<FileHandle_t(*)(CBaseFileSystem*, void*, char*)>(); /*48 89 5C 24 ?? 57 48 81 EC ?? ?? ?? ?? 49 8B C0 4C 8D 8C 24 ?? ?? ?? ??*/
CBaseFileSystem_LoadFromCache = p_CBaseFileSystem_LoadFromCache.RCast<bool(*)(CBaseFileSystem*, char*, void*)>(); /*40 53 48 81 EC ?? ?? ?? ?? 80 3D ?? ?? ?? ?? ?? 49 8B D8*/
}
virtual void GetVar(void) const
{

View File

@ -30,7 +30,7 @@ History:
#include "server/server.h"
#include "client/vengineclient_impl.h"
#include "vpc/keyvalues.h"
#include "vstdlib/completion.h"
#include "vstdlib/callback.h"
#include "vpklib/packedstore.h"
#include "gameui/IBrowser.h"
@ -561,7 +561,7 @@ void IBrowser::HostServerSection(void)
{
if (ImGui::Button("Reload Playlist", ImVec2(ImGui::GetWindowSize().x, 32)))
{
_DownloadPlaylists_f_CompletionFunc();
_DownloadPlaylists_f();
KeyValues::InitPlaylist(); // Re-Init playlist.
}
}

View File

@ -8,7 +8,7 @@
#include "tier0/tslist.h"
#include "tier1/cmd.h"
#include "tier1/cvar.h"
#include "vstdlib/completion.h"
#include "vstdlib/callback.h"
#include "engine/sys_utils.h"
//-----------------------------------------------------------------------------
@ -127,40 +127,40 @@ void ConCommand::Init(void)
{
//-------------------------------------------------------------------------
// SERVER DLL |
new ConCommand("script", "Run input code as SERVER script on the VM.", FCVAR_GAMEDLL | FCVAR_CHEAT, _SQVM_ServerScript_f_CompletionFunc, nullptr);
new ConCommand("sv_kick", "Kick a client from the server by name. | Usage: kick \"<name>\".", FCVAR_RELEASE, _Kick_f_CompletionFunc, nullptr);
new ConCommand("sv_kickid", "Kick a client from the server by UserID or OriginID | Usage: kickid \"<UserID>\"/\"<OriginID>\".", FCVAR_RELEASE, _KickID_f_CompletionFunc, nullptr);
new ConCommand("sv_ban", "Bans a client from the server by name. | Usage: ban <name>.", FCVAR_RELEASE, _Ban_f_CompletionFunc, nullptr);
new ConCommand("sv_banid", "Bans a client from the server by UserID, OriginID or IPAddress | Usage: banid \"<UserID>\"/\"<OriginID>/<IPAddress>\".", FCVAR_RELEASE, _BanID_f_CompletionFunc, nullptr);
new ConCommand("sv_unban", "Unbans a client from the server by OriginID or IPAddress | Usage: unban \"<OriginID>\"/\"<IPAddress>\".", FCVAR_RELEASE, _Unban_f_CompletionFunc, nullptr);
new ConCommand("sv_reloadbanlist", "Reloads the ban list from the disk.", FCVAR_RELEASE, _ReloadBanList_f_CompletionFunc, nullptr);
new ConCommand("script", "Run input code as SERVER script on the VM.", FCVAR_GAMEDLL | FCVAR_CHEAT, SQVM_ServerScript_f, nullptr);
new ConCommand("sv_kick", "Kick a client from the server by name. | Usage: kick \"<name>\".", FCVAR_RELEASE, Host_Kick_f, nullptr);
new ConCommand("sv_kickid", "Kick a client from the server by UserID or OriginID | Usage: kickid \"<UserID>\"/\"<OriginID>\".", FCVAR_RELEASE, Host_KickID_f, nullptr);
new ConCommand("sv_ban", "Bans a client from the server by name. | Usage: ban <name>.", FCVAR_RELEASE, Host_Ban_f, nullptr);
new ConCommand("sv_banid", "Bans a client from the server by UserID, OriginID or IPAddress | Usage: banid \"<UserID>\"/\"<OriginID>/<IPAddress>\".", FCVAR_RELEASE, Host_BanID_f, nullptr);
new ConCommand("sv_unban", "Unbans a client from the server by OriginID or IPAddress | Usage: unban \"<OriginID>\"/\"<IPAddress>\".", FCVAR_RELEASE, Host_Unban_f, nullptr);
new ConCommand("sv_reloadbanlist", "Reloads the ban list from the disk.", FCVAR_RELEASE, Host_ReloadBanList_f, nullptr);
#ifndef DEDICATED
//-------------------------------------------------------------------------
// CLIENT DLL |
new ConCommand("script_client", "Run input code as CLIENT script on the VM.", FCVAR_CLIENTDLL | FCVAR_CHEAT, _SQVM_ClientScript_f_CompletionFunc, nullptr);
new ConCommand("cl_showconsole", "Opens the game console.", FCVAR_CLIENTDLL | FCVAR_RELEASE, _CGameConsole_f_CompletionFunc, nullptr);
new ConCommand("cl_showbrowser", "Opens the server browser.", FCVAR_CLIENTDLL | FCVAR_RELEASE, _CCompanion_f_CompletionFunc, nullptr);
new ConCommand("rcon", "Forward RCON query to remote server. | Usage: rcon \"<query>\".", FCVAR_CLIENTDLL | FCVAR_RELEASE, _RCON_CmdQuery_f_CompletionFunc, nullptr);
new ConCommand("rcon_disconnect", "Disconnect from RCON server.", FCVAR_CLIENTDLL | FCVAR_RELEASE, _RCON_Disconnect_f_CompletionFunc, nullptr);
new ConCommand("script_client", "Run input code as CLIENT script on the VM.", FCVAR_CLIENTDLL | FCVAR_CHEAT, SQVM_ClientScript_f, nullptr);
new ConCommand("cl_showconsole", "Opens the game console.", FCVAR_CLIENTDLL | FCVAR_RELEASE, GameConsole_Invoke_f, nullptr);
new ConCommand("cl_showbrowser", "Opens the server browser.", FCVAR_CLIENTDLL | FCVAR_RELEASE, ServerBrowser_Invoke_f, nullptr);
new ConCommand("rcon", "Forward RCON query to remote server. | Usage: rcon \"<query>\".", FCVAR_CLIENTDLL | FCVAR_RELEASE, RCON_CmdQuery_f, nullptr);
new ConCommand("rcon_disconnect", "Disconnect from RCON server.", FCVAR_CLIENTDLL | FCVAR_RELEASE, RCON_Disconnect_f, nullptr);
//-------------------------------------------------------------------------
// UI DLL |
new ConCommand("script_ui", "Run input code as UI script on the VM.", FCVAR_CLIENTDLL | FCVAR_CHEAT, _SQVM_UIScript_f_CompletionFunc, nullptr);
new ConCommand("script_ui", "Run input code as UI script on the VM.", FCVAR_CLIENTDLL | FCVAR_CHEAT, SQVM_UIScript_f, nullptr);
#endif // !DEDICATED
//-------------------------------------------------------------------------
// FILESYSTEM API |
new ConCommand("fs_unpack_vpk", "Unpacks all files from user specified VPK file.", FCVAR_DEVELOPMENTONLY, _VPK_Unpack_f_CompletionFunc, nullptr);
new ConCommand("fs_mount_vpk", "Mounts user specified VPK file for FileSystem usage.", FCVAR_DEVELOPMENTONLY, _VPK_Mount_f_CompletionFunc, nullptr);
new ConCommand("fs_unpack_vpk", "Unpacks all files from user specified VPK file.", FCVAR_DEVELOPMENTONLY, VPK_Unpack_f, nullptr);
new ConCommand("fs_mount_vpk", "Mounts user specified VPK file for FileSystem usage.", FCVAR_DEVELOPMENTONLY, VPK_Mount_f, nullptr);
//-------------------------------------------------------------------------
// RTECH API |
new ConCommand("rtech_strtoguid", "Calculates the GUID from input data.", FCVAR_DEVELOPMENTONLY, _RTech_StringToGUID_f_CompletionFunc, nullptr);
new ConCommand("pak_requestload", "Requests asynchronous load for specified RPAK file.", FCVAR_DEVELOPMENTONLY, _Pak_RequestLoad_f_CompletionFunc, nullptr);
new ConCommand("pak_requestunload", "Requests unload for specified RPAK by ID.", FCVAR_DEVELOPMENTONLY, _Pak_RequestUnload_f_CompletionFunc, nullptr);
new ConCommand("pak_decompress", "Decompresses the specified RPAK file.", FCVAR_DEVELOPMENTONLY, _RTech_Decompress_f_CompletionFunc, nullptr);
new ConCommand("pak_listpaks", "Display a list of the loaded Pak files.", FCVAR_DEVELOPMENTONLY, _Pak_ListPaks_f_CompletionFunc, nullptr);
new ConCommand("rtech_strtoguid", "Calculates the GUID from input data.", FCVAR_DEVELOPMENTONLY, RTech_StringToGUID_f, nullptr);
new ConCommand("pak_requestload", "Requests asynchronous load for specified RPAK file.", FCVAR_DEVELOPMENTONLY, Pak_RequestLoad_f, nullptr);
new ConCommand("pak_requestunload", "Requests unload for specified RPAK by ID.", FCVAR_DEVELOPMENTONLY, Pak_RequestUnload_f, nullptr);
new ConCommand("pak_decompress", "Decompresses the specified RPAK file.", FCVAR_DEVELOPMENTONLY, RTech_Decompress_f, nullptr);
new ConCommand("pak_listpaks", "Display a list of the loaded Pak files.", FCVAR_DEVELOPMENTONLY, Pak_ListPaks_f, nullptr);
//-------------------------------------------------------------------------
// NETCHANNEL |
new ConCommand("net_setkey", "Sets user specified base64 net key.", FCVAR_RELEASE, _NET_SetKey_f_CompletionFunc, nullptr);
new ConCommand("net_generatekey", "Generates and sets a random base64 net key.", FCVAR_RELEASE, _NET_GenerateKey_f_CompletionFunc, nullptr);
new ConCommand("net_setkey", "Sets user specified base64 net key.", FCVAR_RELEASE, NET_SetKey_f, nullptr);
new ConCommand("net_generatekey", "Generates and sets a random base64 net key.", FCVAR_RELEASE, NET_GenerateKey_f, nullptr);
}
//-----------------------------------------------------------------------------
@ -171,7 +171,7 @@ void ConCommand::InitShipped(void)
#ifndef DEDICATED
//-------------------------------------------------------------------------
// MATERIAL SYSTEM
g_pCVar->FindCommand("mat_crosshair")->m_pCommandCallback = _CMaterial_GetMaterialAtCrossHair_f_ComplectionFunc; // Patch completion function to working callback.
g_pCVar->FindCommand("mat_crosshair")->m_pCommandCallback = Mat_CrossHair_f; // Patch callback function to working callback.
#endif // !DEDICATED
}

View File

@ -5,9 +5,33 @@
//=============================================================================//
#include "core/stdafx.h"
#include "windows/id3dx.h"
#include "tier1/cvar.h"
#include "tier1/IConVar.h"
#ifndef DEDICATED
#include "engine/cl_rcon.h"
#endif // !DEDICATED
#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"
#include "filesystem/filesystem.h"
#include "vpklib/packedstore.h"
#include "squirrel/sqvm.h"
#ifndef DEDICATED
#include "gameui/IBrowser.h"
#include "gameui/IConsole.h"
#endif // !DEDICATED
#include "public/include/bansystem.h"
#include "mathlib/crc32.h"
#include "vstdlib/completion.h"
#include "vstdlib/callback.h"
#ifndef DEDICATED
#include "materialsystem/cmaterialglue.h"
#endif // !DEDICATED
/*
=====================
@ -17,4 +41,783 @@ MP_GameMode_Changed_f
bool MP_GameMode_Changed_f(ConVar* pVTable)
{
return SetupGamemode(mp_gamemode->GetString());
}
}
#ifndef DEDICATED
/*
=====================
GameConsole_Invoke_f
=====================
*/
void GameConsole_Invoke_f(const CCommand& args)
{
g_pIConsole->m_bActivate = !g_pIConsole->m_bActivate;
}
/*
=====================
ServerBrowser_Invoke_f
=====================
*/
void ServerBrowser_Invoke_f(const CCommand& args)
{
g_pIBrowser->m_bActivate = !g_pIBrowser->m_bActivate;
}
#endif // !DEDICATED
/*
=====================
Host_Kick_f
=====================
*/
void Host_Kick_f(const CCommand& args)
{
if (args.ArgC() < 2)
{
return;
}
for (int i = 0; i < MAX_PLAYERS; i++)
{
CBaseClient* pClient = g_pClient->GetClient(i);
CNetChan* pNetChan = pClient->GetNetChan();
if (!pClient || !pNetChan)
{
continue;
}
string svClientName = pNetChan->GetName(); // Get full name.
if (svClientName.empty())
{
continue;
}
if (strcmp(args.Arg(1), svClientName.c_str()) != 0) // Our wanted name?
{
continue;
}
NET_DisconnectClient(pClient, i, "Kicked from server", 0, 1);
}
}
/*
=====================
Host_KickID_f
=====================
*/
void Host_KickID_f(const CCommand& args)
{
if (args.ArgC() < 2) // Do we atleast have 2 arguments?
{
return;
}
try
{
bool bOnlyDigits = args.HasOnlyDigits(1);
for (int i = 0; i < MAX_PLAYERS; i++)
{
CBaseClient* pClient = g_pClient->GetClient(i);
CNetChan* pNetChan = pClient->GetNetChan();
if (!pClient || !pNetChan)
{
continue;
}
string svIpAddress = pNetChan->GetAddress(); // If this stays null they modified the packet somehow.
if (bOnlyDigits)
{
int64_t nTargetID = static_cast<int64_t>(std::stoll(args.Arg(1)));
if (nTargetID > MAX_PLAYERS) // Is it a possible originID?
{
int64_t nOriginID = pClient->GetOriginID();
if (nOriginID != nTargetID)
{
continue;
}
}
else // If its not try by userID.
{
int64_t nClientID = static_cast<int64_t>(pClient->GetUserID() + 1); // Get userID + 1.
if (nClientID != nTargetID)
{
continue;
}
}
NET_DisconnectClient(pClient, i, "Kicked from server", 0, 1);
}
else
{
if (string(args.Arg(1)).compare(svIpAddress) != NULL)
{
continue;
}
NET_DisconnectClient(pClient, i, "Kicked from server", 0, 1);
}
}
}
catch (std::exception& e)
{
Error(eDLL_T::SERVER, "sv_kickid requires a UserID or OriginID. You can get the UserID with the 'status' command. Error: %s", e.what());
return;
}
}
/*
=====================
Host_Ban_f
=====================
*/
void Host_Ban_f(const CCommand& args)
{
if (args.ArgC() < 2)
{
return;
}
for (int i = 0; i < MAX_PLAYERS; i++)
{
CBaseClient* pClient = g_pClient->GetClient(i);
CNetChan* pNetChan = pClient->GetNetChan();
if (!pClient || !pNetChan)
{
continue;
}
string svClientName = pNetChan->GetName(); // Get full name.
if (svClientName.empty())
{
continue;
}
if (strcmp(args.Arg(1), svClientName.c_str()) != 0)
{
continue;
}
string svIpAddress = pNetChan->GetAddress(); // If this stays empty they modified the packet somehow.
g_pBanSystem->AddEntry(svIpAddress, pClient->GetOriginID());
g_pBanSystem->Save();
NET_DisconnectClient(pClient, i, "Banned from server", 0, 1);
}
}
/*
=====================
Host_BanID_f
=====================
*/
void Host_BanID_f(const CCommand& args)
{
if (args.ArgC() < 2)
{
return;
}
try
{
bool bOnlyDigits = args.HasOnlyDigits(1);
for (int i = 0; i < MAX_PLAYERS; i++)
{
CBaseClient* pClient = g_pClient->GetClient(i);
CNetChan* pNetChan = pClient->GetNetChan();
if (!pClient || !pNetChan)
{
continue;
}
string svIpAddress = pNetChan->GetAddress(); // If this stays empty they modified the packet somehow.
if (bOnlyDigits)
{
int64_t nTargetID = static_cast<int64_t>(std::stoll(args.Arg(1)));
if (nTargetID > MAX_PLAYERS) // Is it a possible originID?
{
int64_t nOriginID = pClient->GetOriginID();
if (nOriginID != nTargetID)
{
continue;
}
}
else // If its not try by userID.
{
int64_t nClientID = static_cast<int64_t>(pClient->GetUserID() + 1); // Get UserID + 1.
if (nClientID != nTargetID)
{
continue;
}
}
g_pBanSystem->AddEntry(svIpAddress, pClient->GetOriginID());
g_pBanSystem->Save();
NET_DisconnectClient(pClient, i, "Banned from server", 0, 1);
}
else
{
if (string(args.Arg(1)).compare(svIpAddress) != NULL)
{
continue;
}
g_pBanSystem->AddEntry(svIpAddress, pClient->GetOriginID());
g_pBanSystem->Save();
NET_DisconnectClient(pClient, i, "Banned from server", 0, 1);
}
}
}
catch (std::exception& e)
{
Error(eDLL_T::SERVER, "Banid Error: %s", e.what());
return;
}
}
/*
=====================
Host_Unban_f
=====================
*/
void Host_Unban_f(const CCommand& args)
{
if (args.ArgC() < 2)
{
return;
}
try
{
if (args.HasOnlyDigits(1)) // Check if we have an ip address or origin ID.
{
g_pBanSystem->DeleteEntry("noIP", std::stoll(args.Arg(1))); // Delete ban entry.
g_pBanSystem->Save(); // Save modified vector to file.
}
else
{
g_pBanSystem->DeleteEntry(args.Arg(1), 1); // Delete ban entry.
g_pBanSystem->Save(); // Save modified vector to file.
}
}
catch (std::exception& e)
{
Error(eDLL_T::SERVER, "Unban Error: %s", e.what());
return;
}
}
/*
=====================
Host_ReloadBanList_f
=====================
*/
void Host_ReloadBanList_f(const CCommand& args)
{
g_pBanSystem->Load(); // Reload banlist.
}
/*
=====================
Pak_ListPaks_f
=====================
*/
void Pak_ListPaks_f(const CCommand& args)
{
#ifdef GAMEDLL_S3
DevMsg(eDLL_T::RTECH, "| id | name | status | asset count |\n");
DevMsg(eDLL_T::RTECH, "|----|----------------------------------------------------|--------------------------------------|-------------|\n");
uint32_t nActuallyLoaded = 0;
for (int i = 0; i < *s_pLoadedPakCount; ++i)
{
RPakLoadedInfo_t info = g_pLoadedPakInfo[i];
if (info.m_nStatus == RPakStatus_t::PAK_STATUS_FREED)
continue;
string rpakStatus = "RPAK_CREATED_A_NEW_STATUS_SOMEHOW";
auto it = RPakStatusToString.find(info.m_nStatus);
if (it != RPakStatusToString.end())
rpakStatus = it->second;
// todo: make status into a string from an array/vector
DevMsg(eDLL_T::RTECH, "| %02i | %-50s | %-36s | %11i |\n", info.m_nPakId, info.m_pszFileName, rpakStatus.c_str(), info.m_nAssetCount);
nActuallyLoaded++;
}
DevMsg(eDLL_T::RTECH, "|----|----------------------------------------------------|--------------------------------------|-------------|\n");
DevMsg(eDLL_T::RTECH, "| %16i loaded paks. |\n", nActuallyLoaded);
DevMsg(eDLL_T::RTECH, "|----|----------------------------------------------------|--------------------------------------|-------------|\n");
#endif // GAMEDLL_S3
}
/*
=====================
Pak_RequestUnload_f
=====================
*/
void Pak_RequestUnload_f(const CCommand& args)
{
#ifdef GAMEDLL_S3
if (args.ArgC() < 2)
{
return;
}
try
{
if (args.HasOnlyDigits(1))
{
RPakHandle_t nPakId = std::stoi(args.Arg(1));
RPakLoadedInfo_t pakInfo = g_pRTech->GetPakLoadedInfo(nPakId);
pakInfo.m_pszFileName ? DevMsg(eDLL_T::RTECH, "Requested Pak Unload for '%s'\n", pakInfo.m_pszFileName) : DevMsg(eDLL_T::RTECH, "Requested Pak Unload for '%d'\n", nPakId);
g_pakLoadApi->Unload(nPakId);
}
else
{
throw std::exception("Please provide a number as an arg.");
}
}
catch (std::exception& e)
{
Error(eDLL_T::RTECH, "RequestUnload Error: %s", e.what());
return;
}
#endif // GAMEDLL_S3
}
/*
=====================
Pak_RequestLoad_f
=====================
*/
void Pak_RequestLoad_f(const CCommand& args)
{
g_pakLoadApi->AsyncLoad(args.Arg(1));
}
/*
=====================
RTech_StringToGUID_f
=====================
*/
void RTech_StringToGUID_f(const CCommand& args)
{
if (args.ArgC() < 2)
{
return;
}
unsigned long long guid = g_pRTech->StringToGuid(args.Arg(1));
DevMsg(eDLL_T::RTECH, "______________________________________________________________\n");
DevMsg(eDLL_T::RTECH, "] RTECH_HASH -------------------------------------------------\n");
DevMsg(eDLL_T::RTECH, "] GUID: '0x%llX'\n", guid);
}
/*
=====================
RTech_Decompress_f
Decompresses input RPak file and
dumps results to 'paks\Win32\*.rpak'
=====================
*/
void RTech_Decompress_f(const CCommand& args)
{
if (args.ArgC() < 2)
{
return;
}
const string modDir = "paks\\Win32\\";
const string baseDir = "paks\\Win64\\";
string pakNameOut = modDir + args.Arg(1);
string pakNameIn = baseDir + args.Arg(1);
CreateDirectories(pakNameOut);
DevMsg(eDLL_T::RTECH, "______________________________________________________________\n");
DevMsg(eDLL_T::RTECH, "-+ RTech decompress ------------------------------------------\n");
if (!FileExists(pakNameIn.c_str()))
{
Error(eDLL_T::RTECH, "Error: pak file '%s' does not exist!\n", pakNameIn.c_str());
return;
}
DevMsg(eDLL_T::RTECH, " |-+ Processing: '%s'\n", pakNameIn.c_str());
vector<uint8_t> upak; // Compressed region.
ifstream ipak(pakNameIn, fstream::binary);
ipak.seekg(0, fstream::end);
upak.resize(ipak.tellg());
ipak.seekg(0, fstream::beg);
ipak.read(reinterpret_cast<char*>(upak.data()), upak.size());
RPakHeader_t* rheader = (RPakHeader_t*)upak.data();
uint16_t flags = (rheader->m_nFlags[0] << 8) | rheader->m_nFlags[1];
DevMsg(eDLL_T::RTECH, " | |-+ Header ------------------------------------------------\n");
DevMsg(eDLL_T::RTECH, " | | |-- Magic : '%08X'\n", rheader->m_nMagic);
DevMsg(eDLL_T::RTECH, " | | |-- Version : '%u'\n", rheader->m_nVersion);
DevMsg(eDLL_T::RTECH, " | | |-- Flags : '%04X'\n", flags);
DevMsg(eDLL_T::RTECH, " | | |-- Hash : '%llu'\n", rheader->m_nHash);
DevMsg(eDLL_T::RTECH, " | | |-- Entries : '%zu'\n", rheader->m_nAssetEntryCount);
DevMsg(eDLL_T::RTECH, " | |-+ Compression -------------------------------------------\n");
DevMsg(eDLL_T::RTECH, " | | |-- Size disk: '%lld'\n", rheader->m_nSizeDisk);
DevMsg(eDLL_T::RTECH, " | | |-- Size decp: '%lld'\n", rheader->m_nSizeMemory);
DevMsg(eDLL_T::RTECH, " | | |-- Ratio : '%.02f'\n", (rheader->m_nSizeDisk * 100.f) / rheader->m_nSizeMemory);
if (rheader->m_nMagic != 'kaPR')
{
Error(eDLL_T::RTECH, "Error: pak file '%s' has invalid magic!\n", pakNameIn.c_str());
return;
}
if ((rheader->m_nFlags[1] & 1) != 1)
{
Error(eDLL_T::RTECH, "Error: pak file '%s' already decompressed!\n", pakNameIn.c_str());
return;
}
if (rheader->m_nSizeDisk != upak.size())
{
Error(eDLL_T::RTECH, "Error: pak file '%s' decompressed size '%zu' doesn't match expected value '%zu'!\n", pakNameIn.c_str(), upak.size(), rheader->m_nSizeMemory);
return;
}
RPakDecompState_t state;
uint32_t decompSize = g_pRTech->DecompressPakFileInit(&state, upak.data(), upak.size(), 0, PAK_HEADER_SIZE);
if (decompSize == rheader->m_nSizeDisk)
{
Error(eDLL_T::RTECH, "Error: calculated size: '%zu' expected: '%zu'!\n", decompSize, rheader->m_nSizeMemory);
return;
}
else
{
DevMsg(eDLL_T::RTECH, " | | |-- Calculated size: '%zu'\n", decompSize);
}
vector<uint8_t> pakBuf(rheader->m_nSizeMemory, 0);
state.m_nOutMask = UINT64_MAX;
state.m_nOut = uint64_t(pakBuf.data());
uint8_t decompResult = g_pRTech->DecompressPakFile(&state, upak.size(), pakBuf.size());
if (decompResult != 1)
{
Error(eDLL_T::RTECH, "Error: decompression failed for '%s' return value: '%u'!\n", pakNameIn.c_str(), +decompResult);
return;
}
rheader->m_nFlags[1] = 0x0; // Set compressed flag to false for the decompressed pak file.
rheader->m_nSizeDisk = rheader->m_nSizeMemory; // Equal compressed size with decompressed.
ofstream outBlock(pakNameOut, fstream::binary);
if (rheader->m_nPatchIndex > 0) // Check if its an patch rpak.
{
// Loop through all the structs and patch their compress size.
for (int i = 1, patch_offset = 0x88; i <= rheader->m_nPatchIndex; i++, patch_offset += sizeof(RPakPatchCompressedHeader_t))
{
RPakPatchCompressedHeader_t* patch_header = (RPakPatchCompressedHeader_t*)((uintptr_t)pakBuf.data() + patch_offset);
patch_header->m_nSizeDisk = patch_header->m_nSizeMemory; // Fix size for decompress.
}
}
memcpy_s(pakBuf.data(), state.m_nDecompSize, ((uint8_t*)rheader), PAK_HEADER_SIZE); // Overwrite first 0x80 bytes which are NULL with the header data.
outBlock.write((char*)pakBuf.data(), state.m_nDecompSize);
uint32_t crc32_init = {};
DevMsg(eDLL_T::RTECH, " | | |-- CRC32 : '%08X'\n", crc32::update(crc32_init, pakBuf.data(), state.m_nDecompSize));
DevMsg(eDLL_T::RTECH, " |-+ Decompressed rpak to: '%s'\n", pakNameOut.c_str());
DevMsg(eDLL_T::RTECH, "--------------------------------------------------------------\n");
outBlock.close();
}
/*
=====================
VPK_Decompress_f
Decompresses input VPK files and
dumps the output to '<mod>\vpk'.
=====================
*/
void VPK_Unpack_f(const CCommand& args)
{
if (args.ArgC() < 2)
{
return;
}
string szPathOut = "platform\\vpk";
std::chrono::milliseconds msStart = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch());
DevMsg(eDLL_T::FS, "______________________________________________________________\n");
DevMsg(eDLL_T::FS, "] FS_DECOMPRESS ----------------------------------------------\n");
DevMsg(eDLL_T::FS, "] Processing: '%s'\n", args.Arg(1));
VPKDir_t vpk = g_pPackedStore->GetPackDirFile(args.Arg(1));
g_pPackedStore->InitLzDecompParams();
std::thread th([&] { g_pPackedStore->UnpackAll(vpk, szPathOut); });
th.join();
std::chrono::milliseconds msEnd = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch());
float duration = msEnd.count() - msStart.count();
DevMsg(eDLL_T::FS, "______________________________________________________________\n");
DevMsg(eDLL_T::FS, "] OPERATION_DETAILS ------------------------------------------\n");
DevMsg(eDLL_T::FS, "] Time elapsed: '%.3f' seconds\n", (duration / 1000));
DevMsg(eDLL_T::FS, "] Decompressed vpk to: '%s'\n", szPathOut.c_str());
DevMsg(eDLL_T::FS, "--------------------------------------------------------------\n");
}
/*
=====================
VPK_Mount_f
Mounts input VPK file for
internal FileSystem usage
=====================
*/
void VPK_Mount_f(const CCommand& args)
{
if (args.ArgC() < 2)
{
return;
}
if (g_pFileSystem_Stdio)
{
VPKData_t* pPakData = g_pFileSystem_Stdio->MountVPK(args.Arg(1));
if (pPakData)
{
DevMsg(eDLL_T::FS, "Mounted VPK file '%s' with handle '%d'\n", args.Arg(1), pPakData->m_nHandle);
}
else
{
Warning(eDLL_T::FS, "Unable to mount VPK file '%s': non-existent VPK file\n", args.Arg(1));
}
}
else
{
Warning(eDLL_T::FS, "Unable to mount VPK file '%s': '%s' is not initalized\n", args.Arg(1), VAR_NAME(g_pFileSystem));
}
}
/*
=====================
NET_SetKey_f
Sets the input netchannel encryption key
=====================
*/
void NET_SetKey_f(const CCommand& args)
{
if (args.ArgC() < 2)
{
return;
}
NET_SetKey(args.Arg(1));
}
/*
=====================
NET_GenerateKey_f
Sets a random netchannel encryption key
=====================
*/
void NET_GenerateKey_f(const CCommand& args)
{
NET_GenerateKey();
}
#ifndef DEDICATED
/*
=====================
RCON_CmdQuery_f
Issues an RCON command to the
RCON server.
=====================
*/
void RCON_CmdQuery_f(const CCommand& args)
{
if (args.ArgC() < 2)
{
if (g_pRConClient->IsInitialized()
&& !g_pRConClient->IsConnected()
&& strlen(rcon_address->GetString()) > 0)
{
g_pRConClient->Connect();
}
}
else
{
if (!g_pRConClient->IsInitialized())
{
Warning(eDLL_T::CLIENT, "Failed to issue command to RCON server: uninitialized\n");
return;
}
else if (g_pRConClient->IsConnected())
{
if (strcmp(args.Arg(1), "PASS") == 0) // Auth with RCON server using rcon_password ConVar value.
{
string svCmdQuery = g_pRConClient->Serialize(rcon_password->GetString(), "", cl_rcon::request_t::SERVERDATA_REQUEST_AUTH);
g_pRConClient->Send(svCmdQuery);
return;
}
else if (strcmp(args.Arg(1), "disconnect") == 0) // Disconnect from RCON server.
{
g_pRConClient->Disconnect();
return;
}
string svCmdQuery = g_pRConClient->Serialize(args.ArgS(), "", cl_rcon::request_t::SERVERDATA_REQUEST_EXECCOMMAND);
g_pRConClient->Send(svCmdQuery);
return;
}
else
{
Warning(eDLL_T::CLIENT, "Failed to issue command to RCON server: unconnected\n");
return;
}
}
}
/*
=====================
RCON_Disconnect_f
Disconnect from RCON server
=====================
*/
void RCON_Disconnect_f(const CCommand& args)
{
if (g_pRConClient->IsConnected())
{
g_pRConClient->Disconnect();
DevMsg(eDLL_T::CLIENT, "User closed RCON connection\n");
}
}
#endif // !DEDICATED
/*
=====================
SQVM_ServerScript_f
Exectutes input on the
VM in SERVER context.
=====================
*/
void SQVM_ServerScript_f(const CCommand& args)
{
if (args.ArgC() >= 2)
{
SQVM_Execute(args.ArgS(), SQCONTEXT::SERVER);
}
}
#ifndef DEDICATED
/*
=====================
SQVM_ClientScript_f
Exectutes input on the
VM in CLIENT context.
=====================
*/
void SQVM_ClientScript_f(const CCommand& args)
{
if (args.ArgC() >= 2)
{
SQVM_Execute(args.ArgS(), SQCONTEXT::CLIENT);
}
}
/*
=====================
SQVM_UIScript_f
Exectutes input on the
VM in UI context.
=====================
*/
void SQVM_UIScript_f(const CCommand& args)
{
if (args.ArgC() >= 2)
{
SQVM_Execute(args.ArgS(), SQCONTEXT::UI);
}
}
/*
=====================
Mat_CrossHair_f
Print the material under the crosshair.
=====================
*/
void Mat_CrossHair_f(const CCommand& args)
{
#if defined (GAMEDLL_S3) // [ PIXIE ]: Verification needed for earlier seasons if CMaterialGlue matches.
CMaterialGlue* material = GetMaterialAtCrossHair();
if (material)
{
DevMsg(eDLL_T::MS, "______________________________________________________________\n");
DevMsg(eDLL_T::MS, "-+ Material --------------------------------------------------\n");
DevMsg(eDLL_T::MS, " |-- ADDR: '%llX'\n", material);
DevMsg(eDLL_T::MS, " |-- GUID: '%llX'\n", material->m_GUID);
DevMsg(eDLL_T::MS, " |-- UnknownSignature: '%d'\n", material->m_UnknownSignature);
DevMsg(eDLL_T::MS, " |-- Material Width: '%d'\n", material->m_iWidth);
DevMsg(eDLL_T::MS, " |-- Material Height: '%d'\n", material->m_iHeight);
DevMsg(eDLL_T::MS, " |-- Flags: '%llX'\n", material->m_iFlags);
std::function<void(CMaterialGlue*, const char*)> fnPrintChild = [](CMaterialGlue* material, const char* print)
{
DevMsg(eDLL_T::MS, " |-+\n");
DevMsg(eDLL_T::MS, " | |-+ Child material ----------------------------------------\n");
DevMsg(eDLL_T::MS, print, material);
DevMsg(eDLL_T::MS, " | |-- GUID: '%llX'\n", material->m_GUID);
DevMsg(eDLL_T::MS, " | |-- Material Name: '%s'\n", material->m_pszName);
};
DevMsg(eDLL_T::MS, " |-- Material Name: '%s'\n", material->m_pszName);
DevMsg(eDLL_T::MS, " |-- Material Surface Name 1: '%s'\n", material->m_pszSurfaceName1);
DevMsg(eDLL_T::MS, " |-- Material Surface Name 2: '%s'\n", material->m_pszSurfaceName2);
DevMsg(eDLL_T::MS, " |-- DX Texture 1: '%llX'\n", material->m_ppDXTexture1);
DevMsg(eDLL_T::MS, " |-- DX Texture 2: '%llX'\n", material->m_ppDXTexture2);
material->m_pDepthShadow ? fnPrintChild(material->m_pDepthShadow, " | |-+ DepthShadow Addr: '%llX'\n") : DevMsg(eDLL_T::MS, " | |-+ DepthShadow Addr: 'NULL'\n");
material->m_pDepthPrepass ? fnPrintChild(material->m_pDepthPrepass, " | |-+ DepthPrepass Addr: '%llX'\n") : DevMsg(eDLL_T::MS, " | |-+ DepthPrepass Addr: 'NULL'\n");
material->m_pDepthVSM ? fnPrintChild(material->m_pDepthVSM, " | |-+ DepthVSM Addr: '%llX'\n") : DevMsg(eDLL_T::MS, " | |-+ DepthVSM Addr: 'NULL'\n");
material->m_pDepthShadow ? fnPrintChild(material->m_pDepthShadow, " | |-+ DepthShadowTight Addr: '%llX'\n") : DevMsg(eDLL_T::MS, " | |-+ DepthShadowTight Addr: 'NULL'\n");
material->m_pColPass ? fnPrintChild(material->m_pColPass, " | |-+ ColPass Addr: '%llX'\n") : DevMsg(eDLL_T::MS, " | |-+ ColPass Addr: 'NULL'\n");
DevMsg(eDLL_T::MS, "-+ Texture GUID map ------------------------------------------\n");
material->m_pTextureGUID1 ? DevMsg(eDLL_T::MS, " |-- TextureMap 1 Addr: '%llX'\n", material->m_pTextureGUID1) : DevMsg(eDLL_T::MS, " |-- TextureMap 1 Addr: 'NULL'\n");
material->m_pTextureGUID2 ? DevMsg(eDLL_T::MS, " |-- TextureMap 2 Addr: '%llX'\n", material->m_pTextureGUID2) : DevMsg(eDLL_T::MS, " |-- TextureMap 2 Addr: 'NULL'\n");
DevMsg(eDLL_T::MS, "--------------------------------------------------------------\n");
}
else
{
DevMsg(eDLL_T::MS, "No Material found >:(\n");
}
#endif
}
#endif // !DEDICATED

View File

@ -4,19 +4,67 @@
inline CMemory p_SetupGamemode;
inline auto SetupGamemode = p_SetupGamemode.RCast<bool(*)(const char* pszPlayList)>();
/* ==== CONCOMMANDCALLBACK ============================================================================================================================================== */
inline CMemory p_Host_Map_f;
inline auto _Host_Map_f = p_Host_Map_f.RCast<void (*)(CCommand* pCommand, char a2)>();
inline CMemory p_DownloadPlaylists_f;
inline auto _DownloadPlaylists_f = p_DownloadPlaylists_f.RCast<void(*)(void)>();
///////////////////////////////////////////////////////////////////////////////
bool MP_GameMode_Changed_f(ConVar* pVTable);
#ifndef DEDICATED
void GameConsole_Invoke_f(const CCommand& args);
void ServerBrowser_Invoke_f(const CCommand& args);
#endif // !DEDICATED
void Host_Kick_f(const CCommand& args);
void Host_KickID_f(const CCommand& args);
void Host_Ban_f(const CCommand& args);
void Host_BanID_f(const CCommand& args);
void Host_Unban_f(const CCommand& args);
void Host_ReloadBanList_f(const CCommand& args);
void Pak_ListPaks_f(const CCommand& args);
void Pak_RequestUnload_f(const CCommand& args);
void Pak_RequestLoad_f(const CCommand& args);
void RTech_StringToGUID_f(const CCommand& args);
void RTech_Decompress_f(const CCommand& args);
void VPK_Unpack_f(const CCommand& args);
void VPK_Mount_f(const CCommand& args);
void NET_SetKey_f(const CCommand& args);
void NET_GenerateKey_f(const CCommand& args);
#ifndef DEDICATED
void RCON_CmdQuery_f(const CCommand& args);
void RCON_Disconnect_f(const CCommand& args);
#endif // !DEDICATED
void SQVM_ServerScript_f(const CCommand& args);
#ifndef DEDICATED
void SQVM_ClientScript_f(const CCommand& args);
void SQVM_UIScript_f(const CCommand& args);
void Mat_CrossHair_f(const CCommand& args);
#endif // !DEDICATED
///////////////////////////////////////////////////////////////////////////////
class VCallback : public IDetour
{
virtual void GetAdr(void) const
{
spdlog::debug("| FUN: SetupGamemode : {:#18x} |\n", p_SetupGamemode.GetPtr());
spdlog::debug("| FUN: Host_Map_f : {:#18x} |\n", p_Host_Map_f.GetPtr());
spdlog::debug("| FUN: DownloadPlaylist_f : {:#18x} |\n", p_DownloadPlaylists_f.GetPtr());
spdlog::debug("+----------------------------------------------------------------+\n");
}
virtual void GetFun(void) const
{
p_SetupGamemode = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x40\x53\x48\x83\xEC\x20\x48\x8B\xD9\x48\xC7\xC0\x00\x00\x00\x00"), "xxxxxxxxxxxx????");
#if defined (GAMEDLL_S1)
p_Host_Map_f_CompletionFunc = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x48\x89\x5C\x24\x18\x55\x41\x56\x41\x00\x00\x00\x00\x40\x02"), "xxxxxxxxx????xx");
#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
p_Host_Map_f = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x40\x55\x41\x56\x41\x57\x48\x81\xEC\x00\x00\x00\x00\x83\x3D"), "xxxxxxxxx????xx");
#endif
p_DownloadPlaylists_f = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x33\xC9\xC6\x05\x00\x00\x00\x00\x00\xE9\x00\x00\x00\x00"), "xxxx?????x????");
SetupGamemode = p_SetupGamemode.RCast<bool(*)(const char*)>();
_Host_Map_f = p_Host_Map_f.RCast<void (*)(CCommand* pCommand, char a2)>(); /*40 55 41 56 41 57 48 81 EC ?? ?? ?? ?? 83 3D*/
_DownloadPlaylists_f = p_DownloadPlaylists_f.RCast<void(*)(void)>(); /*33 C9 C6 05 ?? ?? ?? ?? ?? E9 ?? ?? ?? ??*/
}
virtual void GetVar(void) const { }
virtual void GetCon(void) const { }

View File

@ -5,808 +5,3 @@
//=============================================================================//
#include "core/stdafx.h"
#include "windows/id3dx.h"
#include "tier1/cvar.h"
#include "tier1/IConVar.h"
#ifndef DEDICATED
#include "engine/cl_rcon.h"
#endif // !DEDICATED
#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"
#include "filesystem/filesystem.h"
#include "vpklib/packedstore.h"
#include "squirrel/sqvm.h"
#ifndef DEDICATED
#include "gameui/IBrowser.h"
#include "gameui/IConsole.h"
#endif // !DEDICATED
#include "public/include/bansystem.h"
#include "mathlib/crc32.h"
#include "vstdlib/completion.h"
#ifndef DEDICATED
#include "materialsystem/cmaterialglue.h"
#endif // !DEDICATED
#ifndef DEDICATED
/*
=====================
_CGameConsole_f_CompletionFunc
=====================
*/
void _CGameConsole_f_CompletionFunc(const CCommand& args)
{
g_pIConsole->m_bActivate = !g_pIConsole->m_bActivate;
}
/*
=====================
_CCompanion_f_CompletionFunc
=====================
*/
void _CCompanion_f_CompletionFunc(const CCommand& args)
{
g_pIBrowser->m_bActivate = !g_pIBrowser->m_bActivate;
}
#endif // !DEDICATED
/*
=====================
_Kick_f_CompletionFunc
=====================
*/
void _Kick_f_CompletionFunc(const CCommand& args)
{
if (args.ArgC() < 2)
{
return;
}
for (int i = 0; i < MAX_PLAYERS; i++)
{
CBaseClient* pClient = g_pClient->GetClient(i);
CNetChan* pNetChan = pClient->GetNetChan();
if (!pClient || !pNetChan)
{
continue;
}
string svClientName = pNetChan->GetName(); // Get full name.
if (svClientName.empty())
{
continue;
}
if (strcmp(args.Arg(1), svClientName.c_str()) != 0) // Our wanted name?
{
continue;
}
NET_DisconnectClient(pClient, i, "Kicked from server", 0, 1);
}
}
/*
=====================
_KickID_f_CompletionFunc
=====================
*/
void _KickID_f_CompletionFunc(const CCommand& args)
{
if (args.ArgC() < 2) // Do we atleast have 2 arguments?
{
return;
}
try
{
bool bOnlyDigits = args.HasOnlyDigits(1);
for (int i = 0; i < MAX_PLAYERS; i++)
{
CBaseClient* pClient = g_pClient->GetClient(i);
CNetChan* pNetChan = pClient->GetNetChan();
if (!pClient || !pNetChan)
{
continue;
}
string svIpAddress = pNetChan->GetAddress(); // If this stays null they modified the packet somehow.
if (bOnlyDigits)
{
int64_t nTargetID = static_cast<int64_t>(std::stoll(args.Arg(1)));
if (nTargetID > MAX_PLAYERS) // Is it a possible originID?
{
int64_t nOriginID = pClient->GetOriginID();
if (nOriginID != nTargetID)
{
continue;
}
}
else // If its not try by userID.
{
int64_t nClientID = static_cast<int64_t>(pClient->GetUserID() + 1); // Get userID + 1.
if (nClientID != nTargetID)
{
continue;
}
}
NET_DisconnectClient(pClient, i, "Kicked from server", 0, 1);
}
else
{
if (string(args.Arg(1)).compare(svIpAddress) != NULL)
{
continue;
}
NET_DisconnectClient(pClient, i, "Kicked from server", 0, 1);
}
}
}
catch (std::exception& e)
{
Error(eDLL_T::SERVER, "sv_kickid requires a UserID or OriginID. You can get the UserID with the 'status' command. Error: %s", e.what());
return;
}
}
/*
=====================
_Ban_f_CompletionFunc
=====================
*/
void _Ban_f_CompletionFunc(const CCommand& args)
{
if (args.ArgC() < 2)
{
return;
}
for (int i = 0; i < MAX_PLAYERS; i++)
{
CBaseClient* pClient = g_pClient->GetClient(i);
CNetChan* pNetChan = pClient->GetNetChan();
if (!pClient || !pNetChan)
{
continue;
}
string svClientName = pNetChan->GetName(); // Get full name.
if (svClientName.empty())
{
continue;
}
if (strcmp(args.Arg(1), svClientName.c_str()) != 0)
{
continue;
}
string svIpAddress = pNetChan->GetAddress(); // If this stays empty they modified the packet somehow.
g_pBanSystem->AddEntry(svIpAddress, pClient->GetOriginID());
g_pBanSystem->Save();
NET_DisconnectClient(pClient, i, "Banned from server", 0, 1);
}
}
/*
=====================
_BanID_f_CompletionFunc
=====================
*/
void _BanID_f_CompletionFunc(const CCommand& args)
{
if (args.ArgC() < 2)
{
return;
}
try
{
bool bOnlyDigits = args.HasOnlyDigits(1);
for (int i = 0; i < MAX_PLAYERS; i++)
{
CBaseClient* pClient = g_pClient->GetClient(i);
CNetChan* pNetChan = pClient->GetNetChan();
if (!pClient || !pNetChan)
{
continue;
}
string svIpAddress = pNetChan->GetAddress(); // If this stays empty they modified the packet somehow.
if (bOnlyDigits)
{
int64_t nTargetID = static_cast<int64_t>(std::stoll(args.Arg(1)));
if (nTargetID > MAX_PLAYERS) // Is it a possible originID?
{
int64_t nOriginID = pClient->GetOriginID();
if (nOriginID != nTargetID)
{
continue;
}
}
else // If its not try by userID.
{
int64_t nClientID = static_cast<int64_t>(pClient->GetUserID() + 1); // Get UserID + 1.
if (nClientID != nTargetID)
{
continue;
}
}
g_pBanSystem->AddEntry(svIpAddress, pClient->GetOriginID());
g_pBanSystem->Save();
NET_DisconnectClient(pClient, i, "Banned from server", 0, 1);
}
else
{
if (string(args.Arg(1)).compare(svIpAddress) != NULL)
{
continue;
}
g_pBanSystem->AddEntry(svIpAddress, pClient->GetOriginID());
g_pBanSystem->Save();
NET_DisconnectClient(pClient, i, "Banned from server", 0, 1);
}
}
}
catch (std::exception& e)
{
Error(eDLL_T::SERVER, "Banid Error: %s", e.what());
return;
}
}
/*
=====================
_Unban_f_CompletionFunc
=====================
*/
void _Unban_f_CompletionFunc(const CCommand& args)
{
if (args.ArgC() < 2)
{
return;
}
try
{
if (args.HasOnlyDigits(1)) // Check if we have an ip address or origin ID.
{
g_pBanSystem->DeleteEntry("noIP", std::stoll(args.Arg(1))); // Delete ban entry.
g_pBanSystem->Save(); // Save modified vector to file.
}
else
{
g_pBanSystem->DeleteEntry(args.Arg(1), 1); // Delete ban entry.
g_pBanSystem->Save(); // Save modified vector to file.
}
}
catch (std::exception& e)
{
Error(eDLL_T::SERVER, "Unban Error: %s", e.what());
return;
}
}
/*
=====================
_ReloadBanList_f_CompletionFunc
=====================
*/
void _ReloadBanList_f_CompletionFunc(const CCommand& args)
{
g_pBanSystem->Load(); // Reload banlist.
}
/*
=====================
_Pak_ListPaks_f_CompletionFunc
=====================
*/
void _Pak_ListPaks_f_CompletionFunc(const CCommand& args)
{
#ifdef GAMEDLL_S3
DevMsg(eDLL_T::RTECH, "| id | name | status | asset count |\n");
DevMsg(eDLL_T::RTECH, "|----|----------------------------------------------------|--------------------------------------|-------------|\n");
uint32_t nActuallyLoaded = 0;
for (int i = 0; i < *s_pLoadedPakCount; ++i)
{
RPakLoadedInfo_t info = g_pLoadedPakInfo[i];
if (info.m_nStatus == RPakStatus_t::PAK_STATUS_FREED)
continue;
string rpakStatus = "RPAK_CREATED_A_NEW_STATUS_SOMEHOW";
auto it = RPakStatusToString.find(info.m_nStatus);
if (it != RPakStatusToString.end())
rpakStatus = it->second;
// todo: make status into a string from an array/vector
DevMsg(eDLL_T::RTECH, "| %02i | %-50s | %-36s | %11i |\n", info.m_nPakId, info.m_pszFileName, rpakStatus.c_str(), info.m_nAssetCount);
nActuallyLoaded++;
}
DevMsg(eDLL_T::RTECH, "|----|----------------------------------------------------|--------------------------------------|-------------|\n");
DevMsg(eDLL_T::RTECH, "| %16i loaded paks. |\n", nActuallyLoaded);
DevMsg(eDLL_T::RTECH, "|----|----------------------------------------------------|--------------------------------------|-------------|\n");
#endif // GAMEDLL_S3
}
/*
=====================
_Pak_RequestUnload_f_CompletionFunc
=====================
*/
void _Pak_RequestUnload_f_CompletionFunc(const CCommand& args)
{
#ifdef GAMEDLL_S3
if (args.ArgC() < 2)
{
return;
}
try
{
if (args.HasOnlyDigits(1))
{
RPakHandle_t nPakId = std::stoi(args.Arg(1));
RPakLoadedInfo_t pakInfo = g_pRTech->GetPakLoadedInfo(nPakId);
pakInfo.m_pszFileName ? DevMsg(eDLL_T::RTECH, "Requested Pak Unload for '%s'\n", pakInfo.m_pszFileName) : DevMsg(eDLL_T::RTECH, "Requested Pak Unload for '%d'\n", nPakId);
g_pakLoadApi->Unload(nPakId);
}
else
{
throw std::exception("Please provide a number as an arg.");
}
}
catch (std::exception& e)
{
Error(eDLL_T::RTECH, "RequestUnload Error: %s", e.what());
return;
}
#endif // GAMEDLL_S3
}
/*
=====================
_Pak_RequestLoad_f_CompletionFunc
=====================
*/
void _Pak_RequestLoad_f_CompletionFunc(const CCommand& args)
{
g_pakLoadApi->AsyncLoad(args.Arg(1));
}
/*
=====================
_RTech_StringToGUID_f_CompletionFunc
=====================
*/
void _RTech_StringToGUID_f_CompletionFunc(const CCommand& args)
{
if (args.ArgC() < 2)
{
return;
}
unsigned long long guid = g_pRTech->StringToGuid(args.Arg(1));
DevMsg(eDLL_T::RTECH, "______________________________________________________________\n");
DevMsg(eDLL_T::RTECH, "] RTECH_HASH -------------------------------------------------\n");
DevMsg(eDLL_T::RTECH, "] GUID: '0x%llX'\n", guid);
}
/*
=====================
_RTech_Decompress_f_CompletionFunc
Decompresses input RPak file and
dumps results to 'paks\Win32\*.rpak'
=====================
*/
void _RTech_Decompress_f_CompletionFunc(const CCommand& args)
{
if (args.ArgC() < 2)
{
return;
}
const string modDir = "paks\\Win32\\";
const string baseDir = "paks\\Win64\\";
string pakNameOut = modDir + args.Arg(1);
string pakNameIn = baseDir + args.Arg(1);
CreateDirectories(pakNameOut);
DevMsg(eDLL_T::RTECH, "______________________________________________________________\n");
DevMsg(eDLL_T::RTECH, "-+ RTech decompress ------------------------------------------\n");
if (!FileExists(pakNameIn.c_str()))
{
Error(eDLL_T::RTECH, "Error: pak file '%s' does not exist!\n", pakNameIn.c_str());
return;
}
DevMsg(eDLL_T::RTECH, " |-+ Processing: '%s'\n", pakNameIn.c_str());
vector<uint8_t> upak; // Compressed region.
ifstream ipak(pakNameIn, fstream::binary);
ipak.seekg(0, fstream::end);
upak.resize(ipak.tellg());
ipak.seekg(0, fstream::beg);
ipak.read(reinterpret_cast<char*>(upak.data()), upak.size());
RPakHeader_t* rheader = (RPakHeader_t*)upak.data();
uint16_t flags = (rheader->m_nFlags[0] << 8) | rheader->m_nFlags[1];
DevMsg(eDLL_T::RTECH, " | |-+ Header ------------------------------------------------\n");
DevMsg(eDLL_T::RTECH, " | | |-- Magic : '%08X'\n", rheader->m_nMagic);
DevMsg(eDLL_T::RTECH, " | | |-- Version : '%u'\n", rheader->m_nVersion);
DevMsg(eDLL_T::RTECH, " | | |-- Flags : '%04X'\n", flags);
DevMsg(eDLL_T::RTECH, " | | |-- Hash : '%llu'\n", rheader->m_nHash);
DevMsg(eDLL_T::RTECH, " | | |-- Entries : '%zu'\n", rheader->m_nAssetEntryCount);
DevMsg(eDLL_T::RTECH, " | |-+ Compression -------------------------------------------\n");
DevMsg(eDLL_T::RTECH, " | | |-- Size disk: '%lld'\n", rheader->m_nSizeDisk);
DevMsg(eDLL_T::RTECH, " | | |-- Size decp: '%lld'\n", rheader->m_nSizeMemory);
DevMsg(eDLL_T::RTECH, " | | |-- Ratio : '%.02f'\n", (rheader->m_nSizeDisk * 100.f) / rheader->m_nSizeMemory);
if (rheader->m_nMagic != 'kaPR')
{
Error(eDLL_T::RTECH, "Error: pak file '%s' has invalid magic!\n", pakNameIn.c_str());
return;
}
if ((rheader->m_nFlags[1] & 1) != 1)
{
Error(eDLL_T::RTECH, "Error: pak file '%s' already decompressed!\n", pakNameIn.c_str());
return;
}
if (rheader->m_nSizeDisk != upak.size())
{
Error(eDLL_T::RTECH, "Error: pak file '%s' decompressed size '%zu' doesn't match expected value '%zu'!\n", pakNameIn.c_str(), upak.size(), rheader->m_nSizeMemory);
return;
}
RPakDecompState_t state;
uint32_t decompSize = g_pRTech->DecompressPakFileInit(&state, upak.data(), upak.size(), 0, PAK_HEADER_SIZE);
if (decompSize == rheader->m_nSizeDisk)
{
Error(eDLL_T::RTECH, "Error: calculated size: '%zu' expected: '%zu'!\n", decompSize, rheader->m_nSizeMemory);
return;
}
else
{
DevMsg(eDLL_T::RTECH, " | | |-- Calculated size: '%zu'\n", decompSize);
}
vector<uint8_t> pakBuf(rheader->m_nSizeMemory, 0);
state.m_nOutMask = UINT64_MAX;
state.m_nOut = uint64_t(pakBuf.data());
uint8_t decompResult = g_pRTech->DecompressPakFile(&state, upak.size(), pakBuf.size());
if (decompResult != 1)
{
Error(eDLL_T::RTECH, "Error: decompression failed for '%s' return value: '%u'!\n", pakNameIn.c_str(), +decompResult);
return;
}
rheader->m_nFlags[1] = 0x0; // Set compressed flag to false for the decompressed pak file.
rheader->m_nSizeDisk = rheader->m_nSizeMemory; // Equal compressed size with decompressed.
ofstream outBlock(pakNameOut, fstream::binary);
if (rheader->m_nPatchIndex > 0) // Check if its an patch rpak.
{
// Loop through all the structs and patch their compress size.
for (int i = 1, patch_offset = 0x88; i <= rheader->m_nPatchIndex; i++, patch_offset += sizeof(RPakPatchCompressedHeader_t))
{
RPakPatchCompressedHeader_t* patch_header = (RPakPatchCompressedHeader_t*)((uintptr_t)pakBuf.data() + patch_offset);
patch_header->m_nSizeDisk = patch_header->m_nSizeMemory; // Fix size for decompress.
}
}
memcpy_s(pakBuf.data(), state.m_nDecompSize, ((uint8_t*)rheader), PAK_HEADER_SIZE); // Overwrite first 0x80 bytes which are NULL with the header data.
outBlock.write((char*)pakBuf.data(), state.m_nDecompSize);
uint32_t crc32_init = {};
DevMsg(eDLL_T::RTECH, " | | |-- CRC32 : '%08X'\n", crc32::update(crc32_init, pakBuf.data(), state.m_nDecompSize));
DevMsg(eDLL_T::RTECH, " |-+ Decompressed rpak to: '%s'\n", pakNameOut.c_str());
DevMsg(eDLL_T::RTECH, "--------------------------------------------------------------\n");
outBlock.close();
}
/*
=====================
_VPK_Decompress_f_CompletionFunc
Decompresses input VPK files and
dumps the output to '<mod>\vpk'.
=====================
*/
void _VPK_Unpack_f_CompletionFunc(const CCommand& args)
{
if (args.ArgC() < 2)
{
return;
}
string szPathOut = "platform\\vpk";
std::chrono::milliseconds msStart = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch());
DevMsg(eDLL_T::FS, "______________________________________________________________\n");
DevMsg(eDLL_T::FS, "] FS_DECOMPRESS ----------------------------------------------\n");
DevMsg(eDLL_T::FS, "] Processing: '%s'\n", args.Arg(1));
VPKDir_t vpk = g_pPackedStore->GetPackDirFile(args.Arg(1));
g_pPackedStore->InitLzDecompParams();
std::thread th([&] { g_pPackedStore->UnpackAll(vpk, szPathOut); });
th.join();
std::chrono::milliseconds msEnd = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch());
float duration = msEnd.count() - msStart.count();
DevMsg(eDLL_T::FS, "______________________________________________________________\n");
DevMsg(eDLL_T::FS, "] OPERATION_DETAILS ------------------------------------------\n");
DevMsg(eDLL_T::FS, "] Time elapsed: '%.3f' seconds\n", (duration / 1000));
DevMsg(eDLL_T::FS, "] Decompressed vpk to: '%s'\n", szPathOut.c_str());
DevMsg(eDLL_T::FS, "--------------------------------------------------------------\n");
}
/*
=====================
_VPK_Mount_f_CompletionFunc
Mounts input VPK file for
internal FileSystem usage
=====================
*/
void _VPK_Mount_f_CompletionFunc(const CCommand& args)
{
if (args.ArgC() < 2)
{
return;
}
if (g_pFileSystem_Stdio)
{
VPKData_t* pPakData = g_pFileSystem_Stdio->MountVPK(args.Arg(1));
if (pPakData)
{
DevMsg(eDLL_T::FS, "Mounted VPK file '%s' with handle '%d'\n", args.Arg(1), pPakData->m_nHandle);
}
else
{
Warning(eDLL_T::FS, "Unable to mount VPK file '%s': non-existent VPK file\n", args.Arg(1));
}
}
else
{
Warning(eDLL_T::FS, "Unable to mount VPK file '%s': '%s' is not initalized\n", args.Arg(1), VAR_NAME(g_pFileSystem));
}
}
/*
=====================
_NET_SetKey_f_CompletionFunc
Sets the input netchannel encryption key
=====================
*/
void _NET_SetKey_f_CompletionFunc(const CCommand& args)
{
if (args.ArgC() < 2)
{
return;
}
NET_SetKey(args.Arg(1));
}
/*
=====================
_NET_GenerateKey_f_CompletionFunc
Sets a random netchannel encryption key
=====================
*/
void _NET_GenerateKey_f_CompletionFunc(const CCommand& args)
{
NET_GenerateKey();
}
#ifndef DEDICATED
/*
=====================
_RCON_CmdQuery_f_CompletionFunc
Issues an RCON command to the
RCON server.
=====================
*/
void _RCON_CmdQuery_f_CompletionFunc(const CCommand& args)
{
if (args.ArgC() < 2)
{
if (g_pRConClient->IsInitialized()
&& !g_pRConClient->IsConnected()
&& strlen(rcon_address->GetString()) > 0)
{
g_pRConClient->Connect();
}
}
else
{
if (!g_pRConClient->IsInitialized())
{
Warning(eDLL_T::CLIENT, "Failed to issue command to RCON server: uninitialized\n");
return;
}
else if (g_pRConClient->IsConnected())
{
if (strcmp(args.Arg(1), "PASS") == 0) // Auth with RCON server using rcon_password ConVar value.
{
string svCmdQuery = g_pRConClient->Serialize(rcon_password->GetString(), "", cl_rcon::request_t::SERVERDATA_REQUEST_AUTH);
g_pRConClient->Send(svCmdQuery);
return;
}
else if (strcmp(args.Arg(1), "disconnect") == 0) // Disconnect from RCON server.
{
g_pRConClient->Disconnect();
return;
}
string svCmdQuery = g_pRConClient->Serialize(args.ArgS(), "", cl_rcon::request_t::SERVERDATA_REQUEST_EXECCOMMAND);
g_pRConClient->Send(svCmdQuery);
return;
}
else
{
Warning(eDLL_T::CLIENT, "Failed to issue command to RCON server: unconnected\n");
return;
}
}
}
/*
=====================
_RCON_CmdQuery_f_CompletionFunc
Disconnect from RCON server
=====================
*/
void _RCON_Disconnect_f_CompletionFunc(const CCommand& args)
{
if (g_pRConClient->IsConnected())
{
g_pRConClient->Disconnect();
DevMsg(eDLL_T::CLIENT, "User closed RCON connection\n");
}
}
#endif // !DEDICATED
/*
=====================
_SQVM_ServerScript_f_CompletionFunc
Exectutes input on the
VM in SERVER context.
=====================
*/
void _SQVM_ServerScript_f_CompletionFunc(const CCommand& args)
{
if (args.ArgC() >= 2)
{
SQVM_Execute(args.ArgS(), SQCONTEXT::SERVER);
}
}
#ifndef DEDICATED
/*
=====================
_SQVM_ClientScript_f_CompletionFunc
Exectutes input on the
VM in CLIENT context.
=====================
*/
void _SQVM_ClientScript_f_CompletionFunc(const CCommand& args)
{
if (args.ArgC() >= 2)
{
SQVM_Execute(args.ArgS(), SQCONTEXT::CLIENT);
}
}
/*
=====================
_SQVM_UIScript_f_CompletionFunc
Exectutes input on the
VM in UI context.
=====================
*/
void _SQVM_UIScript_f_CompletionFunc(const CCommand& args)
{
if (args.ArgC() >= 2)
{
SQVM_Execute(args.ArgS(), SQCONTEXT::UI);
}
}
/*
=====================
_IMaterial_GetMaterialAtCrossHair_f_CompletionFunc
Print the material under the crosshair.
=====================
*/
void _CMaterial_GetMaterialAtCrossHair_f_ComplectionFunc(const CCommand& args)
{
#if defined (GAMEDLL_S3) // [ PIXIE ]: Verification needed for earlier seasons if CMaterialGlue matches.
CMaterialGlue* material = GetMaterialAtCrossHair();
if (material)
{
DevMsg(eDLL_T::MS, "______________________________________________________________\n");
DevMsg(eDLL_T::MS, "-+ Material --------------------------------------------------\n");
DevMsg(eDLL_T::MS, " |-- ADDR: '%llX'\n", material);
DevMsg(eDLL_T::MS, " |-- GUID: '%llX'\n", material->m_GUID);
DevMsg(eDLL_T::MS, " |-- UnknownSignature: '%d'\n", material->m_UnknownSignature);
DevMsg(eDLL_T::MS, " |-- Material Width: '%d'\n", material->m_iWidth);
DevMsg(eDLL_T::MS, " |-- Material Height: '%d'\n", material->m_iHeight);
DevMsg(eDLL_T::MS, " |-- Flags: '%llX'\n", material->m_iFlags);
std::function<void(CMaterialGlue*, const char*)> fnPrintChild = [](CMaterialGlue* material, const char* print)
{
DevMsg(eDLL_T::MS, " |-+\n");
DevMsg(eDLL_T::MS, " | |-+ Child material ----------------------------------------\n");
DevMsg(eDLL_T::MS, print, material);
DevMsg(eDLL_T::MS, " | |-- GUID: '%llX'\n", material->m_GUID);
DevMsg(eDLL_T::MS, " | |-- Material Name: '%s'\n", material->m_pszName);
};
DevMsg(eDLL_T::MS, " |-- Material Name: '%s'\n", material->m_pszName);
DevMsg(eDLL_T::MS, " |-- Material Surface Name 1: '%s'\n", material->m_pszSurfaceName1);
DevMsg(eDLL_T::MS, " |-- Material Surface Name 2: '%s'\n", material->m_pszSurfaceName2);
DevMsg(eDLL_T::MS, " |-- DX Texture 1: '%llX'\n", material->m_ppDXTexture1);
DevMsg(eDLL_T::MS, " |-- DX Texture 2: '%llX'\n", material->m_ppDXTexture2);
material->m_pDepthShadow ? fnPrintChild(material->m_pDepthShadow, " | |-+ DepthShadow Addr: '%llX'\n") : DevMsg(eDLL_T::MS, " | |-+ DepthShadow Addr: 'NULL'\n");
material->m_pDepthPrepass ? fnPrintChild(material->m_pDepthPrepass, " | |-+ DepthPrepass Addr: '%llX'\n") : DevMsg(eDLL_T::MS, " | |-+ DepthPrepass Addr: 'NULL'\n");
material->m_pDepthVSM ? fnPrintChild(material->m_pDepthVSM, " | |-+ DepthVSM Addr: '%llX'\n") : DevMsg(eDLL_T::MS, " | |-+ DepthVSM Addr: 'NULL'\n");
material->m_pDepthShadow ? fnPrintChild(material->m_pDepthShadow, " | |-+ DepthShadowTight Addr: '%llX'\n") : DevMsg(eDLL_T::MS, " | |-+ DepthShadowTight Addr: 'NULL'\n");
material->m_pColPass ? fnPrintChild(material->m_pColPass, " | |-+ ColPass Addr: '%llX'\n") : DevMsg(eDLL_T::MS, " | |-+ ColPass Addr: 'NULL'\n");
DevMsg(eDLL_T::MS, "-+ Texture GUID map ------------------------------------------\n");
material->m_pTextureGUID1 ? DevMsg(eDLL_T::MS, " |-- TextureMap 1 Addr: '%llX'\n", material->m_pTextureGUID1) : DevMsg(eDLL_T::MS, " |-- TextureMap 1 Addr: 'NULL'\n");
material->m_pTextureGUID2 ? DevMsg(eDLL_T::MS, " |-- TextureMap 2 Addr: '%llX'\n", material->m_pTextureGUID2) : DevMsg(eDLL_T::MS, " |-- TextureMap 2 Addr: 'NULL'\n");
DevMsg(eDLL_T::MS, "--------------------------------------------------------------\n");
}
else
{
DevMsg(eDLL_T::MS, "No Material found >:(\n");
}
#endif
}
#endif // !DEDICATED

View File

@ -1,65 +1,10 @@
#pragma once
#include "tier1/IConVar.h"
/* ==== CONCOMMANDCALLBACK ============================================================================================================================================== */
inline CMemory p_Host_Map_f_CompletionFunc;
inline auto _Host_Map_f_CompletionFunc = p_Host_Map_f_CompletionFunc.RCast<void (*)(CCommand* pCommand, char a2)>();
inline CMemory p_DownloadPlaylists_f_CompletionFunc;
inline auto _DownloadPlaylists_f_CompletionFunc = p_DownloadPlaylists_f_CompletionFunc.RCast<void(*)(void)>();
///////////////////////////////////////////////////////////////////////////////
#ifndef DEDICATED
void _CGameConsole_f_CompletionFunc(const CCommand& args);
void _CCompanion_f_CompletionFunc(const CCommand& args);
#endif // !DEDICATED
void _Kick_f_CompletionFunc(const CCommand& args);
void _KickID_f_CompletionFunc(const CCommand& args);
void _Ban_f_CompletionFunc(const CCommand& args);
void _BanID_f_CompletionFunc(const CCommand& args);
void _Unban_f_CompletionFunc(const CCommand& args);
void _ReloadBanList_f_CompletionFunc(const CCommand& args);
void _Pak_ListPaks_f_CompletionFunc(const CCommand& args);
void _Pak_RequestUnload_f_CompletionFunc(const CCommand& args);
void _Pak_RequestLoad_f_CompletionFunc(const CCommand& args);
void _RTech_StringToGUID_f_CompletionFunc(const CCommand& args);
void _RTech_Decompress_f_CompletionFunc(const CCommand& args);
void _VPK_Unpack_f_CompletionFunc(const CCommand& args);
void _VPK_Mount_f_CompletionFunc(const CCommand& args);
void _NET_SetKey_f_CompletionFunc(const CCommand& args);
void _NET_GenerateKey_f_CompletionFunc(const CCommand& args);
#ifndef DEDICATED
void _RCON_CmdQuery_f_CompletionFunc(const CCommand& args);
void _RCON_Disconnect_f_CompletionFunc(const CCommand& args);
#endif // !DEDICATED
void _SQVM_ServerScript_f_CompletionFunc(const CCommand& args);
#ifndef DEDICATED
void _SQVM_ClientScript_f_CompletionFunc(const CCommand& args);
void _SQVM_UIScript_f_CompletionFunc(const CCommand& args);
void _CMaterial_GetMaterialAtCrossHair_f_ComplectionFunc(const CCommand& args);
#endif // !DEDICATED
///////////////////////////////////////////////////////////////////////////////
class VCompletion : public IDetour
{
virtual void GetAdr(void) const
{
spdlog::debug("| FUN: Host_Map_f_CompletionFunc : {:#18x} |\n", p_Host_Map_f_CompletionFunc.GetPtr());
spdlog::debug("| FUN: DownloadPlaylist_f_CompletionFunc : {:#18x} |\n", p_DownloadPlaylists_f_CompletionFunc.GetPtr());
spdlog::debug("+----------------------------------------------------------------+\n");
}
virtual void GetFun(void) const
{
#if defined (GAMEDLL_S1)
p_Host_Map_f_CompletionFunc = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x48\x89\x5C\x24\x18\x55\x41\x56\x41\x00\x00\x00\x00\x40\x02"), "xxxxxxxxx????xx");
#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
p_Host_Map_f_CompletionFunc = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x40\x55\x41\x56\x41\x57\x48\x81\xEC\x00\x00\x00\x00\x83\x3D"), "xxxxxxxxx????xx");
#endif
p_DownloadPlaylists_f_CompletionFunc = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x33\xC9\xC6\x05\x00\x00\x00\x00\x00\xE9\x00\x00\x00\x00"), "xxxx?????x????");
_Host_Map_f_CompletionFunc = p_Host_Map_f_CompletionFunc.RCast<void (*)(CCommand* pCommand, char a2)>(); /*40 55 41 56 41 57 48 81 EC ?? ?? ?? ?? 83 3D*/
_DownloadPlaylists_f_CompletionFunc = p_DownloadPlaylists_f_CompletionFunc.RCast<void(*)(void)>(); /*33 C9 C6 05 ?? ?? ?? ?? ?? E9 ?? ?? ?? ??*/
}
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 { }