mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Tier1: static construction of ConVar objects during link time
Fully implemented ConVar class so we could statically construct all SDK convars, this avoids a level of indirection, and allows for creating ConVar's everywhere in the project. This patch also removed the settings tab of the ImGui server browser, as it has threading issues, while it technically never caused a crash yet, it has been removed as there was no point keeping it vs the work required to make it thread save (it only managed 2 convars which are perfectly manageable through cfg's or the in-game console). Also temporarily disabled the creation of ConVar's in the mod system due to a memory leak, we would allocate and register a convar based on details parsed out of a mod file definition, but never unregister and free it.
This commit is contained in:
parent
3d36c87b08
commit
6828901815
@ -3,6 +3,8 @@
|
||||
#include "tier0/fasttimer.h"
|
||||
#include "tier1/cvar.h"
|
||||
|
||||
ConVar miles_debug("miles_debug", "0", FCVAR_RELEASE, "Enables debug prints for the Miles Sound System", "1 = print; 0 (zero) = no print");
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: logs debug output emitted from the Miles Sound System
|
||||
// Input : nLogLevel -
|
||||
@ -39,7 +41,7 @@ bool Miles_Initialize()
|
||||
|
||||
void MilesQueueEventRun(Miles::Queue* queue, const char* eventName)
|
||||
{
|
||||
if(miles_debug->GetBool())
|
||||
if(miles_debug.GetBool())
|
||||
Msg(eDLL_T::AUDIO, "%s: running event: '%s'\n", __FUNCTION__, eventName);
|
||||
|
||||
v_MilesQueueEventRun(queue, eventName);
|
||||
|
@ -77,23 +77,11 @@
|
||||
MP_GameMode_Changed_f
|
||||
=====================
|
||||
*/
|
||||
void MP_GameMode_Changed_f(IConVar* pConVar, const char* pOldString, float flOldValue)
|
||||
void MP_GameMode_Changed_f(IConVar* pConVar, const char* pOldString)
|
||||
{
|
||||
v_SetupGamemode(mp_gamemode->GetString());
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
MP_HostName_Changed_f
|
||||
=====================
|
||||
*/
|
||||
void MP_HostName_Changed_f(IConVar* pConVar, const char* pOldString, float flOldValue)
|
||||
{
|
||||
#ifndef DEDICATED
|
||||
g_Browser.SetHostName(pylon_matchmaking_hostname->GetString());
|
||||
#endif // !DEDICATED
|
||||
}
|
||||
|
||||
#ifndef CLIENT_DLL
|
||||
/*
|
||||
=====================
|
||||
@ -120,6 +108,11 @@ void Host_Changelevel_f(const CCommand& args)
|
||||
}
|
||||
#endif // !CLIENT_DLL
|
||||
|
||||
// TODO: move this to 'packedstore.cpp' and move everything in that file to 'packetstorebuilder.cpp'
|
||||
static ConVar fs_packedstore_workspace("fs_packedstore_workspace", "ship", FCVAR_DEVELOPMENTONLY, "Determines the current VPK workspace.");
|
||||
static ConVar fs_packedstore_compression_level("fs_packedstore_compression_level", "default", FCVAR_DEVELOPMENTONLY, "Determines the VPK compression level.", "fastest faster default better uber");
|
||||
static ConVar fs_packedstore_max_helper_threads("fs_packedstore_max_helper_threads", "-1", FCVAR_DEVELOPMENTONLY, "Max # of additional \"helper\" threads to create during compression.", true, -1, true, LZHAM_MAX_HELPER_THREADS, "Must range between [-1,LZHAM_MAX_HELPER_THREADS], where -1=max practical");
|
||||
|
||||
/*
|
||||
=====================
|
||||
VPK_Pack_f
|
||||
@ -135,7 +128,7 @@ void VPK_Pack_f(const CCommand& args)
|
||||
return;
|
||||
}
|
||||
|
||||
const char* workspacePath = fs_packedstore_workspace->GetString();
|
||||
const char* workspacePath = fs_packedstore_workspace.GetString();
|
||||
|
||||
if (!FileSystem()->IsDirectory(workspacePath, "PLATFORM"))
|
||||
{
|
||||
@ -151,7 +144,7 @@ void VPK_Pack_f(const CCommand& args)
|
||||
|
||||
CPackedStoreBuilder builder;
|
||||
|
||||
builder.InitLzEncoder(fs_packedstore_max_helper_threads->GetInt(), fs_packedstore_compression_level->GetString());
|
||||
builder.InitLzEncoder(fs_packedstore_max_helper_threads.GetInt(), fs_packedstore_compression_level.GetString());
|
||||
builder.PackStore(pair, workspacePath, "vpk/");
|
||||
|
||||
timer.End();
|
||||
@ -191,7 +184,7 @@ void VPK_Unpack_f(const CCommand& args)
|
||||
CPackedStoreBuilder builder;
|
||||
|
||||
builder.InitLzDecoder();
|
||||
builder.UnpackStore(vpk, fs_packedstore_workspace->GetString());
|
||||
builder.UnpackStore(vpk, fs_packedstore_workspace.GetString());
|
||||
|
||||
timer.End();
|
||||
Msg(eDLL_T::FS, "*** Time elapsed: '%lf' seconds\n", timer.GetDuration().GetSeconds());
|
||||
@ -234,28 +227,6 @@ void VPK_Unmount_f(const CCommand& args)
|
||||
FileSystem()->UnmountVPKFile(args.Arg(1));
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
NET_UseRandomKeyChanged_f
|
||||
|
||||
Use random AES encryption
|
||||
key for game packets
|
||||
=====================
|
||||
*/
|
||||
void NET_UseRandomKeyChanged_f(IConVar* pConVar, const char* pOldString, float flOldValue)
|
||||
{
|
||||
if (ConVar* pConVarRef = g_pCVar->FindVar(pConVar->GetCommandName()))
|
||||
{
|
||||
if (strcmp(pOldString, pConVarRef->GetString()) == NULL)
|
||||
return; // Same value.
|
||||
|
||||
if (pConVarRef->GetBool())
|
||||
NET_GenerateKey();
|
||||
else
|
||||
NET_SetKey(DEFAULT_NET_ENCRYPTION_KEY);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
NET_UseSocketsForLoopbackChanged_f
|
||||
@ -264,9 +235,9 @@ NET_UseSocketsForLoopbackChanged_f
|
||||
key for game packets
|
||||
=====================
|
||||
*/
|
||||
void NET_UseSocketsForLoopbackChanged_f(IConVar* pConVar, const char* pOldString, float flOldValue)
|
||||
void NET_UseSocketsForLoopbackChanged_f(IConVar* pConVar, const char* pOldString)
|
||||
{
|
||||
if (ConVar* pConVarRef = g_pCVar->FindVar(pConVar->GetCommandName()))
|
||||
if (ConVar* pConVarRef = g_pCVar->FindVar(pConVar->GetName()))
|
||||
{
|
||||
if (strcmp(pOldString, pConVarRef->GetString()) == NULL)
|
||||
return; // Same value.
|
||||
@ -283,37 +254,9 @@ void NET_UseSocketsForLoopbackChanged_f(IConVar* pConVar, const char* pOldString
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef DEDICATED
|
||||
|
||||
/*
|
||||
=====================
|
||||
RCON_SendLogs_f
|
||||
|
||||
request logs from RCON server
|
||||
=====================
|
||||
*/
|
||||
void RCON_InputOnlyChanged_f(IConVar* pConVar, const char* pOldString, float flOldValue)
|
||||
void LanguageChanged_f(IConVar* pConVar, const char* pOldString)
|
||||
{
|
||||
RCONClient()->RequestConsoleLog(RCONClient()->ShouldReceive());
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
GFX_NVN_Changed_f
|
||||
|
||||
force update NVIDIA Reflex
|
||||
Low Latency parameters
|
||||
=====================
|
||||
*/
|
||||
void GFX_NVN_Changed_f(IConVar* pConVar, const char* pOldString, float flOldValue)
|
||||
{
|
||||
GFX_MarkLowLatencyParametersOutOfDate();
|
||||
}
|
||||
#endif // !DEDICATED
|
||||
|
||||
void LanguageChanged_f(IConVar* pConVar, const char* pOldString, float flOldValue)
|
||||
{
|
||||
if (ConVar* pConVarRef = g_pCVar->FindVar(pConVar->GetCommandName()))
|
||||
if (ConVar* pConVarRef = g_pCVar->FindVar(pConVar->GetName()))
|
||||
{
|
||||
const char* pNewString = pConVarRef->GetString();
|
||||
|
||||
@ -334,102 +277,6 @@ void LanguageChanged_f(IConVar* pConVar, const char* pOldString, float flOldValu
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
RCON_PasswordChanged_f
|
||||
|
||||
Change RCON password
|
||||
on server and client
|
||||
=====================
|
||||
*/
|
||||
void RCON_PasswordChanged_f(IConVar* pConVar, const char* pOldString, float flOldValue)
|
||||
{
|
||||
if (ConVar* pConVarRef = g_pCVar->FindVar(pConVar->GetCommandName()))
|
||||
{
|
||||
if (strcmp(pOldString, pConVarRef->GetString()) == NULL)
|
||||
return; // Same password.
|
||||
|
||||
#ifndef DEDICATED
|
||||
if (!RCONClient()->IsInitialized())
|
||||
RCONClient()->Init(); // Initialize first.
|
||||
#endif // !DEDICATED
|
||||
#ifndef CLIENT_DLL
|
||||
if (RCONServer()->IsInitialized())
|
||||
RCONServer()->SetPassword(pConVarRef->GetString());
|
||||
else
|
||||
RCONServer()->Init(); // Initialize first.
|
||||
#endif // !CLIENT_DLL
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef CLIENT_DLL
|
||||
/*
|
||||
=====================
|
||||
RCON_WhiteListAddresChanged_f
|
||||
|
||||
Change whitelist address
|
||||
on RCON server
|
||||
=====================
|
||||
*/
|
||||
void RCON_WhiteListAddresChanged_f(IConVar* pConVar, const char* pOldString, float flOldValue)
|
||||
{
|
||||
if (ConVar* pConVarRef = g_pCVar->FindVar(pConVar->GetCommandName()))
|
||||
{
|
||||
if (strcmp(pOldString, pConVarRef->GetString()) == NULL)
|
||||
return; // Same address.
|
||||
|
||||
if (!RCONServer()->SetWhiteListAddress(pConVarRef->GetString()))
|
||||
{
|
||||
Warning(eDLL_T::SERVER, "Failed to set RCON whitelist address: %s\n", pConVarRef->GetString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
RCON_ConnectionCountChanged_f
|
||||
|
||||
Change max connection
|
||||
count on RCON server
|
||||
=====================
|
||||
*/
|
||||
void RCON_ConnectionCountChanged_f(IConVar* pConVar, const char* pOldString, float flOldValue)
|
||||
{
|
||||
if (!RCONServer()->IsInitialized())
|
||||
return; // Not initialized; no sockets at this point.
|
||||
|
||||
if (ConVar* pConVarRef = g_pCVar->FindVar(pConVar->GetCommandName()))
|
||||
{
|
||||
if (strcmp(pOldString, pConVarRef->GetString()) == NULL)
|
||||
return; // Same count.
|
||||
|
||||
const int maxCount = pConVarRef->GetInt();
|
||||
|
||||
int count = RCONServer()->GetAuthenticatedCount();
|
||||
CSocketCreator* pCreator = RCONServer()->GetSocketCreator();
|
||||
|
||||
if (count < maxCount)
|
||||
{
|
||||
if (!pCreator->IsListening())
|
||||
{
|
||||
pCreator->CreateListenSocket(*RCONServer()->GetNetAddress());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (count > maxCount)
|
||||
{
|
||||
RCONServer()->Disconnect(count-1, "too many authenticated sockets");
|
||||
count = RCONServer()->GetAuthenticatedCount();
|
||||
}
|
||||
|
||||
pCreator->CloseListenSocket();
|
||||
RCONServer()->CloseNonAuthConnection();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // !CLIENT_DLL
|
||||
|
||||
#ifndef DEDICATED
|
||||
/*
|
||||
=====================
|
||||
@ -518,7 +365,7 @@ void Line_f(const CCommand& args)
|
||||
end[i] = float(atof(args[i + 4]));
|
||||
}
|
||||
|
||||
g_pDebugOverlay->AddLineOverlay(start, end, 255, 255, 0, !r_debug_draw_depth_test->GetBool(), 100);
|
||||
g_pDebugOverlay->AddLineOverlay(start, end, 255, 255, 0, !r_debug_draw_depth_test.GetBool(), 100);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -577,6 +424,9 @@ void Capsule_f(const CCommand& args)
|
||||
}
|
||||
#endif // !DEDICATED
|
||||
|
||||
// TODO: move to other file?
|
||||
static ConVar bhit_depth_test("bhit_depth_test", "0", FCVAR_DEVELOPMENTONLY | FCVAR_REPLICATED, "Use depth test for bullet ray trace overlay");
|
||||
static ConVar bhit_abs_origin("bhit_abs_origin", "1", FCVAR_DEVELOPMENTONLY | FCVAR_REPLICATED, "Draw entity's predicted abs origin upon bullet impact for trajectory debugging (requires 'r_visualizetraces' to be set!)");
|
||||
/*
|
||||
=====================
|
||||
BHit_f
|
||||
@ -616,13 +466,13 @@ void BHit_f(const CCommand& args)
|
||||
|
||||
g_pEngineTraceServer->TraceRay(ray, TRACE_MASK_NPCWORLDSTATIC, &trace);
|
||||
|
||||
g_pDebugOverlay->AddLineOverlay(trace.startpos, trace.endpos, 0, 255, 0, !bhit_depth_test->GetBool(), sv_visualizetraces_duration->GetFloat());
|
||||
g_pDebugOverlay->AddLineOverlay(trace.endpos, vecAbsEnd, 255, 0, 0, !bhit_depth_test->GetBool(), sv_visualizetraces_duration->GetFloat());
|
||||
g_pDebugOverlay->AddLineOverlay(trace.startpos, trace.endpos, 0, 255, 0, !bhit_depth_test.GetBool(), sv_visualizetraces_duration->GetFloat());
|
||||
g_pDebugOverlay->AddLineOverlay(trace.endpos, vecAbsEnd, 255, 0, 0, !bhit_depth_test.GetBool(), sv_visualizetraces_duration->GetFloat());
|
||||
}
|
||||
#endif // !CLIENT_DLL
|
||||
|
||||
#ifndef DEDICATED
|
||||
if (bhit_abs_origin->GetBool() && r_visualizetraces->GetBool())
|
||||
if (bhit_abs_origin.GetBool() && r_visualizetraces->GetBool())
|
||||
{
|
||||
const int iEnt = atoi(args[2]);
|
||||
if (const IClientEntity* pEntity = g_pClientEntityList->GetClientEntity(iEnt))
|
||||
@ -697,6 +547,11 @@ Cmd_Exec_f
|
||||
executes a cfg file
|
||||
=====================
|
||||
*/
|
||||
#ifndef DEDICATED
|
||||
static ConVar sv_quota_scriptExecsPerSecond("sv_quota_scriptExecsPerSecond", "3", FCVAR_REPLICATED | FCVAR_RELEASE,
|
||||
"How many script executions per second clients are allowed to submit, 0 to disable the limitation thereof.", true, 0.f, false, 0.f);
|
||||
#endif // !DEDICATED
|
||||
|
||||
void Cmd_Exec_f(const CCommand& args)
|
||||
{
|
||||
#ifndef DEDICATED
|
||||
@ -705,7 +560,7 @@ void Cmd_Exec_f(const CCommand& args)
|
||||
// flag users that patch them out.
|
||||
if (!ThreadInServerFrameThread() && g_pClientState->IsActive())
|
||||
{
|
||||
const int execQuota = sv_quota_scriptExecsPerSecond->GetInt();
|
||||
const int execQuota = sv_quota_scriptExecsPerSecond.GetInt();
|
||||
|
||||
if (execQuota > 0)
|
||||
{
|
||||
|
@ -6,8 +6,7 @@ inline bool(*v_SetupGamemode)(const char* pszPlayList);
|
||||
inline void(*v__Cmd_Exec_f)(const CCommand& args);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void MP_GameMode_Changed_f(IConVar* pConVar, const char* pOldString, float flOldValue);
|
||||
void MP_HostName_Changed_f(IConVar* pConVar, const char* pOldString, float flOldValue);
|
||||
void MP_GameMode_Changed_f(IConVar* pConVar, const char* pOldString);
|
||||
#ifndef CLIENT_DLL
|
||||
void Host_Changelevel_f(const CCommand& args);
|
||||
#endif // !CLIENT_DLL
|
||||
@ -15,26 +14,13 @@ void VPK_Pack_f(const CCommand& args);
|
||||
void VPK_Unpack_f(const CCommand& args);
|
||||
void VPK_Mount_f(const CCommand& args);
|
||||
void VPK_Unmount_f(const CCommand& args);
|
||||
void NET_SetKey_f(const CCommand& args);
|
||||
void NET_GenerateKey_f(const CCommand& args);
|
||||
void NET_UseRandomKeyChanged_f(IConVar* pConVar, const char* pOldString, float flOldValue);
|
||||
void NET_UseSocketsForLoopbackChanged_f(IConVar* pConVar, const char* pOldString, float flOldValue);
|
||||
void NET_UseSocketsForLoopbackChanged_f(IConVar* pConVar, const char* pOldString);
|
||||
#ifndef DEDICATED
|
||||
|
||||
void RCON_InputOnlyChanged_f(IConVar* pConVar, const char* pOldString, float flOldValue);
|
||||
|
||||
void GFX_NVN_Changed_f(IConVar* pConVar, const char* pOldString, float flOldValue);
|
||||
void GFX_NVN_Changed_f(IConVar* pConVar, const char* pOldString);
|
||||
#endif // !DEDICATED
|
||||
void RCON_PasswordChanged_f(IConVar* pConVar, const char* pOldString, float flOldValue);
|
||||
void LanguageChanged_f(IConVar* pConVar, const char* pOldString, float flOldValue);
|
||||
#ifndef CLIENT_DLL
|
||||
void RCON_WhiteListAddresChanged_f(IConVar* pConVar, const char* pOldString, float flOldValue);
|
||||
void RCON_ConnectionCountChanged_f(IConVar* pConVar, const char* pOldString, float flOldValue);
|
||||
void SQVM_ServerScript_f(const CCommand& args);
|
||||
#endif // !CLIENT_DLL
|
||||
void LanguageChanged_f(IConVar* pConVar, const char* pOldString);
|
||||
#ifndef DEDICATED
|
||||
void SQVM_ClientScript_f(const CCommand& args);
|
||||
void SQVM_UIScript_f(const CCommand& args);
|
||||
void Mat_CrossHair_f(const CCommand& args);
|
||||
void Line_f(const CCommand& args);
|
||||
void Sphere_f(const CCommand& args);
|
||||
@ -46,9 +32,6 @@ void CVHelp_f(const CCommand& args);
|
||||
void CVList_f(const CCommand& args);
|
||||
void CVDiff_f(const CCommand& args);
|
||||
void CVFlag_f(const CCommand& args);
|
||||
#ifndef CLIENT_DLL
|
||||
void CC_CreateFakePlayer_f(const CCommand& args);
|
||||
#endif // !CLIENT_DLL
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class VCallback : public IDetour
|
||||
{
|
||||
|
@ -10,9 +10,13 @@
|
||||
#include "callback.h"
|
||||
#include "global.h"
|
||||
|
||||
|
||||
ConVar curl_debug("curl_debug", "0", FCVAR_DEVELOPMENTONLY, "Determines whether or not to enable curl debug logging.", "1 = curl logs; 0 (zero) = no logs");
|
||||
ConVar curl_timeout("curl_timeout", "15", FCVAR_DEVELOPMENTONLY, "Maximum time in seconds a curl transfer operation could take.");
|
||||
ConVar ssl_verify_peer("ssl_verify_peer", "1", FCVAR_DEVELOPMENTONLY, "Verify the authenticity of the peer's SSL certificate.", "1 = curl verifies; 0 (zero) = no verification");
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// ENGINE |
|
||||
ConVar* sdk_fixedframe_tickinterval = nullptr;
|
||||
ConVar* single_frame_shutdown_for_reload = nullptr;
|
||||
ConVar* old_gather_props = nullptr;
|
||||
|
||||
@ -24,23 +28,12 @@ ConVar* fps_max = nullptr;
|
||||
ConVar* fps_max_vsync = nullptr;
|
||||
|
||||
#ifndef DEDICATED
|
||||
ConVar* fps_max_rt = nullptr;
|
||||
ConVar* fps_max_rt_tolerance = nullptr;
|
||||
ConVar* fps_max_rt_sleep_threshold = nullptr;
|
||||
ConVar* fps_max_gfx = nullptr;
|
||||
|
||||
ConVar* in_syncRT = nullptr;
|
||||
#endif // !DEDICATED
|
||||
|
||||
ConVar* base_tickinterval_sp = nullptr;
|
||||
ConVar* base_tickinterval_mp = nullptr;
|
||||
|
||||
// Taken from S15:
|
||||
ConVar* usercmd_frametime_max = nullptr;
|
||||
ConVar* usercmd_frametime_min = nullptr;
|
||||
|
||||
ConVar* usercmd_dualwield_enable = nullptr;
|
||||
|
||||
ConVar* staticProp_no_fade_scalar = nullptr;
|
||||
ConVar* staticProp_gather_size_weight = nullptr;
|
||||
|
||||
@ -49,7 +42,6 @@ ConVar* model_defaultFadeDistMin = nullptr;
|
||||
|
||||
ConVar* ip_cvar = nullptr;
|
||||
ConVar* hostname = nullptr;
|
||||
ConVar* hostdesc = nullptr;
|
||||
ConVar* hostip = nullptr;
|
||||
ConVar* hostport = nullptr;
|
||||
|
||||
@ -58,490 +50,78 @@ ConVar* host_timescale = nullptr;
|
||||
|
||||
ConVar* mp_gamemode = nullptr;
|
||||
|
||||
ConVar* rcon_address = nullptr;
|
||||
ConVar* rcon_password = nullptr;
|
||||
|
||||
ConVar* enable_CmdKeyValues = nullptr;
|
||||
|
||||
ConVar* r_debug_overlay_nodecay = nullptr;
|
||||
ConVar* r_debug_overlay_invisible = nullptr;
|
||||
ConVar* r_debug_overlay_wireframe = nullptr;
|
||||
ConVar* r_debug_draw_depth_test = nullptr;
|
||||
ConVar* r_drawWorldMeshes = nullptr;
|
||||
ConVar* r_drawWorldMeshesDepthOnly = nullptr;
|
||||
ConVar* r_drawWorldMeshesDepthAtTheEnd = nullptr;
|
||||
|
||||
#ifndef DEDICATED
|
||||
ConVar* r_visualizetraces = nullptr;
|
||||
ConVar* r_visualizetraces_duration = nullptr;
|
||||
|
||||
ConVar* gfx_nvnUseLowLatency = nullptr;
|
||||
ConVar* gfx_nvnUseLowLatencyBoost = nullptr;
|
||||
ConVar* gfx_nvnUseMarkersToOptimize = nullptr;
|
||||
#endif // !DEDICATED
|
||||
|
||||
ConVar* stream_overlay = nullptr;
|
||||
ConVar* stream_overlay_mode = nullptr;
|
||||
//-----------------------------------------------------------------------------
|
||||
// SHARED |
|
||||
ConVar* modsystem_enable = nullptr;
|
||||
ConVar* modsystem_debug = nullptr;
|
||||
|
||||
ConVar* eula_version = nullptr;
|
||||
ConVar* eula_version_accepted = nullptr;
|
||||
|
||||
ConVar* promo_version_accepted = nullptr;
|
||||
ConVar* language_cvar = nullptr;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// SERVER |
|
||||
#ifndef CLIENT_DLL
|
||||
ConVar* ai_ainDumpOnLoad = nullptr;
|
||||
ConVar* ai_ainDebugConnect = nullptr;
|
||||
ConVar* ai_script_nodes_draw = nullptr;
|
||||
ConVar* ai_script_nodes_draw_range = nullptr;
|
||||
ConVar* ai_script_nodes_draw_nearest = nullptr;
|
||||
|
||||
ConVar* navmesh_always_reachable = nullptr;
|
||||
ConVar* navmesh_debug_type = nullptr;
|
||||
ConVar* navmesh_debug_tile_range = nullptr;
|
||||
ConVar* navmesh_debug_camera_range = nullptr;
|
||||
#ifndef DEDICATED
|
||||
ConVar* navmesh_draw_bvtree = nullptr;
|
||||
ConVar* navmesh_draw_portal = nullptr;
|
||||
ConVar* navmesh_draw_polys = nullptr;
|
||||
ConVar* navmesh_draw_poly_bounds = nullptr;
|
||||
ConVar* navmesh_draw_poly_bounds_inner = nullptr;
|
||||
#endif // !DEDICATED
|
||||
|
||||
ConVar* sv_language = nullptr;
|
||||
|
||||
ConVar* sv_showconnecting = nullptr;
|
||||
ConVar* sv_globalBanlist = nullptr;
|
||||
ConVar* sv_pylonVisibility = nullptr;
|
||||
ConVar* sv_pylonRefreshRate = nullptr;
|
||||
ConVar* sv_banlistRefreshRate = nullptr;
|
||||
ConVar* sv_statusRefreshRate = nullptr;
|
||||
ConVar* sv_forceChatToTeamOnly = nullptr;
|
||||
|
||||
ConVar* sv_single_core_dedi = nullptr;
|
||||
|
||||
ConVar* sv_maxunlag = nullptr;
|
||||
ConVar* sv_unlag_clamp = nullptr;
|
||||
ConVar* sv_clockcorrection_msecs = nullptr;
|
||||
|
||||
ConVar* sv_updaterate_sp = nullptr;
|
||||
ConVar* sv_updaterate_mp = nullptr;
|
||||
|
||||
ConVar* sv_autoReloadRate = nullptr;
|
||||
|
||||
ConVar* sv_simulateBots = nullptr;
|
||||
ConVar* sv_showhitboxes = nullptr;
|
||||
ConVar* sv_stats = nullptr;
|
||||
|
||||
ConVar* sv_quota_stringCmdsPerSecond = nullptr;
|
||||
|
||||
ConVar* sv_validatePersonaName = nullptr;
|
||||
ConVar* sv_minPersonaNameLength = nullptr;
|
||||
ConVar* sv_maxPersonaNameLength = nullptr;
|
||||
|
||||
ConVar* sv_onlineAuthEnable = nullptr;
|
||||
ConVar* sv_onlineAuthValidateExpiry = nullptr;
|
||||
ConVar* sv_onlineAuthExpiryTolerance = nullptr;
|
||||
|
||||
ConVar* sv_onlineAuthValidateIssuedAt = nullptr;
|
||||
ConVar* sv_onlineAuthIssuedAtTolerance = nullptr;
|
||||
|
||||
ConVar* sv_voiceEcho = nullptr;
|
||||
ConVar* sv_voiceenable = nullptr;
|
||||
ConVar* sv_alltalk = nullptr;
|
||||
|
||||
ConVar* player_userCmdsQueueWarning = nullptr;
|
||||
|
||||
//#ifdef DEDICATED
|
||||
ConVar* sv_rcon_debug = nullptr;
|
||||
ConVar* sv_rcon_sendlogs = nullptr;
|
||||
//ConVar* sv_rcon_banpenalty = nullptr; // TODO
|
||||
ConVar* sv_rcon_maxfailures = nullptr;
|
||||
ConVar* sv_rcon_maxignores = nullptr;
|
||||
ConVar* sv_rcon_maxsockets = nullptr;
|
||||
ConVar* sv_rcon_maxconnections = nullptr;
|
||||
ConVar* sv_rcon_maxpacketsize = nullptr;
|
||||
ConVar* sv_rcon_whitelist_address = nullptr;
|
||||
//#endif // DEDICATED
|
||||
#endif // !CLIENT_DLL
|
||||
ConVar* sv_quota_scriptExecsPerSecond = nullptr;
|
||||
ConVar* sv_cheats = nullptr;
|
||||
ConVar* sv_visualizetraces = nullptr;
|
||||
ConVar* sv_visualizetraces_duration = nullptr;
|
||||
ConVar* bhit_enable = nullptr;
|
||||
ConVar* bhit_depth_test = nullptr;
|
||||
ConVar* bhit_abs_origin = nullptr;
|
||||
//-----------------------------------------------------------------------------
|
||||
// CLIENT |
|
||||
#ifndef DEDICATED
|
||||
ConVar* cl_rcon_inputonly = nullptr;
|
||||
ConVar* cl_quota_stringCmdsPerSecond = nullptr;
|
||||
|
||||
ConVar* cl_updaterate_mp = nullptr;
|
||||
|
||||
ConVar* cl_notify_invert_x = nullptr;
|
||||
ConVar* cl_notify_invert_y = nullptr;
|
||||
ConVar* cl_notify_offset_x = nullptr;
|
||||
ConVar* cl_notify_offset_y = nullptr;
|
||||
|
||||
ConVar* cl_showsimstats = nullptr;
|
||||
ConVar* cl_simstats_invert_x = nullptr;
|
||||
ConVar* cl_simstats_invert_y = nullptr;
|
||||
ConVar* cl_simstats_offset_x = nullptr;
|
||||
ConVar* cl_simstats_offset_y = nullptr;
|
||||
|
||||
ConVar* cl_showgpustats = nullptr;
|
||||
ConVar* cl_gpustats_invert_x = nullptr;
|
||||
ConVar* cl_gpustats_invert_y = nullptr;
|
||||
ConVar* cl_gpustats_offset_x = nullptr;
|
||||
ConVar* cl_gpustats_offset_y = nullptr;
|
||||
|
||||
ConVar* cl_showmaterialinfo = nullptr;
|
||||
ConVar* cl_materialinfo_offset_x = nullptr;
|
||||
ConVar* cl_materialinfo_offset_y = nullptr;
|
||||
|
||||
ConVar* cl_threaded_bone_setup = nullptr;
|
||||
|
||||
ConVar* cl_language = nullptr;
|
||||
|
||||
ConVar* cl_onlineAuthEnable = nullptr;
|
||||
ConVar* cl_onlineAuthToken = nullptr;
|
||||
ConVar* cl_onlineAuthTokenSignature1 = nullptr;
|
||||
ConVar* cl_onlineAuthTokenSignature2 = nullptr;
|
||||
|
||||
ConVar* con_drawnotify = nullptr;
|
||||
ConVar* con_notifylines = nullptr;
|
||||
ConVar* con_notifytime = nullptr;
|
||||
|
||||
ConVar* con_notify_invert_x = nullptr;
|
||||
ConVar* con_notify_invert_y = nullptr;
|
||||
ConVar* con_notify_offset_x = nullptr;
|
||||
ConVar* con_notify_offset_y = nullptr;
|
||||
|
||||
ConVar* con_notify_script_server_clr = nullptr;
|
||||
ConVar* con_notify_script_client_clr = nullptr;
|
||||
ConVar* con_notify_script_ui_clr = nullptr;
|
||||
ConVar* con_notify_native_server_clr = nullptr;
|
||||
ConVar* con_notify_native_client_clr = nullptr;
|
||||
ConVar* con_notify_native_ui_clr = nullptr;
|
||||
ConVar* con_notify_native_engine_clr = nullptr;
|
||||
ConVar* con_notify_native_fs_clr = nullptr;
|
||||
ConVar* con_notify_native_rtech_clr = nullptr;
|
||||
ConVar* con_notify_native_ms_clr = nullptr;
|
||||
ConVar* con_notify_native_audio_clr = nullptr;
|
||||
ConVar* con_notify_native_video_clr = nullptr;
|
||||
ConVar* con_notify_netcon_clr = nullptr;
|
||||
ConVar* con_notify_common_clr = nullptr;
|
||||
ConVar* con_notify_warning_clr = nullptr;
|
||||
ConVar* con_notify_error_clr = nullptr;
|
||||
|
||||
ConVar* con_max_lines = nullptr;
|
||||
ConVar* con_max_history = nullptr;
|
||||
ConVar* con_suggest_limit = nullptr;
|
||||
ConVar* con_suggest_showhelptext = nullptr;
|
||||
ConVar* con_suggest_showflags = nullptr;
|
||||
|
||||
ConVar* origin_disconnectWhenOffline = nullptr;
|
||||
ConVar* discord_updatePresence = nullptr;
|
||||
|
||||
ConVar* settings_reflex = nullptr;
|
||||
ConVar* serverbrowser_hideEmptyServers = nullptr;
|
||||
ConVar* serverbrowser_mapFilter = nullptr;
|
||||
ConVar* serverbrowser_gamemodeFilter = nullptr;
|
||||
#endif // !DEDICATED
|
||||
//-----------------------------------------------------------------------------
|
||||
// FILESYSTEM |
|
||||
ConVar* fs_showWarnings = nullptr;
|
||||
ConVar* fs_showAllReads = nullptr;
|
||||
ConVar* fs_packedstore_entryblock_stats = nullptr;
|
||||
ConVar* fs_packedstore_workspace = nullptr;
|
||||
ConVar* fs_packedstore_compression_level = nullptr;
|
||||
ConVar* fs_packedstore_max_helper_threads = nullptr;
|
||||
//-----------------------------------------------------------------------------
|
||||
// MATERIALSYSTEM |
|
||||
#ifndef DEDICATED
|
||||
ConVar* mat_alwaysComplain = nullptr;
|
||||
#endif // !DEDICATED
|
||||
//-----------------------------------------------------------------------------
|
||||
// SQUIRREL |
|
||||
ConVar* script_show_output = nullptr;
|
||||
ConVar* script_show_warning = nullptr;
|
||||
//-----------------------------------------------------------------------------
|
||||
// NETCHANNEL |
|
||||
ConVar* net_tracePayload = nullptr;
|
||||
ConVar* net_encryptionEnable = nullptr;
|
||||
ConVar* net_useRandomKey = nullptr;
|
||||
ConVar* net_usesocketsforloopback = nullptr;
|
||||
ConVar* net_processTimeBudget = nullptr;
|
||||
|
||||
ConVar* net_usesocketsforloopback;
|
||||
ConVar* net_data_block_enabled = nullptr;
|
||||
ConVar* net_datablock_networkLossForSlowSpeed = nullptr;
|
||||
ConVar* net_compressDataBlock = nullptr;
|
||||
ConVar* net_compressDataBlockLzAcceleration = nullptr;
|
||||
|
||||
ConVar* pylon_matchmaking_hostname = nullptr;
|
||||
ConVar* pylon_host_update_interval = nullptr;
|
||||
ConVar* pylon_showdebuginfo = nullptr;
|
||||
|
||||
ConVar* ssl_verify_peer = nullptr;
|
||||
ConVar* curl_timeout = nullptr;
|
||||
ConVar* curl_debug = nullptr;
|
||||
//-----------------------------------------------------------------------------
|
||||
// RTECH API |
|
||||
ConVar* async_debug_level = nullptr;
|
||||
ConVar* async_debug_close = nullptr;
|
||||
ConVar* pak_debugrelations = nullptr;
|
||||
//-----------------------------------------------------------------------------
|
||||
// RUI |
|
||||
#ifndef DEDICATED
|
||||
ConVar* rui_drawEnable = nullptr;
|
||||
ConVar* rui_defaultDebugFontFace = nullptr;
|
||||
#endif // !DEDICATED
|
||||
//-----------------------------------------------------------------------------
|
||||
// MILES |
|
||||
#ifndef DEDICATED
|
||||
ConVar* miles_debug = nullptr;
|
||||
ConVar* miles_language = nullptr;
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: initialize ConVar's
|
||||
//-----------------------------------------------------------------------------
|
||||
void ConVar_StaticInit(void)
|
||||
{
|
||||
//-------------------------------------------------------------------------
|
||||
// ENGINE |
|
||||
hostdesc = ConVar::StaticCreate("hostdesc", "", FCVAR_RELEASE, "Host game server description.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
sdk_fixedframe_tickinterval = ConVar::StaticCreate("sdk_fixedframe_tickinterval", "0.01", FCVAR_RELEASE, "The tick interval used by the SDK fixed frame.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
|
||||
curl_debug = ConVar::StaticCreate("curl_debug" , "0" , FCVAR_DEVELOPMENTONLY, "Determines whether or not to enable curl debug logging.", false, 0.f, false, 0.f, nullptr, "1 = curl logs; 0 (zero) = no logs");
|
||||
curl_timeout = ConVar::StaticCreate("curl_timeout" , "15", FCVAR_DEVELOPMENTONLY, "Maximum time in seconds a curl transfer operation could take.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
ssl_verify_peer = ConVar::StaticCreate("ssl_verify_peer", "1" , FCVAR_DEVELOPMENTONLY, "Verify the authenticity of the peer's SSL certificate.", false, 0.f, false, 0.f, nullptr, "1 = curl verifies; 0 (zero) = no verification");
|
||||
|
||||
rcon_address = ConVar::StaticCreate("rcon_address", "[loopback]:37015", FCVAR_SERVER_CANNOT_QUERY | FCVAR_DONTRECORD | FCVAR_RELEASE, "Remote server access address.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
rcon_password = ConVar::StaticCreate("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, &RCON_PasswordChanged_f, nullptr);
|
||||
|
||||
enable_CmdKeyValues = ConVar::StaticCreate("enable_CmdKeyValues", "0", FCVAR_DEVELOPMENTONLY, "Toggle CmdKeyValues transmit and receive.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
|
||||
r_debug_overlay_nodecay = ConVar::StaticCreate("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);
|
||||
r_debug_overlay_invisible = ConVar::StaticCreate("r_debug_overlay_invisible" , "1", FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT, "Show invisible debug overlays (alpha < 1 = 255).", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
r_debug_overlay_wireframe = ConVar::StaticCreate("r_debug_overlay_wireframe" , "1", FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT, "Use wireframe in debug overlay.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
r_debug_draw_depth_test = ConVar::StaticCreate("r_debug_draw_depth_test" , "1", FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT, "Toggle depth test for other debug draw functionality.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
r_drawWorldMeshes = ConVar::StaticCreate("r_drawWorldMeshes" , "1", FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT, "Render world meshes.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
r_drawWorldMeshesDepthOnly = ConVar::StaticCreate("r_drawWorldMeshesDepthOnly" , "1", FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT, "Render world meshes (depth only).", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
r_drawWorldMeshesDepthAtTheEnd = ConVar::StaticCreate("r_drawWorldMeshesDepthAtTheEnd", "1", FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT, "Render world meshes (depth at the end).", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
|
||||
#ifndef DEDICATED
|
||||
fps_max_rt = ConVar::StaticCreate("fps_max_rt", "0", FCVAR_RELEASE, "Frame rate limiter within the render thread. -1 indicates use the desktop refresh. 0 is disabled.", true, -1.f, true, 295.f, nullptr, nullptr);
|
||||
fps_max_rt_tolerance = ConVar::StaticCreate("fps_max_rt_tolerance", "0.25", FCVAR_RELEASE, "Maximum amount of frame time before frame limiter restarts.", true, 0.f, false, 0.f, nullptr, nullptr);
|
||||
fps_max_rt_sleep_threshold = ConVar::StaticCreate("fps_max_rt_sleep_threshold", "0.016666667", FCVAR_RELEASE, "Frame limiter starts to sleep when frame time exceeds this threshold.", true, 0.f, false, 0.f, nullptr, nullptr);
|
||||
|
||||
fps_max_gfx = ConVar::StaticCreate("fps_max_gfx", "0", FCVAR_RELEASE, "Frame rate limiter using NVIDIA Reflex Low Latency SDK. -1 indicates use the desktop refresh. 0 is disabled.", true, -1.f, true, 295.f, &GFX_NVN_Changed_f, nullptr);
|
||||
gfx_nvnUseLowLatency = ConVar::StaticCreate("gfx_nvnUseLowLatency" , "1", FCVAR_RELEASE | FCVAR_ARCHIVE, "Enables NVIDIA Reflex Low Latency SDK." , false, 0.f, false, 0.f, &GFX_NVN_Changed_f, nullptr);
|
||||
gfx_nvnUseLowLatencyBoost = ConVar::StaticCreate("gfx_nvnUseLowLatencyBoost" , "0", FCVAR_RELEASE | FCVAR_ARCHIVE, "Enables NVIDIA Reflex Low Latency Boost.", false, 0.f, false, 0.f, &GFX_NVN_Changed_f, nullptr);
|
||||
|
||||
// NOTE: defaulted to 0 as it causes rubber banding on some hardware.
|
||||
gfx_nvnUseMarkersToOptimize = ConVar::StaticCreate("gfx_nvnUseMarkersToOptimize", "0", FCVAR_RELEASE , "Use NVIDIA Reflex Low Latency markers to optimize (requires Low Latency Boost to be enabled).", false, 0.f, false, 0.f, &GFX_NVN_Changed_f, nullptr);
|
||||
#endif // !DEDICATED
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// SHARED |
|
||||
modsystem_enable = ConVar::StaticCreate("modsystem_enable", "1", FCVAR_RELEASE, "Enable the modsystem.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
modsystem_debug = ConVar::StaticCreate("modsystem_debug" , "0", FCVAR_RELEASE, "Debug the modsystem." , false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
|
||||
// NOTE: if we want to make a certain promo only show once, add the playerprofile flag to the cvar below. Current behavior = always show after game restart.
|
||||
promo_version_accepted = ConVar::StaticCreate("promo_version_accepted", "0", FCVAR_RELEASE, "The accepted promo version.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// SERVER |
|
||||
#ifndef CLIENT_DLL
|
||||
ai_ainDumpOnLoad = ConVar::StaticCreate("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 = ConVar::StaticCreate("ai_ainDebugConnect" , "0", FCVAR_DEVELOPMENTONLY, "Debug AIN node connections.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
ai_script_nodes_draw_range = ConVar::StaticCreate("ai_script_nodes_draw_range" , "0", FCVAR_DEVELOPMENTONLY, "Debug draw AIN script nodes ranging from shift index to this cvar.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
ai_script_nodes_draw_nearest = ConVar::StaticCreate("ai_script_nodes_draw_nearest", "1", FCVAR_DEVELOPMENTONLY, "Debug draw AIN script node links to nearest node (build order is used if null).", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
|
||||
navmesh_always_reachable = ConVar::StaticCreate("navmesh_always_reachable" , "0" , FCVAR_DEVELOPMENTONLY, "Marks goal poly from agent poly as reachable regardless of table data ( !slower! ).", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
navmesh_debug_type = ConVar::StaticCreate("navmesh_debug_type" , "0" , FCVAR_DEVELOPMENTONLY, "NavMesh debug draw hull index.", true, 0.f, true, 4.f, nullptr, "0 = small, 1 = med_short, 2 = medium, 3 = large, 4 = extra large");
|
||||
navmesh_debug_tile_range = ConVar::StaticCreate("navmesh_debug_tile_range" , "0" , FCVAR_DEVELOPMENTONLY, "NavMesh debug draw tiles ranging from shift index to this cvar.", true, 0.f, false, 0.f, nullptr, nullptr);
|
||||
navmesh_debug_camera_range = ConVar::StaticCreate("navmesh_debug_camera_range" , "2000" , FCVAR_DEVELOPMENTONLY, "Only debug draw tiles within this distance from camera origin.", true, 0.f, false, 0.f, nullptr, nullptr);
|
||||
#ifndef DEDICATED
|
||||
navmesh_draw_bvtree = ConVar::StaticCreate("navmesh_draw_bvtree" , "-1", FCVAR_DEVELOPMENTONLY, "Draws the BVTree of the NavMesh tiles.", false, 0.f, false, 0.f, nullptr, "Index: >= 0 && < mesh->m_tileCount");
|
||||
navmesh_draw_portal = ConVar::StaticCreate("navmesh_draw_portal" , "-1", FCVAR_DEVELOPMENTONLY, "Draws the portal of the NavMesh tiles.", false, 0.f, false, 0.f, nullptr, "Index: >= 0 && < mesh->m_tileCount");
|
||||
navmesh_draw_polys = ConVar::StaticCreate("navmesh_draw_polys" , "-1", FCVAR_DEVELOPMENTONLY, "Draws the polys of the NavMesh tiles.", false, 0.f, false, 0.f, nullptr, "Index: >= 0 && < mesh->m_tileCount");
|
||||
navmesh_draw_poly_bounds = ConVar::StaticCreate("navmesh_draw_poly_bounds" , "-1", FCVAR_DEVELOPMENTONLY, "Draws the bounds of the NavMesh polys.", false, 0.f, false, 0.f, nullptr, "Index: >= 0 && < mesh->m_tileCount");
|
||||
navmesh_draw_poly_bounds_inner = ConVar::StaticCreate("navmesh_draw_poly_bounds_inner" , "0" , FCVAR_DEVELOPMENTONLY, "Draws the inner bounds of the NavMesh polys (requires navmesh_draw_poly_bounds).", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
#endif // !DEDICATED
|
||||
|
||||
sv_language = ConVar::StaticCreate("sv_language", "english", FCVAR_RELEASE, "Language of the server. Sent to MasterServer for localising error messages.", false, 0.f, false, 0.f, LanguageChanged_f, nullptr);
|
||||
|
||||
sv_unlag_clamp = ConVar::StaticCreate("sv_unlag_clamp", "0", FCVAR_RELEASE, "Clamp the difference between the current time and received command time to sv_maxunlag + sv_clockcorrection_msecs.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
|
||||
sv_showconnecting = ConVar::StaticCreate("sv_showconnecting" , "1", FCVAR_RELEASE, "Logs information about the connecting client to the console.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
sv_globalBanlist = ConVar::StaticCreate("sv_globalBanlist" , "1", FCVAR_RELEASE, "Determines whether or not to use the global banned list.", false, 0.f, false, 0.f, nullptr, "0 = Disable, 1 = Enable.");
|
||||
sv_pylonVisibility = ConVar::StaticCreate("sv_pylonVisibility", "0", FCVAR_RELEASE, "Determines the visibility to the Pylon master server.", false, 0.f, false, 0.f, nullptr, "0 = Offline, 1 = Hidden, 2 = Public.");
|
||||
sv_pylonRefreshRate = ConVar::StaticCreate("sv_pylonRefreshRate" , "5.0" , FCVAR_DEVELOPMENTONLY, "Pylon host refresh rate (seconds).", true, 2.f, true, 8.f, nullptr, nullptr);
|
||||
sv_banlistRefreshRate = ConVar::StaticCreate("sv_banlistRefreshRate", "30.0", FCVAR_DEVELOPMENTONLY, "Banned list refresh rate (seconds).", true, 1.f, false, 0.f, nullptr, nullptr);
|
||||
sv_statusRefreshRate = ConVar::StaticCreate("sv_statusRefreshRate" , "0.5", FCVAR_RELEASE, "Server status refresh rate (seconds).", true, 0.f, false, 0.f, nullptr, nullptr);
|
||||
sv_autoReloadRate = ConVar::StaticCreate("sv_autoReloadRate" , "0" , FCVAR_RELEASE, "Time in seconds between each server auto-reload (disabled if null).", true, 0.f, false, 0.f, nullptr, nullptr);
|
||||
sv_simulateBots = ConVar::StaticCreate("sv_simulateBots", "1", FCVAR_RELEASE, "Simulate user commands for bots on the server.", true, 0.f, false, 0.f, nullptr, nullptr);
|
||||
|
||||
sv_rcon_debug = ConVar::StaticCreate("sv_rcon_debug" , "0" , FCVAR_RELEASE, "Show rcon debug information ( !slower! ).", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
sv_rcon_sendlogs = ConVar::StaticCreate("sv_rcon_sendlogs" , "0" , FCVAR_RELEASE, "Network console logs to connected and authenticated sockets.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
//sv_rcon_banpenalty = ConVar::StaticCreate("sv_rcon_banpenalty" , "10", FCVAR_RELEASE, "Number of minutes to ban users who fail rcon authentication.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
sv_rcon_maxfailures = ConVar::StaticCreate("sv_rcon_maxfailures", "10", FCVAR_RELEASE, "Max number of times an user can fail rcon authentication before being banned.", true, 1.f, false, 0.f, nullptr, nullptr);
|
||||
sv_rcon_maxignores = ConVar::StaticCreate("sv_rcon_maxignores" , "15", FCVAR_RELEASE, "Max number of times an user can ignore the instruction message before being banned.", true, 1.f, false, 0.f, nullptr, nullptr);
|
||||
sv_rcon_maxsockets = ConVar::StaticCreate("sv_rcon_maxsockets" , "32", FCVAR_RELEASE, "Max number of accepted sockets before the server starts closing redundant sockets.", true, 1.f, true, MAX_PLAYERS, nullptr, nullptr);
|
||||
sv_rcon_maxconnections = ConVar::StaticCreate("sv_rcon_maxconnections" , "1" , FCVAR_RELEASE, "Max number of authenticated connections before the server closes the listen socket.", true, 1.f, true, MAX_PLAYERS, &RCON_ConnectionCountChanged_f, nullptr);
|
||||
sv_rcon_maxpacketsize = ConVar::StaticCreate("sv_rcon_maxpacketsize" , "1024", FCVAR_RELEASE, "Max number of bytes allowed in a command packet from a non-authenticated netconsole.", true, 0.f, false, 0.f, nullptr, nullptr);
|
||||
sv_rcon_whitelist_address = ConVar::StaticCreate("sv_rcon_whitelist_address", "" , FCVAR_RELEASE, "This address is not considered a 'redundant' socket and will never be banned for failed authentication attempts.", false, 0.f, false, 0.f, &RCON_WhiteListAddresChanged_f, "Format: '::ffff:127.0.0.1'");
|
||||
|
||||
sv_quota_stringCmdsPerSecond = ConVar::StaticCreate("sv_quota_stringCmdsPerSecond", "16", FCVAR_RELEASE, "How many string commands per second clients are allowed to submit, 0 to disallow all string commands.", true, 0.f, false, 0.f, nullptr, nullptr);
|
||||
sv_validatePersonaName = ConVar::StaticCreate("sv_validatePersonaName" , "1" , FCVAR_RELEASE, "Validate the client's textual persona name on connect.", true, 0.f, false, 0.f, nullptr, nullptr);
|
||||
sv_minPersonaNameLength = ConVar::StaticCreate("sv_minPersonaNameLength", "4" , FCVAR_RELEASE, "The minimum length of the client's textual persona name.", true, 0.f, false, 0.f, nullptr, nullptr);
|
||||
sv_maxPersonaNameLength = ConVar::StaticCreate("sv_maxPersonaNameLength", "16", FCVAR_RELEASE, "The maximum length of the client's textual persona name.", true, 0.f, false, 0.f, nullptr, nullptr);
|
||||
|
||||
sv_onlineAuthEnable = ConVar::StaticCreate("sv_onlineAuthEnable" , "1" , FCVAR_RELEASE, "Enables the server-side online authentication system.", true, 0.f, true, 1.f, nullptr, nullptr);
|
||||
sv_onlineAuthValidateExpiry = ConVar::StaticCreate("sv_onlineAuthValidateExpiry" , "1" , FCVAR_RELEASE, "Validate the online authentication token 'expiry' claim.", true, 0.f, true, 1.f, nullptr, nullptr);
|
||||
sv_onlineAuthExpiryTolerance = ConVar::StaticCreate("sv_onlineAuthExpiryTolerance" , "1" , FCVAR_RELEASE, "The online authentication token 'expiry' claim tolerance in seconds.", true, 0.f, true, float(UINT8_MAX), nullptr, "Must range between [0,255]");
|
||||
sv_onlineAuthValidateIssuedAt = ConVar::StaticCreate("sv_onlineAuthValidateIssuedAt" , "1" , FCVAR_RELEASE, "Validate the online authentication token 'issued at' claim.", true, 0.f, true, 1.f, nullptr, nullptr);
|
||||
sv_onlineAuthIssuedAtTolerance = ConVar::StaticCreate("sv_onlineAuthIssuedAtTolerance", "30", FCVAR_RELEASE, "The online authentication token 'issued at' claim tolerance in seconds.", true, 0.f, true, float(UINT8_MAX), nullptr, "Must range between [0,255]");
|
||||
#endif // !CLIENT_DLL
|
||||
sv_quota_scriptExecsPerSecond = ConVar::StaticCreate("sv_quota_scriptExecsPerSecond", "4", FCVAR_REPLICATED | FCVAR_RELEASE, "How many script executions per second clients are allowed to submit, 0 to disable the limitation thereof.", true, 0.f, false, 0.f, nullptr, nullptr);
|
||||
|
||||
bhit_depth_test = ConVar::StaticCreate("bhit_depth_test", "0", FCVAR_DEVELOPMENTONLY | FCVAR_REPLICATED, "Use depth test for bullet ray trace overlay.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
bhit_abs_origin = ConVar::StaticCreate("bhit_abs_origin", "1", FCVAR_DEVELOPMENTONLY | FCVAR_REPLICATED, "Draw entity's predicted abs origin upon bullet impact for trajectory debugging (requires 'r_visualizetraces' to be set!).", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// CLIENT |
|
||||
#ifndef DEDICATED
|
||||
cl_rcon_inputonly = ConVar::StaticCreate("cl_rcon_inputonly", "0" , FCVAR_RELEASE, "Tells the rcon server whether or not we are input only.", false, 0.f, false, 0.f, RCON_InputOnlyChanged_f, nullptr);
|
||||
cl_quota_stringCmdsPerSecond = ConVar::StaticCreate("cl_quota_stringCmdsPerSecond", "16" , FCVAR_RELEASE, "How many string commands per second user is allowed to submit, 0 to allow all submissions.", true, 0.f, false, 0.f, nullptr, nullptr);
|
||||
|
||||
cl_notify_invert_x = ConVar::StaticCreate("cl_notify_invert_x", "0", FCVAR_DEVELOPMENTONLY, "Inverts the X offset for console notify debug overlay.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
cl_notify_invert_y = ConVar::StaticCreate("cl_notify_invert_y", "0", FCVAR_DEVELOPMENTONLY, "Inverts the Y offset for console notify debug overlay.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
cl_notify_offset_x = ConVar::StaticCreate("cl_notify_offset_x", "10", FCVAR_DEVELOPMENTONLY, "X offset for console notify debug overlay.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
cl_notify_offset_y = ConVar::StaticCreate("cl_notify_offset_y", "10", FCVAR_DEVELOPMENTONLY, "Y offset for console notify debug overlay.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
|
||||
cl_showsimstats = ConVar::StaticCreate("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_x = ConVar::StaticCreate("cl_simstats_invert_x", "1" , FCVAR_DEVELOPMENTONLY, "Inverts the X offset for simulation debug overlay.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
cl_simstats_invert_y = ConVar::StaticCreate("cl_simstats_invert_y", "1" , FCVAR_DEVELOPMENTONLY, "Inverts the Y offset for simulation debug overlay.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
cl_simstats_offset_x = ConVar::StaticCreate("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 = ConVar::StaticCreate("cl_simstats_offset_y", "120", FCVAR_DEVELOPMENTONLY, "Y offset for simulation debug overlay.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
|
||||
cl_showgpustats = ConVar::StaticCreate("cl_showgpustats" , "0", FCVAR_DEVELOPMENTONLY, "Texture streaming debug overlay.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
cl_gpustats_invert_x = ConVar::StaticCreate("cl_gpustats_invert_x", "1", FCVAR_DEVELOPMENTONLY, "Inverts the X offset for texture streaming debug overlay.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
cl_gpustats_invert_y = ConVar::StaticCreate("cl_gpustats_invert_y", "1", FCVAR_DEVELOPMENTONLY, "Inverts the Y offset for texture streaming debug overlay.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
cl_gpustats_offset_x = ConVar::StaticCreate("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 = ConVar::StaticCreate("cl_gpustats_offset_y", "105", FCVAR_DEVELOPMENTONLY, "Y offset for texture streaming debug overlay.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
|
||||
cl_showmaterialinfo = ConVar::StaticCreate("cl_showmaterialinfo" , "0" , FCVAR_DEVELOPMENTONLY, "Draw info for the material under the crosshair on screen.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
cl_materialinfo_offset_x = ConVar::StaticCreate("cl_materialinfo_offset_x", "0" , FCVAR_DEVELOPMENTONLY, "X offset for material debug info overlay.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
cl_materialinfo_offset_y = ConVar::StaticCreate("cl_materialinfo_offset_y", "420", FCVAR_DEVELOPMENTONLY, "Y offset for material debug info overlay.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
|
||||
cl_onlineAuthEnable = ConVar::StaticCreate("cl_onlineAuthEnable" ,"1", FCVAR_RELEASE, "Enables the client-side online authentication system.", true, 0.f, true, 1.f, nullptr, nullptr);
|
||||
cl_onlineAuthToken = ConVar::StaticCreate("cl_onlineAuthToken" , "", FCVAR_HIDDEN | FCVAR_USERINFO | FCVAR_DONTRECORD | FCVAR_SERVER_CANNOT_QUERY | FCVAR_PLATFORM_SYSTEM, "The client's online authentication token.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
cl_onlineAuthTokenSignature1 = ConVar::StaticCreate("cl_onlineAuthTokenSignature1", "", FCVAR_HIDDEN | FCVAR_USERINFO | FCVAR_DONTRECORD | FCVAR_SERVER_CANNOT_QUERY | FCVAR_PLATFORM_SYSTEM, "The client's online authentication token signature.", false, 0.f, false, 0.f, nullptr, "Primary");
|
||||
cl_onlineAuthTokenSignature2 = ConVar::StaticCreate("cl_onlineAuthTokenSignature2", "", FCVAR_HIDDEN | FCVAR_USERINFO | FCVAR_DONTRECORD | FCVAR_SERVER_CANNOT_QUERY | FCVAR_PLATFORM_SYSTEM, "The client's online authentication token signature.", false, 0.f, false, 0.f, nullptr, "Secondary");
|
||||
|
||||
con_drawnotify = ConVar::StaticCreate("con_drawnotify", "0", FCVAR_RELEASE, "Draws the RUI console to the hud.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
con_notifylines = ConVar::StaticCreate("con_notifylines" , "3" , FCVAR_MATERIAL_SYSTEM_THREAD, "Number of console lines to overlay for debugging.", true, 1.f, false, 0.f, nullptr, nullptr);
|
||||
con_notifytime = ConVar::StaticCreate("con_notifytime" , "6" , FCVAR_MATERIAL_SYSTEM_THREAD, "How long to display recent console text to the upper part of the game window.", false, 1.f, false, 50.f, nullptr, nullptr);
|
||||
|
||||
con_notify_invert_x = ConVar::StaticCreate("con_notify_invert_x", "0" , FCVAR_MATERIAL_SYSTEM_THREAD, "Inverts the X offset for RUI console overlay.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
con_notify_invert_y = ConVar::StaticCreate("con_notify_invert_y", "0" , FCVAR_MATERIAL_SYSTEM_THREAD, "Inverts the Y offset for RUI console overlay.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
con_notify_offset_x = ConVar::StaticCreate("con_notify_offset_x", "10", FCVAR_MATERIAL_SYSTEM_THREAD, "X offset for RUI console overlay.", false, 1.f, false, 50.f, nullptr, nullptr);
|
||||
con_notify_offset_y = ConVar::StaticCreate("con_notify_offset_y", "10", FCVAR_MATERIAL_SYSTEM_THREAD, "Y offset for RUI console overlay.", false, 1.f, false, 50.f, nullptr, nullptr);
|
||||
|
||||
con_notify_script_server_clr = ConVar::StaticCreate("con_notify_script_server_clr", "130 120 245 255", FCVAR_MATERIAL_SYSTEM_THREAD, "Script SERVER VM RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr);
|
||||
con_notify_script_client_clr = ConVar::StaticCreate("con_notify_script_client_clr", "117 116 139 255", FCVAR_MATERIAL_SYSTEM_THREAD, "Script CLIENT VM RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr);
|
||||
con_notify_script_ui_clr = ConVar::StaticCreate("con_notify_script_ui_clr" , "200 110 110 255", FCVAR_MATERIAL_SYSTEM_THREAD, "Script UI VM RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr);
|
||||
|
||||
con_notify_native_server_clr = ConVar::StaticCreate("con_notify_native_server_clr", "20 50 248 255" , FCVAR_MATERIAL_SYSTEM_THREAD, "Native SERVER RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr);
|
||||
con_notify_native_client_clr = ConVar::StaticCreate("con_notify_native_client_clr", "70 70 70 255" , FCVAR_MATERIAL_SYSTEM_THREAD, "Native CLIENT RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr);
|
||||
con_notify_native_ui_clr = ConVar::StaticCreate("con_notify_native_ui_clr" , "200 60 60 255" , FCVAR_MATERIAL_SYSTEM_THREAD, "Native UI RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr);
|
||||
con_notify_native_engine_clr = ConVar::StaticCreate("con_notify_native_engine_clr", "255 255 255 255", FCVAR_MATERIAL_SYSTEM_THREAD, "Native engine RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr);
|
||||
con_notify_native_fs_clr = ConVar::StaticCreate("con_notify_native_fs_clr" , "0 100 225 255" , FCVAR_MATERIAL_SYSTEM_THREAD, "Native FileSystem RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr);
|
||||
con_notify_native_rtech_clr = ConVar::StaticCreate("con_notify_native_rtech_clr" , "25 120 20 255" , FCVAR_MATERIAL_SYSTEM_THREAD, "Native RTech RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr);
|
||||
con_notify_native_ms_clr = ConVar::StaticCreate("con_notify_native_ms_clr" , "200 20 180 255" , FCVAR_MATERIAL_SYSTEM_THREAD, "Native MaterialSystem RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr);
|
||||
con_notify_native_audio_clr = ConVar::StaticCreate("con_notify_native_audio_clr" , "238 43 10 255" , FCVAR_MATERIAL_SYSTEM_THREAD, "Native AudioSystem RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr);
|
||||
con_notify_native_video_clr = ConVar::StaticCreate("con_notify_native_video_clr" , "115 0 235 255" , FCVAR_MATERIAL_SYSTEM_THREAD, "Native VideoSystem RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr);
|
||||
|
||||
con_notify_netcon_clr = ConVar::StaticCreate("con_notify_netcon_clr" , "255 255 255 255", FCVAR_MATERIAL_SYSTEM_THREAD, "Netconsole RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr);
|
||||
con_notify_common_clr = ConVar::StaticCreate("con_notify_common_clr" , "255 140 80 255" , FCVAR_MATERIAL_SYSTEM_THREAD, "Common RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr);
|
||||
|
||||
con_notify_warning_clr = ConVar::StaticCreate("con_notify_warning_clr", "180 180 20 255", FCVAR_MATERIAL_SYSTEM_THREAD, "Warning RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr);
|
||||
con_notify_error_clr = ConVar::StaticCreate("con_notify_error_clr" , "225 20 20 255" , FCVAR_MATERIAL_SYSTEM_THREAD, "Error RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr);
|
||||
|
||||
con_max_lines = ConVar::StaticCreate("con_max_lines" , "1024", FCVAR_DEVELOPMENTONLY, "Maximum number of lines in the console before cleanup starts.", true, 1.f, false, 0.f, nullptr, nullptr);
|
||||
con_max_history = ConVar::StaticCreate("con_max_history" , "512" , FCVAR_DEVELOPMENTONLY, "Maximum number of command submission items before history cleanup starts.", true, 0.f, false, 0.f, nullptr, nullptr);
|
||||
con_suggest_limit = ConVar::StaticCreate("con_suggest_limit" , "128" , FCVAR_DEVELOPMENTONLY, "Maximum number of suggestions the autocomplete window will show for the console.", true, 0.f, false, 0.f, nullptr, nullptr);
|
||||
con_suggest_showhelptext = ConVar::StaticCreate("con_suggest_showhelptext" , "1" , FCVAR_DEVELOPMENTONLY, "Show CommandBase help text in autocomplete window.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
con_suggest_showflags = ConVar::StaticCreate("con_suggest_showflags" , "1" , FCVAR_DEVELOPMENTONLY, "Show CommandBase flags in autocomplete window.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
|
||||
settings_reflex = ConVar::StaticCreate("settings_reflex", "1", FCVAR_RELEASE, "Selected NVIDIA Reflex mode.", false, 0.f, false, 0.f, nullptr, "0 = Off. 1 = On. 2 = On + Boost.");
|
||||
serverbrowser_hideEmptyServers = ConVar::StaticCreate("serverbrowser_hideEmptyServers", "0", FCVAR_RELEASE, "Hide empty servers in the server browser.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
serverbrowser_mapFilter = ConVar::StaticCreate("serverbrowser_mapFilter", "0", FCVAR_RELEASE, "Filter servers by map in the server browser.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
serverbrowser_gamemodeFilter = ConVar::StaticCreate("serverbrowser_gamemodeFilter", "0", FCVAR_RELEASE, "Filter servers by gamemode in the server browser.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
|
||||
#endif // !DEDICATED
|
||||
// Taken from S15:
|
||||
usercmd_frametime_max = ConVar::StaticCreate("usercmd_frametime_max", "0.100", FCVAR_REPLICATED | FCVAR_DEVELOPMENTONLY, "The largest amount of simulation seconds a UserCmd can have.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
usercmd_frametime_min = ConVar::StaticCreate("usercmd_frametime_min", "0.002857", FCVAR_REPLICATED | FCVAR_DEVELOPMENTONLY, "The smallest amount of simulation seconds a UserCmd can have.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
|
||||
usercmd_dualwield_enable = ConVar::StaticCreate("usercmd_dualwield_enable", "0", FCVAR_REPLICATED | FCVAR_RELEASE, "Allows setting dual wield cycle slots, and activating multiple inventory weapons from UserCmd.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
//-------------------------------------------------------------------------
|
||||
// FILESYSTEM |
|
||||
fs_showWarnings = ConVar::StaticCreate("fs_showWarnings" , "0", FCVAR_DEVELOPMENTONLY, "Logs the FileSystem warnings to the console, filtered by 'fs_warning_level' ( !slower! ).", true, 0.f, true, 2.f, nullptr, "0 = log to file. 1 = 0 + log to console. 2 = 1 + log to notify");
|
||||
fs_packedstore_entryblock_stats = ConVar::StaticCreate("fs_packedstore_entryblock_stats" , "0", FCVAR_DEVELOPMENTONLY, "Logs the stats of each file entry in the VPK during decompression ( !slower! ).", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
fs_packedstore_workspace = ConVar::StaticCreate("fs_packedstore_workspace" , "ship", FCVAR_DEVELOPMENTONLY, "Determines the current VPK workspace.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
fs_packedstore_compression_level = ConVar::StaticCreate("fs_packedstore_compression_level", "default", FCVAR_DEVELOPMENTONLY, "Determines the VPK compression level.", false, 0.f, false, 0.f, nullptr, "fastest faster default better uber");
|
||||
fs_packedstore_max_helper_threads = ConVar::StaticCreate("fs_packedstore_max_helper_threads" , "-1", FCVAR_DEVELOPMENTONLY, "Max # of additional \"helper\" threads to create during compression.", true, -1, true, LZHAM_MAX_HELPER_THREADS, nullptr, "Must range between [-1,LZHAM_MAX_HELPER_THREADS], where -1=max practical");
|
||||
//-------------------------------------------------------------------------
|
||||
// MATERIALSYSTEM |
|
||||
#ifndef DEDICATED
|
||||
mat_alwaysComplain = ConVar::StaticCreate("mat_alwaysComplain", "0", FCVAR_RELEASE | FCVAR_MATERIAL_SYSTEM_THREAD, "Always complain when a material is missing.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
#endif // !DEDICATED
|
||||
//-------------------------------------------------------------------------
|
||||
// SQUIRREL |
|
||||
script_show_output = ConVar::StaticCreate("script_show_output" , "0", FCVAR_RELEASE, "Prints the VM output to the console ( !slower! ).", true, 0.f, true, 2.f, nullptr, "0 = log to file. 1 = 0 + log to console. 2 = 1 + log to notify");
|
||||
script_show_warning = ConVar::StaticCreate("script_show_warning", "0", FCVAR_RELEASE, "Prints the VM warning output to the console ( !slower! ).", true, 0.f, true, 2.f, nullptr, "0 = log to file. 1 = 0 + log to console. 2 = 1 + log to notify");
|
||||
//-------------------------------------------------------------------------
|
||||
// NETCHANNEL |
|
||||
net_tracePayload = ConVar::StaticCreate("net_tracePayload" , "0", FCVAR_DEVELOPMENTONLY , "Log the payload of the send/recv datagram to a file on the disk.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
net_encryptionEnable = ConVar::StaticCreate("net_encryptionEnable" , "1", FCVAR_DEVELOPMENTONLY | FCVAR_REPLICATED , "Use AES encryption on game packets.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
net_useRandomKey = ConVar::StaticCreate("net_useRandomKey" , "1" , FCVAR_RELEASE , "Use random AES encryption key for game packets.", false, 0.f, false, 0.f, &NET_UseRandomKeyChanged_f, nullptr);
|
||||
net_processTimeBudget = ConVar::StaticCreate("net_processTimeBudget" ,"200" , FCVAR_RELEASE , "Net message process time budget in milliseconds (removing netchannel if exceeded).", true, 0.f, false, 0.f, nullptr, "0 = disabled");
|
||||
|
||||
net_compressDataBlockLzAcceleration = ConVar::StaticCreate("net_compressDataBlockLzAcceleration", "1", FCVAR_DEVELOPMENTONLY, "The acceleration value for LZ4 data block compression.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
//-------------------------------------------------------------------------
|
||||
// NETWORKSYSTEM |
|
||||
pylon_matchmaking_hostname = ConVar::StaticCreate("pylon_matchmaking_hostname", "ms.r5reloaded.com", FCVAR_RELEASE | FCVAR_MATERIAL_SYSTEM_THREAD, "Holds the pylon matchmaking hostname.", false, 0.f, false, 0.f, &MP_HostName_Changed_f, nullptr);
|
||||
pylon_host_update_interval = ConVar::StaticCreate("pylon_host_update_interval", "5" , FCVAR_RELEASE, "Length of time in seconds between each status update interval to master server.", true, 5.f, false, 0.f, nullptr, nullptr);
|
||||
pylon_showdebuginfo = ConVar::StaticCreate("pylon_showdebuginfo" , "0" , FCVAR_RELEASE, "Shows debug output for pylon.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
//-------------------------------------------------------------------------
|
||||
// RTECH API |
|
||||
async_debug_level = ConVar::StaticCreate("async_debug_level" , "0", FCVAR_DEVELOPMENTONLY, "The debug level for async reads.", false, 0.f, false, 0.f, nullptr, "0 = disabled");
|
||||
async_debug_close = ConVar::StaticCreate("async_debug_close" , "0", FCVAR_DEVELOPMENTONLY, "Debug async file closing.", false, 0.f, false, 0.f, nullptr, "0 = disabled");
|
||||
|
||||
pak_debugrelations = ConVar::StaticCreate("pak_debugrelations" , "0", FCVAR_DEVELOPMENTONLY, "Debug RPAK asset dependency resolving.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
//-------------------------------------------------------------------------
|
||||
// RUI |
|
||||
#ifndef DEDICATED
|
||||
rui_drawEnable = ConVar::StaticCreate("rui_drawEnable", "1", FCVAR_RELEASE, "Draws the RUI if set.", false, 0.f, false, 0.f, nullptr, "1 = draw; 0 (zero) = no draw");
|
||||
#endif // !DEDICATED
|
||||
//-------------------------------------------------------------------------
|
||||
// MILES |
|
||||
#ifndef DEDICATED
|
||||
miles_debug = ConVar::StaticCreate("miles_debug", "0", FCVAR_RELEASE, "Enables debug prints for the Miles Sound System.", false, 0.f, false, 0.f, nullptr, "1 = print; 0 (zero) = no print");
|
||||
#endif // !DEDICATED
|
||||
//-------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: initialize shipped ConVar's
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -560,10 +140,11 @@ void ConVar_InitShipped(void)
|
||||
|
||||
eula_version = g_pCVar->FindVar("eula_version");
|
||||
eula_version_accepted = g_pCVar->FindVar("eula_version_accepted");
|
||||
|
||||
language_cvar = g_pCVar->FindVar("language");
|
||||
#ifndef DEDICATED
|
||||
cl_updaterate_mp = g_pCVar->FindVar("cl_updaterate_mp");
|
||||
cl_threaded_bone_setup = g_pCVar->FindVar("cl_threaded_bone_setup");
|
||||
cl_language = g_pCVar->FindVar("cl_language");
|
||||
#endif // !DEDICATED
|
||||
single_frame_shutdown_for_reload = g_pCVar->FindVar("single_frame_shutdown_for_reload");
|
||||
enable_debug_overlays = g_pCVar->FindVar("enable_debug_overlays");
|
||||
@ -654,7 +235,7 @@ void ConVar_InitShipped(void)
|
||||
net_usesocketsforloopback->RemoveFlags(FCVAR_DEVELOPMENTONLY);
|
||||
net_usesocketsforloopback->InstallChangeCallback(NET_UseSocketsForLoopbackChanged_f, false);
|
||||
#ifndef DEDICATED
|
||||
cl_language->InstallChangeCallback(LanguageChanged_f, false);
|
||||
language_cvar->InstallChangeCallback(LanguageChanged_f, false);
|
||||
#endif // !DEDICATED
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// ENGINE |
|
||||
extern ConVar* sdk_fixedframe_tickinterval;
|
||||
extern ConVar* single_frame_shutdown_for_reload;
|
||||
extern ConVar* old_gather_props;
|
||||
|
||||
@ -15,23 +14,12 @@ extern ConVar* fps_max;
|
||||
extern ConVar* fps_max_vsync;
|
||||
|
||||
#ifndef DEDICATED
|
||||
extern ConVar* fps_max_rt;
|
||||
extern ConVar* fps_max_rt_tolerance;
|
||||
extern ConVar* fps_max_rt_sleep_threshold;
|
||||
extern ConVar* fps_max_gfx;
|
||||
|
||||
extern ConVar* in_syncRT;
|
||||
#endif // !DEDICATED
|
||||
|
||||
extern ConVar* base_tickinterval_sp;
|
||||
extern ConVar* base_tickinterval_mp;
|
||||
|
||||
// taken from S15:
|
||||
extern ConVar* usercmd_frametime_max;
|
||||
extern ConVar* usercmd_frametime_min;
|
||||
|
||||
extern ConVar* usercmd_dualwield_enable;
|
||||
|
||||
extern ConVar* staticProp_no_fade_scalar;
|
||||
extern ConVar* staticProp_gather_size_weight;
|
||||
|
||||
@ -40,7 +28,6 @@ extern ConVar* model_defaultFadeDistMin;
|
||||
|
||||
extern ConVar* ip_cvar;
|
||||
extern ConVar* hostname;
|
||||
extern ConVar* hostdesc;
|
||||
extern ConVar* hostip;
|
||||
extern ConVar* hostport;
|
||||
|
||||
@ -49,253 +36,82 @@ extern ConVar* host_timescale;
|
||||
|
||||
extern ConVar* mp_gamemode;
|
||||
|
||||
extern ConVar* rcon_address;
|
||||
extern ConVar* rcon_password;
|
||||
|
||||
extern ConVar* enable_CmdKeyValues;
|
||||
|
||||
extern ConVar* r_debug_overlay_nodecay;
|
||||
extern ConVar* r_debug_overlay_invisible;
|
||||
extern ConVar* r_debug_overlay_wireframe;
|
||||
extern ConVar* r_debug_draw_depth_test;
|
||||
extern ConVar* r_drawWorldMeshes;
|
||||
extern ConVar* r_drawWorldMeshesDepthOnly;
|
||||
extern ConVar* r_drawWorldMeshesDepthAtTheEnd;
|
||||
|
||||
#ifndef DEDICATED
|
||||
extern ConVar* r_visualizetraces;
|
||||
extern ConVar* r_visualizetraces_duration;
|
||||
|
||||
extern ConVar* gfx_nvnUseLowLatency;
|
||||
extern ConVar* gfx_nvnUseLowLatencyBoost;
|
||||
extern ConVar* gfx_nvnUseMarkersToOptimize;
|
||||
#endif // !DEDICATED
|
||||
|
||||
extern ConVar* stream_overlay;
|
||||
extern ConVar* stream_overlay_mode;
|
||||
//-------------------------------------------------------------------------
|
||||
// SHARED |
|
||||
extern ConVar* modsystem_enable;
|
||||
extern ConVar* modsystem_debug;
|
||||
|
||||
extern ConVar* eula_version;
|
||||
extern ConVar* eula_version_accepted;
|
||||
|
||||
extern ConVar* promo_version_accepted;
|
||||
extern ConVar* language_cvar;
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// 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* ai_script_nodes_draw_nearest;
|
||||
|
||||
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_language;
|
||||
extern ConVar* sv_showconnecting;
|
||||
extern ConVar* sv_globalBanlist;
|
||||
extern ConVar* sv_pylonVisibility;
|
||||
extern ConVar* sv_pylonRefreshRate;
|
||||
extern ConVar* sv_banlistRefreshRate;
|
||||
extern ConVar* sv_statusRefreshRate;
|
||||
extern ConVar* sv_forceChatToTeamOnly;
|
||||
|
||||
extern ConVar* sv_single_core_dedi;
|
||||
|
||||
extern ConVar* sv_maxunlag;
|
||||
extern ConVar* sv_unlag_clamp;
|
||||
extern ConVar* sv_clockcorrection_msecs;
|
||||
|
||||
extern ConVar* sv_updaterate_sp;
|
||||
extern ConVar* sv_updaterate_mp;
|
||||
|
||||
extern ConVar* sv_autoReloadRate;
|
||||
|
||||
extern ConVar* sv_simulateBots;
|
||||
extern ConVar* sv_showhitboxes;
|
||||
extern ConVar* sv_stats;
|
||||
|
||||
extern ConVar* sv_quota_stringCmdsPerSecond;
|
||||
|
||||
extern ConVar* sv_validatePersonaName;
|
||||
extern ConVar* sv_minPersonaNameLength;
|
||||
extern ConVar* sv_maxPersonaNameLength;
|
||||
|
||||
extern ConVar* sv_onlineAuthEnable;
|
||||
|
||||
extern ConVar* sv_onlineAuthValidateExpiry;
|
||||
extern ConVar* sv_onlineAuthExpiryTolerance;
|
||||
|
||||
extern ConVar* sv_onlineAuthValidateIssuedAt;
|
||||
extern ConVar* sv_onlineAuthIssuedAtTolerance;
|
||||
|
||||
extern ConVar* sv_voiceEcho;
|
||||
extern ConVar* sv_voiceenable;
|
||||
extern ConVar* sv_alltalk;
|
||||
|
||||
extern ConVar* player_userCmdsQueueWarning;
|
||||
|
||||
//#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_maxconnections;
|
||||
extern ConVar* sv_rcon_maxpacketsize;
|
||||
extern ConVar* sv_rcon_whitelist_address;
|
||||
//#endif // DEDICATED
|
||||
#endif // CLIENT_DLL
|
||||
extern ConVar* sv_quota_scriptExecsPerSecond;
|
||||
extern ConVar* sv_cheats;
|
||||
extern ConVar* sv_visualizetraces;
|
||||
extern ConVar* sv_visualizetraces_duration;
|
||||
extern ConVar* bhit_enable;
|
||||
extern ConVar* bhit_depth_test;
|
||||
extern ConVar* bhit_abs_origin;
|
||||
//-------------------------------------------------------------------------
|
||||
// CLIENT |
|
||||
#ifndef DEDICATED
|
||||
extern ConVar* cl_rcon_inputonly;
|
||||
extern ConVar* cl_quota_stringCmdsPerSecond;
|
||||
|
||||
extern ConVar* enable_CmdKeyValues;
|
||||
|
||||
extern ConVar* cl_notify_invert_x;
|
||||
extern ConVar* cl_notify_invert_y;
|
||||
extern ConVar* cl_notify_offset_x;
|
||||
extern ConVar* cl_notify_offset_y;
|
||||
|
||||
extern ConVar* cl_showsimstats;
|
||||
extern ConVar* cl_simstats_invert_x;
|
||||
extern ConVar* cl_simstats_invert_y;
|
||||
extern ConVar* cl_simstats_offset_x;
|
||||
extern ConVar* cl_simstats_offset_y;
|
||||
|
||||
extern ConVar* cl_showgpustats;
|
||||
extern ConVar* cl_gpustats_invert_x;
|
||||
extern ConVar* cl_gpustats_invert_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* cl_language;
|
||||
|
||||
extern ConVar* cl_onlineAuthEnable;
|
||||
extern ConVar* cl_onlineAuthToken;
|
||||
extern ConVar* cl_onlineAuthTokenSignature1;
|
||||
extern ConVar* cl_onlineAuthTokenSignature2;
|
||||
|
||||
|
||||
extern ConVar* con_drawnotify;
|
||||
extern ConVar* con_notifylines;
|
||||
extern ConVar* con_notifytime;
|
||||
|
||||
extern ConVar* con_notify_invert_x;
|
||||
extern ConVar* con_notify_invert_y;
|
||||
extern ConVar* con_notify_offset_x;
|
||||
extern ConVar* con_notify_offset_y;
|
||||
|
||||
extern ConVar* con_notify_script_server_clr;
|
||||
extern ConVar* con_notify_script_client_clr;
|
||||
extern ConVar* con_notify_script_ui_clr;
|
||||
extern ConVar* con_notify_native_server_clr;
|
||||
extern ConVar* con_notify_native_client_clr;
|
||||
extern ConVar* con_notify_native_ui_clr;
|
||||
extern ConVar* con_notify_native_engine_clr;
|
||||
extern ConVar* con_notify_native_fs_clr;
|
||||
extern ConVar* con_notify_native_rtech_clr;
|
||||
extern ConVar* con_notify_native_ms_clr;
|
||||
extern ConVar* con_notify_native_audio_clr;
|
||||
extern ConVar* con_notify_native_video_clr;
|
||||
extern ConVar* con_notify_netcon_clr;
|
||||
extern ConVar* con_notify_common_clr;
|
||||
extern ConVar* con_notify_warning_clr;
|
||||
extern ConVar* con_notify_error_clr;
|
||||
|
||||
extern ConVar* con_max_lines;
|
||||
extern ConVar* con_max_history;
|
||||
extern ConVar* con_suggest_limit;
|
||||
extern ConVar* con_suggest_showhelptext;
|
||||
extern ConVar* con_suggest_showflags;
|
||||
|
||||
extern ConVar* origin_disconnectWhenOffline;
|
||||
extern ConVar* discord_updatePresence;
|
||||
#endif // !DEDICATED
|
||||
//-------------------------------------------------------------------------
|
||||
// FILESYSTEM |
|
||||
extern ConVar* fs_showWarnings;
|
||||
extern ConVar* fs_showAllReads;
|
||||
extern ConVar* fs_packedstore_entryblock_stats;
|
||||
extern ConVar* fs_packedstore_workspace;
|
||||
extern ConVar* fs_packedstore_compression_level;
|
||||
extern ConVar* fs_packedstore_max_helper_threads;
|
||||
//-------------------------------------------------------------------------
|
||||
// MATERIALSYSTEM |
|
||||
#ifndef DEDICATED
|
||||
extern ConVar* mat_alwaysComplain;
|
||||
#endif // !DEDICATED
|
||||
//-------------------------------------------------------------------------
|
||||
// SQUIRREL |
|
||||
extern ConVar* script_show_output;
|
||||
extern ConVar* script_show_warning;
|
||||
//-------------------------------------------------------------------------
|
||||
// NETCHANNEL |
|
||||
extern ConVar* net_tracePayload;
|
||||
extern ConVar* net_encryptionEnable;
|
||||
extern ConVar* net_useRandomKey;
|
||||
extern ConVar* net_usesocketsforloopback;
|
||||
extern ConVar* net_processTimeBudget;
|
||||
|
||||
extern ConVar* net_data_block_enabled;
|
||||
extern ConVar* net_datablock_networkLossForSlowSpeed;
|
||||
extern ConVar* net_compressDataBlock;
|
||||
extern ConVar* net_compressDataBlockLzAcceleration;
|
||||
|
||||
extern ConVar* pylon_matchmaking_hostname;
|
||||
extern ConVar* pylon_host_update_interval;
|
||||
extern ConVar* pylon_showdebuginfo;
|
||||
|
||||
extern ConVar* ssl_verify_peer;
|
||||
extern ConVar* curl_timeout;
|
||||
extern ConVar* curl_debug;
|
||||
//-------------------------------------------------------------------------
|
||||
// RTECH API |
|
||||
extern ConVar* async_debug_level;
|
||||
extern ConVar* async_debug_close;
|
||||
extern ConVar* pak_debugrelations;
|
||||
extern ConVar ssl_verify_peer;
|
||||
extern ConVar curl_timeout;
|
||||
extern ConVar curl_debug;
|
||||
//-------------------------------------------------------------------------
|
||||
// RUI |
|
||||
#ifndef DEDICATED
|
||||
extern ConVar* rui_drawEnable;
|
||||
extern ConVar* rui_defaultDebugFontFace;
|
||||
#endif // !DEDICATED
|
||||
//-------------------------------------------------------------------------
|
||||
// MILES |
|
||||
#ifndef DEDICATED
|
||||
extern ConVar* miles_debug;
|
||||
extern ConVar* miles_language;
|
||||
#endif
|
||||
|
||||
void ConVar_StaticInit(void);
|
||||
void ConVar_InitShipped(void);
|
||||
void ConVar_PurgeShipped(void);
|
||||
void ConVar_PurgeHostNames(void);
|
||||
|
@ -90,6 +90,7 @@ bool CLC_SetPlaylistVarOverride::WriteToBufferImpl(CLC_SetPlaylistVarOverride* t
|
||||
return CLC_SetPlaylistVarOverride_WriteToBuffer(thisptr, buffer);
|
||||
}
|
||||
|
||||
static ConVar enable_CmdKeyValues("enable_CmdKeyValues", "0", FCVAR_DEVELOPMENTONLY, "Toggle CmdKeyValues transmit and receive.");
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// below functions are hooked as 'CmdKeyValues' isn't really used in this game, but
|
||||
@ -98,8 +99,8 @@ bool CLC_SetPlaylistVarOverride::WriteToBufferImpl(CLC_SetPlaylistVarOverride* t
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
bool Base_CmdKeyValues::ReadFromBufferImpl(Base_CmdKeyValues* thisptr, bf_read* buffer)
|
||||
{
|
||||
// Abusable netmsg; only allow if cheats are enabled.
|
||||
if (!enable_CmdKeyValues->GetBool())
|
||||
// Abusable netmsg; only allow if explicitly enabled by the client.
|
||||
if (!enable_CmdKeyValues.GetBool())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -108,8 +109,8 @@ bool Base_CmdKeyValues::ReadFromBufferImpl(Base_CmdKeyValues* thisptr, bf_read*
|
||||
}
|
||||
bool Base_CmdKeyValues::WriteToBufferImpl(Base_CmdKeyValues* thisptr, bf_write* buffer)
|
||||
{
|
||||
// Abusable netmsg; only allow if cheats are enabled.
|
||||
if (!enable_CmdKeyValues->GetBool())
|
||||
// Abusable netmsg; only allow if explicitly enabled by the client.
|
||||
if (!enable_CmdKeyValues.GetBool())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -231,8 +231,6 @@ void Systems_Init()
|
||||
Msg(eDLL_T::NONE, "+-------------------------------------------------------------+\n");
|
||||
Msg(eDLL_T::NONE, "\n");
|
||||
|
||||
ConVar_StaticInit();
|
||||
|
||||
#ifdef DEDICATED
|
||||
InitCommandLineParameters();
|
||||
#endif // DEDICATED
|
||||
@ -474,7 +472,6 @@ void DetourRegister() // Register detour classes to be searched and hooked.
|
||||
|
||||
// Tier1
|
||||
REGISTER(VCommandLine);
|
||||
REGISTER(VConVar);
|
||||
REGISTER(VCVar);
|
||||
|
||||
// VPC
|
||||
|
@ -42,8 +42,8 @@ void CL_MoveEx()
|
||||
const float hostTimeScale = host_timescale->GetFloat();
|
||||
const bool isTimeScaleDefault = hostTimeScale == 1.0;
|
||||
|
||||
const float minFrameTime = usercmd_frametime_min->GetFloat();
|
||||
const float maxFrameTime = usercmd_frametime_max->GetFloat();
|
||||
const float minFrameTime = usercmd_frametime_min.GetFloat();
|
||||
const float maxFrameTime = usercmd_frametime_max.GetFloat();
|
||||
|
||||
const float netTime = float(*g_pNetTime);
|
||||
|
||||
|
@ -16,6 +16,20 @@
|
||||
#include "common/igameserverdata.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: console variables
|
||||
//-----------------------------------------------------------------------------
|
||||
static ConVar rcon_address("rcon_address", "[loopback]:37015", FCVAR_SERVER_CANNOT_QUERY | FCVAR_DONTRECORD | FCVAR_RELEASE, "Remote server access address");
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: console commands
|
||||
//-----------------------------------------------------------------------------
|
||||
static void RCON_Disconnect_f();
|
||||
static void RCON_CmdQuery_f(const CCommand& args);
|
||||
|
||||
static ConCommand rcon("rcon", RCON_CmdQuery_f, "Forward RCON query to remote server", FCVAR_CLIENTDLL | FCVAR_RELEASE, nullptr, "rcon \"<query>\"");
|
||||
static ConCommand rcon_disconnect("rcon_disconnect", RCON_Disconnect_f, "Disconnect from RCON server", FCVAR_CLIENTDLL | FCVAR_RELEASE);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -190,13 +204,23 @@ SocketHandle_t CRConClient::GetSocket(void)
|
||||
return SH_GetNetConSocketHandle(this, 0);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: request whether to recv logs from RCON server when cvar changes
|
||||
//-----------------------------------------------------------------------------
|
||||
static void RCON_InputOnlyChanged_f(IConVar* pConVar, const char* pOldString)
|
||||
{
|
||||
RCONClient()->RequestConsoleLog(RCONClient()->ShouldReceive());
|
||||
}
|
||||
|
||||
static ConVar cl_rcon_inputonly("cl_rcon_inputonly", "0", FCVAR_RELEASE, "Tells the rcon server whether or not we are input only.",
|
||||
false, 0.f, false, 0.f, RCON_InputOnlyChanged_f);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: returns whether or not we should receive logs from the server
|
||||
// Output : SOCKET_ERROR (-1) on failure
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CRConClient::ShouldReceive(void)
|
||||
{
|
||||
return (!IsRemoteLocal() && !cl_rcon_inputonly->GetBool());
|
||||
return (!IsRemoteLocal() && !cl_rcon_inputonly.GetBool());
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -244,7 +268,7 @@ static void RCON_CmdQuery_f(const CCommand& args)
|
||||
|
||||
if (argCount < 2)
|
||||
{
|
||||
const char* pszAddress = rcon_address->GetString();
|
||||
const char* pszAddress = rcon_address.GetString();
|
||||
|
||||
if (RCONClient()->IsInitialized()
|
||||
&& !RCONClient()->IsConnected()
|
||||
@ -272,9 +296,10 @@ static void RCON_CmdQuery_f(const CCommand& args)
|
||||
{
|
||||
bSuccess = RCONClient()->Serialize(vecMsg, args.Arg(2), "", cl_rcon::request_t::SERVERDATA_REQUEST_AUTH);
|
||||
}
|
||||
else // Use 'rcon_password' ConVar as password.
|
||||
else
|
||||
{
|
||||
bSuccess = RCONClient()->Serialize(vecMsg, rcon_password->GetString(), "", cl_rcon::request_t::SERVERDATA_REQUEST_AUTH);
|
||||
Warning(eDLL_T::CLIENT, "Failed to issue command to RCON server: %s\n", "no password given");
|
||||
return;
|
||||
}
|
||||
|
||||
if (bSuccess)
|
||||
@ -322,6 +347,3 @@ static void RCON_Disconnect_f()
|
||||
Msg(eDLL_T::CLIENT, "User closed RCON connection\n");
|
||||
}
|
||||
}
|
||||
|
||||
static ConCommand rcon("rcon", RCON_CmdQuery_f, "Forward RCON query to remote server", FCVAR_CLIENTDLL | FCVAR_RELEASE, nullptr, "rcon \"<query>\"");
|
||||
static ConCommand rcon_disconnect("rcon_disconnect", RCON_Disconnect_f, "Disconnect from RCON server", FCVAR_CLIENTDLL | FCVAR_RELEASE);
|
||||
|
@ -64,6 +64,16 @@ static const char JWT_PUBLIC_KEY[] =
|
||||
"dwIDAQAB\n"
|
||||
"-----END PUBLIC KEY-----\n";
|
||||
|
||||
static ConVar sv_onlineAuthEnable("sv_onlineAuthEnable", "1", FCVAR_RELEASE, "Enables the server-side online authentication system");
|
||||
|
||||
static ConVar sv_onlineAuthValidateExpiry("sv_onlineAuthValidateExpiry", "1", FCVAR_RELEASE, "Validate the online authentication token 'expiry' claim");
|
||||
static ConVar sv_onlineAuthValidateIssuedAt("sv_onlineAuthValidateIssuedAt", "1", FCVAR_RELEASE, "Validate the online authentication token 'issued at' claim");
|
||||
|
||||
static ConVar sv_onlineAuthExpiryTolerance("sv_onlineAuthExpiryTolerance", "1", FCVAR_DEVELOPMENTONLY, "The online authentication token 'expiry' claim tolerance in seconds", true, 0.f, true, float(UINT8_MAX), "Must range between [0,255]");
|
||||
static ConVar sv_onlineAuthIssuedAtTolerance("sv_onlineAuthIssuedAtTolerance", "30", FCVAR_DEVELOPMENTONLY, "The online authentication token 'issued at' claim tolerance in seconds", true, 0.f, true, float(UINT8_MAX), "Must range between [0,255]");
|
||||
|
||||
static ConVar sv_quota_stringCmdsPerSecond("sv_quota_stringCmdsPerSecond", "16", FCVAR_RELEASE, "How many string commands per second clients are allowed to submit, 0 to disallow all string commands", true, 0.f, false, 0.f);
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
// Purpose: check whether this client is authorized to join this server
|
||||
// Input : *playerName -
|
||||
@ -120,11 +130,11 @@ bool CClient::Authenticate(const char* const playerName, char* const reasonBuf,
|
||||
params.verification_key = (unsigned char*)JWT_PUBLIC_KEY;
|
||||
params.verification_key_length = sizeof(JWT_PUBLIC_KEY);
|
||||
|
||||
params.validate_exp = sv_onlineAuthValidateExpiry->GetBool();
|
||||
params.exp_tolerance_seconds = (uint8_t)sv_onlineAuthExpiryTolerance->GetInt();
|
||||
params.validate_exp = sv_onlineAuthValidateExpiry.GetBool();
|
||||
params.exp_tolerance_seconds = (uint8_t)sv_onlineAuthExpiryTolerance.GetInt();
|
||||
|
||||
params.validate_iat = sv_onlineAuthValidateIssuedAt->GetBool();
|
||||
params.iat_tolerance_seconds = (uint8_t)sv_onlineAuthIssuedAtTolerance->GetInt();
|
||||
params.validate_iat = sv_onlineAuthValidateIssuedAt.GetBool();
|
||||
params.iat_tolerance_seconds = (uint8_t)sv_onlineAuthIssuedAtTolerance.GetInt();
|
||||
|
||||
enum l8w8jwt_validation_result validation_result;
|
||||
const int r = l8w8jwt_decode(¶ms, &validation_result, &claims, &numClaims);
|
||||
@ -205,14 +215,14 @@ bool CClient::Connect(const char* szName, CNetChan* pNetChan, bool bFakePlayer,
|
||||
|
||||
#define REJECT_CONNECTION(fmt, ...) V_snprintf(szMessage, nMessageSize, fmt, ##__VA_ARGS__);
|
||||
|
||||
if (sv_onlineAuthEnable->GetBool())
|
||||
if (sv_onlineAuthEnable.GetBool())
|
||||
{
|
||||
char authFailReason[512];
|
||||
if (!Authenticate(szName, authFailReason, sizeof(authFailReason)))
|
||||
{
|
||||
REJECT_CONNECTION("Failed to verify authentication token [%s]", authFailReason);
|
||||
|
||||
const bool bEnableLogging = sv_showconnecting->GetBool();
|
||||
const bool bEnableLogging = sv_showconnecting.GetBool();
|
||||
if (bEnableLogging)
|
||||
{
|
||||
const char* const netAdr = pNetChan ? pNetChan->GetAddress() : "<unknown>";
|
||||
@ -285,7 +295,7 @@ void CClient::VActivatePlayer(CClient* pClient)
|
||||
#ifndef CLIENT_DLL
|
||||
const CNetChan* pNetChan = pClient->GetNetChan();
|
||||
|
||||
if (pNetChan && sv_showconnecting->GetBool())
|
||||
if (pNetChan && sv_showconnecting.GetBool())
|
||||
{
|
||||
Msg(eDLL_T::SERVER, "Activated player #%d; channel %s(%s) ('%llu')\n",
|
||||
pClient->GetUserID(), pNetChan->GetName(), pNetChan->GetAddress(), pClient->GetNucleusID());
|
||||
@ -399,7 +409,7 @@ bool CClient::VProcessStringCmd(CClient* pClient, NET_StringCmd* pMsg)
|
||||
CClientExtended* const pSlot = pClient_Adj->GetClientExtended();
|
||||
|
||||
const double flStartTime = Plat_FloatTime();
|
||||
const int nCmdQuotaLimit = sv_quota_stringCmdsPerSecond->GetInt();
|
||||
const int nCmdQuotaLimit = sv_quota_stringCmdsPerSecond.GetInt();
|
||||
|
||||
if (!nCmdQuotaLimit)
|
||||
return true;
|
||||
|
@ -307,6 +307,12 @@ bool CClientState::_ProcessCreateStringTable(CClientState* thisptr, SVC_CreateSt
|
||||
return (endbit - startbit) == msg->m_nLength;
|
||||
}
|
||||
|
||||
static ConVar cl_onlineAuthEnable("cl_onlineAuthEnable", "1", FCVAR_RELEASE, "Enables the client-side online authentication system");
|
||||
|
||||
static ConVar cl_onlineAuthToken("cl_onlineAuthToken", "", FCVAR_HIDDEN | FCVAR_USERINFO | FCVAR_DONTRECORD | FCVAR_SERVER_CANNOT_QUERY | FCVAR_PLATFORM_SYSTEM, "The client's online authentication token");
|
||||
static ConVar cl_onlineAuthTokenSignature1("cl_onlineAuthTokenSignature1", "", FCVAR_HIDDEN | FCVAR_USERINFO | FCVAR_DONTRECORD | FCVAR_SERVER_CANNOT_QUERY | FCVAR_PLATFORM_SYSTEM, "The client's online authentication token signature", false, 0.f, false, 0.f, "Primary");
|
||||
static ConVar cl_onlineAuthTokenSignature2("cl_onlineAuthTokenSignature2", "", FCVAR_HIDDEN | FCVAR_USERINFO | FCVAR_DONTRECORD | FCVAR_SERVER_CANNOT_QUERY | FCVAR_PLATFORM_SYSTEM, "The client's online authentication token signature", false, 0.f, false, 0.f, "Secondary");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Purpose: get authentication token for current connection context
|
||||
// Input : *connectParams -
|
||||
@ -347,21 +353,21 @@ bool CClientState::Authenticate(connectparams_t* connectParams, char* const reas
|
||||
*(char*)tokenSignatureDelim = '\0';
|
||||
const size_t sigLength = strlen(tokenSignatureDelim) - 1;
|
||||
|
||||
cl_onlineAuthToken->SetValue(token);
|
||||
cl_onlineAuthToken.SetValue(token);
|
||||
|
||||
if (sigLength > 0)
|
||||
{
|
||||
// get a pointer to the first part of the token signature to store in cl_onlineAuthTokenSignature1
|
||||
const char* tokenSignaturePart1 = tokenSignatureDelim + 1;
|
||||
|
||||
cl_onlineAuthTokenSignature1->SetValue(tokenSignaturePart1);
|
||||
cl_onlineAuthTokenSignature1.SetValue(tokenSignaturePart1);
|
||||
|
||||
if (sigLength > 255)
|
||||
{
|
||||
// get a pointer to the rest of the token signature to store in cl_onlineAuthTokenSignature2
|
||||
const char* tokenSignaturePart2 = tokenSignaturePart1 + 255;
|
||||
|
||||
cl_onlineAuthTokenSignature2->SetValue(tokenSignaturePart2);
|
||||
cl_onlineAuthTokenSignature2.SetValue(tokenSignaturePart2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -376,7 +382,7 @@ bool IsLocalHost(connectparams_t* connectParams)
|
||||
|
||||
void CClientState::VConnect(CClientState* thisptr, connectparams_t* connectParams)
|
||||
{
|
||||
if (cl_onlineAuthEnable->GetBool() && !IsLocalHost(connectParams))
|
||||
if (cl_onlineAuthEnable.GetBool() && !IsLocalHost(connectParams))
|
||||
{
|
||||
char authFailReason[512];
|
||||
|
||||
|
@ -60,6 +60,10 @@ bool Cbuf_AddTextWithMarkers(const char* const pText, const ECmdExecutionMarker
|
||||
// Input : *args -
|
||||
// Output : true on success, false otherwise
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef DEDICATED
|
||||
ConVar cl_quota_stringCmdsPerSecond("cl_quota_stringCmdsPerSecond", "16", FCVAR_RELEASE, "How many string commands per second user is allowed to submit, 0 to allow all submissions.", true, 0.f, false, 0.f);
|
||||
#endif // DEDICATED
|
||||
|
||||
bool Cmd_ForwardToServer(const CCommand* args)
|
||||
{
|
||||
#ifndef DEDICATED
|
||||
@ -72,7 +76,7 @@ bool Cmd_ForwardToServer(const CCommand* args)
|
||||
return false;
|
||||
|
||||
const double flStartTime = Plat_FloatTime();
|
||||
const int nCmdQuotaLimit = cl_quota_stringCmdsPerSecond->GetInt();
|
||||
const int nCmdQuotaLimit = cl_quota_stringCmdsPerSecond.GetInt();
|
||||
const char* pszCmdString = nullptr;
|
||||
|
||||
// Special case: "cmd whatever args..." is forwarded as "whatever args...";
|
||||
@ -101,6 +105,7 @@ bool Cmd_ForwardToServer(const CCommand* args)
|
||||
}
|
||||
return v_Cmd_ForwardToServer(args);
|
||||
#else // !DEDICATED
|
||||
Assert(0);
|
||||
return false; // Client only.
|
||||
#endif // DEDICATED
|
||||
}
|
||||
|
@ -20,6 +20,11 @@
|
||||
#include "game/server/ai_network.h"
|
||||
#endif // !CLIENT_DLL
|
||||
|
||||
ConVar r_debug_draw_depth_test("r_debug_draw_depth_test", "1", FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT, "Toggle depth test for other debug draw functionality");
|
||||
|
||||
static ConVar r_debug_overlay_nodecay("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");
|
||||
static ConVar r_debug_overlay_invisible("r_debug_overlay_invisible", "1", FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT, "Show invisible debug overlays (alpha < 1 = 255)");
|
||||
static ConVar r_debug_overlay_wireframe("r_debug_overlay_wireframe", "1", FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT, "Use wireframe in debug overlay");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Purpose: checks if overlay should be decayed
|
||||
@ -27,7 +32,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
bool OverlayBase_t::IsDead() const
|
||||
{
|
||||
if (r_debug_overlay_nodecay->GetBool())
|
||||
if (r_debug_overlay_nodecay.GetBool())
|
||||
{
|
||||
// Keep rendering the overlay if no-decay is set.
|
||||
return false;
|
||||
@ -107,7 +112,7 @@ void DrawOverlay(OverlayBase_t* pOverlay)
|
||||
OverlayBox_t* pBox = static_cast<OverlayBox_t*>(pOverlay);
|
||||
if (pBox->a < 1)
|
||||
{
|
||||
if (r_debug_overlay_invisible->GetBool())
|
||||
if (r_debug_overlay_invisible.GetBool())
|
||||
{
|
||||
pBox->a = 255;
|
||||
}
|
||||
@ -126,7 +131,7 @@ void DrawOverlay(OverlayBase_t* pOverlay)
|
||||
OverlaySphere_t* pSphere = static_cast<OverlaySphere_t*>(pOverlay);
|
||||
if (pSphere->a < 1)
|
||||
{
|
||||
if (r_debug_overlay_invisible->GetBool())
|
||||
if (r_debug_overlay_invisible.GetBool())
|
||||
{
|
||||
pSphere->a = 255;
|
||||
}
|
||||
@ -137,14 +142,14 @@ void DrawOverlay(OverlayBase_t* pOverlay)
|
||||
}
|
||||
}
|
||||
|
||||
if (r_debug_overlay_wireframe->GetBool())
|
||||
if (r_debug_overlay_wireframe.GetBool())
|
||||
{
|
||||
v_RenderWireframeSphere(pSphere->vOrigin, pSphere->flRadius, pSphere->nTheta, pSphere->nPhi,
|
||||
Color(pSphere->r, pSphere->g, pSphere->b, pSphere->a), r_debug_draw_depth_test->GetBool());
|
||||
Color(pSphere->r, pSphere->g, pSphere->b, pSphere->a), r_debug_draw_depth_test.GetBool());
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugDrawSphere(pSphere->vOrigin, pSphere->flRadius, Color(pSphere->r, pSphere->g, pSphere->b, pSphere->a), 16, r_debug_draw_depth_test->GetBool());
|
||||
DebugDrawSphere(pSphere->vOrigin, pSphere->flRadius, Color(pSphere->r, pSphere->g, pSphere->b, pSphere->a), 16, r_debug_draw_depth_test.GetBool());
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -153,7 +158,7 @@ void DrawOverlay(OverlayBase_t* pOverlay)
|
||||
OverlayLine_t* pLine = static_cast<OverlayLine_t*>(pOverlay);
|
||||
if (pLine->a < 1)
|
||||
{
|
||||
if (r_debug_overlay_invisible->GetBool())
|
||||
if (r_debug_overlay_invisible.GetBool())
|
||||
{
|
||||
pLine->a = 255;
|
||||
}
|
||||
@ -188,7 +193,7 @@ void DrawOverlay(OverlayBase_t* pOverlay)
|
||||
OverlayCapsule_t* pCapsule = static_cast<OverlayCapsule_t*>(pOverlay);
|
||||
if (pCapsule->a < 1)
|
||||
{
|
||||
if (r_debug_overlay_invisible->GetBool())
|
||||
if (r_debug_overlay_invisible.GetBool())
|
||||
{
|
||||
pCapsule->a = 255;
|
||||
}
|
||||
@ -205,7 +210,7 @@ void DrawOverlay(OverlayBase_t* pOverlay)
|
||||
AngleInverse(angles, angles);
|
||||
|
||||
DebugDrawCapsule(pCapsule->start, angles, pCapsule->radius, pCapsule->start.DistTo(pCapsule->end),
|
||||
Color(pCapsule->r, pCapsule->g, pCapsule->b, pCapsule->a), r_debug_draw_depth_test->GetBool());
|
||||
Color(pCapsule->r, pCapsule->g, pCapsule->b, pCapsule->a), r_debug_draw_depth_test.GetBool());
|
||||
break;
|
||||
}
|
||||
case OverlayType_t::OVERLAY_UNK0:
|
||||
|
@ -4,13 +4,8 @@
|
||||
#include "mathlib/color.h"
|
||||
#include "mathlib/ssemath.h"
|
||||
|
||||
// Something has to be hardcoded..
|
||||
constexpr auto MATERIALSYSTEM_VCALL_OFF_0 = 0x3F0;
|
||||
constexpr auto CMATQUEUEDRENDERCONTEXT_VCALL_OFS_0 = 0x288;
|
||||
constexpr auto CMATQUEUEDRENDERCONTEXT_VCALL_OFS_1 = 0x290;
|
||||
|
||||
constexpr auto CMATQUEUEDRENDERCONTEXT_VCALL_OFS_2 = 0x8;
|
||||
constexpr auto NDEBUG_PERSIST_TILL_NEXT_SERVER = (0.01023f);
|
||||
extern ConVar r_debug_draw_depth_test;
|
||||
|
||||
enum class OverlayType_t
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
//===========================================================================//
|
||||
//
|
||||
// Purpose: High-precision render-thread based frame rate limiter
|
||||
// Purpose: High-precision frame rate limiter
|
||||
//
|
||||
//===========================================================================//
|
||||
#include <dwmapi.h>
|
||||
@ -16,9 +16,8 @@ CFrameLimit::CFrameLimit(void)
|
||||
{
|
||||
m_MilliSeconds = 0.0;
|
||||
m_FramesPerSecond = 0.0;
|
||||
//effective_ms = 0.0;
|
||||
|
||||
//m_Last.QuadPart = 0;
|
||||
m_Start.QuadPart = 0;
|
||||
m_Next.QuadPart = 0;
|
||||
m_Time.QuadPart = 0;
|
||||
|
||||
@ -48,35 +47,18 @@ void CFrameLimit::Reset(double targetFps)
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: runs the frame limiter logic
|
||||
//-----------------------------------------------------------------------------
|
||||
void CFrameLimit::Run(void)
|
||||
void CFrameLimit::Run(const double targetFps, const double sleepThreshold, const double maxTolerance)
|
||||
{
|
||||
float targetFps = fps_max_rt->GetFloat();
|
||||
|
||||
if (targetFps == 0.0f)
|
||||
return;
|
||||
|
||||
const float globalFps = fps_max->GetFloat();
|
||||
|
||||
// Make sure the global fps limiter is 'unlimited'
|
||||
// before we let the rt frame limiter cap it to
|
||||
// the desktop's refresh rate; not adhering to
|
||||
// this will result in a major performance drop.
|
||||
if (globalFps == 0.0f && targetFps == -1)
|
||||
targetFps = g_pGame->GetTVRefreshRate();
|
||||
|
||||
if (m_FramesPerSecond != targetFps)
|
||||
Reset(targetFps);
|
||||
|
||||
if (targetFps == 0)
|
||||
return;
|
||||
|
||||
m_Frames++;
|
||||
QueryPerformanceCounter(&m_Time);
|
||||
|
||||
// Actual frametime before we forced a delay
|
||||
//m_EffectiveMilliSeconds = 1000.0 * ((double)(m_Time.QuadPart - m_Last.QuadPart) / (double)g_pPerformanceFrequency->QuadPart);
|
||||
|
||||
if ((double)(m_Time.QuadPart - m_Next.QuadPart) / (double)g_pPerformanceFrequency->QuadPart / (m_MilliSeconds / 1000.0) > (fps_max_rt_tolerance->GetFloat() * m_FramesPerSecond))
|
||||
if ((double)(m_Time.QuadPart - m_Next.QuadPart) / (double)g_pPerformanceFrequency->QuadPart / (m_MilliSeconds / 1000.0) > (maxTolerance * m_FramesPerSecond))
|
||||
{
|
||||
DevMsg(eDLL_T::ENGINE, "%s: Frame time too long (expected: %3.01fx); restarting...\n",
|
||||
__FUNCTION__, (double)(m_Time.QuadPart - m_Next.QuadPart) / (double)g_pPerformanceFrequency->QuadPart / (m_MilliSeconds / 1000.0) / m_FramesPerSecond );
|
||||
@ -98,7 +80,7 @@ void CFrameLimit::Run(void)
|
||||
{
|
||||
while (m_Time.QuadPart < m_Next.QuadPart)
|
||||
{
|
||||
if ((double)(m_Next.QuadPart - m_Time.QuadPart) > (fps_max_rt_sleep_threshold->GetFloat() * (double)g_pPerformanceFrequency->QuadPart))
|
||||
if ((double)(m_Next.QuadPart - m_Time.QuadPart) > (sleepThreshold * (double)g_pPerformanceFrequency->QuadPart))
|
||||
{
|
||||
Sleep(10);
|
||||
}
|
||||
@ -109,5 +91,3 @@ void CFrameLimit::Run(void)
|
||||
|
||||
//m_Last.QuadPart = m_Time.QuadPart;
|
||||
}
|
||||
|
||||
CFrameLimit g_FrameLimiter;
|
||||
|
@ -9,15 +9,13 @@ class CFrameLimit
|
||||
public:
|
||||
CFrameLimit(void);
|
||||
|
||||
void Reset(double target);
|
||||
void Run(void);
|
||||
void Reset(const double target);
|
||||
void Run(const double targetFps, const double sleepThreshold, const double maxTolerance);
|
||||
|
||||
private:
|
||||
double m_MilliSeconds;
|
||||
double m_FramesPerSecond;
|
||||
//double m_EffectiveMilliSeconds;
|
||||
|
||||
//LARGE_INTEGER m_Last;
|
||||
LARGE_INTEGER m_Start;
|
||||
LARGE_INTEGER m_Next;
|
||||
LARGE_INTEGER m_Time;
|
||||
@ -25,6 +23,4 @@ private:
|
||||
bool m_bRestart;
|
||||
};
|
||||
|
||||
extern CFrameLimit g_FrameLimiter;
|
||||
|
||||
#endif // FRAMELIMIT_H
|
||||
|
@ -11,6 +11,10 @@
|
||||
#include "engine/gl_rsurf.h"
|
||||
#include <materialsystem/cmaterialsystem.h>
|
||||
|
||||
static ConVar r_drawWorldMeshes("r_drawWorldMeshes", "1", FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT, "Render world meshes.");
|
||||
static ConVar r_drawWorldMeshesDepthOnly("r_drawWorldMeshesDepthOnly", "1", FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT, "Render world meshes (depth only).");
|
||||
static ConVar r_drawWorldMeshesDepthAtTheEnd("r_drawWorldMeshesDepthAtTheEnd", "1", FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT, "Render world meshes (depth at the end).");
|
||||
|
||||
void* R_DrawDepthOfField(const float scalar)
|
||||
{
|
||||
GFX_SetLatencyMarker(D3D11Device(), RENDERSUBMIT_START, MaterialSystem()->GetCurrentFrameCount());
|
||||
@ -19,7 +23,7 @@ void* R_DrawDepthOfField(const float scalar)
|
||||
|
||||
void* R_DrawWorldMeshes(void* baseEntity, void* renderContext, DrawWorldLists_t worldLists)
|
||||
{
|
||||
if (r_drawWorldMeshes->GetBool())
|
||||
if (r_drawWorldMeshes.GetBool())
|
||||
return V_DrawWorldMeshes(baseEntity, renderContext, worldLists);
|
||||
else
|
||||
return nullptr;
|
||||
@ -27,7 +31,7 @@ void* R_DrawWorldMeshes(void* baseEntity, void* renderContext, DrawWorldLists_t
|
||||
|
||||
void* R_DrawWorldMeshesDepthOnly(void* renderContext, DrawWorldLists_t worldLists)
|
||||
{
|
||||
if (r_drawWorldMeshesDepthOnly->GetBool())
|
||||
if (r_drawWorldMeshesDepthOnly.GetBool())
|
||||
return V_DrawWorldMeshesDepthOnly(renderContext, worldLists);
|
||||
else
|
||||
return nullptr;
|
||||
@ -35,7 +39,7 @@ void* R_DrawWorldMeshesDepthOnly(void* renderContext, DrawWorldLists_t worldList
|
||||
|
||||
void* R_DrawWorldMeshesDepthAtTheEnd(void* ptr1, void* ptr2, void* ptr3, DrawWorldLists_t worldLists)
|
||||
{
|
||||
if (r_drawWorldMeshesDepthAtTheEnd->GetBool())
|
||||
if (r_drawWorldMeshesDepthAtTheEnd.GetBool())
|
||||
return V_DrawWorldMeshesDepthAtTheEnd(ptr1, ptr2, ptr3, worldLists);
|
||||
else
|
||||
return nullptr;
|
||||
|
@ -52,7 +52,16 @@
|
||||
#endif // !CLIENT_DLL
|
||||
#include "game/shared/vscript_shared.h"
|
||||
|
||||
#ifdef DEDICATED
|
||||
static ConVar hostdesc("hostdesc", "", FCVAR_RELEASE, "Host game server description.");
|
||||
#endif // DEDICATED
|
||||
|
||||
#ifndef CLIENT_DLL
|
||||
static ConVar sv_pylonVisibility("sv_pylonVisibility", "0", FCVAR_RELEASE, "Determines the visibility to the Pylon master server.", "0 = Offline, 1 = Hidden, 2 = Public.");
|
||||
static ConVar sv_pylonRefreshRate("sv_pylonRefreshRate", "5.0", FCVAR_DEVELOPMENTONLY, "Pylon host refresh rate (seconds).");
|
||||
|
||||
static ConVar sv_autoReloadRate("sv_autoReloadRate", "0", FCVAR_RELEASE, "Time in seconds between each server auto-reload (disabled if null).");
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Send keep alive request to Pylon Master Server.
|
||||
// Input : &netGameServer -
|
||||
@ -60,7 +69,7 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
bool HostState_KeepAlive(const NetGameServer_t& netGameServer)
|
||||
{
|
||||
if (!g_pServer->IsActive() || !sv_pylonVisibility->GetBool()) // Check for active game.
|
||||
if (!g_pServer->IsActive() || !sv_pylonVisibility.GetBool()) // Check for active game.
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -267,7 +276,7 @@ void CHostState::Setup(void)
|
||||
RCONClient()->Init();
|
||||
#endif // !DEDICATED
|
||||
|
||||
if (net_useRandomKey->GetBool())
|
||||
if (net_useRandomKey.GetBool())
|
||||
{
|
||||
NET_GenerateKey();
|
||||
}
|
||||
@ -307,14 +316,14 @@ void CHostState::Think(void) const
|
||||
#endif // DEDICATED
|
||||
bInitialized = true;
|
||||
}
|
||||
if (sv_autoReloadRate->GetBool())
|
||||
if (sv_autoReloadRate.GetBool())
|
||||
{
|
||||
if (g_ServerGlobalVariables->m_flCurTime > sv_autoReloadRate->GetFloat())
|
||||
if (g_ServerGlobalVariables->m_flCurTime > sv_autoReloadRate.GetFloat())
|
||||
{
|
||||
Cbuf_AddText(Cbuf_GetCurrentPlayer(), "reload\n", cmd_source_t::kCommandSrcCode);
|
||||
}
|
||||
}
|
||||
if (statsTimer.GetDurationInProgress().GetSeconds() > sv_statusRefreshRate->GetFloat())
|
||||
if (statsTimer.GetDurationInProgress().GetSeconds() > sv_statusRefreshRate.GetFloat())
|
||||
{
|
||||
SetConsoleTitleA(Format("%s - %d/%d Players (%s on %s) - %d%% Server CPU (%.3f msec on frame %d)",
|
||||
hostname->GetString(), g_pServer->GetNumClients(),
|
||||
@ -324,20 +333,20 @@ void CHostState::Think(void) const
|
||||
|
||||
statsTimer.Start();
|
||||
}
|
||||
if (sv_globalBanlist->GetBool() &&
|
||||
banListTimer.GetDurationInProgress().GetSeconds() > sv_banlistRefreshRate->GetFloat())
|
||||
if (sv_globalBanlist.GetBool() &&
|
||||
banListTimer.GetDurationInProgress().GetSeconds() > sv_banlistRefreshRate.GetFloat())
|
||||
{
|
||||
SV_CheckForBan();
|
||||
banListTimer.Start();
|
||||
}
|
||||
#ifdef DEDICATED
|
||||
if (pylonTimer.GetDurationInProgress().GetSeconds() > sv_pylonRefreshRate->GetFloat())
|
||||
if (pylonTimer.GetDurationInProgress().GetSeconds() > sv_pylonRefreshRate.GetFloat())
|
||||
{
|
||||
const NetGameServer_t netGameServer
|
||||
{
|
||||
hostname->GetString(),
|
||||
hostdesc->GetString(),
|
||||
sv_pylonVisibility->GetInt() == EServerVisibility_t::HIDDEN,
|
||||
hostdesc.GetString(),
|
||||
sv_pylonVisibility.GetInt() == EServerVisibility_t::HIDDEN,
|
||||
g_pHostState->m_levelName,
|
||||
v_Playlists_GetCurrent(),
|
||||
hostip->GetString(),
|
||||
|
@ -32,6 +32,25 @@ static void NET_GenerateKey_f()
|
||||
NET_GenerateKey();
|
||||
}
|
||||
|
||||
void NET_UseRandomKeyChanged_f(IConVar* pConVar, const char* pOldString)
|
||||
{
|
||||
if (ConVar* pConVarRef = g_pCVar->FindVar(pConVar->GetName()))
|
||||
{
|
||||
if (strcmp(pOldString, pConVarRef->GetString()) == NULL)
|
||||
return; // Same value.
|
||||
|
||||
if (pConVarRef->GetBool())
|
||||
NET_GenerateKey();
|
||||
else
|
||||
NET_SetKey(DEFAULT_NET_ENCRYPTION_KEY);
|
||||
}
|
||||
}
|
||||
|
||||
ConVar net_useRandomKey("net_useRandomKey", "1", FCVAR_RELEASE, "Use random AES encryption key for game packets.", false, 0.f, false, 0.f, &NET_UseRandomKeyChanged_f, nullptr);
|
||||
|
||||
static ConVar net_tracePayload("net_tracePayload", "0", FCVAR_DEVELOPMENTONLY, "Log the payload of the send/recv datagram to a file on the disk.");
|
||||
static ConVar net_encryptionEnable("net_encryptionEnable", "1", FCVAR_DEVELOPMENTONLY | FCVAR_REPLICATED, "Use AES encryption on game packets.");
|
||||
|
||||
static ConCommand net_setkey("net_setkey", NET_SetKey_f, "Sets user specified base64 net key", FCVAR_RELEASE);
|
||||
static ConCommand net_generatekey("net_generatekey", NET_GenerateKey_f, "Generates and sets a random base64 net key", FCVAR_RELEASE);
|
||||
|
||||
@ -44,10 +63,10 @@ static ConCommand net_generatekey("net_generatekey", NET_GenerateKey_f, "Generat
|
||||
//-----------------------------------------------------------------------------
|
||||
bool NET_ReceiveDatagram(int iSocket, netpacket_s* pInpacket, bool bEncrypted)
|
||||
{
|
||||
const bool decryptPacket = (bEncrypted && net_encryptionEnable->GetBool());
|
||||
const bool decryptPacket = (bEncrypted && net_encryptionEnable.GetBool());
|
||||
const bool result = v_NET_ReceiveDatagram(iSocket, pInpacket, decryptPacket);
|
||||
|
||||
if (result && net_tracePayload->GetBool())
|
||||
if (result && net_tracePayload.GetBool())
|
||||
{
|
||||
// Log received packet data.
|
||||
HexDump("[+] NET_ReceiveDatagram ", "net_trace",
|
||||
@ -68,10 +87,10 @@ bool NET_ReceiveDatagram(int iSocket, netpacket_s* pInpacket, bool bEncrypted)
|
||||
//-----------------------------------------------------------------------------
|
||||
int NET_SendDatagram(SOCKET s, void* pPayload, int iLenght, netadr_t* pAdr, bool bEncrypt)
|
||||
{
|
||||
const bool encryptPacket = (bEncrypt && net_encryptionEnable->GetBool());
|
||||
const bool encryptPacket = (bEncrypt && net_encryptionEnable.GetBool());
|
||||
const int result = v_NET_SendDatagram(s, pPayload, iLenght, pAdr, encryptPacket);
|
||||
|
||||
if (result && net_tracePayload->GetBool())
|
||||
if (result && net_tracePayload.GetBool())
|
||||
{
|
||||
// Log transmitted packet data.
|
||||
HexDump("[+] NET_SendDatagram ", "net_trace", pPayload, size_t(iLenght));
|
||||
@ -177,9 +196,9 @@ void NET_SetKey(const string& svNetKey)
|
||||
//-----------------------------------------------------------------------------
|
||||
void NET_GenerateKey()
|
||||
{
|
||||
if (!net_useRandomKey->GetBool())
|
||||
if (!net_useRandomKey.GetBool())
|
||||
{
|
||||
net_useRandomKey->SetValue(1);
|
||||
net_useRandomKey.SetValue(1);
|
||||
return; // Change callback will handle this.
|
||||
}
|
||||
|
||||
|
@ -55,6 +55,8 @@ extern netkey_t* g_pNetKey;
|
||||
|
||||
extern double* g_pNetTime;
|
||||
|
||||
extern ConVar net_useRandomKey;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class VNet : public IDetour
|
||||
{
|
||||
|
@ -17,6 +17,10 @@
|
||||
#include "server/vengineserver_impl.h"
|
||||
#endif // !CLIENT_DLL
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Console variables
|
||||
//-----------------------------------------------------------------------------
|
||||
static ConVar net_processTimeBudget("net_processTimeBudget", "200", FCVAR_RELEASE, "Net message process time budget in milliseconds (removing netchannel if exceeded).", true, 0.f, false, 0.f, "0 = disabled");
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: gets the netchannel resend rate
|
||||
@ -368,7 +372,7 @@ void CNetChan::_Shutdown(CNetChan* pChan, const char* szReason, uint8_t bBadRep,
|
||||
bool CNetChan::_ProcessMessages(CNetChan* pChan, bf_read* pBuf)
|
||||
{
|
||||
#ifndef CLIENT_DLL
|
||||
if (!ThreadInServerFrameThread() || !net_processTimeBudget->GetInt())
|
||||
if (!ThreadInServerFrameThread() || !net_processTimeBudget.GetInt())
|
||||
return pChan->ProcessMessages(pBuf);
|
||||
|
||||
const double flStartTime = Plat_FloatTime();
|
||||
@ -390,10 +394,10 @@ bool CNetChan::_ProcessMessages(CNetChan* pChan, bf_read* pBuf)
|
||||
const double flCurrentTime = Plat_FloatTime();
|
||||
pExtended->SetNetProcessingTimeMsecs(flStartTime, flCurrentTime);
|
||||
|
||||
if (pExtended->GetNetProcessingTimeMsecs() > net_processTimeBudget->GetFloat())
|
||||
if (pExtended->GetNetProcessingTimeMsecs() > net_processTimeBudget.GetFloat())
|
||||
{
|
||||
Warning(eDLL_T::SERVER, "Removing netchannel '%s' ('%s' exceeded time budget by '%3.1f'ms!)\n",
|
||||
pChan->GetName(), pChan->GetAddress(), (pExtended->GetNetProcessingTimeMsecs() - net_processTimeBudget->GetFloat()));
|
||||
pChan->GetName(), pChan->GetAddress(), (pExtended->GetNetProcessingTimeMsecs() - net_processTimeBudget.GetFloat()));
|
||||
pClient->Disconnect(Reputation_t::REP_MARK_BAD, "#DISCONNECT_NETCHAN_OVERFLOW");
|
||||
|
||||
return false;
|
||||
|
@ -12,6 +12,8 @@
|
||||
#include "gameui/IConsole.h"
|
||||
#endif // !DEDICATED
|
||||
|
||||
static ConVar sdk_fixedframe_tickinterval("sdk_fixedframe_tickinterval", "0.01", FCVAR_RELEASE, "The tick interval used by the SDK fixed frame.");
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -23,7 +25,7 @@ void CEngineSDK::FixedFrame()
|
||||
g_Browser.Think();
|
||||
g_Console.Think();
|
||||
#endif // !DEDICATED
|
||||
std::this_thread::sleep_for(IntervalToDuration(sdk_fixedframe_tickinterval->GetFloat()));
|
||||
std::this_thread::sleep_for(IntervalToDuration(sdk_fixedframe_tickinterval.GetFloat()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,8 @@
|
||||
#include "common/proto_oob.h"
|
||||
#include "datablock_sender.h"
|
||||
|
||||
ConVar net_compressDataBlockLzAcceleration("net_compressDataBlockLzAcceleration", "1", FCVAR_DEVELOPMENTONLY, "The acceleration value for LZ4 data block compression");
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: sends the data block
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -109,7 +111,7 @@ void ServerDataBlockSender::WriteDataBlock(const uint8_t* const sourceData, cons
|
||||
if (net_compressDataBlock->GetBool())
|
||||
{
|
||||
const int encodedSize = LZ4_compress_fast((const char*)sourceData, (char*)m_pScratchBuffer + sizeof(ServerDataBlockHeader_s),
|
||||
dataSize, SNAPSHOT_SCRATCH_BUFFER_SIZE, net_compressDataBlockLzAcceleration->GetInt());
|
||||
dataSize, SNAPSHOT_SCRATCH_BUFFER_SIZE, net_compressDataBlockLzAcceleration.GetInt());
|
||||
|
||||
// this shouldn't happen at all
|
||||
if (!encodedSize)
|
||||
|
@ -20,6 +20,19 @@
|
||||
#include "public/edict.h"
|
||||
#include "pluginsystem/pluginsystem.h"
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
// Console variables
|
||||
//---------------------------------------------------------------------------------
|
||||
ConVar sv_showconnecting("sv_showconnecting", "1", FCVAR_RELEASE, "Logs information about the connecting client to the console");
|
||||
ConVar sv_globalBanlist("sv_globalBanlist", "1", FCVAR_RELEASE, "Determines whether or not to use the global banned list.", false, 0.f, false, 0.f, "0 = Disable, 1 = Enable.");
|
||||
|
||||
ConVar sv_banlistRefreshRate("sv_banlistRefreshRate", "30.0", FCVAR_DEVELOPMENTONLY, "Banned list refresh rate (seconds).", true, 1.f, false, 0.f);
|
||||
ConVar sv_statusRefreshRate("sv_statusRefreshRate", "0.5", FCVAR_RELEASE, "Server status refresh rate (seconds).", true, 0.f, false, 0.f);
|
||||
|
||||
static ConVar sv_validatePersonaName("sv_validatePersonaName", "1", FCVAR_RELEASE, "Validate the client's textual persona name on connect.");
|
||||
static ConVar sv_minPersonaNameLength("sv_minPersonaNameLength", "4", FCVAR_RELEASE, "The minimum length of the client's textual persona name.", true, 0.f, false, 0.f);
|
||||
static ConVar sv_maxPersonaNameLength("sv_maxPersonaNameLength", "16", FCVAR_RELEASE, "The maximum length of the client's textual persona name.", true, 0.f, false, 0.f);
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
// Purpose: Gets the number of human players on the server
|
||||
// Output : int
|
||||
@ -109,7 +122,7 @@ CClient* CServer::ConnectClient(CServer* pServer, user_creds_s* pChallenge)
|
||||
char pszAddresBuffer[128]; // Render the client's address.
|
||||
pChallenge->netAdr.ToString(pszAddresBuffer, sizeof(pszAddresBuffer), true);
|
||||
|
||||
const bool bEnableLogging = sv_showconnecting->GetBool();
|
||||
const bool bEnableLogging = sv_showconnecting.GetBool();
|
||||
const int nPort = int(ntohs(pChallenge->netAdr.GetPort()));
|
||||
|
||||
if (bEnableLogging)
|
||||
@ -121,8 +134,8 @@ CClient* CServer::ConnectClient(CServer* pServer, user_creds_s* pChallenge)
|
||||
if (VALID_CHARSTAR(pszPersonaName) &&
|
||||
V_IsValidUTF8(pszPersonaName))
|
||||
{
|
||||
if (sv_validatePersonaName->GetBool() &&
|
||||
!IsValidPersonaName(pszPersonaName, sv_minPersonaNameLength->GetInt(), sv_maxPersonaNameLength->GetInt()))
|
||||
if (sv_validatePersonaName.GetBool() &&
|
||||
!IsValidPersonaName(pszPersonaName, sv_minPersonaNameLength.GetInt(), sv_maxPersonaNameLength.GetInt()))
|
||||
{
|
||||
bValidName = false;
|
||||
}
|
||||
@ -167,7 +180,7 @@ CClient* CServer::ConnectClient(CServer* pServer, user_creds_s* pChallenge)
|
||||
}
|
||||
}
|
||||
|
||||
if (pClient && sv_globalBanlist->GetBool())
|
||||
if (pClient && sv_globalBanlist.GetBool())
|
||||
{
|
||||
if (!pClient->GetNetChan()->GetRemoteAddress().IsLoopback())
|
||||
{
|
||||
|
@ -111,6 +111,13 @@ static_assert(sizeof(CServer) == 0x25264C0);
|
||||
|
||||
extern CServer* g_pServer;
|
||||
|
||||
extern ConVar sv_globalBanlist;
|
||||
extern ConVar sv_banlistRefreshRate;
|
||||
|
||||
extern ConVar sv_statusRefreshRate;
|
||||
|
||||
extern ConVar sv_showconnecting;
|
||||
|
||||
/* ==== CSERVER ========================================================================================================================================================= */
|
||||
inline void(*CServer__FrameJob)(double flFrameTime, bool bRunOverlays, bool bUpdateFrame);
|
||||
inline void(*CServer__RunFrame)(CServer* pServer);
|
||||
|
@ -17,13 +17,35 @@
|
||||
#include "mbedtls/include/mbedtls/sha512.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Purpose: constants
|
||||
//-----------------------------------------------------------------------------
|
||||
static const char s_NoAuthMessage[] = "This server is password protected for console access; authenticate with 'PASS <password>' command.\n";
|
||||
static const char s_WrongPwMessage[] = "Admin password incorrect.\n";
|
||||
static const char s_AuthMessage[] = "Authentication successful.\n";
|
||||
static const char s_BannedMessage[] = "Go away.\n";
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: console variables
|
||||
//-----------------------------------------------------------------------------
|
||||
static void RCON_WhiteListAddresChanged_f(IConVar* pConVar, const char* pOldString);
|
||||
static void RCON_ConnectionCountChanged_f(IConVar* pConVar, const char* pOldString);
|
||||
static void RCON_PasswordChanged_f(IConVar* pConVar, const char* pOldString);
|
||||
|
||||
static ConVar rcon_password("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, &RCON_PasswordChanged_f);
|
||||
|
||||
static ConVar sv_rcon_debug("sv_rcon_debug", "0", FCVAR_RELEASE, "Show rcon debug information ( !slower! )");
|
||||
static ConVar sv_rcon_sendlogs("sv_rcon_sendlogs", "0", FCVAR_RELEASE, "Network console logs to connected and authenticated sockets");
|
||||
|
||||
//static ConVar sv_rcon_banpenalty("sv_rcon_banpenalty" , "10", FCVAR_RELEASE, "Number of minutes to ban users who fail rcon authentication");
|
||||
|
||||
static ConVar sv_rcon_maxfailures("sv_rcon_maxfailures", "10", FCVAR_RELEASE, "Max number of times an user can fail rcon authentication before being banned", true, 1.f, false, 0.f);
|
||||
static ConVar sv_rcon_maxignores("sv_rcon_maxignores", "15", FCVAR_RELEASE, "Max number of times an user can ignore the instruction message before being banned", true, 1.f, false, 0.f);
|
||||
static ConVar sv_rcon_maxsockets("sv_rcon_maxsockets", "32", FCVAR_RELEASE, "Max number of accepted sockets before the server starts closing redundant sockets", true, 1.f, true, MAX_PLAYERS);
|
||||
|
||||
static ConVar sv_rcon_maxconnections("sv_rcon_maxconnections", "1", FCVAR_RELEASE, "Max number of authenticated connections before the server closes the listen socket", true, 1.f, true, MAX_PLAYERS, &RCON_ConnectionCountChanged_f);
|
||||
static ConVar sv_rcon_maxpacketsize("sv_rcon_maxpacketsize", "1024", FCVAR_RELEASE, "Max number of bytes allowed in a command packet from a non-authenticated netconsole", true, 0.f, false, 0.f);
|
||||
static ConVar sv_rcon_whitelist_address("sv_rcon_whitelist_address", "", FCVAR_RELEASE, "This address is not considered a 'redundant' socket and will never be banned for failed authentication attempts", &RCON_WhiteListAddresChanged_f, "Format: '::ffff:127.0.0.1'");
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -51,7 +73,7 @@ void CRConServer::Init(void)
|
||||
{
|
||||
if (!m_bInitialized)
|
||||
{
|
||||
if (!SetPassword(rcon_password->GetString()))
|
||||
if (!SetPassword(rcon_password.GetString()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -97,7 +119,7 @@ void CRConServer::Think(void)
|
||||
const int nCount = m_Socket.GetAcceptedSocketCount();
|
||||
|
||||
// Close redundant sockets if there are too many except for whitelisted and authenticated.
|
||||
if (nCount > sv_rcon_maxsockets->GetInt())
|
||||
if (nCount > sv_rcon_maxsockets.GetInt())
|
||||
{
|
||||
for (m_nConnIndex = nCount - 1; m_nConnIndex >= 0; m_nConnIndex--)
|
||||
{
|
||||
@ -202,7 +224,7 @@ void CRConServer::RunFrame(void)
|
||||
continue;
|
||||
}
|
||||
|
||||
Recv(data, sv_rcon_maxpacketsize->GetInt());
|
||||
Recv(data, sv_rcon_maxpacketsize.GetInt());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -350,13 +372,13 @@ void CRConServer::Authenticate(const cl_rcon::request& request, CConnectedNetCon
|
||||
if (Comparator(request.requestmsg()))
|
||||
{
|
||||
data.m_bAuthorized = true;
|
||||
if (++m_nAuthConnections >= sv_rcon_maxconnections->GetInt())
|
||||
if (++m_nAuthConnections >= sv_rcon_maxconnections.GetInt())
|
||||
{
|
||||
m_Socket.CloseListenSocket();
|
||||
CloseNonAuthConnection();
|
||||
}
|
||||
|
||||
const char* pSendLogs = (!sv_rcon_sendlogs->GetBool() || data.m_bInputOnly) ? "0" : "1";
|
||||
const char* pSendLogs = (!sv_rcon_sendlogs.GetBool() || data.m_bInputOnly) ? "0" : "1";
|
||||
|
||||
SendEncode(data.m_hSocket, s_AuthMessage, pSendLogs,
|
||||
sv_rcon::response_t::SERVERDATA_RESPONSE_AUTH, static_cast<int>(eDLL_T::NETCON));
|
||||
@ -364,7 +386,7 @@ void CRConServer::Authenticate(const cl_rcon::request& request, CConnectedNetCon
|
||||
else // Bad password.
|
||||
{
|
||||
const netadr_t& netAdr = m_Socket.GetAcceptedSocketAddress(m_nConnIndex);
|
||||
if (sv_rcon_debug->GetBool())
|
||||
if (sv_rcon_debug.GetBool())
|
||||
{
|
||||
Msg(eDLL_T::SERVER, "Bad RCON password attempt from '%s'\n", netAdr.ToString());
|
||||
}
|
||||
@ -449,11 +471,11 @@ bool CRConServer::ProcessMessage(const char* pMsgBuf, const int nMsgLen)
|
||||
const bool bWantLog = atoi(request.requestval().c_str()) != NULL;
|
||||
|
||||
data.m_bInputOnly = !bWantLog;
|
||||
if (bWantLog && !sv_rcon_sendlogs->GetBool())
|
||||
if (bWantLog && !sv_rcon_sendlogs.GetBool())
|
||||
{
|
||||
// Toggle it on since there's at least 1 netconsole that
|
||||
// wants to receive logs.
|
||||
sv_rcon_sendlogs->SetValue(bWantLog);
|
||||
sv_rcon_sendlogs.SetValue(bWantLog);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -539,7 +561,7 @@ bool CRConServer::CheckForBan(CConnectedNetConsoleData& data)
|
||||
|
||||
if (m_BannedList.size() >= RCON_MAX_BANNEDLIST_SIZE)
|
||||
{
|
||||
const char* pszWhiteListAddress = sv_rcon_whitelist_address->GetString();
|
||||
const char* pszWhiteListAddress = sv_rcon_whitelist_address.GetString();
|
||||
if (!pszWhiteListAddress[0])
|
||||
{
|
||||
Warning(eDLL_T::SERVER, "Banned list overflowed; please use a whitelist address. RCON shutting down...\n");
|
||||
@ -551,7 +573,7 @@ bool CRConServer::CheckForBan(CConnectedNetConsoleData& data)
|
||||
// Only allow whitelisted at this point.
|
||||
if (!m_WhiteListAddress.CompareAdr(netAdr))
|
||||
{
|
||||
if (sv_rcon_debug->GetBool())
|
||||
if (sv_rcon_debug.GetBool())
|
||||
{
|
||||
Msg(eDLL_T::SERVER, "Banned list is full; dropping '%s'\n", szNetAdr);
|
||||
}
|
||||
@ -569,8 +591,8 @@ bool CRConServer::CheckForBan(CConnectedNetConsoleData& data)
|
||||
}
|
||||
|
||||
// Check if netconsole has reached maximum number of attempts > add to banned list.
|
||||
if (data.m_nFailedAttempts >= sv_rcon_maxfailures->GetInt()
|
||||
|| data.m_nIgnoredMessage >= sv_rcon_maxignores->GetInt())
|
||||
if (data.m_nFailedAttempts >= sv_rcon_maxfailures.GetInt()
|
||||
|| data.m_nIgnoredMessage >= sv_rcon_maxignores.GetInt())
|
||||
{
|
||||
// Don't add white listed address to banned list.
|
||||
if (m_WhiteListAddress.CompareAdr(netAdr))
|
||||
@ -651,7 +673,7 @@ bool CRConServer::ShouldSend(const sv_rcon::response_t responseType) const
|
||||
|
||||
if (responseType == sv_rcon::response_t::SERVERDATA_RESPONSE_CONSOLE_LOG)
|
||||
{
|
||||
if (!sv_rcon_sendlogs->GetBool() || !m_Socket.GetAuthorizedSocketCount())
|
||||
if (!sv_rcon_sendlogs.GetBool() || !m_Socket.GetAuthorizedSocketCount())
|
||||
{
|
||||
// Disabled or no authorized clients to send to...
|
||||
return false;
|
||||
@ -677,6 +699,79 @@ int CRConServer::GetAuthenticatedCount(void) const
|
||||
return m_nAuthConnections;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: change whitelist address on RCON server
|
||||
//-----------------------------------------------------------------------------
|
||||
static void RCON_WhiteListAddresChanged_f(IConVar* pConVar, const char* pOldString)
|
||||
{
|
||||
if (ConVar* pConVarRef = g_pCVar->FindVar(pConVar->GetName()))
|
||||
{
|
||||
if (strcmp(pOldString, pConVarRef->GetString()) == NULL)
|
||||
return; // Same address.
|
||||
|
||||
if (!RCONServer()->SetWhiteListAddress(pConVarRef->GetString()))
|
||||
{
|
||||
Warning(eDLL_T::SERVER, "Failed to set RCON whitelist address: %s\n", pConVarRef->GetString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: change max connection count on RCON server
|
||||
//-----------------------------------------------------------------------------
|
||||
static void RCON_ConnectionCountChanged_f(IConVar* pConVar, const char* pOldString)
|
||||
{
|
||||
if (!RCONServer()->IsInitialized())
|
||||
return; // Not initialized; no sockets at this point.
|
||||
|
||||
if (ConVar* pConVarRef = g_pCVar->FindVar(pConVar->GetName()))
|
||||
{
|
||||
if (strcmp(pOldString, pConVarRef->GetString()) == NULL)
|
||||
return; // Same count.
|
||||
|
||||
const int maxCount = pConVarRef->GetInt();
|
||||
|
||||
int count = RCONServer()->GetAuthenticatedCount();
|
||||
CSocketCreator* pCreator = RCONServer()->GetSocketCreator();
|
||||
|
||||
if (count < maxCount)
|
||||
{
|
||||
if (!pCreator->IsListening())
|
||||
{
|
||||
pCreator->CreateListenSocket(*RCONServer()->GetNetAddress());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (count > maxCount)
|
||||
{
|
||||
RCONServer()->Disconnect(count - 1, "too many authenticated sockets");
|
||||
count = RCONServer()->GetAuthenticatedCount();
|
||||
}
|
||||
|
||||
pCreator->CloseListenSocket();
|
||||
RCONServer()->CloseNonAuthConnection();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: change RCON password on server and drop all connections
|
||||
//-----------------------------------------------------------------------------
|
||||
void RCON_PasswordChanged_f(IConVar* pConVar, const char* pOldString)
|
||||
{
|
||||
if (ConVar* pConVarRef = g_pCVar->FindVar(pConVar->GetName()))
|
||||
{
|
||||
if (strcmp(pOldString, pConVarRef->GetString()) == NULL)
|
||||
return; // Same password.
|
||||
|
||||
if (RCONServer()->IsInitialized())
|
||||
RCONServer()->SetPassword(pConVarRef->GetString());
|
||||
else
|
||||
RCONServer()->Init(); // Initialize first.
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
static CRConServer s_RCONServer;
|
||||
CRConServer* RCONServer() // Singleton RCON Server.
|
||||
|
@ -173,14 +173,31 @@ void CEngineAPI::PumpMessages()
|
||||
#endif // !DEDICATED
|
||||
}
|
||||
|
||||
#ifndef DEDICATED
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: force update NVIDIA Reflex Low Latency parameters
|
||||
//-----------------------------------------------------------------------------
|
||||
static void GFX_NVN_Changed_f(IConVar* pConVar, const char* pOldString)
|
||||
{
|
||||
GFX_MarkLowLatencyParametersOutOfDate();
|
||||
}
|
||||
|
||||
static ConVar fps_max_gfx("fps_max_gfx", "0", FCVAR_RELEASE, "Frame rate limiter using NVIDIA Reflex Low Latency SDK. -1 indicates the use of desktop refresh. 0 is disabled.", true, -1.f, true, 295.f, GFX_NVN_Changed_f);
|
||||
static ConVar gfx_nvnUseLowLatency("gfx_nvnUseLowLatency", "1", FCVAR_RELEASE | FCVAR_ARCHIVE, "Enables NVIDIA Reflex Low Latency SDK.", GFX_NVN_Changed_f);
|
||||
static ConVar gfx_nvnUseLowLatencyBoost("gfx_nvnUseLowLatencyBoost", "0", FCVAR_RELEASE | FCVAR_ARCHIVE, "Enables NVIDIA Reflex Low Latency Boost.", GFX_NVN_Changed_f);
|
||||
|
||||
// NOTE: defaulted to 0 as it causes rubber banding on some hardware.
|
||||
static ConVar gfx_nvnUseMarkersToOptimize("gfx_nvnUseMarkersToOptimize", "0", FCVAR_RELEASE, "Use NVIDIA Reflex Low Latency markers to optimize (requires Low Latency Boost to be enabled).", GFX_NVN_Changed_f);
|
||||
#endif // !DEDICATED
|
||||
|
||||
void CEngineAPI::UpdateLowLatencyParameters()
|
||||
{
|
||||
#ifndef DEDICATED
|
||||
const bool bUseLowLatencyMode = gfx_nvnUseLowLatency->GetBool();
|
||||
const bool bUseLowLatencyBoost = gfx_nvnUseLowLatencyBoost->GetBool();
|
||||
const bool bUseMarkersToOptimize = gfx_nvnUseMarkersToOptimize->GetBool();
|
||||
const bool bUseLowLatencyMode = gfx_nvnUseLowLatency.GetBool();
|
||||
const bool bUseLowLatencyBoost = gfx_nvnUseLowLatencyBoost.GetBool();
|
||||
const bool bUseMarkersToOptimize = gfx_nvnUseMarkersToOptimize.GetBool();
|
||||
|
||||
float fpsMax = fps_max_gfx->GetFloat();
|
||||
float fpsMax = fps_max_gfx.GetFloat();
|
||||
|
||||
if (fpsMax == -1.0f)
|
||||
{
|
||||
|
@ -6,6 +6,8 @@
|
||||
#include "bspfile.h"
|
||||
#include "engine/modelloader.h"
|
||||
|
||||
static ConVar fs_showWarnings("fs_showWarnings", "0", FCVAR_DEVELOPMENTONLY, "Logs the FileSystem warnings to the console, filtered by 'fs_warning_level' ( !slower! ).", true, 0.f, true, 2.f, "0 = log to file. 1 = 0 + log to console. 2 = 1 + log to notify");
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
// Purpose: prints the output of the filesystem based on the warning level
|
||||
// Input : *this -
|
||||
@ -25,7 +27,7 @@ void CBaseFileSystem::Warning(CBaseFileSystem* pFileSystem, FileWarningLevel_t l
|
||||
|
||||
va_list args;
|
||||
va_start(args, pFmt);
|
||||
CoreMsgV(LogType_t::LOG_WARNING, static_cast<LogLevel_t>(fs_showWarnings->GetInt()), eDLL_T::FS, "filesystem", pFmt, args);
|
||||
CoreMsgV(LogType_t::LOG_WARNING, static_cast<LogLevel_t>(fs_showWarnings.GetInt()), eDLL_T::FS, "filesystem", pFmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
@ -476,3 +476,14 @@ void Script_RegisterCoreClientFunctions(CSquirrelVM* s)
|
||||
{
|
||||
DEFINE_CLIENT_SCRIPTFUNC_NAMED(s, IsClientDLL, "Returns whether this build is client only", "bool", "");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
// Purpose: console variables for scripts, these should not be used in engine/sdk code !!!
|
||||
//---------------------------------------------------------------------------------
|
||||
static ConVar settings_reflex("settings_reflex", "1", FCVAR_RELEASE, "Selected NVIDIA Reflex mode.", "0 = Off. 1 = On. 2 = On + Boost.");
|
||||
static ConVar serverbrowser_hideEmptyServers("serverbrowser_hideEmptyServers", "0", FCVAR_RELEASE, "Hide empty servers in the server browser.");
|
||||
static ConVar serverbrowser_mapFilter("serverbrowser_mapFilter", "0", FCVAR_RELEASE, "Filter servers by map in the server browser.");
|
||||
static ConVar serverbrowser_gamemodeFilter("serverbrowser_gamemodeFilter", "0", FCVAR_RELEASE, "Filter servers by gamemode in the server browser.");
|
||||
|
||||
// NOTE: if we want to make a certain promo only show once, add the playerprofile flag to the cvar below. Current behavior = always show after game restart.
|
||||
static ConVar promo_version_accepted("promo_version_accepted", "0", FCVAR_RELEASE, "The accepted promo version.");
|
||||
|
@ -11,6 +11,8 @@ int g_DebugConnectNode1 = -1;
|
||||
int g_DebugConnectNode2 = -1;
|
||||
#define DebuggingConnect( node1, node2 ) ( ( node1 == g_DebugConnectNode1 && node2 == g_DebugConnectNode2 ) || ( node1 == g_DebugConnectNode2 && node2 == g_DebugConnectNode1 ) )
|
||||
|
||||
static ConVar ai_ainDebugConnect("ai_ainDebugConnect", "0", FCVAR_DEVELOPMENTONLY, "Debug AIN node connections");
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: debug logs node connections
|
||||
// Input : node1 -
|
||||
@ -20,7 +22,7 @@ int g_DebugConnectNode2 = -1;
|
||||
//-----------------------------------------------------------------------------
|
||||
void CAI_Network::DebugConnectMsg(int node1, int node2, const char* pszFormat, ...)
|
||||
{
|
||||
if (ai_ainDebugConnect->GetBool())
|
||||
if (ai_ainDebugConnect.GetBool())
|
||||
{
|
||||
if (DebuggingConnect(node1, node2))
|
||||
{
|
||||
|
@ -22,6 +22,9 @@ constexpr int AINET_MINIMUM_SIZE = 82; // The file is at least this lar
|
||||
constexpr const char* AINETWORK_EXT = ".ain";
|
||||
constexpr const char* AINETWORK_PATH = "maps/graphs/";
|
||||
|
||||
|
||||
static ConVar ai_ainDumpOnLoad("ai_ainDumpOnLoad", "0", FCVAR_DEVELOPMENTONLY, "Dumps AIN data from node graphs loaded from the disk on load");
|
||||
|
||||
/*
|
||||
==============================
|
||||
CAI_NetworkBuilder::BuildFile
|
||||
@ -521,7 +524,7 @@ void CAI_NetworkManager::LoadNetworkGraphEx(CAI_NetworkManager* pManager, CUtlBu
|
||||
{
|
||||
CAI_NetworkManager__LoadNetworkGraph(pManager, pBuffer, szAIGraphFile);
|
||||
|
||||
if (ai_ainDumpOnLoad->GetBool())
|
||||
if (ai_ainDumpOnLoad.GetBool())
|
||||
{
|
||||
Msg(eDLL_T::SERVER, "Dumping AI Network '%s'\n", szAIGraphFile);
|
||||
CAI_NetworkBuilder::SaveNetworkGraph(pManager->m_pNetwork);
|
||||
|
@ -12,6 +12,8 @@
|
||||
#include "game/server/detour_impl.h"
|
||||
#include "game/server/ai_networkmanager.h"
|
||||
|
||||
static ConVar navmesh_always_reachable("navmesh_always_reachable", "0", FCVAR_DEVELOPMENTONLY, "Marks goal poly from agent poly as reachable regardless of table data ( !slower! )");
|
||||
|
||||
inline uint32_t g_HullMasks[10] = // Hull mask table [r5apex_ds.exe + 131a2f8].
|
||||
{
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
@ -71,7 +73,7 @@ uint32_t GetHullMaskById(int hullId)
|
||||
//-----------------------------------------------------------------------------
|
||||
uint8_t IsGoalPolyReachable(dtNavMesh* nav, dtPolyRef fromRef, dtPolyRef goalRef, int hullId)
|
||||
{
|
||||
if (navmesh_always_reachable->GetBool())
|
||||
if (navmesh_always_reachable.GetBool())
|
||||
return true;
|
||||
|
||||
return dtNavMesh__isPolyReachable(nav, fromRef, goalRef, hullId);
|
||||
|
@ -12,12 +12,14 @@
|
||||
#include "engine/client/client.h"
|
||||
#include "game/server/util_server.h"
|
||||
|
||||
static ConVar sv_simulateBots("sv_simulateBots", "1", FCVAR_RELEASE, "Simulate user commands for bots on the server.");
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Runs the command simulation for fake players
|
||||
//-----------------------------------------------------------------------------
|
||||
void Physics_RunBotSimulation(bool bSimulating)
|
||||
{
|
||||
if (!sv_simulateBots->GetBool())
|
||||
if (!sv_simulateBots.GetBool())
|
||||
return;
|
||||
|
||||
for (int i = 0; i < g_ServerGlobalVariables->m_nMaxClients; i++)
|
||||
|
@ -176,6 +176,11 @@ void CPlayer::ClampUnlag(CUserCmd* cmd)
|
||||
// droppedPackets -
|
||||
// paused -
|
||||
//------------------------------------------------------------------------------
|
||||
// TODO: this code is experimental and has reported problems from players with
|
||||
// high latency, needs to be debugged or a different approach needs to be taken!
|
||||
// Defaulted to OFF for now
|
||||
static ConVar sv_unlag_clamp("sv_unlag_clamp", "0", FCVAR_RELEASE, "Clamp the difference between the current time and received command time to sv_maxunlag + sv_clockcorrection_msecs.");
|
||||
|
||||
void CPlayer::ProcessUserCmds(CUserCmd* cmds, int numCmds, int totalCmds,
|
||||
int droppedPackets, bool paused)
|
||||
{
|
||||
@ -198,7 +203,7 @@ void CPlayer::ProcessUserCmds(CUserCmd* cmds, int numCmds, int totalCmds,
|
||||
if (lastCommandNumber == MAX_QUEUED_COMMANDS_PROCESS)
|
||||
return;
|
||||
|
||||
if (sv_unlag_clamp->GetBool())
|
||||
if (sv_unlag_clamp.GetBool())
|
||||
ClampUnlag(cmd);
|
||||
|
||||
CUserCmd* queuedCmd = &m_Commands[lastCommandNumber];
|
||||
|
@ -21,6 +21,19 @@
|
||||
#include "thirdparty/recast/Detour/Include/DetourCommon.h"
|
||||
#include "thirdparty/recast/Detour/Include/DetourNavMesh.h"
|
||||
|
||||
static ConVar ai_script_nodes_draw_range("ai_script_nodes_draw_range", "0", FCVAR_DEVELOPMENTONLY, "Debug draw AIN script nodes ranging from shift index to this cvar");
|
||||
static ConVar ai_script_nodes_draw_nearest("ai_script_nodes_draw_nearest", "1", FCVAR_DEVELOPMENTONLY, "Debug draw AIN script node links to nearest node (build order is used if null)");
|
||||
|
||||
static ConVar navmesh_debug_type("navmesh_debug_type", "0", FCVAR_DEVELOPMENTONLY, "NavMesh debug draw hull index", true, 0.f, true, 4.f, nullptr, "0 = small, 1 = med_short, 2 = medium, 3 = large, 4 = extra large");
|
||||
static ConVar navmesh_debug_tile_range("navmesh_debug_tile_range", "0", FCVAR_DEVELOPMENTONLY, "NavMesh debug draw tiles ranging from shift index to this cvar", true, 0.f, false, 0.f);
|
||||
static ConVar navmesh_debug_camera_range("navmesh_debug_camera_range", "2000", FCVAR_DEVELOPMENTONLY, "Only debug draw tiles within this distance from camera origin", true, 0.f, false, 0.f);
|
||||
|
||||
static ConVar navmesh_draw_bvtree("navmesh_draw_bvtree", "-1", FCVAR_DEVELOPMENTONLY, "Draws the BVTree of the NavMesh tiles", false, 0.f, false, 0.f, nullptr, "Index: >= 0 && < mesh->m_tileCount");
|
||||
static ConVar navmesh_draw_portal("navmesh_draw_portal", "-1", FCVAR_DEVELOPMENTONLY, "Draws the portal of the NavMesh tiles", false, 0.f, false, 0.f, nullptr, "Index: >= 0 && < mesh->m_tileCount");
|
||||
static ConVar navmesh_draw_polys("navmesh_draw_polys", "-1", FCVAR_DEVELOPMENTONLY, "Draws the polys of the NavMesh tiles", false, 0.f, false, 0.f, nullptr, "Index: >= 0 && < mesh->m_tileCount");
|
||||
static ConVar navmesh_draw_poly_bounds("navmesh_draw_poly_bounds", "-1", FCVAR_DEVELOPMENTONLY, "Draws the bounds of the NavMesh polys", false, 0.f, false, 0.f, nullptr, "Index: >= 0 && < mesh->m_tileCount");
|
||||
static ConVar navmesh_draw_poly_bounds_inner("navmesh_draw_poly_bounds_inner", "0", FCVAR_DEVELOPMENTONLY, "Draws the inner bounds of the NavMesh polys (requires navmesh_draw_poly_bounds)");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//------------------------------------------------------------------------------
|
||||
@ -43,10 +56,10 @@ static const fltx4 s_xSubMask = LoadAlignedSIMD(s_vSubMask);
|
||||
void CAI_Utility::RunRenderFrame(void)
|
||||
{
|
||||
const int iScriptNodeIndex = ai_script_nodes_draw->GetInt();
|
||||
const int iNavMeshBVTreeIndex = navmesh_draw_bvtree->GetInt();
|
||||
const int iNavMeshPortalIndex = navmesh_draw_portal->GetInt();
|
||||
const int iNavMeshPolyIndex = navmesh_draw_polys->GetInt();
|
||||
const int iNavMeshPolyBoundIndex = navmesh_draw_poly_bounds->GetInt();
|
||||
const int iNavMeshBVTreeIndex = navmesh_draw_bvtree.GetInt();
|
||||
const int iNavMeshPortalIndex = navmesh_draw_portal.GetInt();
|
||||
const int iNavMeshPolyIndex = navmesh_draw_polys.GetInt();
|
||||
const int iNavMeshPolyBoundIndex = navmesh_draw_poly_bounds.GetInt();
|
||||
|
||||
if (iScriptNodeIndex <= -1 &&
|
||||
iNavMeshBVTreeIndex <= -1 &&
|
||||
@ -64,9 +77,9 @@ void CAI_Utility::RunRenderFrame(void)
|
||||
const Vector3D vNormal = vCamera - aCamera.GetNormal() * 256.0f;
|
||||
const VPlane vCullPlane(vNormal, aCamera);
|
||||
|
||||
const float flCameraRange = navmesh_debug_camera_range->GetFloat();
|
||||
const int nTileRange = navmesh_debug_tile_range->GetInt();
|
||||
const bool bUseDepthBuffer = r_debug_draw_depth_test->GetBool();
|
||||
const float flCameraRange = navmesh_debug_camera_range.GetFloat();
|
||||
const int nTileRange = navmesh_debug_tile_range.GetInt();
|
||||
const bool bUseDepthBuffer = r_debug_draw_depth_test.GetBool();
|
||||
|
||||
if (iScriptNodeIndex > -1)
|
||||
g_pAIUtility->DrawAIScriptNetwork(*g_pAINetwork, vCamera, iScriptNodeIndex, flCameraRange, bUseDepthBuffer);
|
||||
@ -98,8 +111,8 @@ void CAI_Utility::DrawAIScriptNetwork(
|
||||
if (!pNetwork)
|
||||
return; // AI Network not build or loaded.
|
||||
|
||||
const bool bDrawNearest = ai_script_nodes_draw_nearest->GetBool();
|
||||
const int nNodeRange = ai_script_nodes_draw_range->GetInt();
|
||||
const bool bDrawNearest = ai_script_nodes_draw_nearest.GetBool();
|
||||
const int nNodeRange = ai_script_nodes_draw_range.GetInt();
|
||||
|
||||
OverlayBox_t::Transforms vTransforms;
|
||||
std::unordered_set<int64_t> uLinkSet;
|
||||
@ -174,7 +187,7 @@ void CAI_Utility::DrawNavMeshBVTree(
|
||||
const bool bDepthBuffer) const
|
||||
{
|
||||
if (!pMesh)
|
||||
pMesh = GetNavMeshForHull(navmesh_debug_type->GetInt());
|
||||
pMesh = GetNavMeshForHull(navmesh_debug_type.GetInt());
|
||||
if (!pMesh)
|
||||
return; // NavMesh for hull not loaded.
|
||||
|
||||
@ -235,7 +248,7 @@ void CAI_Utility::DrawNavMeshPortals(const dtNavMesh* pMesh,
|
||||
const bool bDepthBuffer) const
|
||||
{
|
||||
if (!pMesh)
|
||||
pMesh = GetNavMeshForHull(navmesh_debug_type->GetInt());
|
||||
pMesh = GetNavMeshForHull(navmesh_debug_type.GetInt());
|
||||
if (!pMesh)
|
||||
return; // NavMesh for hull not loaded.
|
||||
|
||||
@ -355,7 +368,7 @@ void CAI_Utility::DrawNavMeshPolys(const dtNavMesh* pMesh,
|
||||
const bool bDepthBuffer) const
|
||||
{
|
||||
if (!pMesh)
|
||||
pMesh = GetNavMeshForHull(navmesh_debug_type->GetInt());
|
||||
pMesh = GetNavMeshForHull(navmesh_debug_type.GetInt());
|
||||
if (!pMesh)
|
||||
return; // NavMesh for hull not loaded.
|
||||
|
||||
@ -439,11 +452,11 @@ void CAI_Utility::DrawNavMeshPolyBoundaries(const dtNavMesh* pMesh,
|
||||
Color col{ 20, 140, 255, 255 };
|
||||
|
||||
if (!pMesh)
|
||||
pMesh = GetNavMeshForHull(navmesh_debug_type->GetInt());
|
||||
pMesh = GetNavMeshForHull(navmesh_debug_type.GetInt());
|
||||
if (!pMesh)
|
||||
return; // NavMesh for hull not loaded.
|
||||
|
||||
const bool bDrawInner = navmesh_draw_poly_bounds_inner->GetBool();
|
||||
const bool bDrawInner = navmesh_draw_poly_bounds_inner.GetBool();
|
||||
|
||||
for (int i = iBoundaryIndex, nt = pMesh->getTileCount(); i < nt; ++i)
|
||||
{
|
||||
|
@ -10,6 +10,11 @@
|
||||
#include "game/shared/in_buttons.h"
|
||||
#include "game/shared/weapon_types.h"
|
||||
|
||||
ConVar usercmd_frametime_max("usercmd_frametime_max", "0.100" , FCVAR_REPLICATED | FCVAR_DEVELOPMENTONLY, "The largest amount of simulation seconds a UserCmd can have." );
|
||||
ConVar usercmd_frametime_min("usercmd_frametime_min", "0.002857", FCVAR_REPLICATED | FCVAR_DEVELOPMENTONLY, "The smallest amount of simulation seconds a UserCmd can have.");
|
||||
|
||||
ConVar usercmd_dualwield_enable("usercmd_dualwield_enable", "0", FCVAR_REPLICATED | FCVAR_RELEASE, "Allows setting dual wield cycle slots, and activating multiple inventory weapons from UserCmd.");
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Read in a delta compressed usercommand.
|
||||
// Input : *buf -
|
||||
@ -47,13 +52,13 @@ int ReadUserCmd(bf_read* buf, CUserCmd* move, CUserCmd* from)
|
||||
// it couldn't be circumvented by busting out the client side clamps.
|
||||
if (host_timescale->GetFloat() == 1.0f)
|
||||
move->frametime = clamp(move->frametime,
|
||||
usercmd_frametime_min->GetFloat(),
|
||||
usercmd_frametime_max->GetFloat());
|
||||
usercmd_frametime_min.GetFloat(),
|
||||
usercmd_frametime_max.GetFloat());
|
||||
|
||||
// Checks are only required if cycleslot is valid; see 'CPlayer::UpdateWeaponSlots'.
|
||||
if (move->cycleslot != WEAPON_INVENTORY_SLOT_INVALID)
|
||||
{
|
||||
const bool dualWieldEnabled = usercmd_dualwield_enable->GetBool();
|
||||
const bool dualWieldEnabled = usercmd_dualwield_enable.GetBool();
|
||||
|
||||
// Client could instruct the server to switch cycle slots for inventory
|
||||
// weapons, however, the client could also cycle to the dual wield slots.
|
||||
|
@ -13,6 +13,14 @@
|
||||
#include "tier1/bitbuf.h"
|
||||
#include "mathlib/vector.h"
|
||||
|
||||
//-------------------------------------------------------------------------------------
|
||||
// Console variables
|
||||
//-------------------------------------------------------------------------------------
|
||||
extern ConVar usercmd_frametime_max;
|
||||
extern ConVar usercmd_frametime_min;
|
||||
|
||||
extern ConVar usercmd_dualwield_enable;
|
||||
|
||||
//-------------------------------------------------------------------------------------
|
||||
// Forward declarations
|
||||
//-------------------------------------------------------------------------------------
|
||||
|
@ -78,7 +78,6 @@ CBrowser::~CBrowser(void)
|
||||
bool CBrowser::Init(void)
|
||||
{
|
||||
SetStyleVar();
|
||||
m_szMatchmakingHostName = pylon_matchmaking_hostname->GetString();
|
||||
|
||||
bool ret = LoadTextureBuffer(reinterpret_cast<unsigned char*>(m_rLockedIconBlob.m_pData), int(m_rLockedIconBlob.m_nSize),
|
||||
&m_idLockedIcon, &m_rLockedIconBlob.m_nWidth, &m_rLockedIconBlob.m_nHeight);
|
||||
@ -169,7 +168,7 @@ void CBrowser::RunTask()
|
||||
bInitialized = true;
|
||||
}
|
||||
|
||||
if (timer.GetDurationInProgress().GetSeconds() > pylon_host_update_interval->GetFloat())
|
||||
if (timer.GetDurationInProgress().GetSeconds() > pylon_host_update_interval.GetFloat())
|
||||
{
|
||||
UpdateHostingStatus();
|
||||
timer.Start();
|
||||
@ -236,11 +235,6 @@ void CBrowser::DrawSurface(void)
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
#endif // !CLIENT_DLL
|
||||
if (ImGui::BeginTabItem("Settings"))
|
||||
{
|
||||
SettingsPanel();
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
ImGui::EndTabBar();
|
||||
}
|
||||
|
||||
@ -371,7 +365,7 @@ void CBrowser::BrowserPanel(void)
|
||||
//-----------------------------------------------------------------------------
|
||||
void CBrowser::RefreshServerList(void)
|
||||
{
|
||||
Msg(eDLL_T::CLIENT, "Refreshing server list with matchmaking host '%s'\n", pylon_matchmaking_hostname->GetString());
|
||||
Msg(eDLL_T::CLIENT, "Refreshing server list with matchmaking host '%s'\n", pylon_matchmaking_hostname.GetString());
|
||||
|
||||
std::string svServerListMessage;
|
||||
g_ServerListManager.RefreshServerList(svServerListMessage);
|
||||
@ -539,10 +533,10 @@ void CBrowser::HostPanel(void)
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
|
||||
m_bQueryGlobalBanList = sv_globalBanlist->GetBool(); // Sync toggle with 'sv_globalBanlist'.
|
||||
m_bQueryGlobalBanList = sv_globalBanlist.GetBool(); // Sync toggle with 'sv_globalBanlist'.
|
||||
if (ImGui::Checkbox("Load global banned list", &m_bQueryGlobalBanList))
|
||||
{
|
||||
sv_globalBanlist->SetValue(m_bQueryGlobalBanList);
|
||||
sv_globalBanlist.SetValue(m_bQueryGlobalBanList);
|
||||
}
|
||||
|
||||
ImGui::Text("Server visibility");
|
||||
@ -829,37 +823,6 @@ void CBrowser::ProcessCommand(const char* pszCommand) const
|
||||
//g_TaskScheduler->Dispatch(Cbuf_Execute, 0); // Run in main thread.
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: draws the settings section
|
||||
//-----------------------------------------------------------------------------
|
||||
void CBrowser::SettingsPanel(void)
|
||||
{
|
||||
ImGui::InputTextWithHint("Hostname", "Matchmaking host name", &m_szMatchmakingHostName);
|
||||
if (ImGui::Button("Update hostname"))
|
||||
{
|
||||
ProcessCommand(Format("%s \"%s\"", pylon_matchmaking_hostname->GetName(), m_szMatchmakingHostName.c_str()).c_str());
|
||||
}
|
||||
|
||||
// The 'const' qualifier has been casted away, however the readonly flag is set.
|
||||
// Still a hack, but better than modifying the Dear ImGui lib even more..
|
||||
ImGui::InputTextWithHint("Netkey", "Network encryption key", const_cast<char*>(g_pNetKey->GetBase64NetKey()), ImGuiInputTextFlags_ReadOnly);
|
||||
if (ImGui::Button("Regenerate encryption key"))
|
||||
{
|
||||
g_TaskScheduler->Dispatch(NET_GenerateKey, 0);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: hooked to 'MP_HostName_Changed_f' to sync hostname field with
|
||||
// the 'pylon_matchmaking_hostname' ConVar (!!! DO NOT USE !!!).
|
||||
// Input : *pszHostName -
|
||||
//-----------------------------------------------------------------------------
|
||||
void CBrowser::SetHostName(const char* pszHostName)
|
||||
{
|
||||
AUTO_LOCK(m_Mutex);
|
||||
m_szMatchmakingHostName = pszHostName;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: sets the browser front-end style
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -31,9 +31,7 @@ public:
|
||||
void SendHostingPostRequest(const NetGameServer_t& gameServer);
|
||||
|
||||
void ProcessCommand(const char* pszCommand) const;
|
||||
void SettingsPanel(void);
|
||||
|
||||
void SetHostName(const char* pszHostName);
|
||||
virtual void SetStyleVar(void);
|
||||
|
||||
inline bool IsVisible() { return m_flFadeAlpha > 0.0f; }
|
||||
@ -64,7 +62,6 @@ private:
|
||||
////////////////////
|
||||
ImGuiTextFilter m_imServerBrowserFilter;
|
||||
string m_svServerListMessage;
|
||||
string m_szMatchmakingHostName;
|
||||
|
||||
////////////////////
|
||||
// Host Server //
|
||||
|
@ -23,6 +23,19 @@ History:
|
||||
#include "engine/cmd.h"
|
||||
#include "gameui/IConsole.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Console variables
|
||||
//-----------------------------------------------------------------------------
|
||||
static ConVar con_max_lines("con_max_lines", "1024", FCVAR_DEVELOPMENTONLY | FCVAR_MATERIAL_SYSTEM_THREAD, "Maximum number of lines in the console before cleanup starts", true, 1.f, false, 0.f);
|
||||
static ConVar con_max_history("con_max_history", "512", FCVAR_DEVELOPMENTONLY | FCVAR_MATERIAL_SYSTEM_THREAD, "Maximum number of command submission items before history cleanup starts", true, 0.f, false, 0.f);
|
||||
static ConVar con_suggest_limit("con_suggest_limit", "128", FCVAR_DEVELOPMENTONLY | FCVAR_MATERIAL_SYSTEM_THREAD, "Maximum number of suggestions the autocomplete window will show for the console", true, 0.f, false, 0.f);
|
||||
|
||||
static ConVar con_suggest_showhelptext("con_suggest_showhelptext", "1", FCVAR_DEVELOPMENTONLY | FCVAR_MATERIAL_SYSTEM_THREAD, "Show CommandBase help text in autocomplete window");
|
||||
static ConVar con_suggest_showflags("con_suggest_showflags", "1", FCVAR_DEVELOPMENTONLY | FCVAR_MATERIAL_SYSTEM_THREAD, "Show CommandBase flags in autocomplete window");
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Console commands
|
||||
//-----------------------------------------------------------------------------
|
||||
static ConCommand toggleconsole("toggleconsole", CConsole::ToggleConsole_f, "Show/hide the developer console.", FCVAR_CLIENTDLL | FCVAR_RELEASE);
|
||||
|
||||
static ConCommand con_history("con_history", CConsole::LogHistory_f, "Shows the developer console submission history", FCVAR_CLIENTDLL | FCVAR_RELEASE);
|
||||
@ -410,7 +423,7 @@ void CConsole::SuggestPanel(void)
|
||||
|
||||
ImGui::PushID(static_cast<int>(i));
|
||||
|
||||
if (con_suggest_showflags->GetBool())
|
||||
if (con_suggest_showflags.GetBool())
|
||||
{
|
||||
// Show the flag texture before the cvar name.
|
||||
const int mainTexIdx = GetFlagTextureIndex(suggest.m_nFlags);
|
||||
@ -603,7 +616,7 @@ void CConsole::FindFromPartial(void)
|
||||
ICvar::Iterator iter(g_pCVar);
|
||||
for (iter.SetFirst(); iter.IsValid(); iter.Next())
|
||||
{
|
||||
if (m_vSuggest.size() >= con_suggest_limit->GetInt())
|
||||
if (m_vSuggest.size() >= con_suggest_limit.GetInt())
|
||||
{
|
||||
break;
|
||||
}
|
||||
@ -633,7 +646,7 @@ void CConsole::FindFromPartial(void)
|
||||
svValue.append(pConVar->GetString());
|
||||
svValue.append("]");
|
||||
}
|
||||
if (con_suggest_showhelptext->GetBool())
|
||||
if (con_suggest_showhelptext.GetBool())
|
||||
{
|
||||
std::function<void(string& , const char*)> fnAppendDocString = [&](string& svTarget, const char* pszDocString)
|
||||
{
|
||||
@ -748,7 +761,7 @@ void CConsole::BuildSuggestPanelRect(void)
|
||||
//-----------------------------------------------------------------------------
|
||||
void CConsole::ClampLogSize(void)
|
||||
{
|
||||
const int nMaxLines = con_max_lines->GetInt();
|
||||
const int nMaxLines = con_max_lines.GetInt();
|
||||
|
||||
if (m_Logger.GetTotalLines() > nMaxLines)
|
||||
{
|
||||
@ -769,7 +782,7 @@ void CConsole::ClampLogSize(void)
|
||||
//-----------------------------------------------------------------------------
|
||||
void CConsole::ClampHistorySize(void)
|
||||
{
|
||||
while (m_vHistory.size() > con_max_history->GetInt())
|
||||
while (m_vHistory.size() > con_max_history.GetInt())
|
||||
{
|
||||
m_vHistory.erase(m_vHistory.begin());
|
||||
}
|
||||
|
@ -138,11 +138,13 @@ ssize_t SpinPresent(void)
|
||||
// bComplain -
|
||||
// Output : pointer to material
|
||||
//-----------------------------------------------------------------------------
|
||||
static ConVar mat_alwaysComplain("mat_alwaysComplain", "0", FCVAR_RELEASE | FCVAR_MATERIAL_SYSTEM_THREAD, "Always complain when a material is missing");
|
||||
|
||||
CMaterialGlue* CMaterialSystem::FindMaterialEx(CMaterialSystem* pMatSys, const char* pMaterialName, uint8_t nMaterialType, int nUnk, bool bComplain)
|
||||
{
|
||||
CMaterialGlue* pMaterial = CMaterialSystem__FindMaterialEx(pMatSys, pMaterialName, nMaterialType, nUnk, bComplain);
|
||||
|
||||
if ((bComplain || mat_alwaysComplain->GetBool()) && pMaterial->IsErrorMaterial())
|
||||
if ((bComplain || mat_alwaysComplain.GetBool()) && pMaterial->IsErrorMaterial())
|
||||
{
|
||||
Error(eDLL_T::MS, NO_ERROR, "Material \"%s\" not found; replacing with \"%s\".\n", pMaterialName, pMaterial->GetName());
|
||||
}
|
||||
|
@ -11,6 +11,15 @@
|
||||
#include <networksystem/pylon.h>
|
||||
#include <engine/server/server.h>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Console variables
|
||||
// NOTE: marked FCVAR_MATERIAL_SYSTEM_THREAD as these are also used in the
|
||||
// ImGui development panels
|
||||
//-----------------------------------------------------------------------------
|
||||
ConVar pylon_matchmaking_hostname("pylon_matchmaking_hostname", "ms.r5reloaded.com", FCVAR_RELEASE | FCVAR_MATERIAL_SYSTEM_THREAD, "Holds the pylon matchmaking hostname");
|
||||
ConVar pylon_host_update_interval("pylon_host_update_interval", "5", FCVAR_RELEASE | FCVAR_MATERIAL_SYSTEM_THREAD, "Length of time in seconds between each status update interval to master server", true, 5.f, false, 0.f);
|
||||
ConVar pylon_showdebuginfo("pylon_showdebuginfo", "0", FCVAR_RELEASE | FCVAR_MATERIAL_SYSTEM_THREAD, "Shows debug output for pylon");
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: checks if the server listing fields are valid.
|
||||
// Input : &value -
|
||||
@ -468,7 +477,7 @@ bool CPylon::SendRequest(const char* endpoint, const rapidjson::Document& reques
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pylon_showdebuginfo->GetBool())
|
||||
if (pylon_showdebuginfo.GetBool())
|
||||
{
|
||||
LogBody(responseJson);
|
||||
}
|
||||
@ -504,8 +513,8 @@ bool CPylon::SendRequest(const char* endpoint, const rapidjson::Document& reques
|
||||
bool CPylon::QueryServer(const char* endpoint, const char* request,
|
||||
string& outResponse, string& outMessage, CURLINFO& outStatus) const
|
||||
{
|
||||
const bool showDebug = pylon_showdebuginfo->GetBool();
|
||||
const char* hostName = pylon_matchmaking_hostname->GetString();
|
||||
const bool showDebug = pylon_showdebuginfo.GetBool();
|
||||
const char* hostName = pylon_matchmaking_hostname.GetString();
|
||||
|
||||
if (showDebug)
|
||||
{
|
||||
@ -520,9 +529,9 @@ bool CPylon::QueryServer(const char* endpoint, const char* request,
|
||||
CURLParams params;
|
||||
|
||||
params.writeFunction = CURLWriteStringCallback;
|
||||
params.timeout = curl_timeout->GetInt();
|
||||
params.verifyPeer = ssl_verify_peer->GetBool();
|
||||
params.verbose = curl_debug->GetBool();
|
||||
params.timeout = curl_timeout.GetInt();
|
||||
params.verifyPeer = ssl_verify_peer.GetBool();
|
||||
params.verbose = curl_debug.GetBool();
|
||||
|
||||
curl_slist* sList = nullptr;
|
||||
CURL* curl = CURLInitRequest(finalUrl.c_str(), request, outResponse, sList, params);
|
||||
|
@ -4,6 +4,10 @@
|
||||
#include "serverlisting.h"
|
||||
#include "localize/ilocalize.h"
|
||||
|
||||
extern ConVar pylon_matchmaking_hostname;
|
||||
extern ConVar pylon_host_update_interval;
|
||||
extern ConVar pylon_showdebuginfo;
|
||||
|
||||
struct MSEulaData_t
|
||||
{
|
||||
int version;
|
||||
|
@ -14,6 +14,12 @@
|
||||
#include "localize/localize.h"
|
||||
#include "modsystem.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Console variables
|
||||
//-----------------------------------------------------------------------------
|
||||
static ConVar modsystem_enable("modsystem_enable", "1", FCVAR_RELEASE, "Enable the modsystem");
|
||||
static ConVar modsystem_debug("modsystem_debug", "0", FCVAR_RELEASE, "Debug the modsystem");
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -32,7 +38,7 @@ CModSystem::~CModSystem()
|
||||
//-----------------------------------------------------------------------------
|
||||
void CModSystem::Init()
|
||||
{
|
||||
if (!modsystem_enable->GetBool())
|
||||
if (!modsystem_enable.GetBool())
|
||||
return;
|
||||
|
||||
// no mods installed, no point in initializing.
|
||||
@ -43,7 +49,7 @@ void CModSystem::Init()
|
||||
// executes commands/convars over the command line. we check for an
|
||||
// explicit modsystem debug flag, and set the convar from here.
|
||||
if (CommandLine()->CheckParm("-modsystem_debug"))
|
||||
modsystem_debug->SetValue(true);
|
||||
modsystem_debug.SetValue(true);
|
||||
|
||||
CUtlVector<CUtlString> modFileList;
|
||||
RecursiveFindFilesMatchingName(modFileList,
|
||||
@ -88,7 +94,7 @@ void CModSystem::UpdateModStatusList()
|
||||
|
||||
if (!enabledList.HasElement(mod->m_ModID))
|
||||
{
|
||||
if (modsystem_debug->GetBool())
|
||||
if (modsystem_debug.GetBool())
|
||||
Msg(eDLL_T::ENGINE, "Mod '%s' does not exist in '%s'; enabling...\n",
|
||||
mod->m_ModID.Get(), MOD_STATUS_LIST_FILE);
|
||||
|
||||
@ -99,7 +105,7 @@ void CModSystem::UpdateModStatusList()
|
||||
const bool bEnable = enabledList.FindElement(mod->m_ModID, false);
|
||||
mod->SetState(bEnable ? eModState::ENABLED : eModState::DISABLED);
|
||||
|
||||
if (modsystem_debug->GetBool())
|
||||
if (modsystem_debug.GetBool())
|
||||
Msg(eDLL_T::ENGINE, "Mod '%s' exists in '%s' and is %s.\n",
|
||||
mod->m_ModID.Get(), MOD_STATUS_LIST_FILE, bEnable ? "enabled" : "disabled");
|
||||
}
|
||||
@ -174,7 +180,7 @@ CModSystem::ModInstance_t::ModInstance_t(const CUtlString& basePath)
|
||||
}
|
||||
|
||||
// parse any additional info from mod.vdf
|
||||
ParseConVars();
|
||||
//ParseConVars();
|
||||
ParseLocalizationFiles();
|
||||
|
||||
// add mod folder to search paths so files can be easily loaded from here
|
||||
@ -273,56 +279,56 @@ bool CModSystem::ModInstance_t::ParseSettings()
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: parses and registers convars listed in settings KV
|
||||
//-----------------------------------------------------------------------------
|
||||
void CModSystem::ModInstance_t::ParseConVars()
|
||||
{
|
||||
Assert(m_SettingsKV);
|
||||
KeyValues* pConVars = m_SettingsKV->FindKey("ConVars");
|
||||
|
||||
if (pConVars)
|
||||
{
|
||||
for (KeyValues* pSubKey = pConVars->GetFirstSubKey();
|
||||
pSubKey != nullptr; pSubKey = pSubKey->GetNextKey())
|
||||
{
|
||||
const char* pszName = pSubKey->GetName();
|
||||
const char* pszFlagsString = pSubKey->GetString("flags", "NONE");
|
||||
const char* pszHelpString = pSubKey->GetString("helpText");
|
||||
const char* pszUsageString = pSubKey->GetString("usageText");
|
||||
|
||||
KeyValues* pValues = pSubKey->FindKey("Values");
|
||||
|
||||
const char* pszDefaultValue = "0";
|
||||
bool bMin = false;
|
||||
bool bMax = false;
|
||||
float fMin = 0.f;
|
||||
float fMax = 0.f;
|
||||
|
||||
if (pValues)
|
||||
{
|
||||
pszDefaultValue = pValues->GetString("default", "0");
|
||||
|
||||
// minimum cvar value
|
||||
if (pValues->FindKey("min"))
|
||||
{
|
||||
bMin = true; // has min value
|
||||
fMin = pValues->GetFloat("min", 0.f);
|
||||
}
|
||||
|
||||
// maximum cvar value
|
||||
if (pValues->FindKey("max"))
|
||||
{
|
||||
bMax = true; // has max value
|
||||
fMax = pValues->GetFloat("max", 1.f);
|
||||
}
|
||||
}
|
||||
|
||||
int flags = FCVAR_NONE;
|
||||
|
||||
if (ConVar_ParseFlagString(pszFlagsString, flags, pszName))
|
||||
ConVar::StaticCreate(pszName, pszDefaultValue, flags,
|
||||
pszHelpString, bMin, fMin, bMax, fMax, nullptr, pszUsageString);
|
||||
}
|
||||
}
|
||||
}
|
||||
//void CModSystem::ModInstance_t::ParseConVars()
|
||||
//{
|
||||
// Assert(m_SettingsKV);
|
||||
// KeyValues* pConVars = m_SettingsKV->FindKey("ConVars");
|
||||
//
|
||||
// if (pConVars)
|
||||
// {
|
||||
// for (KeyValues* pSubKey = pConVars->GetFirstSubKey();
|
||||
// pSubKey != nullptr; pSubKey = pSubKey->GetNextKey())
|
||||
// {
|
||||
// const char* pszName = pSubKey->GetName();
|
||||
// const char* pszFlagsString = pSubKey->GetString("flags", "NONE");
|
||||
// const char* pszHelpString = pSubKey->GetString("helpText");
|
||||
// const char* pszUsageString = pSubKey->GetString("usageText");
|
||||
//
|
||||
// KeyValues* pValues = pSubKey->FindKey("Values");
|
||||
//
|
||||
// const char* pszDefaultValue = "0";
|
||||
// bool bMin = false;
|
||||
// bool bMax = false;
|
||||
// float fMin = 0.f;
|
||||
// float fMax = 0.f;
|
||||
//
|
||||
// if (pValues)
|
||||
// {
|
||||
// pszDefaultValue = pValues->GetString("default", "0");
|
||||
//
|
||||
// // minimum cvar value
|
||||
// if (pValues->FindKey("min"))
|
||||
// {
|
||||
// bMin = true; // has min value
|
||||
// fMin = pValues->GetFloat("min", 0.f);
|
||||
// }
|
||||
//
|
||||
// // maximum cvar value
|
||||
// if (pValues->FindKey("max"))
|
||||
// {
|
||||
// bMax = true; // has max value
|
||||
// fMax = pValues->GetFloat("max", 1.f);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// int flags = FCVAR_NONE;
|
||||
//
|
||||
// if (ConVar_ParseFlagString(pszFlagsString, flags, pszName))
|
||||
// ConVar::StaticCreate(pszName, pszDefaultValue, flags,
|
||||
// pszHelpString, bMin, fMin, bMax, fMax, nullptr, pszUsageString);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: parses and stores localization file paths in a vector
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
~ModInstance_t();
|
||||
|
||||
bool ParseSettings();
|
||||
void ParseConVars();
|
||||
//void ParseConVars();
|
||||
void ParseLocalizationFiles();
|
||||
|
||||
inline void SetState(eModState state) { m_iState = state; };
|
||||
|
@ -96,7 +96,7 @@ public:
|
||||
// Called when a ConVar changes value
|
||||
// NOTE: For FCVAR_NEVER_AS_STRING ConVars, pOldValue == NULL
|
||||
//-----------------------------------------------------------------------------
|
||||
typedef void (*FnChangeCallback_t)(IConVar* var, const char* pOldValue, float flOldValue);
|
||||
typedef void (*FnChangeCallback_t)(IConVar* var, const char* pOldValue);
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -112,17 +112,15 @@ public:
|
||||
virtual void SetValue(float flValue) = 0;
|
||||
virtual void SetValue(int nValue) = 0;
|
||||
|
||||
// Original name 'GetName'. Renamed due to name ambiguity
|
||||
// as we are not implementing it in ConVar, we are just
|
||||
// interfacing it with the game executable.
|
||||
virtual const char* GetCommandName(void) const = 0;
|
||||
// Return name of command
|
||||
virtual const char* GetName(void) const = 0;
|
||||
|
||||
// Return name of command (usually == GetName(), except in case of FCVAR_SS_ADDED vars
|
||||
virtual const char* GetBaseName(void) const = 0;
|
||||
|
||||
// Accessors.. not as efficient as using GetState()/GetInfo()
|
||||
// if you call these methods multiple times on the same IConVar
|
||||
virtual bool IsConVarFlagSet(int nFlag) const = 0; // Original name 'IsFlagSet'. Renamed for same reason as 'GetName'.
|
||||
virtual bool IsFlagSet(const int nFlag) const = 0;
|
||||
|
||||
virtual int GetSplitScreenPlayerSlot() const = 0;
|
||||
};
|
||||
|
@ -24,7 +24,7 @@
|
||||
class ConCommandBase
|
||||
{
|
||||
public:
|
||||
virtual ~ConCommandBase(void) { };
|
||||
virtual ~ConCommandBase(void);
|
||||
|
||||
virtual bool IsCommand(void) const;
|
||||
virtual bool IsFlagSet(const int nFlags) const;
|
||||
@ -35,9 +35,10 @@ public:
|
||||
virtual int GetFlags(void) const;
|
||||
virtual const char* GetName(void) const;
|
||||
virtual const char* GetHelpText(void) const;
|
||||
virtual const char* GetUsageText(void) const;
|
||||
|
||||
virtual void SetAccessor(IConCommandBaseAccessor* const pAccessor);
|
||||
virtual const char* GetUsageText(void) const;
|
||||
virtual void SetUsageText(const char* const usageText);
|
||||
|
||||
virtual bool IsRegistered(void) const;
|
||||
|
||||
virtual int GetDLLIdentifier() const;
|
||||
@ -63,9 +64,9 @@ public:
|
||||
// Static data.
|
||||
const char* m_pszName; //0x0018
|
||||
const char* m_pszHelpString; //0x0020
|
||||
const char* m_pszUsageString; //0x0028
|
||||
|
||||
IConCommandBaseAccessor* m_pAccessor; //0x0030 <-- unused since executable is monolithic.
|
||||
const char* m_pszStaticUsageString; //0x0028
|
||||
const char* m_pszCustomUsageString; //0x0030
|
||||
|
||||
// ConVar flags
|
||||
int m_nFlags; //0x0038
|
||||
@ -151,12 +152,49 @@ class ConVar : public ConCommandBase, public IConVar
|
||||
friend class ConVarRef;
|
||||
|
||||
public:
|
||||
static ConVar* StaticCreate(const char* pszName, const char* pszDefaultValue, int nFlags, const char* pszHelpString,
|
||||
bool bMin, float fMin, bool bMax, float fMax, FnChangeCallback_t pCallback, const char* pszUsageString);
|
||||
void Destroy(void);
|
||||
typedef ConCommandBase BaseClass;
|
||||
|
||||
ConVar(void);
|
||||
virtual ~ConVar(void) { };
|
||||
ConVar(const char* pName, const char* pDefaultValue, int flags = 0);
|
||||
|
||||
ConVar(const char* pName, const char* pDefaultValue, int flags,
|
||||
const char* pHelpString, const char* pUsageString = 0);
|
||||
ConVar(const char* pName, const char* pDefaultValue, int flags,
|
||||
const char* pHelpString, bool bMin, float fMin, bool bMax, float fMax, const char* pUsageString = 0);
|
||||
ConVar(const char* pName, const char* pDefaultValue, int flags,
|
||||
const char* pHelpString, FnChangeCallback_t callback, const char* pUsageString = 0);
|
||||
ConVar(const char* pName, const char* pDefaultValue, int flags,
|
||||
const char* pHelpString, bool bMin, float fMin, bool bMax, float fMax,
|
||||
FnChangeCallback_t callback, const char* pUsageString = 0);
|
||||
|
||||
virtual ~ConVar(void);
|
||||
|
||||
virtual bool IsCommand(void) const;
|
||||
virtual bool IsFlagSet(const int flag) const;
|
||||
|
||||
virtual void AddFlags(const int flags);
|
||||
virtual int GetFlags() const;
|
||||
|
||||
// Return name of cvar
|
||||
virtual const char* GetName(void) const;
|
||||
|
||||
// Return name of command (usually == GetName(), except in case of FCVAR_SS_ADDED vars
|
||||
virtual const char* GetBaseName(void) const;
|
||||
virtual int GetSplitScreenPlayerSlot() const;
|
||||
|
||||
// Return help text for cvar
|
||||
virtual const char* GetHelpText(void) const;
|
||||
|
||||
virtual const char* GetUsageText(void) const;
|
||||
virtual void SetUsageText(const char* const usageText);
|
||||
|
||||
virtual bool IsRegistered(void) const;
|
||||
|
||||
// Install a change callback (there shouldn't already be one....)
|
||||
void InstallChangeCallback(FnChangeCallback_t callback, bool bInvoke);
|
||||
void RemoveChangeCallback(FnChangeCallback_t callback);
|
||||
|
||||
int GetChangeCallbackCount() const { return m_pParent->m_fnChangeCallbacks.Count(); }
|
||||
FnChangeCallback_t GetChangeCallback(int slot) const { return m_pParent->m_fnChangeCallbacks[slot]; }
|
||||
|
||||
FORCEINLINE bool GetBool(void) const;
|
||||
FORCEINLINE float GetFloat(void) const;
|
||||
@ -164,42 +202,59 @@ public:
|
||||
FORCEINLINE Color GetColor(void) const;
|
||||
FORCEINLINE const char* GetString(void) const;
|
||||
|
||||
void SetMax(float flMaxValue);
|
||||
void SetMin(float flMinValue);
|
||||
bool GetMin(float& flMinValue) const;
|
||||
bool GetMax(float& flMaxValue) const;
|
||||
float GetMinValue(void) const;
|
||||
float GetMaxValue(void) const;
|
||||
// Any function that allocates/frees memory needs to be virtual or else you'll have crashes
|
||||
// from alloc/free across dll/exe boundaries.
|
||||
|
||||
// These just call into the IConCommandBaseAccessor to check flags and set the var (which ends up calling InternalSetValue).
|
||||
virtual void SetValue(const char *value);
|
||||
virtual void SetValue(float value);
|
||||
virtual void SetValue(int value);
|
||||
void SetValue(Color value);
|
||||
|
||||
// Reset to default value
|
||||
void Revert(void);
|
||||
|
||||
// True if it has a min/max setting
|
||||
bool HasMin(void) const;
|
||||
bool HasMax(void) const;
|
||||
|
||||
void SetValue(int nValue);
|
||||
void SetValue(float flValue);
|
||||
void SetValue(const char* pszValue);
|
||||
void SetValue(Color clValue);
|
||||
void SetMax(float flMaxValue);
|
||||
void SetMin(float flMinValue);
|
||||
|
||||
virtual void InternalSetValue(const char* pszValue) = 0;
|
||||
virtual void InternalSetFloatValue(float flValue) = 0;
|
||||
virtual void InternalSetIntValue(int nValue) = 0;
|
||||
void InternalSetColorValue(Color value);
|
||||
bool GetMin(float& flMinValue) const;
|
||||
bool GetMax(float& flMaxValue) const;
|
||||
|
||||
virtual __int64 Unknown0(unsigned int a2) = 0;
|
||||
virtual __int64 Unknown1(const char* a2) = 0;
|
||||
|
||||
void Revert(void);
|
||||
virtual bool ClampValue(float& flValue) = 0;
|
||||
float GetMinValue(void) const;
|
||||
float GetMaxValue(void) const;
|
||||
|
||||
const char* GetDefault(void) const;
|
||||
void SetDefault(const char* pszDefault);
|
||||
bool SetColorFromString(const char* pszValue);
|
||||
|
||||
virtual void ChangeStringValue(const char* pszTempValue) = 0;
|
||||
virtual void CreateInternal(const char* pszName, const char* pszDefaultValue, int nFlags, const char* pszHelpString,
|
||||
bool bMin, float fMin, bool bMax, float fMax, FnChangeCallback_t pCallback, const char* pszUsageString) = 0;
|
||||
private:
|
||||
bool InternalSetColorFromString(const char* value);
|
||||
|
||||
void InstallChangeCallback(FnChangeCallback_t callback, bool bInvoke);
|
||||
void RemoveChangeCallback(FnChangeCallback_t callback);
|
||||
// Called by CCvar when the value of a var is changing.
|
||||
virtual void InternalSetValue(const char* pszValue);
|
||||
|
||||
// For CVARs marked FCVAR_NEVER_AS_STRING
|
||||
virtual void InternalSetFloatValue(float flValue);
|
||||
virtual void InternalSetIntValue(int nValue);
|
||||
|
||||
virtual void InternalSetColorValue(Color value);
|
||||
|
||||
// DoNothing in the engine, probably for tracking/debugging cvar strings in debug.
|
||||
virtual void TrackDefaultValue(const char* value) { };
|
||||
|
||||
virtual bool ClampValue(float& flValue);
|
||||
|
||||
virtual void ChangeStringValue(const char* pszTempValue);
|
||||
|
||||
virtual void Create(const char* pName, const char* pDefaultValue, int flags = 0,
|
||||
const char* pHelpString = 0, bool bMin = false, float fMin = 0.0, bool bMax = false, float fMax = false,
|
||||
FnChangeCallback_t callback = 0, const char* pszUsageString = 0);
|
||||
|
||||
//protected:
|
||||
public: // TODO: make protected!
|
||||
struct CVValue_t
|
||||
{
|
||||
char* m_pszString;
|
||||
@ -279,45 +334,4 @@ FORCEINLINE const char* ConVar::GetString(void) const
|
||||
void ConVar_Register(int nCVarFlag = 0, IConCommandBaseAccessor* pAccessor = NULL);
|
||||
void ConVar_Unregister();
|
||||
|
||||
/* ==== CONVAR ========================================================================================================================================================== */
|
||||
inline void*(*ConVar__Register)(ConVar* thisptr, const char* szName, const char* szDefaultValue, int nFlags, const char* szHelpString, bool bMin, float fMin, bool bMax, float fMax, FnChangeCallback_t pCallback, const char* pszUsageString);
|
||||
inline void(*ConVar__Unregister)(ConVar* thisptr);
|
||||
inline bool(*ConVar__IsFlagSet)(ConVar* pConVar, int nFlag);
|
||||
|
||||
inline ConCommandBase* g_pConCommandBaseVFTable;
|
||||
inline ConCommand* g_pConCommandVFTable;
|
||||
inline ConVar* g_pConVarVBTable;
|
||||
inline IConVar* g_pConVarVFTable;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class VConVar : public IDetour
|
||||
{
|
||||
virtual void GetAdr(void) const
|
||||
{
|
||||
LogConAdr("ConCommandBase::`vftable'", g_pConCommandBaseVFTable);
|
||||
LogConAdr("ConCommand::`vftable'", g_pConCommandVFTable);
|
||||
LogConAdr("ConVar::`vbtable'", g_pConVarVBTable);
|
||||
LogConAdr("ConVar::`vftable'", g_pConVarVFTable);
|
||||
LogFunAdr("ConVar::Register", ConVar__Register);
|
||||
LogFunAdr("ConVar::Unregister", ConVar__Unregister);
|
||||
LogFunAdr("ConVar::IsFlagSet", ConVar__IsFlagSet);
|
||||
}
|
||||
virtual void GetFun(void) const
|
||||
{
|
||||
g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 48 83 EC 40 F3 0F 10 84 24 ?? ?? ?? ??").GetPtr(ConVar__Register);
|
||||
g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 74 24 ?? 57 48 83 EC 20 48 8B 79 58").GetPtr(ConVar__Unregister);
|
||||
g_GameDll.FindPatternSIMD("48 8B 41 48 85 50 38").GetPtr(ConVar__IsFlagSet);
|
||||
}
|
||||
virtual void GetVar(void) const { }
|
||||
virtual void GetCon(void) const
|
||||
{
|
||||
g_pConCommandBaseVFTable = g_GameDll.GetVirtualMethodTable(".?AVConCommandBase@@").RCast<ConCommandBase*>();
|
||||
g_pConCommandVFTable = g_GameDll.GetVirtualMethodTable(".?AVConCommand@@").RCast<ConCommand*>();
|
||||
g_pConVarVBTable = g_GameDll.GetVirtualMethodTable(".?AVConVar@@", 0).RCast<ConVar*>();
|
||||
g_pConVarVFTable = g_GameDll.GetVirtualMethodTable(".?AVConVar@@", 1).RCast<IConVar*>();
|
||||
}
|
||||
virtual void Detour(const bool bAttach) const { }
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif // CONVAR_H
|
||||
|
@ -7,6 +7,9 @@
|
||||
#include "rtech/pak/paktools.h"
|
||||
#include "asyncio.h"
|
||||
|
||||
ConVar async_debug_level("async_debug_level", "0", FCVAR_DEVELOPMENTONLY, "The debug level for async reads", false, 0.f, false, 0.f, "0 = disabled");
|
||||
ConVar async_debug_close("async_debug_close", "0", FCVAR_DEVELOPMENTONLY, "Debug async file closing", false, 0.f, false, 0.f, "0 = disabled");
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// open a file and add it to the async file handle array
|
||||
//----------------------------------------------------------------------------------
|
||||
@ -51,7 +54,7 @@ int FS_OpenAsyncFile(const char* const filePath, const int logLevel, size_t* con
|
||||
tracker.handle = hFile;
|
||||
tracker.state = 1;
|
||||
|
||||
if (async_debug_level->GetInt() >= logLevel)
|
||||
if (async_debug_level.GetInt() >= logLevel)
|
||||
Msg(eDLL_T::RTECH, "%s: Opened file: '%s' to slot #%d\n", __FUNCTION__, fileToLoad, slotNum);
|
||||
|
||||
return fileIdx;
|
||||
@ -72,7 +75,7 @@ void FS_CloseAsyncFile(const int fileHandle)
|
||||
|
||||
g_pAsyncFileSlotMgr->FreeSlot(slotNum);
|
||||
|
||||
if (async_debug_close->GetBool())
|
||||
if (async_debug_close.GetBool())
|
||||
Msg(eDLL_T::RTECH, "%s: Closed file from slot #%d\n", __FUNCTION__, slotNum);
|
||||
}
|
||||
}
|
||||
|
@ -56,6 +56,8 @@ inline void(*v_FS_CloseAsyncFile)(const int fileHandle);
|
||||
inline int(*v_FS_ReadAsyncFile)(const int fileHandle, __int64 readOffset, unsigned __int64 readSize, void* a4, void* a5, void* a6, int a7);
|
||||
inline uint8_t(*v_FS_CheckAsyncRequest)(AsyncHandleStatus_t* pakStatus, size_t* bytesProcessed, const char** stateString);
|
||||
|
||||
extern ConVar async_debug_level;
|
||||
|
||||
inline AsyncHandleTracker_t* g_pAsyncFileSlots; // bufSize=1024*sizeof(FileHandleTracker_t).
|
||||
inline RHashMap_MT* g_pAsyncFileSlotMgr; // Manages 'g_pakFileSlots'.
|
||||
inline AsyncHandleStatus_t* g_pAsyncStatusSlots; // bufSize=256*sizeof(PakStatus_t).
|
||||
|
@ -14,6 +14,8 @@
|
||||
#include "pakdecode.h"
|
||||
#include "pakstream.h"
|
||||
|
||||
static ConVar pak_debugrelations("pak_debugrelations", "0", FCVAR_DEVELOPMENTONLY, "Debug RPAK asset dependency resolving");
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// resolve the target guid from lookuo table
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -51,7 +53,7 @@ void Pak_ResolveAssetRelations(PakFile_t* const pak, const PakAsset_t* const ass
|
||||
PakPage_t* const pGuidDescriptors = &pak->memoryData.guidDescriptors[asset->dependenciesIndex];
|
||||
uint32_t* const v5 = (uint32_t*)g_pakGlobals->loadedPaks[pak->memoryData.pakId & PAK_MAX_HANDLES_MASK].qword50;
|
||||
|
||||
if (pak_debugrelations->GetBool())
|
||||
if (pak_debugrelations.GetBool())
|
||||
Msg(eDLL_T::RTECH, "Resolving relations for asset: '0x%-16llX', dependencies: %-4u; in pak '%s'\n",
|
||||
asset->guid, asset->dependenciesCount, pak->memoryData.fileName);
|
||||
|
||||
@ -1013,7 +1015,7 @@ bool Pak_StartLoadingPak(PakLoadedInfo_t* const loadedInfo)
|
||||
//
|
||||
// if (pakFileHandle == FS_ASYNC_FILE_INVALID)
|
||||
// {
|
||||
// if (async_debug_level->GetInt() >= loadedInfo->logLevel)
|
||||
// if (async_debug_level.GetInt() >= loadedInfo->logLevel)
|
||||
// Error(eDLL_T::RTECH, NO_ERROR, "Couldn't read package file \"%s\".\n", pakFilePath);
|
||||
//
|
||||
// loadedInfo->status = PAK_STATUS_ERROR;
|
||||
|
@ -11,12 +11,14 @@
|
||||
#include "rui.h"
|
||||
#include "tier1/cvar.h"
|
||||
|
||||
static ConVar rui_drawEnable("rui_drawEnable", "1", FCVAR_RELEASE, "Draws the RUI if set", false, 0.f, false, 0.f, "1 = draw; 0 (zero) = no draw");
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: draw RUI frame
|
||||
//-----------------------------------------------------------------------------
|
||||
bool __fastcall Rui_Draw(__int64* a1, __m128* a2, const __m128i* a3, __int64 a4, __m128* a5)
|
||||
{
|
||||
if (!rui_drawEnable->GetBool())
|
||||
if (!rui_drawEnable.GetBool())
|
||||
return false;
|
||||
|
||||
return v_Rui_Draw(a1, a2, a3, a4, a5);
|
||||
|
@ -76,6 +76,15 @@ void ConVar_Unregister()
|
||||
s_bRegistered = false;
|
||||
}
|
||||
|
||||
ConCommandBase::~ConCommandBase(void)
|
||||
{
|
||||
if (m_pszCustomUsageString)
|
||||
{
|
||||
delete[] m_pszCustomUsageString;
|
||||
m_pszCustomUsageString = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Returns true if this is a command
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -143,15 +152,23 @@ const char* ConCommandBase::GetHelpText(void) const
|
||||
//-----------------------------------------------------------------------------
|
||||
const char* ConCommandBase::GetUsageText(void) const
|
||||
{
|
||||
return m_pszUsageString;
|
||||
return m_pszStaticUsageString;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Purpose: Sets the ConCommandBase usage text.
|
||||
//-----------------------------------------------------------------------------
|
||||
void ConCommandBase::SetAccessor(IConCommandBaseAccessor* const pAccessor)
|
||||
void ConCommandBase::SetUsageText(const char* const usageText)
|
||||
{
|
||||
m_pAccessor = pAccessor;
|
||||
const char* const szCustomString = m_pszCustomUsageString;
|
||||
|
||||
// If a custom usage string has been set, return that instead
|
||||
if (szCustomString)
|
||||
delete[] szCustomString;
|
||||
|
||||
m_pszCustomUsageString = usageText
|
||||
? V_strdup(usageText)
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -206,9 +223,9 @@ ConCommandBase* ConCommandBase::Create(const char* pName, const char* pHelpStrin
|
||||
m_pszName = pName;
|
||||
|
||||
m_pszHelpString = pHelpString ? pHelpString : "";
|
||||
m_pszUsageString = pszUsageString ? pszUsageString : "";
|
||||
m_pszStaticUsageString = pszUsageString ? pszUsageString : "";
|
||||
|
||||
m_pAccessor = nullptr;
|
||||
m_pszCustomUsageString = nullptr;
|
||||
|
||||
m_nFlags = flags;
|
||||
|
||||
@ -429,96 +446,312 @@ void ConCommand::Dispatch(const CCommand& command)
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: create
|
||||
// Various constructors
|
||||
//-----------------------------------------------------------------------------
|
||||
ConVar* ConVar::StaticCreate(const char* pszName, const char* pszDefaultValue,
|
||||
int nFlags, const char* pszHelpString, bool bMin, float fMin, bool bMax,
|
||||
float fMax, FnChangeCallback_t pCallback, const char* pszUsageString)
|
||||
ConVar::ConVar(const char* pName, const char* pDefaultValue, int flags /* = 0 */)
|
||||
{
|
||||
ConVar* pNewConVar = (ConVar*)malloc(sizeof(ConVar));
|
||||
|
||||
pNewConVar->m_bRegistered = false;
|
||||
*(ConVar**)pNewConVar = g_pConVarVBTable;
|
||||
char* pConVarVFTable = (char*)pNewConVar + sizeof(ConCommandBase);
|
||||
*(IConVar**)pConVarVFTable = g_pConVarVFTable;
|
||||
|
||||
pNewConVar->m_pszName = nullptr;
|
||||
pNewConVar->m_pszHelpString = nullptr;
|
||||
pNewConVar->m_pszUsageString = nullptr;
|
||||
pNewConVar->m_pAccessor = nullptr;
|
||||
pNewConVar->m_nFlags = FCVAR_NONE;
|
||||
pNewConVar->m_pNext = nullptr;
|
||||
|
||||
pNewConVar->m_fnChangeCallbacks.Init();
|
||||
|
||||
ConVar__Register(pNewConVar, pszName, pszDefaultValue, nFlags,
|
||||
pszHelpString, bMin, fMin, bMax, fMax, pCallback, pszUsageString);
|
||||
return pNewConVar;
|
||||
Create(pName, pDefaultValue, flags);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: destroy
|
||||
//-----------------------------------------------------------------------------
|
||||
void ConVar::Destroy(void)
|
||||
ConVar::ConVar(const char* pName, const char* pDefaultValue, int flags, const char* pHelpString, const char* pUsageString)
|
||||
{
|
||||
ConVar__Unregister(this);
|
||||
Create(pName, pDefaultValue, flags, pHelpString, false, 0.0, false, 0.0, nullptr, pUsageString);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: construct/allocate
|
||||
//-----------------------------------------------------------------------------
|
||||
ConVar::ConVar(void)
|
||||
: m_pParent(nullptr)
|
||||
, m_pszDefaultValue(nullptr)
|
||||
, m_bHasMin(false)
|
||||
, m_fMinVal(0.f)
|
||||
, m_bHasMax(false)
|
||||
, m_fMaxVal(0.f)
|
||||
ConVar::ConVar(const char* pName, const char* pDefaultValue, int flags, const char* pHelpString,
|
||||
bool bMin, float fMin, bool bMax, float fMax, const char* pUsageString)
|
||||
{
|
||||
m_Value.m_pszString = nullptr;
|
||||
m_Value.m_iStringLength = 0;
|
||||
m_Value.m_fValue = 0.0f;
|
||||
m_Value.m_nValue = 0;
|
||||
Create(pName, pDefaultValue, flags, pHelpString, bMin, fMin, bMax, fMax, nullptr, pUsageString);
|
||||
}
|
||||
|
||||
ConVar::ConVar(const char* pName, const char* pDefaultValue, int flags, const char* pHelpString,
|
||||
FnChangeCallback_t callback, const char* pUsageString)
|
||||
{
|
||||
Create(pName, pDefaultValue, flags, pHelpString, false, 0.0, false, 0.0, callback, pUsageString);
|
||||
}
|
||||
|
||||
ConVar::ConVar(const char* pName, const char* pDefaultValue, int flags, const char* pHelpString,
|
||||
bool bMin, float fMin, bool bMax, float fMax, FnChangeCallback_t callback, const char* pUsageString)
|
||||
{
|
||||
Create(pName, pDefaultValue, flags, pHelpString, bMin, fMin, bMax, fMax, callback, pUsageString);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: destructor
|
||||
//-----------------------------------------------------------------------------
|
||||
//ConVar::~ConVar(void)
|
||||
//{
|
||||
// if (m_Value.m_pszString)
|
||||
// {
|
||||
// delete[] m_Value.m_pszString);
|
||||
// m_Value.m_pszString = NULL;
|
||||
// }
|
||||
//}
|
||||
ConVar::~ConVar(void)
|
||||
{
|
||||
if (m_Value.m_pszString)
|
||||
{
|
||||
delete[] m_Value.m_pszString;
|
||||
m_Value.m_pszString = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
////-----------------------------------------------------------------------------
|
||||
//// Purpose: Returns the base ConVar name.
|
||||
//// Output : const char*
|
||||
////-----------------------------------------------------------------------------
|
||||
//const char* ConVar::GetBaseName(void) const
|
||||
//{
|
||||
// return m_pParent->m_pszName;
|
||||
//}
|
||||
//
|
||||
////-----------------------------------------------------------------------------
|
||||
//// Purpose: Returns the ConVar help text.
|
||||
//// Output : const char*
|
||||
////-----------------------------------------------------------------------------
|
||||
//const char* ConVar::GetHelpText(void) const
|
||||
//{
|
||||
// return m_pParent->m_pszHelpString;
|
||||
//}
|
||||
//
|
||||
////-----------------------------------------------------------------------------
|
||||
//// Purpose: Returns the ConVar usage text.
|
||||
//// Output : const char*
|
||||
////-----------------------------------------------------------------------------
|
||||
//const char* ConVar::GetUsageText(void) const
|
||||
//{
|
||||
// return m_pParent->m_pszUsageString;
|
||||
//}
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
bool ConVar::IsCommand(void) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ConVar::IsFlagSet(int flag) const
|
||||
{
|
||||
return (flag & m_pParent->m_nFlags) ? true : false;
|
||||
}
|
||||
|
||||
void ConVar::AddFlags(int flags)
|
||||
{
|
||||
m_pParent->m_nFlags |= flags;
|
||||
}
|
||||
|
||||
int ConVar::GetFlags() const
|
||||
{
|
||||
return m_pParent->m_nFlags;
|
||||
}
|
||||
|
||||
const char* ConVar::GetName(void) const
|
||||
{
|
||||
return m_pParent->m_pszName;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Returns the base ConVar name.
|
||||
// Output : const char*
|
||||
//-----------------------------------------------------------------------------
|
||||
const char* ConVar::GetBaseName(void) const
|
||||
{
|
||||
return m_pParent->m_pszName;
|
||||
}
|
||||
|
||||
int ConVar::GetSplitScreenPlayerSlot(void) const
|
||||
{
|
||||
// Default implementation (certain FCVAR_USERINFO derive a new type of convar and set this)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Returns the ConVar help text.
|
||||
// Output : const char*
|
||||
//-----------------------------------------------------------------------------
|
||||
const char* ConVar::GetHelpText(void) const
|
||||
{
|
||||
return m_pParent->m_pszHelpString;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Returns the ConVar usage text.
|
||||
// Output : const char*
|
||||
//-----------------------------------------------------------------------------
|
||||
const char* ConVar::GetUsageText(void) const
|
||||
{
|
||||
const char* const szCustomString = m_pParent->m_pszCustomUsageString;
|
||||
|
||||
// If a custom usage string has been set, return that instead
|
||||
if (szCustomString)
|
||||
return szCustomString;
|
||||
|
||||
return m_pParent->m_pszStaticUsageString;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Sets the ConVar usage text.
|
||||
//-----------------------------------------------------------------------------
|
||||
void ConVar::SetUsageText(const char* const usageText)
|
||||
{
|
||||
const char* const szCustomString = m_pParent->m_pszCustomUsageString;
|
||||
|
||||
// If a custom usage string has been set, return that instead
|
||||
if (szCustomString)
|
||||
delete[] szCustomString;
|
||||
|
||||
m_pParent->m_pszCustomUsageString = usageText
|
||||
? V_strdup(usageText)
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
bool ConVar::IsRegistered(void) const
|
||||
{
|
||||
return m_pParent->m_bRegistered;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: sets the ConVar color value from string.
|
||||
// Input : *pszValue -
|
||||
//-----------------------------------------------------------------------------
|
||||
bool ConVar::InternalSetColorFromString(const char* value)
|
||||
{
|
||||
bool bColor = false;
|
||||
|
||||
// Try pulling RGBA color values out of the string
|
||||
int nRGBA[4];
|
||||
int nParamsRead = sscanf(value, "%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)
|
||||
{
|
||||
// This is definitely a color!
|
||||
bColor = true;
|
||||
|
||||
// Stuff all the values into each byte of our int
|
||||
unsigned char* pColorElement = ((unsigned char*)&m_Value.m_nValue);
|
||||
pColorElement[0] = (unsigned char)nRGBA[0];
|
||||
pColorElement[1] = (unsigned char)nRGBA[1];
|
||||
pColorElement[2] = (unsigned char)nRGBA[2];
|
||||
pColorElement[3] = (unsigned char)nRGBA[3];
|
||||
|
||||
// Copy that value into a float (even though this has little meaning)
|
||||
m_Value.m_fValue = (float)(m_Value.m_nValue);
|
||||
}
|
||||
}
|
||||
|
||||
return bColor;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Input : *value -
|
||||
//-----------------------------------------------------------------------------
|
||||
void ConVar::InternalSetValue(const char* value)
|
||||
{
|
||||
if (IsFlagSet(FCVAR_MATERIAL_THREAD_MASK))
|
||||
{
|
||||
if (g_pCVar && !g_pCVar->IsMaterialThreadSetAllowed())
|
||||
{
|
||||
g_pCVar->QueueMaterialThreadSetValue(this, value);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Assert(m_pParent == this); // Only valid for root convars.
|
||||
|
||||
char tempVal[32];
|
||||
const char* newVal = value;
|
||||
|
||||
if (!newVal)
|
||||
newVal = "";
|
||||
|
||||
if (!InternalSetColorFromString(value))
|
||||
{
|
||||
// Not a color, do the standard thing
|
||||
float fNewValue = (float)atof(value);
|
||||
if (!IsFinite(fNewValue))
|
||||
{
|
||||
DevWarning(eDLL_T::COMMON, "Warning: %s = '%s' is infinite, clamping value.\n", GetName(), value);
|
||||
fNewValue = FLT_MAX;
|
||||
}
|
||||
|
||||
if (ClampValue(fNewValue))
|
||||
{
|
||||
V_snprintf(tempVal, sizeof(tempVal), "%f", fNewValue);
|
||||
newVal = tempVal;
|
||||
}
|
||||
|
||||
// Redetermine value
|
||||
m_Value.m_fValue = fNewValue;
|
||||
m_Value.m_nValue = (int)(m_Value.m_fValue);
|
||||
}
|
||||
|
||||
if (!(m_nFlags & FCVAR_NEVER_AS_STRING))
|
||||
{
|
||||
ChangeStringValue(newVal);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Input : *value -
|
||||
//-----------------------------------------------------------------------------
|
||||
void ConVar::InternalSetFloatValue(float fNewValue)
|
||||
{
|
||||
if (fNewValue == m_Value.m_fValue)
|
||||
return;
|
||||
|
||||
if (IsFlagSet(FCVAR_MATERIAL_THREAD_MASK))
|
||||
{
|
||||
if (g_pCVar && !g_pCVar->IsMaterialThreadSetAllowed())
|
||||
{
|
||||
g_pCVar->QueueMaterialThreadSetValue(this, fNewValue);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Assert(m_pParent == this); // Only valid for root convars.
|
||||
|
||||
// Check bounds
|
||||
ClampValue(fNewValue);
|
||||
|
||||
// Redetermine value
|
||||
m_Value.m_fValue = fNewValue;
|
||||
m_Value.m_nValue = (int)m_Value.m_fValue;
|
||||
|
||||
if (!(m_nFlags & FCVAR_NEVER_AS_STRING))
|
||||
{
|
||||
char tempVal[32];
|
||||
V_snprintf(tempVal, sizeof(tempVal), "%f", m_Value.m_fValue);
|
||||
ChangeStringValue(tempVal);
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert(m_fnChangeCallbacks.Count() == 0);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Input : *value -
|
||||
//-----------------------------------------------------------------------------
|
||||
void ConVar::InternalSetIntValue(int nValue)
|
||||
{
|
||||
if (nValue == m_Value.m_nValue)
|
||||
return;
|
||||
|
||||
if (IsFlagSet(FCVAR_MATERIAL_THREAD_MASK))
|
||||
{
|
||||
if (g_pCVar && !g_pCVar->IsMaterialThreadSetAllowed())
|
||||
{
|
||||
g_pCVar->QueueMaterialThreadSetValue(this, nValue);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Assert(m_pParent == this); // Only valid for root convars.
|
||||
|
||||
float fValue = (float)nValue;
|
||||
if (ClampValue(fValue))
|
||||
{
|
||||
nValue = (int)(fValue);
|
||||
}
|
||||
|
||||
// Redetermine value
|
||||
m_Value.m_fValue = fValue;
|
||||
m_Value.m_nValue = nValue;
|
||||
|
||||
if (!(m_nFlags & FCVAR_NEVER_AS_STRING))
|
||||
{
|
||||
char tempVal[32];
|
||||
V_snprintf(tempVal, sizeof(tempVal), "%d", m_Value.m_nValue);
|
||||
ChangeStringValue(tempVal);
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert(m_fnChangeCallbacks.Count() == 0);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
@ -657,6 +890,135 @@ void ConVar::InternalSetColorValue(Color value)
|
||||
InternalSetIntValue(nValue);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Check whether to clamp and then perform clamp
|
||||
// Input : value -
|
||||
// Output : Returns true if value changed
|
||||
//-----------------------------------------------------------------------------
|
||||
bool ConVar::ClampValue(float& value)
|
||||
{
|
||||
if (m_bHasMin && (value < m_fMinVal))
|
||||
{
|
||||
value = m_fMinVal;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (m_bHasMax && (value > m_fMaxVal))
|
||||
{
|
||||
value = m_fMaxVal;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Input : *tempVal -
|
||||
//-----------------------------------------------------------------------------
|
||||
void ConVar::ChangeStringValue(const char* tempVal)
|
||||
{
|
||||
Assert(!(m_nFlags & FCVAR_NEVER_AS_STRING));
|
||||
|
||||
char* pszOldValue = (char*)stackalloc(m_Value.m_iStringLength);
|
||||
memcpy(pszOldValue, m_Value.m_pszString, m_Value.m_iStringLength);
|
||||
|
||||
const size_t len = V_strlen(tempVal) + 1;
|
||||
|
||||
if (len > m_Value.m_iStringLength)
|
||||
{
|
||||
if (m_Value.m_pszString)
|
||||
{
|
||||
delete[] m_Value.m_pszString;
|
||||
}
|
||||
|
||||
m_Value.m_pszString = new char[len];
|
||||
m_Value.m_iStringLength = len;
|
||||
}
|
||||
|
||||
memcpy(m_Value.m_pszString, tempVal, len);
|
||||
|
||||
// Invoke any necessary callback function
|
||||
for (int i = 0; i < m_fnChangeCallbacks.Count(); ++i)
|
||||
{
|
||||
m_fnChangeCallbacks[i](this, pszOldValue);
|
||||
}
|
||||
|
||||
if (g_pCVar)
|
||||
{
|
||||
g_pCVar->CallGlobalChangeCallbacks(this, pszOldValue);
|
||||
}
|
||||
|
||||
stackfree(pszOldValue);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Private creation
|
||||
//-----------------------------------------------------------------------------
|
||||
void ConVar::Create(const char* pName, const char* pDefaultValue, int flags /*= 0*/,
|
||||
const char* pHelpString /*= NULL*/, bool bMin /*= false*/, float fMin /*= 0.0*/,
|
||||
bool bMax /*= false*/, float fMax /*= false*/, FnChangeCallback_t callback /*= NULL*/,
|
||||
const char* pszUsageString /*= NULL*/)
|
||||
{
|
||||
// Name should be static data
|
||||
m_pszDefaultValue = pDefaultValue ? pDefaultValue : "";
|
||||
Assert(m_pszDefaultValue);
|
||||
|
||||
m_bHasMin = bMin;
|
||||
m_fMinVal = fMin;
|
||||
m_bHasMax = bMax;
|
||||
m_fMaxVal = fMax;
|
||||
|
||||
m_pParent = this;
|
||||
|
||||
if (callback)
|
||||
{
|
||||
m_fnChangeCallbacks.AddToTail(callback);
|
||||
}
|
||||
|
||||
m_Value.m_iStringLength = strlen(m_pszDefaultValue) + 1;
|
||||
m_Value.m_pszString = new char[m_Value.m_iStringLength];
|
||||
memcpy(m_Value.m_pszString, m_pszDefaultValue, m_Value.m_iStringLength);
|
||||
|
||||
if (!InternalSetColorFromString(m_Value.m_pszString))
|
||||
{
|
||||
m_Value.m_fValue = (float)atof(m_Value.m_pszString);
|
||||
if (!IsFinite(m_Value.m_fValue))
|
||||
{
|
||||
DevWarning(eDLL_T::COMMON, "ConVar(%s) defined with infinite float value (%s).\n", pName, m_Value.m_pszString);
|
||||
m_Value.m_fValue = FLT_MAX;
|
||||
Assert(0);
|
||||
}
|
||||
|
||||
// Bounds Check, should never happen, if it does, no big deal
|
||||
if (m_bHasMin && (m_Value.m_fValue < m_fMinVal))
|
||||
{
|
||||
Assert(0);
|
||||
}
|
||||
|
||||
if (m_bHasMax && (m_Value.m_fValue > m_fMaxVal))
|
||||
{
|
||||
Assert(0);
|
||||
}
|
||||
|
||||
m_Value.m_nValue = (int)m_Value.m_fValue;
|
||||
}
|
||||
|
||||
|
||||
TrackDefaultValue(m_Value.m_pszString);
|
||||
|
||||
// Only 1 of the 2 can be set on a ConVar, both means there is a bug in
|
||||
// your code, fix it!
|
||||
const int nFlagsToCheck = (FCVAR_ARCHIVE | FCVAR_ARCHIVE_PLAYERPROFILE);
|
||||
if ((m_nFlags & nFlagsToCheck) == nFlagsToCheck)
|
||||
{
|
||||
Error(eDLL_T::COMMON, EXIT_FAILURE,
|
||||
"Convar '%s' is flagged as both FCVAR_ARCHIVE and FCVAR_ARCHIVE_PLAYERPROFILE.\n", pName);
|
||||
}
|
||||
|
||||
BaseClass::Create(pName, pHelpString, flags, pszUsageString);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Reset to default value.
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -685,95 +1047,6 @@ void ConVar::SetDefault(const char* pszDefault)
|
||||
assert(m_pszDefaultValue);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// 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.
|
||||
unsigned char* pColorElement =
|
||||
(reinterpret_cast<unsigned char*>(&m_Value.m_nValue));
|
||||
|
||||
pColorElement[0] = (unsigned char)nRGBA[0];
|
||||
pColorElement[1] = (unsigned char)nRGBA[1];
|
||||
pColorElement[2] = (unsigned char)nRGBA[2];
|
||||
pColorElement[3] = (unsigned char)nRGBA[3];
|
||||
|
||||
// Copy that value into our float.
|
||||
m_Value.m_fValue = static_cast<float>(m_Value.m_nValue);
|
||||
}
|
||||
}
|
||||
|
||||
return bColor;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: changes the ConVar string value.
|
||||
// Input : *pszTempVal - flOldValue
|
||||
//-----------------------------------------------------------------------------
|
||||
void ConVar::ChangeStringValue(const char* pszTempVal)
|
||||
{
|
||||
Assert(!(m_nFlags & FCVAR_NEVER_AS_STRING));
|
||||
|
||||
char* pszOldValue = (char*)stackalloc(m_Value.m_iStringLength);
|
||||
memcpy(pszOldValue, m_Value.m_pszString, m_Value.m_iStringLength);
|
||||
|
||||
size_t len = strlen(pszTempVal) + 1;
|
||||
|
||||
if (len > m_Value.m_iStringLength)
|
||||
{
|
||||
if (m_Value.m_pszString)
|
||||
{
|
||||
delete[] m_Value.m_pszString;
|
||||
}
|
||||
|
||||
m_Value.m_pszString = new char[len];
|
||||
m_Value.m_iStringLength = len;
|
||||
}
|
||||
|
||||
memcpy(reinterpret_cast<void*>(m_Value.m_pszString), pszTempVal, len);
|
||||
|
||||
// Invoke any necessary callback function
|
||||
for (int i = 0; i < m_fnChangeCallbacks.Count(); ++i)
|
||||
{
|
||||
m_fnChangeCallbacks[i](this, pszOldValue, NULL);
|
||||
}
|
||||
|
||||
if (g_pCVar)
|
||||
{
|
||||
g_pCVar->CallGlobalChangeCallbacks(this, pszOldValue);
|
||||
}
|
||||
|
||||
stackfree(pszOldValue);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Install a change callback (there shouldn't already be one....)
|
||||
// Input : callback -
|
||||
@ -802,7 +1075,7 @@ void ConVar::InstallChangeCallback(FnChangeCallback_t callback, bool bInvoke /*=
|
||||
// Call it immediately to set the initial value...
|
||||
if (bInvoke)
|
||||
{
|
||||
callback(this, m_Value.m_pszString, m_Value.m_fValue);
|
||||
callback(this, m_Value.m_pszString);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,62 @@
|
||||
#include <engine/client/clientstate.h>
|
||||
#include <materialsystem/cmaterialglue.h>
|
||||
|
||||
static ConVar con_drawnotify("con_drawnotify", "0", FCVAR_RELEASE, "Draws the RUI console to the hud");
|
||||
|
||||
// Various cvars that dictate how many lines and how long the text is shown
|
||||
static ConVar con_notifylines("con_notifylines", "3", FCVAR_MATERIAL_SYSTEM_THREAD, "Number of console lines to overlay for debugging", true, 1.f, false, 0.f);
|
||||
static ConVar con_notifytime("con_notifytime", "6", FCVAR_MATERIAL_SYSTEM_THREAD, "How long to display recent console text to the upper part of the game window", true, 1.f, false, 0.f);
|
||||
|
||||
// Various cvars that dictate where the debug text is shown on the screen
|
||||
static ConVar con_notify_invert_x("con_notify_invert_x", "0", FCVAR_MATERIAL_SYSTEM_THREAD, "Inverts the X offset for RUI console overlay");
|
||||
static ConVar con_notify_invert_y("con_notify_invert_y", "0", FCVAR_MATERIAL_SYSTEM_THREAD, "Inverts the Y offset for RUI console overlay");
|
||||
static ConVar con_notify_offset_x("con_notify_offset_x", "10", FCVAR_MATERIAL_SYSTEM_THREAD, "X offset for RUI console overlay");
|
||||
static ConVar con_notify_offset_y("con_notify_offset_y", "10", FCVAR_MATERIAL_SYSTEM_THREAD, "Y offset for RUI console overlay");
|
||||
|
||||
// Various cvars that dictate the colors of script debug text
|
||||
static ConVar con_notify_script_server_clr("con_notify_script_server_clr", "130 120 245 255", FCVAR_MATERIAL_SYSTEM_THREAD, "Script SERVER VM RUI console overlay log color");
|
||||
static ConVar con_notify_script_client_clr("con_notify_script_client_clr", "117 116 139 255", FCVAR_MATERIAL_SYSTEM_THREAD, "Script CLIENT VM RUI console overlay log color");
|
||||
static ConVar con_notify_script_ui_clr("con_notify_script_ui_clr", "200 110 110 255", FCVAR_MATERIAL_SYSTEM_THREAD, "Script UI VM RUI console overlay log color");
|
||||
|
||||
// Various cvars that dictate the colors of code debug text
|
||||
static ConVar con_notify_native_server_clr("con_notify_native_server_clr", "20 50 248 255", FCVAR_MATERIAL_SYSTEM_THREAD, "Native SERVER RUI console overlay log color");
|
||||
static ConVar con_notify_native_client_clr("con_notify_native_client_clr", "70 70 70 255", FCVAR_MATERIAL_SYSTEM_THREAD, "Native CLIENT RUI console overlay log color");
|
||||
static ConVar con_notify_native_ui_clr("con_notify_native_ui_clr", "200 60 60 255", FCVAR_MATERIAL_SYSTEM_THREAD, "Native UI RUI console overlay log color");
|
||||
static ConVar con_notify_native_engine_clr("con_notify_native_engine_clr", "255 255 255 255", FCVAR_MATERIAL_SYSTEM_THREAD, "Native engine RUI console overlay log color");
|
||||
static ConVar con_notify_native_fs_clr("con_notify_native_fs_clr", "0 100 225 255", FCVAR_MATERIAL_SYSTEM_THREAD, "Native FileSystem RUI console overlay log color");
|
||||
static ConVar con_notify_native_rtech_clr("con_notify_native_rtech_clr", "25 120 20 255", FCVAR_MATERIAL_SYSTEM_THREAD, "Native RTech RUI console overlay log color");
|
||||
static ConVar con_notify_native_ms_clr("con_notify_native_ms_clr", "200 20 180 255", FCVAR_MATERIAL_SYSTEM_THREAD, "Native MaterialSystem RUI console overlay log color");
|
||||
static ConVar con_notify_native_audio_clr("con_notify_native_audio_clr", "238 43 10 255", FCVAR_MATERIAL_SYSTEM_THREAD, "Native AudioSystem RUI console overlay log color");
|
||||
static ConVar con_notify_native_video_clr("con_notify_native_video_clr", "115 0 235 255", FCVAR_MATERIAL_SYSTEM_THREAD, "Native VideoSystem RUI console overlay log color");
|
||||
|
||||
static ConVar con_notify_netcon_clr("con_notify_netcon_clr", "255 255 255 255", FCVAR_MATERIAL_SYSTEM_THREAD, "Netconsole RUI console overlay log color");
|
||||
static ConVar con_notify_common_clr("con_notify_common_clr", "255 140 80 255", FCVAR_MATERIAL_SYSTEM_THREAD, "Common RUI console overlay log color");
|
||||
|
||||
static ConVar con_notify_warning_clr("con_notify_warning_clr", "180 180 20 255", FCVAR_MATERIAL_SYSTEM_THREAD, "Warning RUI console overlay log color");
|
||||
static ConVar con_notify_error_clr("con_notify_error_clr", "225 20 20 255", FCVAR_MATERIAL_SYSTEM_THREAD, "Error RUI console overlay log color");
|
||||
|
||||
|
||||
static ConVar cl_notify_invert_x("cl_notify_invert_x", "0", FCVAR_DEVELOPMENTONLY, "Inverts the X offset for console notify debug overlay");
|
||||
static ConVar cl_notify_invert_y("cl_notify_invert_y", "0", FCVAR_DEVELOPMENTONLY, "Inverts the Y offset for console notify debug overlay");
|
||||
static ConVar cl_notify_offset_x("cl_notify_offset_x", "10", FCVAR_DEVELOPMENTONLY, "X offset for console notify debug overlay");
|
||||
static ConVar cl_notify_offset_y("cl_notify_offset_y", "10", FCVAR_DEVELOPMENTONLY, "Y offset for console notify debug overlay");
|
||||
|
||||
static ConVar cl_showsimstats("cl_showsimstats", "0", FCVAR_DEVELOPMENTONLY, "Shows the tick counter for the server/client simulation and the render frame");
|
||||
static ConVar cl_simstats_invert_x("cl_simstats_invert_x", "1", FCVAR_DEVELOPMENTONLY, "Inverts the X offset for simulation debug overlay");
|
||||
static ConVar cl_simstats_invert_y("cl_simstats_invert_y", "1", FCVAR_DEVELOPMENTONLY, "Inverts the Y offset for simulation debug overlay");
|
||||
static ConVar cl_simstats_offset_x("cl_simstats_offset_x", "650", FCVAR_DEVELOPMENTONLY, "X offset for simulation debug overlay");
|
||||
static ConVar cl_simstats_offset_y("cl_simstats_offset_y", "120", FCVAR_DEVELOPMENTONLY, "Y offset for simulation debug overlay");
|
||||
|
||||
static ConVar cl_showgpustats("cl_showgpustats", "0", FCVAR_DEVELOPMENTONLY, "Texture streaming debug overlay");
|
||||
static ConVar cl_gpustats_invert_x("cl_gpustats_invert_x", "1", FCVAR_DEVELOPMENTONLY, "Inverts the X offset for texture streaming debug overlay");
|
||||
static ConVar cl_gpustats_invert_y("cl_gpustats_invert_y", "1", FCVAR_DEVELOPMENTONLY, "Inverts the Y offset for texture streaming debug overlay");
|
||||
static ConVar cl_gpustats_offset_x("cl_gpustats_offset_x", "650", FCVAR_DEVELOPMENTONLY, "X offset for texture streaming debug overlay");
|
||||
static ConVar cl_gpustats_offset_y("cl_gpustats_offset_y", "105", FCVAR_DEVELOPMENTONLY, "Y offset for texture streaming debug overlay");
|
||||
|
||||
static ConVar cl_showmaterialinfo("cl_showmaterialinfo", "0", FCVAR_DEVELOPMENTONLY, "Draw info for the material under the crosshair on screen");
|
||||
static ConVar cl_materialinfo_offset_x("cl_materialinfo_offset_x", "0", FCVAR_DEVELOPMENTONLY, "X offset for material debug info overlay");
|
||||
static ConVar cl_materialinfo_offset_y("cl_materialinfo_offset_y", "420", FCVAR_DEVELOPMENTONLY, "Y offset for material debug info overlay");
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: proceed a log update
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -32,19 +88,19 @@ void CTextOverlay::Update(void)
|
||||
return;
|
||||
}
|
||||
Con_NPrintf();
|
||||
if (con_drawnotify->GetBool())
|
||||
if (con_drawnotify.GetBool())
|
||||
{
|
||||
DrawNotify();
|
||||
}
|
||||
if (cl_showsimstats->GetBool())
|
||||
if (cl_showsimstats.GetBool())
|
||||
{
|
||||
DrawSimStats();
|
||||
}
|
||||
if (cl_showgpustats->GetBool())
|
||||
if (cl_showgpustats.GetBool())
|
||||
{
|
||||
DrawGPUStats();
|
||||
}
|
||||
if (cl_showmaterialinfo->GetBool())
|
||||
if (cl_showmaterialinfo.GetBool())
|
||||
{
|
||||
DrawCrosshairMaterial();
|
||||
}
|
||||
@ -59,16 +115,16 @@ void CTextOverlay::Update(void)
|
||||
//-----------------------------------------------------------------------------
|
||||
void CTextOverlay::AddLog(const eDLL_T context, const char* pszText)
|
||||
{
|
||||
if (!con_drawnotify->GetBool() || !VALID_CHARSTAR(pszText))
|
||||
if (!con_drawnotify.GetBool() || !VALID_CHARSTAR(pszText))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AUTO_LOCK(m_Mutex);
|
||||
m_NotifyLines.AddToTail(CTextNotify{ context, con_notifytime->GetFloat() , pszText });
|
||||
m_NotifyLines.AddToTail(CTextNotify{ context, con_notifytime.GetFloat() , pszText });
|
||||
|
||||
while (m_NotifyLines.Count() > 0 &&
|
||||
(m_NotifyLines.Count() > con_notifylines->GetInt()))
|
||||
(m_NotifyLines.Count() > con_notifylines.GetInt()))
|
||||
{
|
||||
m_NotifyLines.Remove(0);
|
||||
}
|
||||
@ -79,8 +135,8 @@ void CTextOverlay::AddLog(const eDLL_T context, const char* pszText)
|
||||
//-----------------------------------------------------------------------------
|
||||
void CTextOverlay::DrawNotify(void)
|
||||
{
|
||||
int x = con_notify_invert_x->GetBool() ? g_nWindowRect[0] - con_notify_offset_x->GetInt() : con_notify_offset_x->GetInt();
|
||||
int y = con_notify_invert_y->GetBool() ? g_nWindowRect[1] - con_notify_offset_y->GetInt() : con_notify_offset_y->GetInt();
|
||||
int x = con_notify_invert_x.GetBool() ? g_nWindowRect[0] - con_notify_offset_x.GetInt() : con_notify_offset_x.GetInt();
|
||||
int y = con_notify_invert_y.GetBool() ? g_nWindowRect[1] - con_notify_offset_y.GetInt() : con_notify_offset_y.GetInt();
|
||||
|
||||
AUTO_LOCK(m_Mutex);
|
||||
|
||||
@ -149,7 +205,7 @@ void CTextOverlay::DrawFormat(const int x, const int y, const Color c, const cha
|
||||
//-----------------------------------------------------------------------------
|
||||
void CTextOverlay::ShouldDraw(const float flFrameTime)
|
||||
{
|
||||
if (con_drawnotify->GetBool())
|
||||
if (con_drawnotify.GetBool())
|
||||
{
|
||||
AUTO_LOCK(m_Mutex);
|
||||
|
||||
@ -183,8 +239,8 @@ void CTextOverlay::Con_NPrintf(void)
|
||||
}
|
||||
|
||||
static const Color c = { 255, 255, 255, 255 };
|
||||
const int nWidth = cl_notify_invert_x->GetBool() ? g_nWindowRect[0] - cl_notify_offset_x->GetInt() : cl_notify_offset_x->GetInt() + m_nCon_NPrintf_Idx * m_nFontHeight;
|
||||
const int nHeight = cl_notify_invert_y->GetBool() ? g_nWindowRect[1] - cl_notify_offset_y->GetInt() : cl_notify_offset_y->GetInt();
|
||||
const int nWidth = cl_notify_invert_x.GetBool() ? g_nWindowRect[0] - cl_notify_offset_x.GetInt() : cl_notify_offset_x.GetInt() + m_nCon_NPrintf_Idx * m_nFontHeight;
|
||||
const int nHeight = cl_notify_invert_y.GetBool() ? g_nWindowRect[1] - cl_notify_offset_y.GetInt() : cl_notify_offset_y.GetInt();
|
||||
|
||||
CMatSystemSurface__DrawColoredText(g_pMatSystemSurface, v_Rui_GetFontFace(), m_nFontHeight, nWidth, nHeight, c.r(), c.g(), c.b(), c.a(), "%s", m_szCon_NPrintf_Buf);
|
||||
|
||||
@ -198,8 +254,8 @@ void CTextOverlay::Con_NPrintf(void)
|
||||
void CTextOverlay::DrawSimStats(void) const
|
||||
{
|
||||
static const Color c = { 255, 255, 255, 255 };
|
||||
const int nWidth = cl_simstats_invert_x->GetBool() ? g_nWindowRect[0] - cl_simstats_offset_x->GetInt() : cl_simstats_offset_x->GetInt();
|
||||
const int nHeight = cl_simstats_invert_y->GetBool() ? g_nWindowRect[1] - cl_simstats_offset_y->GetInt() : cl_simstats_offset_y->GetInt();
|
||||
const int nWidth = cl_simstats_invert_x.GetBool() ? g_nWindowRect[0] - cl_simstats_offset_x.GetInt() : cl_simstats_offset_x.GetInt();
|
||||
const int nHeight = cl_simstats_invert_y.GetBool() ? g_nWindowRect[1] - cl_simstats_offset_y.GetInt() : cl_simstats_offset_y.GetInt();
|
||||
|
||||
DrawFormat(nWidth, nHeight, c, "Server Frame: (%d) Client Frame: (%d) Render Frame: (%d)\n",
|
||||
g_pClientState->GetServerTickCount(), g_pClientState->GetClientTickCount(), *g_nRenderTickCount);
|
||||
@ -211,8 +267,8 @@ void CTextOverlay::DrawSimStats(void) const
|
||||
void CTextOverlay::DrawGPUStats(void) const
|
||||
{
|
||||
static const Color c = { 255, 255, 255, 255 };
|
||||
const int nWidth = cl_gpustats_invert_x->GetBool() ? g_nWindowRect[0] - cl_gpustats_offset_x->GetInt() : cl_gpustats_offset_x->GetInt();
|
||||
const int nHeight = cl_gpustats_invert_y->GetBool() ? g_nWindowRect[1] - cl_gpustats_offset_y->GetInt() : cl_gpustats_offset_y->GetInt();
|
||||
const int nWidth = cl_gpustats_invert_x.GetBool() ? g_nWindowRect[0] - cl_gpustats_offset_x.GetInt() : cl_gpustats_offset_x.GetInt();
|
||||
const int nHeight = cl_gpustats_invert_y.GetBool() ? g_nWindowRect[1] - cl_gpustats_offset_y.GetInt() : cl_gpustats_offset_y.GetInt();
|
||||
|
||||
DrawFormat(nWidth, nHeight, c, "%8zd/%8zd/%8zdkiB unusable/unfree/total GPU Streaming Texture memory\n",
|
||||
*g_nUnusableStreamingTextureMemory / 1024, *g_nUnfreeStreamingTextureMemory / 1024, *g_nTotalStreamingTextureMemory / 1024);
|
||||
@ -228,7 +284,7 @@ void CTextOverlay::DrawCrosshairMaterial(void) const
|
||||
return;
|
||||
|
||||
static Color c = { 255, 255, 255, 255 };
|
||||
DrawFormat(cl_materialinfo_offset_x->GetInt(), cl_materialinfo_offset_y->GetInt(), c, "name: %s\nguid: %llx\ndimensions: %d x %d\nsurface: %s/%s\nstc: %i\ntc: %i",
|
||||
DrawFormat(cl_materialinfo_offset_x.GetInt(), cl_materialinfo_offset_y.GetInt(), c, "name: %s\nguid: %llx\ndimensions: %d x %d\nsurface: %s/%s\nstc: %i\ntc: %i",
|
||||
pMaterialGlue->name,
|
||||
pMaterialGlue->assetGuid,
|
||||
pMaterialGlue->width, pMaterialGlue->height,
|
||||
@ -259,39 +315,39 @@ Color CTextOverlay::GetLogColorForType(const eDLL_T context) const
|
||||
switch (context)
|
||||
{
|
||||
case eDLL_T::SCRIPT_SERVER:
|
||||
return { con_notify_script_server_clr->GetColor() };
|
||||
return { con_notify_script_server_clr.GetColor() };
|
||||
case eDLL_T::SCRIPT_CLIENT:
|
||||
return { con_notify_script_client_clr->GetColor() };
|
||||
return { con_notify_script_client_clr.GetColor() };
|
||||
case eDLL_T::SCRIPT_UI:
|
||||
return { con_notify_script_ui_clr->GetColor() };
|
||||
return { con_notify_script_ui_clr.GetColor() };
|
||||
case eDLL_T::SERVER:
|
||||
return { con_notify_native_server_clr->GetColor() };
|
||||
return { con_notify_native_server_clr.GetColor() };
|
||||
case eDLL_T::CLIENT:
|
||||
return { con_notify_native_client_clr->GetColor() };
|
||||
return { con_notify_native_client_clr.GetColor() };
|
||||
case eDLL_T::UI:
|
||||
return { con_notify_native_ui_clr->GetColor() };
|
||||
return { con_notify_native_ui_clr.GetColor() };
|
||||
case eDLL_T::ENGINE:
|
||||
return { con_notify_native_engine_clr->GetColor() };
|
||||
return { con_notify_native_engine_clr.GetColor() };
|
||||
case eDLL_T::FS:
|
||||
return { con_notify_native_fs_clr->GetColor() };
|
||||
return { con_notify_native_fs_clr.GetColor() };
|
||||
case eDLL_T::RTECH:
|
||||
return { con_notify_native_rtech_clr->GetColor() };
|
||||
return { con_notify_native_rtech_clr.GetColor() };
|
||||
case eDLL_T::MS:
|
||||
return { con_notify_native_ms_clr->GetColor() };
|
||||
return { con_notify_native_ms_clr.GetColor() };
|
||||
case eDLL_T::AUDIO:
|
||||
return { con_notify_native_audio_clr->GetColor() };
|
||||
return { con_notify_native_audio_clr.GetColor() };
|
||||
case eDLL_T::VIDEO:
|
||||
return { con_notify_native_video_clr->GetColor() };
|
||||
return { con_notify_native_video_clr.GetColor() };
|
||||
case eDLL_T::NETCON:
|
||||
return { con_notify_netcon_clr->GetColor() };
|
||||
return { con_notify_netcon_clr.GetColor() };
|
||||
case eDLL_T::COMMON:
|
||||
return { con_notify_common_clr->GetColor() };
|
||||
return { con_notify_common_clr.GetColor() };
|
||||
case eDLL_T::SYSTEM_WARNING:
|
||||
return { con_notify_warning_clr->GetColor() };
|
||||
return { con_notify_warning_clr.GetColor() };
|
||||
case eDLL_T::SYSTEM_ERROR:
|
||||
return { con_notify_error_clr->GetColor() };
|
||||
return { con_notify_error_clr.GetColor() };
|
||||
default:
|
||||
return { con_notify_native_engine_clr->GetColor() };
|
||||
return { con_notify_native_engine_clr.GetColor() };
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,12 @@
|
||||
#include "vscript/languages/squirrel_re/include/sqstate.h"
|
||||
#include "vscript/languages/squirrel_re/include/sqstdaux.h"
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
// Console variables
|
||||
//---------------------------------------------------------------------------------
|
||||
static ConVar script_show_output("script_show_output", "0", FCVAR_RELEASE, "Prints the VM output to the console ( !slower! ).", true, 0.f, true, 2.f, "0 = log to file. 1 = 0 + log to console. 2 = 1 + log to notify");
|
||||
static ConVar script_show_warning("script_show_warning", "0", FCVAR_RELEASE, "Prints the VM warning output to the console ( !slower! ).", true, 0.f, true, 2.f, "0 = log to file. 1 = 0 + log to console. 2 = 1 + log to notify");
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
// Purpose: prints the output of each VM to the console
|
||||
// Input : *sqvm -
|
||||
@ -71,7 +77,7 @@ SQRESULT SQVM_PrintFunc(HSQUIRRELVM v, SQChar* fmt, ...)
|
||||
|
||||
// Determine whether this is an info or warning log.
|
||||
bool bLogLevelOverride = (g_bSQAuxError || (g_bSQAuxBadLogic && v == g_pErrorVM));
|
||||
LogLevel_t level = LogLevel_t(script_show_output->GetInt());
|
||||
LogLevel_t level = LogLevel_t(script_show_output.GetInt());
|
||||
LogType_t type = bLogLevelOverride ? LogType_t::SQ_WARNING : LogType_t::SQ_INFO;
|
||||
|
||||
// Always log script related problems to the console.
|
||||
@ -124,7 +130,7 @@ SQRESULT SQVM_sprintf(HSQUIRRELVM v, SQInteger a2, SQInteger a3, SQInteger* nStr
|
||||
}
|
||||
|
||||
const std::string svConstructor(*ppString, *nStringSize); // Get string from memory via std::string constructor.
|
||||
CoreMsg(LogType_t::SQ_WARNING, static_cast<LogLevel_t>(script_show_warning->GetInt()),
|
||||
CoreMsg(LogType_t::SQ_WARNING, static_cast<LogLevel_t>(script_show_warning.GetInt()),
|
||||
remoteContext, NO_ERROR, "squirrel_re(warning)", "%s", svConstructor.c_str());
|
||||
}
|
||||
|
||||
|
@ -45,6 +45,9 @@ static IPostMessageW s_oPostMessageW = NULL;
|
||||
static IDXGIResizeBuffers s_fnResizeBuffers = NULL;
|
||||
static IDXGISwapChainPresent s_fnSwapChainPresent = NULL;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
static CFrameLimit s_FrameLimiter;
|
||||
|
||||
//#################################################################################
|
||||
// WINDOW PROCEDURE
|
||||
//#################################################################################
|
||||
@ -133,9 +136,33 @@ void DrawImGui()
|
||||
// IDXGI
|
||||
//#################################################################################
|
||||
|
||||
static ConVar fps_max_rt("fps_max_rt", "0", FCVAR_RELEASE, "Frame rate limiter within the render thread. -1 indicates the use of desktop refresh. 0 is disabled.", true, -1.f, true, 295.f);
|
||||
static ConVar fps_max_rt_tolerance("fps_max_rt_tolerance", "0.25", FCVAR_RELEASE, "Maximum amount of frame time before frame limiter restarts.", true, 0.f, false, 0.f);
|
||||
static ConVar fps_max_rt_sleep_threshold("fps_max_rt_sleep_threshold", "0.016666667", FCVAR_RELEASE, "Frame limiter starts to sleep when frame time exceeds this threshold.", true, 0.f, false, 0.f);
|
||||
|
||||
HRESULT __stdcall Present(IDXGISwapChain* pSwapChain, UINT nSyncInterval, UINT nFlags)
|
||||
{
|
||||
g_FrameLimiter.Run();
|
||||
float targetFps = fps_max_rt.GetFloat();
|
||||
|
||||
if (targetFps > 0.0f)
|
||||
{
|
||||
const float globalFps = fps_max->GetFloat();
|
||||
|
||||
// Make sure the global fps limiter is 'unlimited'
|
||||
// before we let the rt frame limiter cap it to
|
||||
// the desktop's refresh rate; not adhering to
|
||||
// this will result in a major performance drop.
|
||||
if (globalFps == 0.0f && targetFps == -1)
|
||||
targetFps = g_pGame->GetTVRefreshRate();
|
||||
|
||||
if (targetFps > 0.0f)
|
||||
{
|
||||
const float sleepThreshold = fps_max_rt_sleep_threshold.GetFloat();
|
||||
const float maxTolerance = fps_max_rt_tolerance.GetFloat();
|
||||
|
||||
s_FrameLimiter.Run(targetFps, sleepThreshold, maxTolerance);
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// NOTE: -1 since we need to sync this with its corresponding frame, g_FrameNum
|
||||
|
Loading…
x
Reference in New Issue
Block a user