2022-01-09 16:14:17 +01:00
//=============================================================================//
//
// Purpose: Console Variables
//
//=============================================================================//
2021-12-25 22:36:38 +01:00
# include "core/stdafx.h"
2022-04-14 19:18:59 +02:00
# include "vstdlib/callback.h"
2022-04-09 16:16:40 +02:00
# include "tier1/IConVar.h"
# include "tier1/cvar.h"
2021-12-25 22:36:38 +01:00
# include "engine/sys_utils.h"
# include "engine/sys_dll2.h"
2022-01-09 16:14:17 +01:00
# include "mathlib/bits.h"
//-----------------------------------------------------------------------------
2022-02-13 15:16:09 +01:00
// Purpose: construct/allocate
2022-01-09 16:14:17 +01:00
//-----------------------------------------------------------------------------
2022-02-21 17:56:31 +01:00
ConVar : : ConVar ( const char * pszName , const char * pszDefaultValue , int nFlags , const char * pszHelpString , bool bMin , float fMin , bool bMax , float fMax , void * pCallback , const char * pszUsageString )
2022-01-09 16:14:17 +01:00
{
2022-02-21 17:56:31 +01:00
ConVar * pNewConVar = reinterpret_cast < ConVar * > ( MemAlloc_Wrapper ( sizeof ( ConVar ) ) ) ; // Allocate new memory with StdMemAlloc else we crash.
memset ( pNewConVar , ' \0 ' , sizeof ( ConVar ) ) ; // Set all to null.
2022-01-09 16:14:17 +01:00
2022-02-23 15:56:03 +01:00
pNewConVar - > m_pConCommandBaseVTable = g_pConVarVtable . RCast < void * > ( ) ;
2022-02-21 17:56:31 +01:00
pNewConVar - > m_pIConVarVTable = g_pIConVarVtable . RCast < void * > ( ) ;
2022-01-09 16:14:17 +01:00
2022-02-21 17:56:31 +01:00
ConVar_Register ( pNewConVar , pszName , pszDefaultValue , nFlags , pszHelpString , bMin , fMin , bMax , fMax , pCallback , pszUsageString ) ;
* this = * pNewConVar ;
2022-01-09 16:14:17 +01:00
}
//-----------------------------------------------------------------------------
2022-02-13 15:16:09 +01:00
// Purpose: destructor
2022-01-09 16:14:17 +01:00
//-----------------------------------------------------------------------------
ConVar : : ~ ConVar ( void )
{
2022-02-21 17:56:31 +01:00
if ( m_Value . m_pszString )
2022-01-09 16:14:17 +01:00
{
2022-02-21 17:56:31 +01:00
delete [ ] m_Value . m_pszString ;
m_Value . m_pszString = NULL ;
2022-01-09 16:14:17 +01:00
}
}
//-----------------------------------------------------------------------------
2022-04-14 19:18:59 +02:00
// Purpose: initialize ConVar's
2022-01-09 16:14:17 +01:00
//-----------------------------------------------------------------------------
2022-02-17 18:00:29 +01:00
void ConVar : : Init ( void ) const
2022-01-09 16:14:17 +01:00
{
//-------------------------------------------------------------------------
// ENGINE |
2022-02-17 18:00:29 +01:00
cm_debug_cmdquery = new ConVar ( " cm_debug_cmdquery " , " 0 " , FCVAR_DEVELOPMENTONLY , " Prints the flags of each ConVar/ConCommand query to the console ( !slower! ). " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
cm_return_false_cmdquery_all = new ConVar ( " cm_return_false_cmdquery_all " , " 0 " , FCVAR_DEVELOPMENTONLY | FCVAR_REPLICATED , " Returns false on every ConVar/ConCommand query ( !warning! ). " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
2022-01-28 01:32:27 +01:00
cm_return_false_cmdquery_cheats = new ConVar ( " cm_return_false_cmdquery_cheats " , " 0 " , FCVAR_DEVELOPMENTONLY | FCVAR_REPLICATED , " Returns false on all FCVAR_DEVELOPMENTONLY and FCVAR_CHEAT ConVar/ConCommand queries ( !warning! ). " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
2022-02-17 18:00:29 +01:00
r_debug_overlay_nodecay = new ConVar ( " r_debug_overlay_nodecay " , " 0 " , FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT , " Keeps all debug overlays alive regardless of their lifetime. Use command 'clear_debug_overlays' to clear everything. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
2022-02-06 15:54:52 +01:00
2022-02-08 16:32:00 +01:00
// TODO: RconPasswordChanged_f
2022-02-14 03:02:38 +01:00
rcon_address = new ConVar ( " rcon_address " , " :: " , FCVAR_SERVER_CANNOT_QUERY | FCVAR_DONTRECORD | FCVAR_RELEASE , " Remote server access address. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
2022-02-17 18:00:29 +01:00
rcon_password = new ConVar ( " rcon_password " , " " , FCVAR_SERVER_CANNOT_QUERY | FCVAR_DONTRECORD | FCVAR_RELEASE , " Remote server access password (rcon is disabled if empty). " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
2022-01-09 16:14:17 +01:00
//-------------------------------------------------------------------------
// SERVER |
2022-04-03 03:10:48 +02:00
ai_ainDumpOnLoad = new ConVar ( " ai_ainDumpOnLoad " , " 0 " , FCVAR_DEVELOPMENTONLY , " Dumps AIN data from node graphs loaded from the disk on load. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
ai_ainDebugConnect = new ConVar ( " ai_ainDebugConnect " , " 0 " , FCVAR_DEVELOPMENTONLY , " Debug AIN node connections. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
2022-03-18 03:14:07 +01:00
navmesh_always_reachable = new ConVar ( " navmesh_always_reachable " , " 1 " , FCVAR_DEVELOPMENTONLY , " Marks poly from agent to target on navmesh as reachable regardless of table data ( !slower! ). " , false , 0.f , false , 0.f , nullptr , nullptr ) ; // !TODO: Default to '0' once the reachability table gets properly parsed.
2022-02-27 03:15:00 +01:00
2022-02-17 18:00:29 +01:00
sv_showconnecting = new ConVar ( " sv_showconnecting " , " 1 " , FCVAR_RELEASE , " Logs information about the connecting client to the console. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
sv_pylonvisibility = new ConVar ( " sv_pylonvisibility " , " 0 " , FCVAR_RELEASE , " Determines the visiblity to the Pylon Master Server, 0 = Not visible, 1 = Visible, 2 = Hidden !TODO: not implemented yet. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
2022-03-27 11:42:24 +02:00
sv_pylonRefreshInterval = new ConVar ( " sv_pylonRefreshInterval " , " 5.0 " , FCVAR_RELEASE , " Pylon server host request post update interval (seconds). " , true , 2.f , true , 8.f , nullptr , nullptr ) ;
sv_banlistRefreshInterval = new ConVar ( " sv_banlistRefreshInterval " , " 1.0 " , FCVAR_RELEASE , " Banlist refresh interval (seconds). " , true , 1.f , false , 0.f , nullptr , nullptr ) ;
sv_statusRefreshInterval = new ConVar ( " sv_statusRefreshInterval " , " 0.5 " , FCVAR_RELEASE , " Server status bar update interval (seconds). " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
2022-02-08 16:32:00 +01:00
# ifdef DEDICATED
2022-02-17 18:00:29 +01:00
sv_rcon_debug = new ConVar ( " sv_rcon_debug " , " 0 " , FCVAR_RELEASE , " Show rcon debug information ( !slower! ). " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
sv_rcon_banpenalty = new ConVar ( " sv_rcon_banpenalty " , " 10 " , FCVAR_RELEASE , " Number of minutes to ban users who fail rcon authentication. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
2022-02-06 15:54:52 +01:00
sv_rcon_maxfailures = new ConVar ( " sv_rcon_maxfailures " , " 10 " , FCVAR_RELEASE , " Max number of times a user can fail rcon authentication before being banned. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
2022-02-17 18:00:29 +01:00
sv_rcon_maxignores = new ConVar ( " sv_rcon_maxignores " , " 15 " , FCVAR_RELEASE , " Max number of times a user can ignore the no-auth message before being banned. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
sv_rcon_maxsockets = new ConVar ( " sv_rcon_maxsockets " , " 32 " , FCVAR_RELEASE , " Max number of accepted sockets before the server starts closing redundant sockets. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
2022-02-15 02:31:41 +01:00
sv_rcon_whitelist_address = new ConVar ( " sv_rcon_whitelist_address " , " " , FCVAR_RELEASE , " This address is not considered a 'redundant' socket and will never be banned for failed authentications. Example: '::ffff:127.0.0.1'. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
2022-02-08 16:32:00 +01:00
# endif // DEDICATED
2022-01-09 16:14:17 +01:00
//-------------------------------------------------------------------------
// CLIENT |
2022-02-08 16:32:00 +01:00
# ifndef DEDICATED
2022-02-28 01:01:40 +01:00
cl_drawconsoleoverlay = new ConVar ( " cl_drawconsoleoverlay " , " 0 " , FCVAR_DEVELOPMENTONLY , " Draws the RUI console overlay at the top of the screen. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
cl_consoleoverlay_lines = new ConVar ( " cl_consoleoverlay_lines " , " 3 " , FCVAR_DEVELOPMENTONLY , " Number of lines of console output to draw. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
cl_consoleoverlay_invert_rect_x = new ConVar ( " cl_consoleoverlay_invert_rect_x " , " 0 " , FCVAR_DEVELOPMENTONLY , " Inverts the X rect for RUI console overlay. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
cl_consoleoverlay_invert_rect_y = new ConVar ( " cl_consoleoverlay_invert_rect_y " , " 0 " , FCVAR_DEVELOPMENTONLY , " Inverts the Y rect for RUI console overlay. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
cl_consoleoverlay_offset_x = new ConVar ( " cl_consoleoverlay_offset_x " , " 10 " , FCVAR_DEVELOPMENTONLY , " X offset for RUI console overlay. " , false , 1.f , false , 50.f , nullptr , nullptr ) ;
cl_consoleoverlay_offset_y = new ConVar ( " cl_consoleoverlay_offset_y " , " 10 " , FCVAR_DEVELOPMENTONLY , " Y offset for RUI console overlay. " , false , 1.f , false , 50.f , nullptr , nullptr ) ;
2022-01-09 16:14:17 +01:00
2022-02-17 18:00:29 +01:00
cl_conoverlay_script_server_clr = new ConVar ( " cl_conoverlay_script_server_clr " , " 130 120 245 255 " , FCVAR_DEVELOPMENTONLY , " Script SERVER VM RUI console overlay log color. " , false , 1.f , false , 50.f , nullptr , nullptr ) ;
cl_conoverlay_script_client_clr = new ConVar ( " cl_conoverlay_script_client_clr " , " 117 116 139 255 " , FCVAR_DEVELOPMENTONLY , " Script CLIENT VM RUI console overlay log color. " , false , 1.f , false , 50.f , nullptr , nullptr ) ;
2022-03-12 13:19:31 +01:00
cl_conoverlay_script_ui_clr = new ConVar ( " cl_conoverlay_script_ui_clr " , " 200 110 110 255 " , FCVAR_DEVELOPMENTONLY , " Script UI VM RUI console overlay log color. " , false , 1.f , false , 50.f , nullptr , nullptr ) ;
2022-01-12 02:53:07 +01:00
2022-02-17 18:00:29 +01:00
cl_conoverlay_native_server_clr = new ConVar ( " cl_conoverlay_native_server_clr " , " 020 050 248 255 " , FCVAR_DEVELOPMENTONLY , " Native SERVER RUI console overlay log color. " , false , 1.f , false , 50.f , nullptr , nullptr ) ;
cl_conoverlay_native_client_clr = new ConVar ( " cl_conoverlay_native_client_clr " , " 070 070 070 255 " , FCVAR_DEVELOPMENTONLY , " Native CLIENT RUI console overlay log color. " , false , 1.f , false , 50.f , nullptr , nullptr ) ;
cl_conoverlay_native_ui_clr = new ConVar ( " cl_conoverlay_native_ui_clr " , " 200 060 060 255 " , FCVAR_DEVELOPMENTONLY , " Native UI RUI console overlay log color. " , false , 1.f , false , 50.f , nullptr , nullptr ) ;
cl_conoverlay_native_engine_clr = new ConVar ( " cl_conoverlay_native_engine_clr " , " 255 255 255 255 " , FCVAR_DEVELOPMENTONLY , " Native engine RUI console overlay log color. " , false , 1.f , false , 50.f , nullptr , nullptr ) ;
cl_conoverlay_native_fs_clr = new ConVar ( " cl_conoverlay_native_fs_clr " , " 000 100 225 255 " , FCVAR_DEVELOPMENTONLY , " Native filesystem RUI console overlay log color. " , false , 1.f , false , 50.f , nullptr , nullptr ) ;
cl_conoverlay_native_rtech_clr = new ConVar ( " cl_conoverlay_native_rtech_clr " , " 025 100 100 255 " , FCVAR_DEVELOPMENTONLY , " Native rtech RUI console overlay log color. " , false , 1.f , false , 50.f , nullptr , nullptr ) ;
cl_conoverlay_native_ms_clr = new ConVar ( " cl_conoverlay_native_ms_clr " , " 200 020 180 255 " , FCVAR_DEVELOPMENTONLY , " Native materialsystem RUI console overlay log color. " , false , 1.f , false , 50.f , nullptr , nullptr ) ;
2022-02-28 01:01:40 +01:00
cl_conoverlay_netcon_clr = new ConVar ( " cl_conoverlay_netcon_clr " , " 255 255 255 255 " , FCVAR_DEVELOPMENTONLY , " Net console RUI console overlay log color. " , false , 1.f , false , 50.f , nullptr , nullptr ) ;
cl_conoverlay_warning_clr = new ConVar ( " cl_conoverlay_warning_clr " , " 180 180 020 255 " , FCVAR_DEVELOPMENTONLY , " Warning RUI console overlay log color. " , false , 1.f , false , 50.f , nullptr , nullptr ) ;
2022-03-04 15:59:33 +01:00
cl_conoverlay_error_clr = new ConVar ( " cl_conoverlay_error_clr " , " 225 030 030 255 " , FCVAR_DEVELOPMENTONLY , " Error RUI console overlay log color. " , false , 1.f , false , 50.f , nullptr , nullptr ) ;
2022-02-28 01:01:40 +01:00
cl_showhoststats = new ConVar ( " cl_showhoststats " , " 0 " , FCVAR_DEVELOPMENTONLY , " Host speeds debug overlay. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
cl_hoststats_invert_rect_x = new ConVar ( " cl_hoststats_invert_rect_x " , " 0 " , FCVAR_DEVELOPMENTONLY , " Inverts the X rect for host speeds debug overlay. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
cl_hoststats_invert_rect_y = new ConVar ( " cl_hoststats_invert_rect_y " , " 0 " , FCVAR_DEVELOPMENTONLY , " Inverts the Y rect for host speeds debug overlay. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
cl_hoststats_offset_x = new ConVar ( " cl_hoststats_offset_x " , " 10 " , FCVAR_DEVELOPMENTONLY , " X offset for host speeds debug overlay. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
cl_hoststats_offset_y = new ConVar ( " cl_hoststats_offset_y " , " 10 " , FCVAR_DEVELOPMENTONLY , " Y offset for host speeds debug overlay. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
cl_showsimstats = new ConVar ( " cl_showsimstats " , " 0 " , FCVAR_DEVELOPMENTONLY , " Shows the tick counter for the server/client simulation and the render frame. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
cl_simstats_invert_rect_x = new ConVar ( " cl_simstats_invert_rect_x " , " 1 " , FCVAR_DEVELOPMENTONLY , " Inverts the X rect for simulation debug overlay. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
cl_simstats_invert_rect_y = new ConVar ( " cl_simstats_invert_rect_y " , " 1 " , FCVAR_DEVELOPMENTONLY , " Inverts the Y rect for simulation debug overlay. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
cl_simstats_offset_x = new ConVar ( " cl_simstats_offset_x " , " 650 " , FCVAR_DEVELOPMENTONLY , " X offset for simulation debug overlay. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
cl_simstats_offset_y = new ConVar ( " cl_simstats_offset_y " , " 120 " , FCVAR_DEVELOPMENTONLY , " Y offset for simulation debug overlay. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
cl_showgpustats = new ConVar ( " cl_showgpustats " , " 0 " , FCVAR_DEVELOPMENTONLY , " Texture streaming debug overlay. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
cl_gpustats_invert_rect_x = new ConVar ( " cl_gpustats_invert_rect_x " , " 1 " , FCVAR_DEVELOPMENTONLY , " Inverts the X rect for texture streaming debug overlay. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
cl_gpustats_invert_rect_y = new ConVar ( " cl_gpustats_invert_rect_y " , " 1 " , FCVAR_DEVELOPMENTONLY , " Inverts the Y rect for texture streaming debug overlay. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
cl_gpustats_offset_x = new ConVar ( " cl_gpustats_offset_x " , " 650 " , FCVAR_DEVELOPMENTONLY , " X offset for texture streaming debug overlay. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
cl_gpustats_offset_y = new ConVar ( " cl_gpustats_offset_y " , " 105 " , FCVAR_DEVELOPMENTONLY , " Y offset for texture streaming debug overlay. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
2022-01-17 23:20:03 +01:00
2022-01-22 15:51:09 +01:00
con_max_size_logvector = new ConVar ( " con_max_size_logvector " , " 1000 " , FCVAR_DEVELOPMENTONLY , " Maximum number of logs in the console until cleanup starts. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
2022-02-17 18:00:29 +01:00
con_suggestion_limit = new ConVar ( " con_suggestion_limit " , " 120 " , FCVAR_DEVELOPMENTONLY , " Maximum number of suggestions the autocomplete window will show for the console. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
2022-02-22 16:31:24 +01:00
con_suggestion_helptext = new ConVar ( " con_suggestion_helptext " , " 1 " , FCVAR_DEVELOPMENTONLY , " Show ConVar help text in autocomplete window. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
2022-02-08 16:32:00 +01:00
# endif // !DEDICATED
2022-01-09 16:14:17 +01:00
//-------------------------------------------------------------------------
// FILESYSTEM |
2022-02-17 18:00:29 +01:00
fs_warning_level_sdk = new ConVar ( " fs_warning_level_sdk " , " 0 " , FCVAR_DEVELOPMENTONLY , " Set the SDK filesystem warning level. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
fs_show_warning_output = new ConVar ( " fs_show_warning_output " , " 0 " , FCVAR_DEVELOPMENTONLY , " Logs the filesystem warnings to the console, filtered by 'fs_warning_level_native' ( !slower! ). " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
2022-01-09 16:14:17 +01:00
fs_packedstore_entryblock_stats = new ConVar ( " fs_packedstore_entryblock_stats " , " 0 " , FCVAR_DEVELOPMENTONLY , " If set to 1, prints the stats of each file entry in the VPK during decompression ( !slower! ). " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
//-------------------------------------------------------------------------
2022-02-08 16:32:00 +01:00
// MATERIALSYSTEM |
# ifndef DEDICATED
2022-01-09 16:14:17 +01:00
mat_showdxoutput = new ConVar ( " mat_showdxoutput " , " 0 " , FCVAR_DEVELOPMENTONLY , " Shows debug output for the DirectX system. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
2022-02-08 16:32:00 +01:00
# endif // !DEDICATED
2022-01-09 16:14:17 +01:00
//-------------------------------------------------------------------------
// SQUIRREL |
2022-02-17 18:00:29 +01:00
sq_showrsonloading = new ConVar ( " sq_showrsonloading " , " 0 " , FCVAR_DEVELOPMENTONLY , " Logs all 'rson' files loaded by the SQVM ( !slower! ). " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
2022-01-09 16:14:17 +01:00
sq_showscriptloading = new ConVar ( " sq_showscriptloading " , " 0 " , FCVAR_DEVELOPMENTONLY , " Logs all scripts loaded by the SQVM to be pre-compiled ( !slower! ). " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
2022-02-17 18:00:29 +01:00
sq_showvmoutput = new ConVar ( " sq_showvmoutput " , " 0 " , FCVAR_DEVELOPMENTONLY , " Prints the VM output to the console. 1 = Log to file. 2 = 1 + log to console. 3 = 1 + 2 + log to overhead console. 4 = only log to overhead console. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
sq_showvmwarning = new ConVar ( " sq_showvmwarning " , " 0 " , FCVAR_DEVELOPMENTONLY , " Prints the VM warning output to the console. 1 = Log to file. 2 = 1 + log to console. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
2022-01-09 16:14:17 +01:00
//-------------------------------------------------------------------------
// NETCHANNEL |
2022-02-17 18:00:29 +01:00
net_userandomkey = new ConVar ( " net_userandomkey " , " 1 " , FCVAR_RELEASE , " If set to 1, the netchannel generates and sets a random base64 netkey. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
r5net_matchmaking_hostname = new ConVar ( " r5net_matchmaking_hostname " , " r5a-comp-sv.herokuapp.com " , FCVAR_RELEASE , " Holds the R5Net matchmaking hostname. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
r5net_show_debug = new ConVar ( " r5net_show_debug " , " 1 " , FCVAR_DEVELOPMENTONLY , " Shows debug output for R5Net. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
2022-03-23 23:28:12 +01:00
//-------------------------------------------------------------------------
// RTECH API |
2022-03-26 18:06:54 +01:00
//-------------------------------------------------------------------------
2022-03-23 23:28:12 +01:00
// RUI |
# ifndef DEDICATED
2022-03-24 00:05:19 +01:00
rui_drawEnable = new ConVar ( " rui_drawEnable " , " 1 " , FCVAR_RELEASE , " Draws the RUI, 1 = Draw, 0 = No Draw. " , false , 0.f , false , 0.f , nullptr , nullptr ) ;
2022-03-23 23:28:12 +01:00
# endif // !DEDICATED
//-------------------------------------------------------------------------
2022-01-09 16:14:17 +01:00
}
2022-04-14 19:18:59 +02:00
//-----------------------------------------------------------------------------
// Purpose: initialize shipped ConVar's
//-----------------------------------------------------------------------------
void ConVar : : InitShipped ( void ) const
{
single_frame_shutdown_for_reload = g_pCVar - > FindVar ( " single_frame_shutdown_for_reload " ) ;
mp_gamemode = g_pCVar - > FindVar ( " mp_gamemode " ) ;
hostname = g_pCVar - > FindVar ( " hostname " ) ;
hostport = g_pCVar - > FindVar ( " hostport " ) ;
host_hasIrreversibleShutdown = g_pCVar - > FindVar ( " host_hasIrreversibleShutdown " ) ;
net_usesocketsforloopback = g_pCVar - > FindVar ( " net_usesocketsforloopback " ) ;
mp_gamemode - > SetCallback ( & MP_GameMode_Changed_f ) ;
}
2022-02-23 00:18:46 +01:00
//-----------------------------------------------------------------------------
// Purpose: Add's flags to ConVar.
// Input : nFlags -
//-----------------------------------------------------------------------------
void ConVar : : AddFlags ( int nFlags )
{
2022-02-23 15:56:03 +01:00
m_pParent - > m_nFlags | = nFlags ;
2022-02-23 00:18:46 +01:00
}
//-----------------------------------------------------------------------------
// Purpose: Removes flags from ConVar.
// Input : nFlags -
//-----------------------------------------------------------------------------
void ConVar : : RemoveFlags ( int nFlags )
{
2022-02-23 15:56:03 +01:00
m_nFlags & = ~ nFlags ;
2022-02-23 00:18:46 +01:00
}
2022-01-09 16:14:17 +01:00
//-----------------------------------------------------------------------------
// Purpose: Returns the base ConVar name.
// Output : const char*
//-----------------------------------------------------------------------------
2022-02-06 19:15:34 +01:00
const char * ConVar : : GetBaseName ( void ) const
2022-01-09 16:14:17 +01:00
{
2022-02-23 15:56:03 +01:00
return m_pParent - > m_pszName ;
2022-01-09 16:14:17 +01:00
}
//-----------------------------------------------------------------------------
// Purpose: Returns the ConVar help text.
// Output : const char*
//-----------------------------------------------------------------------------
2022-02-06 19:15:34 +01:00
const char * ConVar : : GetHelpText ( void ) const
2022-01-09 16:14:17 +01:00
{
2022-02-23 15:56:03 +01:00
return m_pParent - > m_pszHelpString ;
2022-01-09 16:14:17 +01:00
}
//-----------------------------------------------------------------------------
2022-02-22 16:31:24 +01:00
// Purpose: Returns the ConVar usage text.
// Output : const char*
//-----------------------------------------------------------------------------
const char * ConVar : : GetUsageText ( void ) const
{
2022-02-23 15:56:03 +01:00
return m_pParent - > m_pszUsageString ;
2022-02-22 16:31:24 +01:00
}
2022-01-09 16:14:17 +01:00
//-----------------------------------------------------------------------------
// Purpose: Return ConVar value as a boolean.
// Output : bool
//-----------------------------------------------------------------------------
2022-02-06 19:15:34 +01:00
bool ConVar : : GetBool ( void ) const
2022-01-09 16:14:17 +01:00
{
return ! ! GetInt ( ) ;
}
//-----------------------------------------------------------------------------
// Purpose: Return ConVar value as a float.
// Output : float
//-----------------------------------------------------------------------------
2022-02-06 19:15:34 +01:00
float ConVar : : GetFloat ( void ) const
2022-01-09 16:14:17 +01:00
{
2022-02-21 17:56:31 +01:00
return m_pParent - > m_Value . m_fValue ;
2022-01-09 16:14:17 +01:00
}
2022-03-27 11:42:24 +02:00
//-----------------------------------------------------------------------------
// Purpose: Return ConVar value as a double.
// Output : double
//-----------------------------------------------------------------------------
double ConVar : : GetDouble ( void ) const
{
return static_cast < double > ( m_pParent - > m_Value . m_fValue ) ;
}
2022-01-09 16:14:17 +01:00
//-----------------------------------------------------------------------------
// Purpose: Return ConVar value as an integer.
// Output : int
//-----------------------------------------------------------------------------
2022-02-06 19:15:34 +01:00
int ConVar : : GetInt ( void ) const
2022-01-09 16:14:17 +01:00
{
2022-02-21 17:56:31 +01:00
return m_pParent - > m_Value . m_nValue ;
2022-01-09 16:14:17 +01:00
}
//-----------------------------------------------------------------------------
// Purpose: Return ConVar value as a color.
// Output : Color
//-----------------------------------------------------------------------------
2022-02-06 19:15:34 +01:00
Color ConVar : : GetColor ( void ) const
2022-01-09 16:14:17 +01:00
{
2022-03-27 11:42:24 +02:00
unsigned char * pColorElement = ( reinterpret_cast < unsigned char * > ( & m_pParent - > m_Value . m_nValue ) ) ;
2022-01-09 16:14:17 +01:00
return Color ( pColorElement [ 0 ] , pColorElement [ 1 ] , pColorElement [ 2 ] , pColorElement [ 3 ] ) ;
}
//-----------------------------------------------------------------------------
// Purpose: Return ConVar value as a string.
// Output : const char *
//-----------------------------------------------------------------------------
2022-02-06 19:15:34 +01:00
const char * ConVar : : GetString ( void ) const
2022-01-09 16:14:17 +01:00
{
2022-02-23 15:56:03 +01:00
if ( m_nFlags & FCVAR_NEVER_AS_STRING )
2022-01-09 16:14:17 +01:00
{
return " FCVAR_NEVER_AS_STRING " ;
}
2022-02-21 17:56:31 +01:00
char const * str = m_pParent - > m_Value . m_pszString ;
2022-01-09 16:14:17 +01:00
return str ? str : " " ;
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : flMinVal -
// Output : true if there is a min set.
//-----------------------------------------------------------------------------
2022-02-06 19:15:34 +01:00
bool ConVar : : GetMin ( float & flMinVal ) const
2022-01-09 16:14:17 +01:00
{
2022-02-21 17:56:31 +01:00
flMinVal = m_pParent - > m_fMinVal ;
2022-01-09 16:14:17 +01:00
return m_pParent - > m_bHasMin ;
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : flMaxVal -
// Output : true if there is a max set.
//-----------------------------------------------------------------------------
2022-02-06 19:15:34 +01:00
bool ConVar : : GetMax ( float & flMaxVal ) const
2022-01-09 16:14:17 +01:00
{
2022-02-21 17:56:31 +01:00
flMaxVal = m_pParent - > m_fMaxVal ;
2022-01-09 16:14:17 +01:00
return m_pParent - > m_bHasMax ;
}
//-----------------------------------------------------------------------------
// Purpose: returns the min value.
// Output : float
//-----------------------------------------------------------------------------
2022-02-06 19:15:34 +01:00
float ConVar : : GetMinValue ( void ) const
2022-01-09 16:14:17 +01:00
{
2022-02-21 17:56:31 +01:00
return m_pParent - > m_fMinVal ;
2022-01-09 16:14:17 +01:00
}
//-----------------------------------------------------------------------------
// Purpose: returns the max value.
// Output : float
//-----------------------------------------------------------------------------
2022-02-06 19:15:34 +01:00
float ConVar : : GetMaxValue ( void ) const
2022-01-09 16:14:17 +01:00
{
2022-02-21 17:56:31 +01:00
return m_pParent - > m_fMaxVal ;
2022-01-09 16:14:17 +01:00
}
//-----------------------------------------------------------------------------
// Purpose: checks if ConVar has min value.
// Output : bool
//-----------------------------------------------------------------------------
2022-02-06 19:15:34 +01:00
bool ConVar : : HasMin ( void ) const
2022-01-09 16:14:17 +01:00
{
return m_pParent - > m_bHasMin ;
}
//-----------------------------------------------------------------------------
// Purpose: checks if ConVar has max value.
// Output : bool
//-----------------------------------------------------------------------------
2022-02-06 19:15:34 +01:00
bool ConVar : : HasMax ( void ) const
2022-01-09 16:14:17 +01:00
{
return m_pParent - > m_bHasMax ;
}
//-----------------------------------------------------------------------------
// Purpose: sets the ConVar int value.
// Input : nValue -
//-----------------------------------------------------------------------------
void ConVar : : SetValue ( int nValue )
{
2022-02-21 17:56:31 +01:00
if ( nValue = = m_Value . m_nValue )
2022-01-09 16:14:17 +01:00
{
return ;
}
// Only valid for root ConVars.
assert ( m_pParent = = this ) ;
2022-03-27 11:42:24 +02:00
float flValue = static_cast < float > ( nValue ) ;
2022-01-09 16:14:17 +01:00
// Check bounds.
if ( ClampValue ( flValue ) )
{
2022-03-27 11:42:24 +02:00
nValue = static_cast < int > ( flValue ) ;
2022-01-09 16:14:17 +01:00
}
// Redetermine value.
2022-02-21 17:56:31 +01:00
float flOldValue = m_Value . m_fValue ;
m_Value . m_fValue = flValue ;
m_Value . m_fValue = nValue ;
2022-01-09 16:14:17 +01:00
2022-02-23 15:56:03 +01:00
if ( ! ( m_nFlags & FCVAR_NEVER_AS_STRING ) )
2022-01-09 16:14:17 +01:00
{
char szTempValue [ 32 ] ;
2022-02-21 17:56:31 +01:00
snprintf ( szTempValue , sizeof ( szTempValue ) , " %d " , m_Value . m_nValue ) ;
2022-01-09 16:14:17 +01:00
ChangeStringValue ( szTempValue , flOldValue ) ;
}
}
//-----------------------------------------------------------------------------
// Purpose: sets the ConVar float value.
// Input : flValue -
//-----------------------------------------------------------------------------
void ConVar : : SetValue ( float flValue )
{
2022-02-21 17:56:31 +01:00
if ( flValue = = m_Value . m_fValue )
2022-01-09 16:14:17 +01:00
{
return ;
}
// Only valid for root ConVars.
assert ( m_pParent = = this ) ;
// Check bounds.
ClampValue ( flValue ) ;
// Redetermine value.
2022-02-21 17:56:31 +01:00
float flOldValue = m_Value . m_fValue ;
m_Value . m_fValue = flValue ;
2022-03-27 11:42:24 +02:00
m_Value . m_nValue = static_cast < int > ( m_Value . m_fValue ) ;
2022-01-09 16:14:17 +01:00
2022-02-23 15:56:03 +01:00
if ( ! ( m_nFlags & FCVAR_NEVER_AS_STRING ) )
2022-01-09 16:14:17 +01:00
{
char szTempValue [ 32 ] ;
2022-02-21 17:56:31 +01:00
snprintf ( szTempValue , sizeof ( szTempValue ) , " %f " , m_Value . m_fValue ) ;
2022-01-09 16:14:17 +01:00
ChangeStringValue ( szTempValue , flOldValue ) ;
}
}
//-----------------------------------------------------------------------------
// Purpose: sets the ConVar string value.
// Input : *szValue -
//-----------------------------------------------------------------------------
2022-01-12 02:53:07 +01:00
void ConVar : : SetValue ( const char * pszValue )
2022-01-09 16:14:17 +01:00
{
2022-02-21 17:56:31 +01:00
if ( strcmp ( this - > m_pParent - > m_Value . m_pszString , pszValue ) = = 0 )
2022-01-09 16:14:17 +01:00
{
return ;
}
2022-02-21 17:56:31 +01:00
this - > m_pParent - > m_Value . m_pszString = pszValue ;
2022-01-09 16:14:17 +01:00
char szTempValue [ 32 ] { } ;
2022-01-12 02:53:07 +01:00
const char * pszNewValue { } ;
2022-01-09 16:14:17 +01:00
// Only valid for root convars.
assert ( m_pParent = = this ) ;
2022-02-21 17:56:31 +01:00
float flOldValue = m_Value . m_fValue ;
2022-03-27 11:42:24 +02:00
pszNewValue = const_cast < char * > ( pszValue ) ;
2022-01-12 02:53:07 +01:00
if ( ! pszNewValue )
2022-01-09 16:14:17 +01:00
{
2022-01-12 02:53:07 +01:00
pszNewValue = " " ;
2022-01-09 16:14:17 +01:00
}
2022-01-12 02:53:07 +01:00
if ( ! SetColorFromString ( pszValue ) )
2022-01-09 16:14:17 +01:00
{
// Not a color, do the standard thing
2022-03-27 11:42:24 +02:00
float flNewValue = static_cast < float > ( atof ( pszValue ) ) ;
2022-01-09 16:14:17 +01:00
if ( ! IsFinite ( flNewValue ) )
{
2022-03-04 15:59:33 +01:00
Warning ( eDLL_T : : ENGINE , " Warning: ConVar '%s' = '%s' is infinite, clamping value. \n " , GetBaseName ( ) , pszValue ) ;
2022-01-09 16:14:17 +01:00
flNewValue = FLT_MAX ;
}
if ( ClampValue ( flNewValue ) )
{
snprintf ( szTempValue , sizeof ( szTempValue ) , " %f " , flNewValue ) ;
2022-01-12 02:53:07 +01:00
pszNewValue = szTempValue ;
2022-01-09 16:14:17 +01:00
}
// Redetermine value
2022-02-21 17:56:31 +01:00
m_Value . m_fValue = flNewValue ;
2022-03-27 11:42:24 +02:00
m_Value . m_nValue = static_cast < int > ( m_Value . m_fValue ) ;
2022-01-09 16:14:17 +01:00
}
2022-02-23 15:56:03 +01:00
if ( ! ( m_nFlags & FCVAR_NEVER_AS_STRING ) )
2022-01-09 16:14:17 +01:00
{
2022-01-12 02:53:07 +01:00
ChangeStringValue ( pszNewValue , flOldValue ) ;
2022-01-09 16:14:17 +01:00
}
}
2021-12-25 22:36:38 +01:00
//-----------------------------------------------------------------------------
2022-01-09 16:14:17 +01:00
// Purpose: sets the ConVar color value.
// Input : clValue -
2021-12-25 22:36:38 +01:00
//-----------------------------------------------------------------------------
2022-01-09 16:14:17 +01:00
void ConVar : : SetValue ( Color clValue )
{
std : : string svResult = " " ;
for ( int i = 0 ; i < 4 ; i + + )
{
2022-02-17 18:00:29 +01:00
if ( ! ( clValue . GetValue ( i ) = = 0 & & svResult . size ( ) = = 0 ) )
2022-01-09 16:14:17 +01:00
{
2022-02-17 18:00:29 +01:00
svResult + = std : : to_string ( clValue . GetValue ( i ) ) ;
2022-01-09 16:14:17 +01:00
svResult . append ( " " ) ;
}
}
2022-02-21 17:56:31 +01:00
this - > m_pParent - > m_Value . m_pszString = svResult . c_str ( ) ;
2022-01-09 16:14:17 +01:00
}
//-----------------------------------------------------------------------------
// Purpose: Reset to default value.
//-----------------------------------------------------------------------------
void ConVar : : Revert ( void )
{
this - > SetValue ( this - > m_pszDefaultValue ) ;
}
//-----------------------------------------------------------------------------
// Purpose: returns the default ConVar value.
// Output : const char
//-----------------------------------------------------------------------------
2022-02-06 19:15:34 +01:00
const char * ConVar : : GetDefault ( void ) const
2022-01-09 16:14:17 +01:00
{
return m_pParent - > m_pszDefaultValue ;
}
//-----------------------------------------------------------------------------
// Purpose: sets the default ConVar value.
// Input : *pszDefault -
//-----------------------------------------------------------------------------
void ConVar : : SetDefault ( const char * pszDefault )
{
static const char * pszEmpty = " " ;
m_pszDefaultValue = pszDefault ? pszDefault : pszEmpty ;
assert ( m_pszDefaultValue ) ;
}
2022-04-14 19:18:59 +02:00
//-----------------------------------------------------------------------------
// Purpose: sets the ConVar callback.
// Input : *pCallback -
//-----------------------------------------------------------------------------
void ConVar : : SetCallback ( void * pCallback )
{
* m_Callback . m_ppCallback = * & pCallback ;
}
2022-01-09 16:14:17 +01:00
//-----------------------------------------------------------------------------
// Purpose: changes the ConVar string value.
// Input : *pszTempVal - flOldValue
//-----------------------------------------------------------------------------
void ConVar : : ChangeStringValue ( const char * pszTempVal , float flOldValue )
{
2022-02-23 21:02:37 +01:00
assert ( ! ( m_nFlags & FCVAR_NEVER_AS_STRING ) ) ;
2022-01-09 16:14:17 +01:00
2022-03-27 11:42:24 +02:00
char * pszOldValue = reinterpret_cast < char * > ( _malloca ( m_Value . m_iStringLength ) ) ;
2022-01-09 16:14:17 +01:00
if ( pszOldValue ! = NULL )
{
2022-02-21 17:56:31 +01:00
memcpy ( pszOldValue , m_Value . m_pszString , m_Value . m_iStringLength ) ;
2022-01-09 16:14:17 +01:00
}
if ( pszTempVal )
{
int len = strlen ( pszTempVal ) + 1 ;
2022-02-21 17:56:31 +01:00
if ( len > m_Value . m_iStringLength )
2022-01-09 16:14:17 +01:00
{
2022-02-21 17:56:31 +01:00
if ( m_Value . m_pszString )
2022-01-09 16:14:17 +01:00
{
2022-02-21 17:56:31 +01:00
delete [ ] m_Value . m_pszString ;
2022-01-09 16:14:17 +01:00
}
2022-02-21 17:56:31 +01:00
m_Value . m_pszString = new char [ len ] ;
m_Value . m_iStringLength = len ;
2022-01-09 16:14:17 +01:00
}
2022-03-27 11:42:24 +02:00
memcpy ( const_cast < char * > ( m_Value . m_pszString ) , pszTempVal , len ) ;
2022-01-09 16:14:17 +01:00
}
else
{
2022-02-21 17:56:31 +01:00
m_Value . m_pszString = NULL ;
2022-01-09 16:14:17 +01:00
}
2022-03-26 18:06:54 +01:00
pszOldValue = NULL ;
2022-01-09 16:14:17 +01:00
}
//-----------------------------------------------------------------------------
// Purpose: sets the ConVar color value from string.
// Input : *pszValue -
//-----------------------------------------------------------------------------
bool ConVar : : SetColorFromString ( const char * pszValue )
{
bool bColor = false ;
// Try pulling RGBA color values out of the string.
int nRGBA [ 4 ] { } ;
int nParamsRead = sscanf_s ( pszValue , " %i %i %i %i " , & ( nRGBA [ 0 ] ) , & ( nRGBA [ 1 ] ) , & ( nRGBA [ 2 ] ) , & ( nRGBA [ 3 ] ) ) ;
if ( nParamsRead > = 3 )
{
// This is probably a color!
if ( nParamsRead = = 3 )
{
// Assume they wanted full alpha.
nRGBA [ 3 ] = 255 ;
}
if ( nRGBA [ 0 ] > = 0 & & nRGBA [ 0 ] < = 255 & &
nRGBA [ 1 ] > = 0 & & nRGBA [ 1 ] < = 255 & &
nRGBA [ 2 ] > = 0 & & nRGBA [ 2 ] < = 255 & &
nRGBA [ 3 ] > = 0 & & nRGBA [ 3 ] < = 255 )
{
//printf("*** WOW! Found a color!! ***\n");
// This is definitely a color!
bColor = true ;
// Stuff all the values into each byte of our int.
2022-03-27 11:42:24 +02:00
unsigned char * pColorElement = ( reinterpret_cast < unsigned char * > ( & m_Value . m_nValue ) ) ;
2022-01-09 16:14:17 +01:00
pColorElement [ 0 ] = nRGBA [ 0 ] ;
pColorElement [ 1 ] = nRGBA [ 1 ] ;
pColorElement [ 2 ] = nRGBA [ 2 ] ;
pColorElement [ 3 ] = nRGBA [ 3 ] ;
// Copy that value into our float.
2022-03-27 11:42:24 +02:00
m_Value . m_fValue = static_cast < float > ( m_Value . m_nValue ) ;
2022-01-09 16:14:17 +01:00
}
}
return bColor ;
}
//-----------------------------------------------------------------------------
// Purpose: Check whether to clamp and then perform clamp.
// Input : flValue -
// Output : Returns true if value changed.
//-----------------------------------------------------------------------------
bool ConVar : : ClampValue ( float & flValue )
{
2022-02-21 17:56:31 +01:00
if ( m_bHasMin & & ( flValue < m_fMinVal ) )
2022-01-09 16:14:17 +01:00
{
2022-02-21 17:56:31 +01:00
flValue = m_fMinVal ;
2022-01-09 16:14:17 +01:00
return true ;
}
2022-02-21 17:56:31 +01:00
if ( m_bHasMax & & ( flValue > m_fMaxVal ) )
2022-01-09 16:14:17 +01:00
{
2022-02-21 17:56:31 +01:00
flValue = m_fMaxVal ;
2022-01-09 16:14:17 +01:00
return true ;
}
return false ;
}
2022-02-23 00:18:46 +01:00
//-----------------------------------------------------------------------------
// Purpose: Checks if ConVar is registered.
// Output : bool
//-----------------------------------------------------------------------------
bool ConVar : : IsRegistered ( void ) const
{
2022-02-23 15:56:03 +01:00
return m_pParent - > m_bRegistered ;
2022-02-23 00:18:46 +01:00
}
//-----------------------------------------------------------------------------
// Purpose: Returns true if this is a command
// Output : bool
//-----------------------------------------------------------------------------
bool ConVar : : IsCommand ( void ) const
{
return false ;
}
2022-01-09 16:14:17 +01:00
//-----------------------------------------------------------------------------
2022-01-12 02:53:07 +01:00
// Purpose: Test each ConVar query before setting the value.
2022-01-09 16:14:17 +01:00
// Input : *pConVar - nFlags
2022-01-12 02:53:07 +01:00
// Output : False if change is permitted, true if not.
2022-01-09 16:14:17 +01:00
//-----------------------------------------------------------------------------
bool ConVar : : IsFlagSet ( ConVar * pConVar , int nFlags )
2021-12-25 22:36:38 +01:00
{
2022-01-10 02:03:31 +01:00
if ( cm_debug_cmdquery - > GetBool ( ) )
2022-01-08 02:05:33 +01:00
{
printf ( " -------------------------------------------------- \n " ) ;
2022-02-23 15:56:03 +01:00
printf ( " Flaged: %08X \n " , pConVar - > m_nFlags ) ;
2022-01-08 02:05:33 +01:00
}
2022-01-10 02:03:31 +01:00
if ( cm_return_false_cmdquery_cheats - > GetBool ( ) )
2021-12-25 22:36:38 +01:00
{
2021-12-27 02:23:03 +01:00
// Mask off FCVAR_CHEATS and FCVAR_DEVELOPMENTONLY.
2022-02-23 15:56:03 +01:00
pConVar - > RemoveFlags ( FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT ) ;
2021-12-25 22:36:38 +01:00
}
2022-01-09 16:14:17 +01:00
else // Mask off FCVAR_DEVELOPMENTONLY.
2021-12-25 22:36:38 +01:00
{
2022-02-23 15:56:03 +01:00
pConVar - > RemoveFlags ( FCVAR_DEVELOPMENTONLY ) ;
2021-12-25 22:36:38 +01:00
}
2022-01-10 02:03:31 +01:00
if ( cm_debug_cmdquery - > GetBool ( ) )
2022-01-08 02:05:33 +01:00
{
2022-02-23 15:56:03 +01:00
printf ( " Masked: %08X \n " , pConVar - > m_nFlags ) ;
2022-01-08 02:05:33 +01:00
printf ( " Verify: %08X \n " , nFlags ) ;
printf ( " -------------------------------------------------- \n " ) ;
}
2022-01-10 02:03:31 +01:00
if ( nFlags & FCVAR_RELEASE & & ! cm_return_false_cmdquery_all - > GetBool ( ) )
2022-01-08 02:05:33 +01:00
{
// Default retail behaviour.
return IConVar_IsFlagSet ( pConVar , nFlags ) ;
}
2022-01-10 02:03:31 +01:00
if ( cm_return_false_cmdquery_all - > GetBool ( ) )
2022-01-08 02:05:33 +01:00
{
// Returning false on all queries may cause problems.
return false ;
}
// Return false on every FCVAR_DEVELOPMENTONLY query.
2022-02-23 15:56:03 +01:00
return pConVar - > HasFlags ( nFlags ) ! = 0 ;
2021-12-25 22:36:38 +01:00
}
//-----------------------------------------------------------------------------
2022-01-09 16:14:17 +01:00
// Purpose: clear all hostname ConVar's.
2021-12-25 22:36:38 +01:00
//-----------------------------------------------------------------------------
2022-01-09 16:14:17 +01:00
void ConVar : : ClearHostNames ( void )
2021-12-25 22:36:38 +01:00
{
2022-01-09 16:14:17 +01:00
const char * pszHostnameArray [ ] =
2021-12-25 22:36:38 +01:00
{
" pin_telemetry_hostname " ,
" assetdownloads_hostname " ,
" users_hostname " ,
" persistence_hostname " ,
" speechtotexttoken_hostname " ,
" communities_hostname " ,
" persistenceDef_hostname " ,
" party_hostname " ,
" speechtotext_hostname " ,
" serverReports_hostname " ,
" subscription_hostname " ,
" steamlink_hostname " ,
" staticfile_hostname " ,
" matchmaking_hostname " ,
" skill_hostname " ,
" publication_hostname " ,
" stats_hostname "
} ;
2022-01-16 03:26:11 +01:00
for ( int i = 0 ; i < ( & pszHostnameArray ) [ 1 ] - pszHostnameArray ; i + + )
2021-12-25 22:36:38 +01:00
{
2022-01-09 16:14:17 +01:00
const char * pszName = pszHostnameArray [ i ] ;
2022-01-10 01:31:25 +01:00
ConVar * pCVar = g_pCVar - > FindVar ( pszName ) ;
2022-01-09 16:14:17 +01:00
2022-04-14 19:18:59 +02:00
if ( pCVar )
2022-01-09 16:14:17 +01:00
{
2022-02-21 17:56:31 +01:00
pCVar - > m_Value . m_pszString = " 0.0.0.0 " ;
2022-01-09 16:14:17 +01:00
}
2021-12-25 22:36:38 +01:00
}
}
///////////////////////////////////////////////////////////////////////////////
void IConVar_Attach ( )
{
2022-01-09 16:14:17 +01:00
DetourAttach ( ( LPVOID * ) & IConVar_IsFlagSet , & ConVar : : IsFlagSet ) ;
2021-12-25 22:36:38 +01:00
}
void IConVar_Detach ( )
{
2022-01-09 16:14:17 +01:00
DetourDetach ( ( LPVOID * ) & IConVar_IsFlagSet , & ConVar : : IsFlagSet ) ;
2021-12-25 22:36:38 +01:00
}
2022-01-09 16:14:17 +01:00
///////////////////////////////////////////////////////////////////////////////
ConVar * g_pConVar = new ConVar ( ) ;