Create RCON ConCommand

This commit is contained in:
Amos 2022-02-06 15:59:46 +01:00
parent 70a5f77121
commit ee82a58133
5 changed files with 31 additions and 9 deletions

View File

@ -43,17 +43,18 @@ void ConCommand::Init(void)
{
//-------------------------------------------------------------------------
// SERVER DLL |
ConCommand* sv_kick = new ConCommand("sv_kick", "Kick a client from the server by name. | Usage: kick <name>.", FCVAR_RELEASE, _Kick_f_CompletionFunc, nullptr);
ConCommand* sv_kickid = new ConCommand("sv_kickid", "Kick a client from the server by UserID or OriginID | Usage: kickid <OriginID>/<UserID>.", FCVAR_RELEASE, _KickID_f_CompletionFunc, nullptr);
ConCommand* sv_kick = new ConCommand("sv_kick", "Kick a client from the server by name. | Usage: kick \"<name>\".", FCVAR_RELEASE, _Kick_f_CompletionFunc, nullptr);
ConCommand* sv_kickid = new ConCommand("sv_kickid", "Kick a client from the server by UserID or OriginID | Usage: kickid \"<OriginID>\"/\"<UserID>\".", FCVAR_RELEASE, _KickID_f_CompletionFunc, nullptr);
ConCommand* sv_ban = new ConCommand("sv_ban", "Bans a client from the server by name. | Usage: ban <name>.", FCVAR_RELEASE, _Ban_f_CompletionFunc, nullptr);
ConCommand* sv_banid = new ConCommand("sv_banid", "Bans a client from the server by OriginID, UserID or IPAddress | Usage: banid <OriginID>/<IPAddress>/<UserID>.", FCVAR_RELEASE, _BanID_f_CompletionFunc, nullptr);
ConCommand* sv_unban = new ConCommand("sv_unban", "Unbans a client from the Server by IPAddress or OriginID | Usage: unban <OriginID>/<IPAddress>.", FCVAR_RELEASE, _Unban_f_CompletionFunc, nullptr);
ConCommand* sv_banid = new ConCommand("sv_banid", "Bans a client from the server by OriginID, UserID or IPAddress | Usage: banid \"<OriginID>\"/\"<IPAddress>/<UserID>\".", FCVAR_RELEASE, _BanID_f_CompletionFunc, nullptr);
ConCommand* sv_unban = new ConCommand("sv_unban", "Unbans a client from the Server by IPAddress or OriginID | Usage: unban \"<OriginID>\"/\"<IPAddress>\".", FCVAR_RELEASE, _Unban_f_CompletionFunc, nullptr);
ConCommand* sv_reloadbanlist = new ConCommand("sv_reloadbanlist", "Reloads the ban list from the disk.", FCVAR_RELEASE, _ReloadBanList_f_CompletionFunc, nullptr);
#ifndef DEDICATED
//-------------------------------------------------------------------------
// CLIENT DLL |
ConCommand* cl_showconsole = new ConCommand("cl_showconsole", "Opens the game console.", FCVAR_CLIENTDLL | FCVAR_RELEASE, _CGameConsole_f_CompletionFunc, nullptr);
ConCommand* cl_showbrowser = new ConCommand("cl_showbrowser", "Opens the server browser.", FCVAR_CLIENTDLL | FCVAR_RELEASE, _CCompanion_f_CompletionFunc, nullptr);
ConCommand* rcon = new ConCommand("rcon", "Forward RCON query to remote server. | Usage: rcon \"<query>\".", FCVAR_CLIENTDLL | FCVAR_RELEASE, _RCON_CmdQuery_f_CompletionFunc, nullptr);
#endif // !DEDICATED
//-------------------------------------------------------------------------
// FILESYSTEM API |

View File

@ -9,6 +9,9 @@
#include "tier0/cvar.h"
#include "tier0/IConVar.h"
#include "tier0/completion.h"
#ifndef DEDICATED
#include "engine/cl_rcon.h"
#endif // !DEDICATED
#include "engine/net_chan.h"
#include "engine/sys_utils.h"
#include "rtech/rtech_game.h"
@ -580,7 +583,7 @@ void _VPK_Decompress_f_CompletionFunc(CCommand* cmd)
DevMsg(eDLL_T::FS, "] Processing: '%s'\n", firstArg.c_str());
vpk_dir_h vpk = g_pPackedStore->GetPackDirFile(firstArg);
g_pPackedStore->InitLzParams();
g_pPackedStore->InitLzDecompParams();
std::thread th([&] { g_pPackedStore->UnpackAll(vpk, szPathOut); });
th.join();
@ -614,3 +617,9 @@ void _NET_GenerateKey_f_CompletionFunc(CCommand* cmd)
{
HNET_GenerateKey();
}
void _RCON_CmdQuery_f_CompletionFunc(CCommand* cmd)
{
// TODO: CRConClient..
return;
}

View File

@ -33,7 +33,7 @@ void _VPK_Decompress_f_CompletionFunc(CCommand* cmd);
void _NET_TraceNetChan_f_CompletionFunc(CCommand* cmd);
void _NET_SetKey_f_CompletionFunc(CCommand* cmd);
void _NET_GenerateKey_f_CompletionFunc(CCommand* cmd);
void _RCON_CmdQuery_f_CompletionFunc(CCommand* cmd);
///////////////////////////////////////////////////////////////////////////////
class HCompletion : public IDetour

View File

@ -14,10 +14,19 @@
* *
***********************************************************************/
//-----------------------------------------------------------------------------
// Purpose: initialize parameters for compression algorithm
//-----------------------------------------------------------------------------
void CPackedStore::InitLzCompParams(void)
{
/*| PARAMETERS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/
m_lzCompParams.m_dict_size_log2 = RVPK_DICT_SIZE;
}
//-----------------------------------------------------------------------------
// Purpose: initialize parameters for decompression algorithm
//-----------------------------------------------------------------------------
void CPackedStore::InitLzParams()
void CPackedStore::InitLzDecompParams(void)
{
/*| PARAMETERS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/
m_lzDecompParams.m_dict_size_log2 = RVPK_DICT_SIZE;

View File

@ -56,11 +56,14 @@ class CPackedStore
lzham_uint32 m_nAdler32 {}; // Pre/post operation Adler32 file checksum.
lzham_uint32 m_nCrc32_Internal {}; // Internal operation Crc32 file checksum.
lzham_uint32 m_nCrc32 {}; // Pre/post operation Crc32 file checksum.
lzham_compress_params m_lzCompParams {}; // LZham decompression parameters.
lzham_compress_status_t m_lzCompStatus {}; // LZham compression status.
lzham_decompress_params m_lzDecompParams {}; // LZham decompression parameters.
lzham_decompress_status_t m_lzDecompStatus {}; // LZham decompression results.
lzham_decompress_status_t m_lzDecompStatus {}; // LZham decompression status.
public:
void InitLzParams();
void InitLzCompParams(void);
void InitLzDecompParams(void);
vpk_dir_h GetPackDirFile(std::string svPackDirFile);
std::string GetPackChunkFile(std::string svPackDirFile, int iArchiveIndex);
std::vector<vpk_entry_block> GetEntryBlocks(CIOStream* reader);