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.
317 lines
11 KiB
C++
317 lines
11 KiB
C++
#pragma once
|
|
#include "tier1/IConVar.h"
|
|
#include <vstdlib/concommandhash.h>
|
|
|
|
//-------------------------------------------------------------------------
|
|
// ENGINE |
|
|
extern ConVar* sdk_fixedframe_tickinterval;
|
|
extern ConVar* single_frame_shutdown_for_reload;
|
|
extern ConVar* old_gather_props;
|
|
extern ConVar* enable_debug_overlays;
|
|
extern ConVar* cm_unset_all_cmdquery;
|
|
|
|
extern ConVar* staticProp_defaultBuildFrustum;
|
|
extern ConVar* staticProp_no_fade_scalar;
|
|
extern ConVar* staticProp_gather_size_weight;
|
|
|
|
extern ConVar* model_defaultFadeDistScale;
|
|
extern ConVar* model_defaultFadeDistMin;
|
|
|
|
extern ConVar* hostname;
|
|
extern ConVar* hostdesc;
|
|
extern ConVar* hostip;
|
|
extern ConVar* hostport;
|
|
extern ConVar* host_hasIrreversibleShutdown;
|
|
|
|
extern ConVar* mp_gamemode;
|
|
|
|
extern ConVar* rcon_address;
|
|
extern ConVar* rcon_password;
|
|
|
|
extern ConVar* r_debug_overlay_nodecay;
|
|
extern ConVar* r_debug_overlay_invisible;
|
|
extern ConVar* r_debug_overlay_wireframe;
|
|
extern ConVar* r_debug_overlay_zbuffer;
|
|
extern ConVar* r_drawWorldMeshes;
|
|
extern ConVar* r_drawWorldMeshesDepthOnly;
|
|
extern ConVar* r_drawWorldMeshesDepthAtTheEnd;
|
|
|
|
extern ConVar* stream_overlay;
|
|
extern ConVar* stream_overlay_mode;
|
|
//-------------------------------------------------------------------------
|
|
// SERVER |
|
|
#ifndef CLIENT_DLL
|
|
extern ConVar* ai_ainDumpOnLoad;
|
|
extern ConVar* ai_ainDebugConnect;
|
|
extern ConVar* ai_script_nodes_draw;
|
|
extern ConVar* ai_script_nodes_draw_range;
|
|
|
|
extern ConVar* navmesh_always_reachable;
|
|
extern ConVar* navmesh_debug_type;
|
|
extern ConVar* navmesh_debug_tile_range;
|
|
extern ConVar* navmesh_debug_camera_range;
|
|
#ifndef DEDICATED
|
|
extern ConVar* navmesh_draw_bvtree;
|
|
extern ConVar* navmesh_draw_portal;
|
|
extern ConVar* navmesh_draw_polys;
|
|
extern ConVar* navmesh_draw_poly_bounds;
|
|
extern ConVar* navmesh_draw_poly_bounds_inner;
|
|
#endif // DEDICATED
|
|
extern ConVar* sv_showconnecting;
|
|
extern ConVar* sv_pylonVisibility;
|
|
extern ConVar* sv_pylonRefreshInterval;
|
|
extern ConVar* sv_banlistRefreshInterval;
|
|
extern ConVar* sv_statusRefreshInterval;
|
|
|
|
#ifdef DEDICATED
|
|
extern ConVar* sv_rcon_debug;
|
|
extern ConVar* sv_rcon_sendlogs;
|
|
extern ConVar* sv_rcon_banpenalty;
|
|
extern ConVar* sv_rcon_maxfailures;
|
|
extern ConVar* sv_rcon_maxignores;
|
|
extern ConVar* sv_rcon_maxsockets;
|
|
extern ConVar* sv_rcon_whitelist_address;
|
|
#endif // DEDICATED
|
|
#endif // CLIENT_DLL
|
|
extern ConVar* sv_visualizetraces;
|
|
#if !defined (GAMEDLL_S0) && !defined (GAMEDLL_S1)
|
|
extern ConVar* bhit_enable;
|
|
extern ConVar* bhit_abs_origin;
|
|
#endif // !GAMEDLL_S0 && !GAMEDLL_S1
|
|
//-------------------------------------------------------------------------
|
|
// CLIENT |
|
|
#ifndef DEDICATED
|
|
extern ConVar* cl_rcon_request_sendlogs;
|
|
|
|
extern ConVar* cl_drawconsoleoverlay;
|
|
extern ConVar* cl_consoleoverlay_lines;
|
|
extern ConVar* cl_consoleoverlay_invert_rect_x;
|
|
extern ConVar* cl_consoleoverlay_invert_rect_y;
|
|
extern ConVar* cl_consoleoverlay_offset_x;
|
|
extern ConVar* cl_consoleoverlay_offset_y;
|
|
|
|
extern ConVar* cl_conoverlay_script_server_clr;
|
|
extern ConVar* cl_conoverlay_script_client_clr;
|
|
extern ConVar* cl_conoverlay_script_ui_clr;
|
|
extern ConVar* cl_conoverlay_native_server_clr;
|
|
extern ConVar* cl_conoverlay_native_client_clr;
|
|
extern ConVar* cl_conoverlay_native_ui_clr;
|
|
extern ConVar* cl_conoverlay_native_engine_clr;
|
|
extern ConVar* cl_conoverlay_native_fs_clr;
|
|
extern ConVar* cl_conoverlay_native_rtech_clr;
|
|
extern ConVar* cl_conoverlay_native_ms_clr;
|
|
extern ConVar* cl_conoverlay_netcon_clr;
|
|
extern ConVar* cl_conoverlay_common_clr;
|
|
extern ConVar* cl_conoverlay_warning_clr;
|
|
extern ConVar* cl_conoverlay_error_clr;
|
|
|
|
extern ConVar* cl_showhoststats;
|
|
extern ConVar* cl_hoststats_invert_rect_x;
|
|
extern ConVar* cl_hoststats_invert_rect_y;
|
|
extern ConVar* cl_hoststats_offset_x;
|
|
extern ConVar* cl_hoststats_offset_y;
|
|
|
|
extern ConVar* cl_showsimstats;
|
|
extern ConVar* cl_simstats_invert_rect_x;
|
|
extern ConVar* cl_simstats_invert_rect_y;
|
|
extern ConVar* cl_simstats_offset_x;
|
|
extern ConVar* cl_simstats_offset_y;
|
|
|
|
extern ConVar* cl_showgpustats;
|
|
extern ConVar* cl_gpustats_invert_rect_x;
|
|
extern ConVar* cl_gpustats_invert_rect_y;
|
|
extern ConVar* cl_gpustats_offset_x;
|
|
extern ConVar* cl_gpustats_offset_y;
|
|
|
|
extern ConVar* cl_showmaterialinfo;
|
|
extern ConVar* cl_materialinfo_offset_x;
|
|
extern ConVar* cl_materialinfo_offset_y;
|
|
|
|
extern ConVar* cl_threaded_bone_setup;
|
|
|
|
extern ConVar* con_max_size_logvector;
|
|
extern ConVar* con_max_size_history;
|
|
extern ConVar* con_suggestion_limit;
|
|
extern ConVar* con_suggestion_showhelptext;
|
|
extern ConVar* con_suggestion_showflags;
|
|
extern ConVar* con_suggestion_flags_realtime;
|
|
|
|
extern ConVar* origin_disconnectWhenOffline;
|
|
#endif // !DEDICATED
|
|
//-------------------------------------------------------------------------
|
|
// FILESYSTEM |
|
|
extern ConVar* fs_warning_level_sdk;
|
|
extern ConVar* fs_show_warning_output;
|
|
extern ConVar* fs_packedstore_entryblock_stats;
|
|
extern ConVar* fs_packedstore_workspace;
|
|
//-------------------------------------------------------------------------
|
|
// MATERIALSYSTEM |
|
|
#ifndef DEDICATED
|
|
extern ConVar* mat_showdxoutput;
|
|
#endif // !DEDICATED
|
|
//-------------------------------------------------------------------------
|
|
// SQUIRREL |
|
|
extern ConVar* sq_showrsonloading;
|
|
extern ConVar* sq_showscriptloading;
|
|
extern ConVar* sq_showvmoutput;
|
|
extern ConVar* sq_showvmwarning;
|
|
//-------------------------------------------------------------------------
|
|
// NETCHANNEL |
|
|
extern ConVar* net_tracePayload;
|
|
extern ConVar* net_encryptionEnable;
|
|
extern ConVar* net_useRandomKey;
|
|
extern ConVar* net_usesocketsforloopback;
|
|
extern ConVar* pylon_matchmaking_hostname;
|
|
extern ConVar* pylon_host_update_interval;
|
|
extern ConVar* pylon_showdebuginfo;
|
|
//-------------------------------------------------------------------------
|
|
// RTECH API |
|
|
extern ConVar* rtech_debug;
|
|
//-------------------------------------------------------------------------
|
|
// RUI |
|
|
#ifndef DEDICATED
|
|
extern ConVar* rui_drawEnable;
|
|
extern ConVar* rui_defaultDebugFontFace;
|
|
#endif // !DEDICATED
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Purpose:
|
|
//-----------------------------------------------------------------------------
|
|
class CCvarUtilities
|
|
{
|
|
public:
|
|
//bool IsCommand(const CCommand& args);
|
|
|
|
// Writes lines containing "set variable value" for all variables
|
|
// with the archive flag set to true.
|
|
//void WriteVariables(CUtlBuffer& buff, bool bAllVars);
|
|
|
|
// Returns the # of cvars with the server flag set.
|
|
int CountVariablesWithFlags(int flags);
|
|
|
|
// Enable cvars marked with FCVAR_DEVELOPMENTONLY
|
|
void EnableDevCvars();
|
|
|
|
// Lists cvars to console
|
|
void CvarList(const CCommand& args);
|
|
|
|
// Prints help text for cvar
|
|
void CvarHelp(const CCommand& args);
|
|
|
|
// Revert all cvar values
|
|
//void CvarRevert(const CCommand& args);
|
|
|
|
// Revert all cvar values
|
|
void CvarDifferences(const CCommand& args);
|
|
|
|
// Toggles a cvar on/off, or cycles through a set of values
|
|
//void CvarToggle(const CCommand& args);
|
|
|
|
// Finds commands with a specified flag.
|
|
void CvarFindFlags_f(const CCommand& args);
|
|
|
|
|
|
int CvarFindFlagsCompletionCallback(const char* partial, char commands[COMMAND_COMPLETION_MAXITEMS][COMMAND_COMPLETION_ITEM_LENGTH]);
|
|
|
|
private:
|
|
// just like Cvar_set, but optimizes out the search
|
|
//void SetDirect(ConVar* var, const char* value);
|
|
|
|
//bool IsValidToggleCommand(const char* cmd);
|
|
};
|
|
|
|
extern CCvarUtilities* cv;
|
|
|
|
class CCvar // TODO: interface class !!!
|
|
{
|
|
public:
|
|
ConCommandBase* RegisterConCommand(ConCommandBase* pCommandToAdd);
|
|
ConCommandBase* UnregisterConCommand(ConCommandBase* pCommandToRemove);
|
|
ConCommandBase* FindCommandBase(const char* pszCommandName); // @0x1405983A0 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
|
ConVar* FindVar(const char* pszVarName); // @0x1405983B0 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
|
ConCommand* FindCommand(const char* pszCommandName);
|
|
ConCommandBase* GetCommands(void) const { return m_pConCommandList; };
|
|
|
|
void CallGlobalChangeCallbacks(ConVar* pConVar, const char* pOldString);
|
|
bool IsMaterialThreadSetAllowed(void);
|
|
void QueueMaterialThreadSetValue(ConVar* pConVar, float flValue);
|
|
void QueueMaterialThreadSetValue(ConVar* pConVar, int nValue);
|
|
void QueueMaterialThreadSetValue(ConVar* pConVar, const char* pValue);
|
|
|
|
class CCVarIteratorInternal : public ICVarIteratorInternal
|
|
{
|
|
public:
|
|
virtual void SetFirst(void) = 0; //0
|
|
virtual void Next(void) = 0; //1
|
|
virtual bool IsValid(void) = 0; //2
|
|
virtual ConCommandBase* Get(void) = 0; //3
|
|
|
|
CCvar* const m_pOuter;
|
|
CConCommandHash* const m_pHash;
|
|
CConCommandHash::CCommandHashIterator_t m_hashIter;
|
|
};
|
|
|
|
CCVarIteratorInternal* FactoryInternalIterator(void);
|
|
unordered_map<string, ConCommandBase*> DumpToMap(void);
|
|
friend class CCVarIteratorInternal;
|
|
|
|
protected:
|
|
enum ConVarSetType_t
|
|
{
|
|
CONVAR_SET_STRING = 0,
|
|
CONVAR_SET_INT,
|
|
CONVAR_SET_FLOAT,
|
|
};
|
|
|
|
struct QueuedConVarSet_t
|
|
{
|
|
ConVar* m_pConVar;
|
|
ConVarSetType_t m_nType;
|
|
int m_nInt;
|
|
float m_flFloat;
|
|
//CUtlString m_String; // !TODO:
|
|
};
|
|
|
|
private:
|
|
void* m_pVFTable;
|
|
CUtlVector< FnChangeCallback_t > m_GlobalChangeCallbacks;
|
|
char pad0[30]; //!TODO:
|
|
int m_nNextDLLIdentifier;
|
|
ConCommandBase* m_pConCommandList;
|
|
CConCommandHash m_CommandHash;
|
|
CUtlVector<void*> m_Unknown;
|
|
char pad2[32];
|
|
void* m_pCallbackStub;
|
|
void* m_pAllocFunc;
|
|
char pad3[16];
|
|
CUtlVector< QueuedConVarSet_t > m_QueuedConVarSets;
|
|
bool m_bMaterialSystemThreadSetAllowed;
|
|
};
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
extern CCvar* g_pCVar;
|
|
|
|
/* ==== CCVAR =========================================================================================================================================================== */
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
class VCVar : public IDetour
|
|
{
|
|
virtual void GetAdr(void) const
|
|
{
|
|
spdlog::debug("| VAR: g_pCVar : {:#18x} |\n", reinterpret_cast<uintptr_t>(g_pCVar));
|
|
spdlog::debug("+----------------------------------------------------------------+\n");
|
|
}
|
|
virtual void GetFun(void) const { }
|
|
virtual void GetVar(void) const
|
|
{
|
|
g_pCVar = g_GameDll.FindPatternSIMD(reinterpret_cast<rsig_t>(
|
|
"\x48\x83\xEC\x28\x48\x8B\x05\x00\x00\x00\x00\x48\x8D\x0D\x00\x00\x00\x00\x48\x85\xC0\x48\x89\x15"),
|
|
"xxxxxxx????xxx????xxxxxx").FindPatternSelf("48 8D 0D", CMemory::Direction::DOWN, 40).ResolveRelativeAddressSelf(0x3, 0x7).RCast<CCvar*>();
|
|
}
|
|
virtual void GetCon(void) const { }
|
|
virtual void Attach(void) const { }
|
|
virtual void Detach(void) const { }
|
|
};
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
REGISTER(VCVar);
|