Initial port to CMake

* All libraries have been isolated from each other, and build into separate artifacts.
* Project has been restructured to support isolating libraries.
* CCrashHandler now calls a callback on crash (setup from core/dllmain.cpp, this can be setup in any way for any project. This callback is getting called when the apllication crashes. Useful for flushing buffers before closing handles to logging files for example).
* Tier0 'CoreMsgV' function now calls a callback sink, which could be set by the user (currently setup to the SDK's internal logger in core/dllmain.cpp).

TODO:
* Add a batch file to autogenerate all projects.
* Add support for dedicated server.
* Add support for client dll.

Bugs:
* Game crashes on the title screen after the UI script compiler has finished (root cause unknown).
* Curl error messages are getting logged twice for the dedicated server due to the removal of all "DEDICATED" preprocessor directives to support isolating projects. This has to be fixed properly!
This commit is contained in:
Kawe Mazidjatari 2023-05-10 00:05:38 +02:00
parent 807d660883
commit f120354e96
221 changed files with 5144 additions and 20425 deletions

1
.gitignore vendored
View File

@ -33,6 +33,7 @@ bld/
[Ll]og/
[Ll]ogs/
/[Gg]ame/
build_intermediate/
# Visual Studio 2015/2017 cache/options directory
.vs/

23
CMakeLists.txt Normal file
View File

@ -0,0 +1,23 @@
cmake_minimum_required( VERSION 3.16 )
project( r5sdk )
include( "r5dev/cmake/Configure.cmake" )
include( "r5dev/cmake/Macros.cmake" )
include( "r5dev/cmake/Options.cmake" )
set( CMAKE_CXX_STANDARD 17 )
set( CMAKE_CXX_STANDARD_REQUIRED True )
set( ENGINE_SOURCE_DIR ${CMAKE_SOURCE_DIR}/r5dev )
set( GLOBAL_PCH ${ENGINE_SOURCE_DIR}/core/stdafx.h ) # Global precompiled header shared among all libraries
define_compiler_variables()
setup_build_configurations()
apply_project_settings()
include_directories( ${ENGINE_SOURCE_DIR} )
include_directories( ${ENGINE_SOURCE_DIR}/public )
include_directories( ${ENGINE_SOURCE_DIR}/thirdparty )
# Include the subdirectories that contain the individual projects
add_subdirectory( ${ENGINE_SOURCE_DIR} )

53
r5dev/CMakeLists.txt Normal file
View File

@ -0,0 +1,53 @@
cmake_minimum_required( VERSION 3.16 )
project( sdk )
add_subdirectory( vpc ) # Must be the first as this creates the shared PCH!
add_subdirectory( tier0 )
add_subdirectory( tier1 )
add_subdirectory( tier2 )
add_subdirectory( vpklib )
add_subdirectory( vscript )
add_subdirectory( vstdlib )
add_subdirectory( vphysics )
add_subdirectory( vguimatsurface )
add_subdirectory( vgui )
add_subdirectory( thirdparty/detours )
add_subdirectory( thirdparty/cppnet )
add_subdirectory( thirdparty/lzham )
add_subdirectory( thirdparty/fastlz )
add_subdirectory( thirdparty/imgui )
add_subdirectory( thirdparty/curl )
add_subdirectory( thirdparty/protobuf )
add_subdirectory( thirdparty/spdlog )
add_subdirectory( thirdparty/sdl )
add_subdirectory( thirdparty/recast )
add_subdirectory( sdklauncher )
add_subdirectory( rtech )
add_subdirectory( protoc )
add_subdirectory( networksystem )
add_subdirectory( pluginsystem )
add_subdirectory( pluginsdk )
add_subdirectory( mathlib )
add_subdirectory( netconsole )
add_subdirectory( naveditor )
add_subdirectory( materialsystem )
add_subdirectory( localize )
add_subdirectory( inputsystem )
add_subdirectory( game )
add_subdirectory( datacache )
add_subdirectory( filesystem )
add_subdirectory( ebisusdk )
add_subdirectory( codecs )
add_subdirectory( engine )
add_subdirectory( core )
add_subdirectory( appframework )

View File

@ -0,0 +1,18 @@
cmake_minimum_required( VERSION 3.16 )
project( appframework )
add_library( ${PROJECT_NAME} )
start_sources()
add_sources( SOURCE_GROUP "Private"
"IAppSystemGroup.cpp"
)
add_sources( SOURCE_GROUP "Public"
"${ENGINE_SOURCE_DIR}/public/appframework/IAppSystem.h"
"${ENGINE_SOURCE_DIR}/public/appframework/IAppSystemGroup.h"
)
end_sources()
target_precompile_headers( ${PROJECT_NAME} REUSE_FROM tier0 )

View File

@ -1,4 +1,4 @@
//===== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ======//
//===== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ======//
//
// Purpose: Defines a group of app systems that all have the same lifetime
// that need to be connected/initialized, etc. in a well-defined order
@ -7,7 +7,7 @@
// $NoKeywords: $
//===========================================================================//
#include "core/stdafx.h"
#include "IAppSystemGroup.h"
#include "appframework/IAppSystemGroup.h"
//-----------------------------------------------------------------------------
// Purpose: Initialize plugin system

View File

@ -1,101 +0,0 @@
//===== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ======//
//
// Purpose:
//
// $NoKeywords: $
//
//===========================================================================//
#include "core/stdafx.h"
#include "mathlib/mathlib.h"
//-----------------------------------------------------------------------------
// Purpose: qt = ( s * p ) * q
//-----------------------------------------------------------------------------
void QuaternionSM(float s, const Quaternion& p, const Quaternion& q, Quaternion& qt)
{
Quaternion p1, q1;
QuaternionScale(p, s, p1);
QuaternionMult(p1, q, q1);
QuaternionNormalize(q1);
qt[0] = q1[0];
qt[1] = q1[1];
qt[2] = q1[2];
qt[3] = q1[3];
}
#if ALLOW_SIMD_QUATERNION_MATH
FORCEINLINE fltx4 QuaternionSMSIMD(const fltx4& s, const fltx4& p, const fltx4& q)
{
fltx4 p1, q1, result;
p1 = QuaternionScaleSIMD(p, s);
q1 = QuaternionMultSIMD(p1, q);
result = QuaternionNormalizeSIMD(q1);
return result;
}
FORCEINLINE fltx4 QuaternionSMSIMD(float s, const fltx4& p, const fltx4& q)
{
return QuaternionSMSIMD(ReplicateX4(s), p, q);
}
#endif
//-----------------------------------------------------------------------------
// Purpose: qt = p * ( s * q )
//-----------------------------------------------------------------------------
void QuaternionMA(const Quaternion& p, float s, const Quaternion& q, Quaternion& qt)
{
Quaternion p1, q1;
QuaternionScale(q, s, q1);
QuaternionMult(p, q1, p1);
QuaternionNormalize(p1);
qt[0] = p1[0];
qt[1] = p1[1];
qt[2] = p1[2];
qt[3] = p1[3];
}
#if ALLOW_SIMD_QUATERNION_MATH
FORCEINLINE fltx4 QuaternionMASIMD(const fltx4& p, const fltx4& s, const fltx4& q)
{
fltx4 p1, q1, result;
q1 = QuaternionScaleSIMD(q, s);
p1 = QuaternionMultSIMD(p, q1);
result = QuaternionNormalizeSIMD(p1);
return result;
}
FORCEINLINE fltx4 QuaternionMASIMD(const fltx4& p, float s, const fltx4& q)
{
return QuaternionMASIMD(p, ReplicateX4(s), q);
}
#endif
//-----------------------------------------------------------------------------
// Purpose: qt = p + s * q
//-----------------------------------------------------------------------------
void QuaternionAccumulate(const Quaternion& p, float s, const Quaternion& q, Quaternion& qt)
{
Quaternion q2;
QuaternionAlign(p, q, q2);
qt[0] = p[0] + s * q2[0];
qt[1] = p[1] + s * q2[1];
qt[2] = p[2] + s * q2[2];
qt[3] = p[3] + s * q2[3];
}
#if ALLOW_SIMD_QUATERNION_MATH
FORCEINLINE fltx4 QuaternionAccumulateSIMD(const fltx4& p, float s, const fltx4& q)
{
fltx4 q2, s4, result;
q2 = QuaternionAlignSIMD(p, q);
s4 = ReplicateX4(s);
result = MaddSIMD(s4, q2, p);
return result;
}
#endif

View File

@ -0,0 +1,23 @@
cmake_minimum_required( VERSION 3.16 )
project( codecs )
add_library( ${PROJECT_NAME} )
start_sources()
add_sources( SOURCE_GROUP "Bink"
"bink/bink_impl.cpp"
"bink/bink_impl.h"
)
add_sources( SOURCE_GROUP "Miles"
"miles/miles_impl.cpp"
"miles/miles_impl.h"
"miles/miles_types.h" # TODO[ AMOS ]: move to public!
"miles/radshal_wasapi.h"
)
end_sources()
target_include_directories( ${PROJECT_NAME} PRIVATE "${ENGINE_SOURCE_DIR}/tier0/" "${ENGINE_SOURCE_DIR}/tier1/" )
target_precompile_headers( ${PROJECT_NAME} REUSE_FROM tier0 )

View File

@ -14,6 +14,7 @@
#endif // !CLIENT_DLL
#ifndef DEDICATED
#include "engine/client/cl_rcon.h"
#include "engine/client/cdll_engine_int.h"
#endif // !DEDICATED
#include "engine/client/client.h"
#include "engine/net.h"
@ -23,9 +24,6 @@
#ifndef CLIENT_DLL
#include "engine/server/server.h"
#endif // !CLIENT_DLL
#ifndef DEDICATED
#include "client/cdll_engine_int.h"
#endif // !DEDICATED
#include "rtech/rtech_game.h"
#include "rtech/rtech_utils.h"
#include "filesystem/basefilesystem.h"
@ -44,8 +42,8 @@
#include "public/worldsize.h"
#include "mathlib/crc32.h"
#include "mathlib/mathlib.h"
#include "vstdlib/completion.h"
#include "vstdlib/callback.h"
#include "common/completion.h"
#include "common/callback.h"
#ifndef DEDICATED
#include "materialsystem/cmaterialglue.h"
#endif // !DEDICATED

View File

@ -8,7 +8,7 @@
#include "engine/cmodel_bsp.h"
#include "tier1/strtools.h"
#include "completion.h"
#include "autocompletefilelist.h"
#include "vstdlib/autocompletefilelist.h"
//-----------------------------------------------------------------------------
// Purpose:

View File

@ -1,6 +1,6 @@
#pragma once
#include "public/iconvar.h"
#include "autocompletefilelist.h"
#include "vstdlib/autocompletefilelist.h"
int Host_SSMap_f_CompletionFunc(char const* partial, char commands[COMMAND_COMPLETION_MAXITEMS][COMMAND_COMPLETION_ITEM_LENGTH]);
int Host_Map_f_CompletionFunc(char const* partial, char commands[COMMAND_COMPLETION_MAXITEMS][COMMAND_COMPLETION_ITEM_LENGTH]);

786
r5dev/common/global.cpp Normal file
View File

@ -0,0 +1,786 @@
#include "core/stdafx.h"
#include "const.h"
#include "tier0/commandline.h"
#include "tier1/cvar.h"
#include "tier1/cmd.h"
#include "tier1/NetAdr.h"
#include "tier2/curlutils.h" // For initializing the curl cvars.
#include "completion.h"
#include "callback.h"
#include "global.h"
//-----------------------------------------------------------------------------
// ENGINE |
ConVar* sdk_fixedframe_tickinterval = nullptr;
ConVar* single_frame_shutdown_for_reload = nullptr;
ConVar* old_gather_props = nullptr;
ConVar* enable_debug_overlays = nullptr;
ConVar* debug_draw_box_depth_test = nullptr;
ConVar* developer = nullptr;
ConVar* fps_max = nullptr;
ConVar* staticProp_defaultBuildFrustum = nullptr;
ConVar* staticProp_no_fade_scalar = nullptr;
ConVar* staticProp_gather_size_weight = nullptr;
ConVar* model_defaultFadeDistScale = nullptr;
ConVar* model_defaultFadeDistMin = nullptr;
ConVar* ip_cvar = nullptr;
ConVar* hostname = nullptr;
ConVar* hostdesc = nullptr;
ConVar* hostip = nullptr;
ConVar* hostport = nullptr;
ConVar* host_hasIrreversibleShutdown = nullptr;
ConVar* mp_gamemode = nullptr;
ConVar* rcon_address = nullptr;
ConVar* rcon_password = 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;
#endif // !DEDICATED
ConVar* stream_overlay = nullptr;
ConVar* stream_overlay_mode = 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_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_updaterate_mp = nullptr;
ConVar* sv_updaterate_sp = 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_voiceEcho = nullptr;
ConVar* sv_voiceenable = nullptr;
ConVar* sv_alltalk = 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_cheats = nullptr;
ConVar* sv_visualizetraces = nullptr;
ConVar* sv_visualizetraces_duration = nullptr;
#if !defined (GAMEDLL_S0) && !defined (GAMEDLL_S1)
ConVar* bhit_enable = nullptr;
ConVar* bhit_depth_test = nullptr;
ConVar* bhit_abs_origin = nullptr;
#endif // !GAMEDLL_S0 && !GAMEDLL_S1
//-----------------------------------------------------------------------------
// CLIENT |
#ifndef DEDICATED
ConVar* cl_rcon_request_sendlogs = nullptr;
ConVar* cl_quota_stringCmdsPerSecond = 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* 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_suggestion_limit = nullptr;
ConVar* con_suggestion_showhelptext = nullptr;
ConVar* con_suggestion_showflags = nullptr;
ConVar* con_suggestion_flags_realtime = nullptr;
ConVar* origin_disconnectWhenOffline = 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* pylon_matchmaking_hostname = nullptr;
ConVar* pylon_host_update_interval = nullptr;
ConVar* pylon_showdebuginfo = nullptr;
//-----------------------------------------------------------------------------
// RTECH API |
ConVar* rtech_debug = 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);
staticProp_defaultBuildFrustum = ConVar::StaticCreate("staticProp_defaultBuildFrustum", "0", FCVAR_DEVELOPMENTONLY, "Use the old solution for building static prop frustum culling.", 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);
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);
//-------------------------------------------------------------------------
// 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, "Index: > 0 && < mesh->m_tileCount");
#endif // !DEDICATED
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 a 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 a 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 net console.", 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);
#endif // !CLIENT_DLL
#if !defined (GAMEDLL_S0) && !defined (GAMEDLL_S1)
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);
#endif // !GAMEDLL_S0 && !GAMEDLL_S1
//-------------------------------------------------------------------------
// CLIENT |
#ifndef DEDICATED
cl_rcon_request_sendlogs = ConVar::StaticCreate("cl_rcon_request_sendlogs", "1" , FCVAR_RELEASE, "Request the rcon server to send console logs on connect.", false, 0.f, false, 0.f, nullptr, 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);
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, "Net console 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_suggestion_limit = ConVar::StaticCreate("con_suggestion_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_suggestion_showhelptext = ConVar::StaticCreate("con_suggestion_showhelptext" , "1" , FCVAR_DEVELOPMENTONLY, "Show CommandBase help text in autocomplete window.", false, 0.f, false, 0.f, nullptr, nullptr);
con_suggestion_showflags = ConVar::StaticCreate("con_suggestion_showflags" , "1" , FCVAR_DEVELOPMENTONLY, "Show CommandBase flags in autocomplete window.", false, 0.f, false, 0.f, nullptr, nullptr);
con_suggestion_flags_realtime = ConVar::StaticCreate("con_suggestion_flags_realtime", "1" , FCVAR_DEVELOPMENTONLY, "Whether to show compile-time or run-time CommandBase flags.", false, 0.f, false, 0.f, nullptr, nullptr);
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
//-------------------------------------------------------------------------
// 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" , "platform/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.");
//-------------------------------------------------------------------------
// NETWORKSYSTEM |
pylon_matchmaking_hostname = ConVar::StaticCreate("pylon_matchmaking_hostname", "ms.r5reloaded.com", FCVAR_RELEASE, "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 |
rtech_debug = ConVar::StaticCreate("rtech_debug", "0", FCVAR_DEVELOPMENTONLY, "Shows debug output for the RTech system.", 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 = 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 = No Print");
#endif // !DEDICATED
//-------------------------------------------------------------------------
}
//-----------------------------------------------------------------------------
// Purpose: initialize shipped ConVar's
//-----------------------------------------------------------------------------
void ConVar_InitShipped(void)
{
#ifndef CLIENT_DLL
ai_script_nodes_draw = g_pCVar->FindVar("ai_script_nodes_draw");
#if !defined (GAMEDLL_S0) && !defined (GAMEDLL_S1)
bhit_enable = g_pCVar->FindVar("bhit_enable");
#endif // !GAMEDLL_S0 && !GAMEDLL_S1
#endif // !CLIENT_DLL
developer = g_pCVar->FindVar("developer");
fps_max = g_pCVar->FindVar("fps_max");
fs_showAllReads = g_pCVar->FindVar("fs_showAllReads");
#ifndef DEDICATED
cl_threaded_bone_setup = g_pCVar->FindVar("cl_threaded_bone_setup");
#endif // !DEDICATED
single_frame_shutdown_for_reload = g_pCVar->FindVar("single_frame_shutdown_for_reload");
enable_debug_overlays = g_pCVar->FindVar("enable_debug_overlays");
debug_draw_box_depth_test = g_pCVar->FindVar("debug_draw_box_depth_test");
model_defaultFadeDistScale = g_pCVar->FindVar("model_defaultFadeDistScale");
model_defaultFadeDistMin = g_pCVar->FindVar("model_defaultFadeDistMin");
#ifndef DEDICATED
miles_language = g_pCVar->FindVar("miles_language");
rui_defaultDebugFontFace = g_pCVar->FindVar("rui_defaultDebugFontFace");
r_visualizetraces = g_pCVar->FindVar("r_visualizetraces");
r_visualizetraces_duration = g_pCVar->FindVar("r_visualizetraces_duration");
#endif // !DEDICATED
staticProp_no_fade_scalar = g_pCVar->FindVar("staticProp_no_fade_scalar");
staticProp_gather_size_weight = g_pCVar->FindVar("staticProp_gather_size_weight");
stream_overlay = g_pCVar->FindVar("stream_overlay");
stream_overlay_mode = g_pCVar->FindVar("stream_overlay_mode");
sv_cheats = g_pCVar->FindVar("sv_cheats");
sv_visualizetraces = g_pCVar->FindVar("sv_visualizetraces");
sv_visualizetraces_duration = g_pCVar->FindVar("sv_visualizetraces_duration");
old_gather_props = g_pCVar->FindVar("old_gather_props");
#ifndef DEDICATED
origin_disconnectWhenOffline = g_pCVar->FindVar("origin_disconnectWhenOffline");
#endif // !DEDICATED
mp_gamemode = g_pCVar->FindVar("mp_gamemode");
ip_cvar = g_pCVar->FindVar("ip");
hostname = g_pCVar->FindVar("hostname");
hostip = g_pCVar->FindVar("hostip");
hostport = g_pCVar->FindVar("hostport");
host_hasIrreversibleShutdown = g_pCVar->FindVar("host_hasIrreversibleShutdown");
net_usesocketsforloopback = g_pCVar->FindVar("net_usesocketsforloopback");
#ifndef CLIENT_DLL
sv_stats = g_pCVar->FindVar("sv_stats");
sv_updaterate_mp = g_pCVar->FindVar("sv_updaterate_mp");
sv_updaterate_sp = g_pCVar->FindVar("sv_updaterate_sp");
sv_showhitboxes = g_pCVar->FindVar("sv_showhitboxes");
sv_forceChatToTeamOnly = g_pCVar->FindVar("sv_forceChatToTeamOnly");
sv_voiceenable = g_pCVar->FindVar("sv_voiceenable");
sv_voiceEcho = g_pCVar->FindVar("sv_voiceEcho");
sv_alltalk = g_pCVar->FindVar("sv_alltalk");
sv_showhitboxes->SetMin(-1); // Allow user to go over each entity manually without going out of bounds.
sv_showhitboxes->SetMax(NUM_ENT_ENTRIES - 1);
sv_forceChatToTeamOnly->RemoveFlags(FCVAR_DEVELOPMENTONLY);
sv_forceChatToTeamOnly->AddFlags(FCVAR_REPLICATED);
ai_script_nodes_draw->SetValue(-1);
#if !defined (GAMEDLL_S0) && !defined (GAMEDLL_S1) && !defined (GAMEDLL_S2)
bhit_enable->SetValue(0);
#endif // !(GAMEDLL_S0) || !(GAMEDLL_S1) || !(GAMEDLL_S2)
#endif // !CLIENT_DLL
#ifndef DEDICATED
cl_threaded_bone_setup->RemoveFlags(FCVAR_DEVELOPMENTONLY);
rui_defaultDebugFontFace->RemoveFlags(FCVAR_DEVELOPMENTONLY);
origin_disconnectWhenOffline->RemoveFlags(FCVAR_DEVELOPMENTONLY);
#endif // !DEDICATED
mp_gamemode->RemoveFlags(FCVAR_DEVELOPMENTONLY);
mp_gamemode->RemoveChangeCallback(mp_gamemode->m_fnChangeCallbacks[0]);
mp_gamemode->InstallChangeCallback(MP_GameMode_Changed_f, false);
net_usesocketsforloopback->RemoveFlags(FCVAR_DEVELOPMENTONLY);
net_usesocketsforloopback->InstallChangeCallback(NET_UseSocketsForLoopbackChanged_f, false);
}
//-----------------------------------------------------------------------------
// Purpose: unregister/disable extraneous ConVar's.
//-----------------------------------------------------------------------------
void ConVar_PurgeShipped(void)
{
#ifdef DEDICATED
const char* pszToPurge[] =
{
"bink_materials_enabled",
"communities_enabled",
"community_frame_run",
"ime_enabled",
"origin_igo_mutes_sound_enabled",
"twitch_shouldQuery",
"voice_enabled",
};
for (size_t i = 0; i < SDK_ARRAYSIZE(pszToPurge); i++)
{
if (ConVar* pCVar = g_pCVar->FindVar(pszToPurge[i]))
{
pCVar->SetValue(0);
}
}
#endif // DEDICATED
}
//-----------------------------------------------------------------------------
// Purpose: clear all hostname ConVar's.
//-----------------------------------------------------------------------------
void ConVar_PurgeHostNames(void)
{
const char* pszHostNames[] =
{
"assetdownloads_hostname",
"communities_hostname",
"matchmaking_hostname",
"party_hostname",
"persistence_hostname",
"persistenceDef_hostname",
"pin_telemetry_hostname",
"publication_hostname",
"serverReports_hostname",
"skill_hostname",
"speechtotext_hostname",
"staticfile_hostname",
"stats_hostname",
"steamlink_hostname",
"subscription_hostname",
"users_hostname"
};
for (size_t i = 0; i < SDK_ARRAYSIZE(pszHostNames); i++)
{
if (ConVar* pCVar = g_pCVar->FindVar(pszHostNames[i]))
{
pCVar->SetValue(NET_IPV4_UNSPEC);
}
}
}
//-----------------------------------------------------------------------------
// Purpose: ConCommand registration
//-----------------------------------------------------------------------------
void ConCommand_StaticInit(void)
{
//-------------------------------------------------------------------------
// ENGINE DLL |
#if !defined (GAMEDLL_S0) && !defined (GAMEDLL_S1)
ConCommand::StaticCreate("bhit", "Bullet-hit trajectory debug.", nullptr, FCVAR_DEVELOPMENTONLY | FCVAR_GAMEDLL, BHit_f, nullptr);
#endif // !GAMEDLL_S0 && !GAMEDLL_S1
#ifndef DEDICATED
ConCommand::StaticCreate("line", "Draw a debug line.", nullptr, FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT, Line_f, nullptr);
ConCommand::StaticCreate("sphere", "Draw a debug sphere.", nullptr, FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT, Sphere_f, nullptr);
ConCommand::StaticCreate("capsule", "Draw a debug capsule.", nullptr, FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT, Capsule_f, nullptr);
#endif //!DEDICATED
ConCommand::StaticCreate("con_help", "Shows the colors and description of each context.", nullptr, FCVAR_RELEASE, CON_Help_f, nullptr);
#ifndef CLIENT_DLL
ConCommand::StaticCreate("reload_playlists", "Reloads the playlists file.", nullptr, FCVAR_RELEASE, Host_ReloadPlaylists_f, nullptr);
#endif // !CLIENT_DLL
//-------------------------------------------------------------------------
// SERVER DLL |
#ifndef CLIENT_DLL
ConCommand::StaticCreate("script", "Run input code as SERVER script on the VM.", nullptr, FCVAR_GAMEDLL | FCVAR_CHEAT, SQVM_ServerScript_f, nullptr);
ConCommand::StaticCreate("sv_kick", "Kick a client from the server by user name.", "sv_kick \"<userId>\"", FCVAR_RELEASE, Host_Kick_f, nullptr);
ConCommand::StaticCreate("sv_kickid", "Kick a client from the server by handle, nucleus id or ip address.", "sv_kickid \"<handle>\"/\"<nucleusId>/<ipAddress>\"", FCVAR_RELEASE, Host_KickID_f, nullptr);
ConCommand::StaticCreate("sv_ban", "Bans a client from the server by user name.", "sv_ban <userId>", FCVAR_RELEASE, Host_Ban_f, nullptr);
ConCommand::StaticCreate("sv_banid", "Bans a client from the server by handle, nucleus id or ip address.", "sv_banid \"<handle>\"/\"<nucleusId>/<ipAddress>\"", FCVAR_RELEASE, Host_BanID_f, nullptr);
ConCommand::StaticCreate("sv_unban", "Unbans a client from the server by nucleus id or ip address.", "sv_unban \"<nucleusId>\"/\"<ipAddress>\"", FCVAR_RELEASE, Host_Unban_f, nullptr);
ConCommand::StaticCreate("sv_reloadbanlist", "Reloads the banned list.", nullptr, FCVAR_RELEASE, Host_ReloadBanList_f, nullptr);
ConCommand::StaticCreate("sv_addbot", "Creates a bot on the server.", nullptr, FCVAR_RELEASE, CC_CreateFakePlayer_f, nullptr);
ConCommand::StaticCreate("navmesh_hotswap", "Hot swap the NavMesh for all hulls.", nullptr, FCVAR_DEVELOPMENTONLY, Detour_HotSwap_f, nullptr);
#endif // !CLIENT_DLL
#ifndef DEDICATED
//-------------------------------------------------------------------------
// CLIENT DLL |
ConCommand::StaticCreate("script_client", "Run input code as CLIENT script on the VM.", nullptr, FCVAR_CLIENTDLL | FCVAR_CHEAT, SQVM_ClientScript_f, nullptr);
ConCommand::StaticCreate("rcon", "Forward RCON query to remote server.", "rcon \"<query>\"", FCVAR_CLIENTDLL | FCVAR_RELEASE, RCON_CmdQuery_f, nullptr);
ConCommand::StaticCreate("rcon_disconnect", "Disconnect from RCON server.", nullptr, FCVAR_CLIENTDLL | FCVAR_RELEASE, RCON_Disconnect_f, nullptr);
ConCommand::StaticCreate("con_history", "Shows the developer console submission history.", nullptr, FCVAR_CLIENTDLL | FCVAR_RELEASE, CON_LogHistory_f, nullptr);
ConCommand::StaticCreate("con_removeline", "Removes a range of lines from the developer console.", nullptr, FCVAR_CLIENTDLL | FCVAR_RELEASE, CON_RemoveLine_f, nullptr);
ConCommand::StaticCreate("con_clearlines", "Clears all lines from the developer console.", nullptr, FCVAR_CLIENTDLL | FCVAR_RELEASE, CON_ClearLines_f, nullptr);
ConCommand::StaticCreate("con_clearhistory", "Clears all submissions from the developer console history.", nullptr, FCVAR_CLIENTDLL | FCVAR_RELEASE, CON_ClearHistory_f, nullptr);
ConCommand::StaticCreate("toggleconsole", "Show/hide the developer console.", nullptr, FCVAR_CLIENTDLL | FCVAR_RELEASE, ToggleConsole_f, nullptr);
ConCommand::StaticCreate("togglebrowser", "Show/hide the server browser.", nullptr, FCVAR_CLIENTDLL | FCVAR_RELEASE, ToggleBrowser_f, nullptr);
//-------------------------------------------------------------------------
// UI DLL |
ConCommand::StaticCreate("script_ui", "Run input code as UI script on the VM.", nullptr, FCVAR_CLIENTDLL | FCVAR_CHEAT, SQVM_UIScript_f, nullptr);
#endif // !DEDICATED
//-------------------------------------------------------------------------
// FILESYSTEM API |
ConCommand::StaticCreate("fs_vpk_mount", "Mount a VPK file for FileSystem usage.", nullptr, FCVAR_DEVELOPMENTONLY, VPK_Mount_f, nullptr);
ConCommand::StaticCreate("fs_vpk_unmount", "Unmount a VPK file and clear its cache.", nullptr, FCVAR_DEVELOPMENTONLY, VPK_Unmount_f, nullptr);
ConCommand::StaticCreate("fs_vpk_build", "Build a VPK file from current workspace.", nullptr, FCVAR_DEVELOPMENTONLY, VPK_Pack_f, nullptr);
ConCommand::StaticCreate("fs_vpk_unpack", "Unpack all files from a VPK file.", nullptr, FCVAR_DEVELOPMENTONLY, VPK_Unpack_f, nullptr);
//-------------------------------------------------------------------------
// RTECH API |
ConCommand::StaticCreate("rtech_strtoguid", "Calculates the GUID from input data.", nullptr, FCVAR_DEVELOPMENTONLY, RTech_StringToGUID_f, nullptr);
ConCommand::StaticCreate("pak_decompress", "Decompresses specified RPAK file.", nullptr, FCVAR_DEVELOPMENTONLY, RTech_Decompress_f, RTech_PakDecompress_f_CompletionFunc);
ConCommand::StaticCreate("pak_requestload", "Requests asynchronous load for specified RPAK file.", nullptr, FCVAR_DEVELOPMENTONLY, Pak_RequestLoad_f, RTech_PakLoad_f_CompletionFunc);
ConCommand::StaticCreate("pak_requestunload", "Requests unload for specified RPAK file or ID.", nullptr, FCVAR_DEVELOPMENTONLY, Pak_RequestUnload_f, RTech_PakUnload_f_CompletionFunc);
ConCommand::StaticCreate("pak_swap", "Requests swap for specified RPAK file or ID", nullptr, FCVAR_DEVELOPMENTONLY, Pak_Swap_f, nullptr);
ConCommand::StaticCreate("pak_listpaks", "Display a list of the loaded Pak files.", nullptr, FCVAR_RELEASE, Pak_ListPaks_f, nullptr);
ConCommand::StaticCreate("pak_listtypes", "Display a list of the registered asset types.", nullptr, FCVAR_RELEASE, Pak_ListTypes_f, nullptr);
//-------------------------------------------------------------------------
// NETCHANNEL |
ConCommand::StaticCreate("net_setkey", "Sets user specified base64 net key.", nullptr, FCVAR_RELEASE, NET_SetKey_f, nullptr);
ConCommand::StaticCreate("net_generatekey", "Generates and sets a random base64 net key.", nullptr, FCVAR_RELEASE, NET_GenerateKey_f, nullptr);
//-------------------------------------------------------------------------
// TIER0 |
ConCommand::StaticCreate("sig_getadr", "Logs the sigscan results to the console.", nullptr, FCVAR_DEVELOPMENTONLY | FCVAR_HIDDEN, SIG_GetAdr_f, nullptr);
}
//-----------------------------------------------------------------------------
// Purpose: shipped ConCommand initialization
//-----------------------------------------------------------------------------
void ConCommand_InitShipped(void)
{
///------------------------------------------------------ [ CALLBACK SWAP ]
//-------------------------------------------------------------------------
// ENGINE DLL |
ConCommand* changelevel = g_pCVar->FindCommand("changelevel");
ConCommand* map = g_pCVar->FindCommand("map");
ConCommand* map_background = g_pCVar->FindCommand("map_background");
ConCommand* ss_map = g_pCVar->FindCommand("ss_map");
ConCommand* migrateme = g_pCVar->FindCommand("migrateme");
ConCommand* help = g_pCVar->FindCommand("help");
ConCommand* convar_list = g_pCVar->FindCommand("convar_list");
ConCommand* convar_differences = g_pCVar->FindCommand("convar_differences");
ConCommand* convar_findByFlags = g_pCVar->FindCommand("convar_findByFlags");
#ifndef DEDICATED
//-------------------------------------------------------------------------
// MATERIAL SYSTEM
ConCommand* mat_crosshair = g_pCVar->FindCommand("mat_crosshair"); // Patch callback function to working callback.
//-------------------------------------------------------------------------
// CLIENT DLL |
ConCommand* give = g_pCVar->FindCommand("give");
#endif // !DEDICATED
help->m_fnCommandCallback = CVHelp_f;
convar_list->m_fnCommandCallback = CVList_f;
convar_differences->m_fnCommandCallback = CVDiff_f;
convar_findByFlags->m_fnCommandCallback = CVFlag_f;
#ifndef CLIENT_DLL
changelevel->m_fnCommandCallback = Host_Changelevel_f;
#endif // !CLIENT_DLL
changelevel->m_fnCompletionCallback = Host_Changelevel_f_CompletionFunc;
map->m_fnCompletionCallback = Host_Map_f_CompletionFunc;
map_background->m_fnCompletionCallback = Host_Background_f_CompletionFunc;
ss_map->m_fnCompletionCallback = Host_SSMap_f_CompletionFunc;
#ifndef DEDICATED
mat_crosshair->m_fnCommandCallback = Mat_CrossHair_f;
give->m_fnCompletionCallback = Game_Give_f_CompletionFunc;
#endif // !DEDICATED
/// ------------------------------------------------------ [ FLAG REMOVAL ]
//-------------------------------------------------------------------------
if (!CommandLine()->CheckParm("-devsdk"))
{
const char* pszMaskedBases[] =
{
#ifndef DEDICATED
"connect",
"connectAsSpectator",
"connectWithKey",
"silentconnect",
"set",
"ping",
#endif // !DEDICATED
"launchplaylist",
"quit",
"exit",
"reload",
"restart",
"status",
"version",
};
for (size_t i = 0; i < SDK_ARRAYSIZE(pszMaskedBases); i++)
{
if (ConCommandBase* pCommandBase = g_pCVar->FindCommandBase(pszMaskedBases[i]))
{
pCommandBase->RemoveFlags(FCVAR_DEVELOPMENTONLY);
}
}
convar_list->RemoveFlags(FCVAR_DEVELOPMENTONLY);
convar_differences->RemoveFlags(FCVAR_DEVELOPMENTONLY);
convar_findByFlags->RemoveFlags(FCVAR_DEVELOPMENTONLY);
help->RemoveFlags(FCVAR_DEVELOPMENTONLY);
migrateme->RemoveFlags(FCVAR_SERVER_CAN_EXECUTE);
changelevel->RemoveFlags(FCVAR_DEVELOPMENTONLY);
map->RemoveFlags(FCVAR_DEVELOPMENTONLY | FCVAR_SERVER_CAN_EXECUTE);
map_background->RemoveFlags(FCVAR_DEVELOPMENTONLY | FCVAR_SERVER_CAN_EXECUTE);
ss_map->RemoveFlags(FCVAR_DEVELOPMENTONLY | FCVAR_SERVER_CAN_EXECUTE);
}
}
//-----------------------------------------------------------------------------
// Purpose: unregister extraneous ConCommand's.
//-----------------------------------------------------------------------------
void ConCommand_PurgeShipped(void)
{
#ifdef DEDICATED
const char* pszCommandToRemove[] =
{
"bind",
"bind_held",
"bind_list",
"bind_list_abilities",
"bind_US_standard",
"bind_held_US_standard",
"unbind",
"unbind_US_standard",
"unbindall",
"unbind_all_gamepad",
"unbindall_ignoreGamepad",
"unbind_batch",
"unbind_held",
"unbind_held_US_standard",
"uiscript_reset",
"getpos_bind",
"connect",
"silent_connect",
"ping",
"gameui_activate",
"gameui_hide",
"weaponSelectOrdnance",
"weaponSelectPrimary0",
"weaponSelectPrimary1",
"weaponSelectPrimary2",
"+scriptCommand1",
"-scriptCommand1",
"+scriptCommand2",
"-scriptCommand2",
"+scriptCommand3",
"-scriptCommand3",
"+scriptCommand4",
"-scriptCommand4",
"+scriptCommand5",
"-scriptCommand5",
"+scriptCommand6",
"-scriptCommand6",
"+scriptCommand7",
"-scriptCommand7",
"+scriptCommand8",
"-scriptCommand8",
"+scriptCommand9",
"-scriptCommand9",
};
for (size_t i = 0; i < SDK_ARRAYSIZE(pszCommandToRemove); i++)
{
ConCommandBase* pCommandBase = g_pCVar->FindCommandBase(pszCommandToRemove[i]);
if (pCommandBase)
{
g_pCVar->UnregisterConCommand(pCommandBase);
}
}
#endif // DEDICATED
}

232
r5dev/common/global.h Normal file
View File

@ -0,0 +1,232 @@
#ifndef GLOBAL_H
#define GLOBAL_H
//-------------------------------------------------------------------------
// ENGINE |
extern ConVar* sdk_fixedframe_tickinterval;
extern ConVar* single_frame_shutdown_for_reload;
extern ConVar* old_gather_props;
extern ConVar* enable_debug_overlays;
extern ConVar* debug_draw_box_depth_test;
extern ConVar* developer;
extern ConVar* fps_max;
extern ConVar* staticProp_defaultBuildFrustum;
extern ConVar* staticProp_no_fade_scalar;
extern ConVar* staticProp_gather_size_weight;
extern ConVar* model_defaultFadeDistScale;
extern ConVar* model_defaultFadeDistMin;
extern ConVar* ip_cvar;
extern ConVar* hostname;
extern ConVar* hostdesc;
extern ConVar* hostip;
extern ConVar* hostport;
extern ConVar* host_hasIrreversibleShutdown;
extern ConVar* mp_gamemode;
extern ConVar* rcon_address;
extern ConVar* rcon_password;
extern ConVar* r_debug_overlay_nodecay;
extern ConVar* r_debug_overlay_invisible;
extern ConVar* r_debug_overlay_wireframe;
extern ConVar* r_debug_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;
#endif // !DEDICATED
extern ConVar* stream_overlay;
extern ConVar* stream_overlay_mode;
//-------------------------------------------------------------------------
// SERVER |
#ifndef CLIENT_DLL
extern ConVar* ai_ainDumpOnLoad;
extern ConVar* ai_ainDebugConnect;
extern ConVar* ai_script_nodes_draw;
extern ConVar* ai_script_nodes_draw_range;
extern ConVar* 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_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_updaterate_mp;
extern ConVar* sv_updaterate_sp;
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_voiceEcho;
extern ConVar* sv_voiceenable;
extern ConVar* sv_alltalk;
//#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_cheats;
extern ConVar* sv_visualizetraces;
extern ConVar* sv_visualizetraces_duration;
#if !defined (GAMEDLL_S0) && !defined (GAMEDLL_S1)
extern ConVar* bhit_enable;
extern ConVar* bhit_depth_test;
extern ConVar* bhit_abs_origin;
#endif // !GAMEDLL_S0 && !GAMEDLL_S1
//-------------------------------------------------------------------------
// CLIENT |
#ifndef DEDICATED
extern ConVar* cl_rcon_request_sendlogs;
extern ConVar* cl_quota_stringCmdsPerSecond;
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* 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_suggestion_limit;
extern ConVar* con_suggestion_showhelptext;
extern ConVar* con_suggestion_showflags;
extern ConVar* con_suggestion_flags_realtime;
extern ConVar* origin_disconnectWhenOffline;
#endif // !DEDICATED
//-------------------------------------------------------------------------
// FILESYSTEM |
extern ConVar* fs_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* pylon_matchmaking_hostname;
extern ConVar* pylon_host_update_interval;
extern ConVar* pylon_showdebuginfo;
//-------------------------------------------------------------------------
// RTECH API |
extern ConVar* rtech_debug;
//-------------------------------------------------------------------------
// RUI |
#ifndef DEDICATED
extern ConVar* rui_drawEnable;
extern ConVar* rui_defaultDebugFontFace;
#endif // !DEDICATED
//-------------------------------------------------------------------------
// 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);
void ConCommand_StaticInit(void);
void ConCommand_InitShipped(void);
void ConCommand_PurgeShipped(void);
#endif // GLOBAL_H

View File

@ -3,7 +3,6 @@
*-----------------------------------------------------------------------------*/
#include "core/stdafx.h"
#include "launcher/IApplication.h"
#include "common/opcodes.h"
//#include "common/netmessages.h"
//#include "engine/cmodel_bsp.h"
@ -17,7 +16,9 @@
//#include "engine/client/cl_main.h"
//#include "engine/client/client.h"
//#include "engine/client/clientstate.h"
//#include "engine/client/cdll_engine_int.h"
//#include "engine/sys_getmodes.h"
//#include "engine/sys_dll.h"
#ifndef CLIENT_DLL
#include "game/server/ai_networkmanager.h"
#include "game/server/fairfight_impl.h"
@ -25,11 +26,9 @@
#endif // !CLIENT_DLL
#include "rtech/rtech_game.h"
//#include "rtech/rui/rui.h"
//#include "client/cdll_engine_int.h"
//#include "materialsystem/cmaterialsystem.h"
//#include "studiorender/studiorendercontext.h"
#include "vscript/languages/squirrel_re/include/sqvm.h"
//#include "bsplib/bsplib.h"
//#include "ebisusdk/EbisuSDK.h"
#ifndef DEDICATED
#include "codecs/miles/radshal_wasapi.h"

84
r5dev/core/CMakeLists.txt Normal file
View File

@ -0,0 +1,84 @@
cmake_minimum_required( VERSION 3.16 )
project( gamesdk )
add_library( ${PROJECT_NAME} SHARED )
start_sources()
add_sources( SOURCE_GROUP "Core"
"assert.h"
"dllmain.cpp"
"init.cpp"
"init.h"
"logdef.cpp"
"logdef.h"
"logger.cpp"
"logger.h"
"r5dev.h"
"resource.h"
"shared_pch.h"
"stdafx.cpp"
"stdafx.h"
"termutil.cpp"
"termutil.h"
)
target_link_libraries( ${PROJECT_NAME} PRIVATE
"tier0"
"tier1"
"tier2"
"vpklib"
"vscript"
"vstdlib"
"vphysics"
"vguimatsurface"
"vpc"
"vgui"
"rtech"
"mathlib"
"libdetours"
"liblzham"
"libimgui"
"libcurl"
"libprotobuf"
"libspdlog"
"navdebugutils"
"libdetour"
"protocol_pb"
"networksystem"
"pluginsystem"
"materialsystem"
"inputsystem"
"filesystem"
"datacache"
"EbisuSDK"
"codecs"
"localize"
"gamedll"
"engine"
"appframework"
"advapi32.lib"
"bcrypt.lib"
"crypt32.lib"
"dbghelp.lib"
"d3d11.lib"
"wldap32.lib"
"ws2_32.lib"
"Rpcrt4.lib"
)
end_sources()
target_compile_definitions( ${PROJECT_NAME} PRIVATE
"GAMESDK"
)
target_precompile_headers( ${PROJECT_NAME} REUSE_FROM vpc )

View File

@ -2,6 +2,7 @@
#include "core/r5dev.h"
#include "core/init.h"
#include "core/logdef.h"
#include "core/logger.h"
#include "tier0/crashhandler.h"
/*****************************************************************************/
#ifndef DEDICATED
@ -17,6 +18,38 @@
// INITIALIZATION
//#############################################################################
void Crash_Callback()
{
// Shutdown SpdLog to flush all buffers.
SpdLog_Shutdown();
// TODO[ AMOS ]: This is where we want to call backtrace from.
}
void Tier0_Init()
{
#if !defined (DEDICATED)
g_GameDll = CModule("r5apex.exe");
g_RadVideoToolsDll = CModule("bink2w64.dll");
g_RadAudioDecoderDll = CModule("binkawin64.dll");
g_RadAudioSystemDll = CModule("mileswin64.dll");
#if !defined (CLIENT_DLL)
g_SDKDll = CModule("gamesdk.dll");
#else // This dll is loaded from 'bin/x64_retail//'
g_SDKDll = CModule("client.dll");
#endif // !CLIENT_DLL
#else // No DirectX and Miles imports.
g_GameDll = CModule("r5apex_ds.exe");
g_SDKDll = CModule("dedicated.dll");
#endif // !DEDICATED
// Setup logger callback sink.
g_CoreMsgVCallback = EngineLoggerSink;
// Setup crash callback.
g_CrashHandler->SetCrashCallback(&Crash_Callback);
}
void SDK_Init()
{
if (strstr(GetCommandLineA(), "-launcher"))
@ -113,6 +146,7 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpReserved)
{
if (!s_bNoWorkerDll)
{
Tier0_Init();
SDK_Init();
}
else // Destroy crash handler.

View File

@ -18,19 +18,17 @@
#include "tier0/sigcache.h"
#include "tier1/cmd.h"
#include "tier1/cvar.h"
#include "tier1/binstream.h"
#include "vpc/IAppSystem.h"
#include "vpc/keyvalues.h"
#include "vpc/rson.h"
#include "vpc/interfaces.h"
#include "vstdlib/callback.h"
#include "vstdlib/completion.h"
#include "common/callback.h"
#include "common/completion.h"
#include "vstdlib/keyvaluessystem.h"
#include "common/opcodes.h"
#include "common/netmessages.h"
#include "launcher/prx.h"
#include "launcher/launcher.h"
#include "launcher/IApplication.h"
#include "filesystem/basefilesystem.h"
#include "filesystem/filesystem.h"
#include "datacache/mdlcache.h"
@ -49,13 +47,13 @@
#include "vgui/vgui_debugpanel.h"
#include "vgui/vgui_fpspanel.h"
#include "vguimatsurface/MatSystemSurface.h"
#include "client/vengineclient_impl.h"
#include "client/cdll_engine_int.h"
#include "engine/client/vengineclient_impl.h"
#include "engine/client/cdll_engine_int.h"
#endif // !DEDICATED
#ifndef CLIENT_DLL
#include "engine/server/server.h"
#include "server/persistence.h"
#include "server/vengineserver_impl.h"
#include "engine/server/persistence.h"
#include "engine/server/vengineserver_impl.h"
#endif // !CLIENT_DLL
#include "studiorender/studiorendercontext.h"
#include "rtech/rtech_game.h"
@ -186,7 +184,7 @@ void Systems_Init()
spdlog::info("{:16s} '{:10.6f}' seconds ('{:12d}' clocks)\n", "Detour->Attach()", initTimer.GetDuration().GetSeconds(), initTimer.GetDuration().GetCycles());
spdlog::info("+-------------------------------------------------------------+\n");
ConVar::StaticInit();
ConVar_StaticInit();
}
//////////////////////////////////////////////////////////////////////////
@ -408,7 +406,6 @@ void DetourRegister() // Register detour classes to be searched and hooked.
REGISTER(VLauncher);
REGISTER(VAppSystemGroup);
REGISTER(VApplication);
// FileSystem
REGISTER(VBaseFileSystem);
@ -482,8 +479,16 @@ void DetourRegister() // Register detour classes to be searched and hooked.
#endif // !DEDICATED
// Engine
REGISTER(VTraceInit);
REGISTER(VCommon);
REGISTER(VSys_Dll);
REGISTER(VSys_Dll2);
REGISTER(VSys_Utils);
REGISTER(VEngine);
REGISTER(VEngineTrace);
REGISTER(VModelInfo);
REGISTER(VTraceInit);
REGISTER(VModel_BSP);
REGISTER(VHost);
REGISTER(VHostCmd);
@ -493,13 +498,6 @@ void DetourRegister() // Register detour classes to be searched and hooked.
REGISTER(VNetChan);
REGISTER(VNetworkStringTableContainer);
REGISTER(VSys_Dll);
REGISTER(VSys_Dll2);
REGISTER(VSys_Utils);
REGISTER(VEngine);
REGISTER(VEngineTrace);
REGISTER(VModelInfo);
REGISTER(VLocalize);
#ifndef DEDICATED

View File

@ -18,7 +18,8 @@ void SpdLog_Init(void)
}
#ifndef NETCONSOLE
g_LogSessionDirectory = fmt::format("platform\\logs\\{:s}", g_ProcessTimestamp);
g_LogSessionUUID = CreateUUID();
g_LogSessionDirectory = fmt::format("platform\\logs\\{:s}", g_LogSessionUUID);
/************************
* IMGUI LOGGER SETUP *
************************/

View File

@ -1,13 +1,21 @@
#pragma once
#include <sstream>
#include "thirdparty/spdlog/spdlog.h"
#include "thirdparty/spdlog/async.h"
#include "thirdparty/spdlog/sinks/ostream_sink.h"
#include "thirdparty/spdlog/sinks/basic_file_sink.h"
#include "thirdparty/spdlog/sinks/stdout_sinks.h"
#include "thirdparty/spdlog/sinks/stdout_color_sinks.h"
#include "thirdparty/spdlog/sinks/ansicolor_sink.h"
#include "thirdparty/spdlog/sinks/rotating_file_sink.h"
constexpr int SPDLOG_MAX_SIZE = 10 * 1024 * 1024; // Sets number of bytes before rotating logger.
constexpr int SPDLOG_NUM_FILE = 512; // Sets number of files to rotate to.
inline bool g_bSpdLog_UseAnsiClr = false;
inline bool g_bSpdLog_PostInit = false;
inline string g_LogSessionDirectory;
extern std::shared_ptr<spdlog::logger> g_TermLogger;
extern std::shared_ptr<spdlog::logger> g_ImGuiLogger;

318
r5dev/core/logger.cpp Normal file
View File

@ -0,0 +1,318 @@
#include "core/stdafx.h"
#include "tier0/utility.h"
#include "logdef.h"
#include "logger.h"
#ifndef DEDICATED
#include "vgui/vgui_debugpanel.h"
#include "gameui/IConsole.h"
#endif // !DEDICATED
#ifndef CLIENT_DLL
#include "engine/server/sv_rcon.h"
#endif // !CLIENT_DLL
#ifndef NETCONSOLE
#include "vscript/languages/squirrel_re/include/sqstdaux.h"
#endif // !NETCONSOLE
std::mutex g_LogMutex;
#if !defined (DEDICATED) && !defined (NETCONSOLE)
ImVec4 CheckForWarnings(LogType_t type, eDLL_T context, const ImVec4& defaultCol)
{
ImVec4 color = defaultCol;
if (type == LogType_t::LOG_WARNING || context == eDLL_T::SYSTEM_WARNING)
{
color = ImVec4(1.00f, 1.00f, 0.00f, 0.80f);
}
else if (type == LogType_t::LOG_ERROR || context == eDLL_T::SYSTEM_ERROR)
{
color = ImVec4(1.00f, 0.00f, 0.00f, 0.80f);
}
return color;
}
ImVec4 GetColorForContext(LogType_t type, eDLL_T context)
{
switch (context)
{
case eDLL_T::SCRIPT_SERVER:
return CheckForWarnings(type, context, ImVec4(0.59f, 0.58f, 0.73f, 1.00f));
case eDLL_T::SCRIPT_CLIENT:
return CheckForWarnings(type, context, ImVec4(0.59f, 0.58f, 0.63f, 1.00f));
case eDLL_T::SCRIPT_UI:
return CheckForWarnings(type, context, ImVec4(0.59f, 0.48f, 0.53f, 1.00f));
case eDLL_T::SERVER:
return CheckForWarnings(type, context, ImVec4(0.23f, 0.47f, 0.85f, 1.00f));
case eDLL_T::CLIENT:
return CheckForWarnings(type, context, ImVec4(0.46f, 0.46f, 0.46f, 1.00f));
case eDLL_T::UI:
return CheckForWarnings(type, context, ImVec4(0.59f, 0.35f, 0.46f, 1.00f));
case eDLL_T::ENGINE:
return CheckForWarnings(type, context, ImVec4(0.70f, 0.70f, 0.70f, 1.00f));
case eDLL_T::FS:
return CheckForWarnings(type, context, ImVec4(0.32f, 0.64f, 0.72f, 1.00f));
case eDLL_T::RTECH:
return CheckForWarnings(type, context, ImVec4(0.36f, 0.70f, 0.35f, 1.00f));
case eDLL_T::MS:
return CheckForWarnings(type, context, ImVec4(0.75f, 0.30f, 0.68f, 1.00f));
case eDLL_T::AUDIO:
return CheckForWarnings(type, context, ImVec4(0.93f, 0.42f, 0.12f, 1.00f));
case eDLL_T::VIDEO:
return CheckForWarnings(type, context, ImVec4(0.73f, 0.00f, 0.92f, 1.00f));
case eDLL_T::NETCON:
return CheckForWarnings(type, context, ImVec4(0.81f, 0.81f, 0.81f, 1.00f));
case eDLL_T::COMMON:
return CheckForWarnings(type, context, ImVec4(1.00f, 0.80f, 0.60f, 1.00f));
default:
return CheckForWarnings(type, context, ImVec4(0.81f, 0.81f, 0.81f, 1.00f));
}
}
#endif // !DEDICATED && !NETCONSOLE
const char* GetContextNameByIndex(eDLL_T context, const bool ansiColor = false)
{
int index = static_cast<int>(context);
const char* contextName = s_DefaultAnsiColor;
switch (context)
{
case eDLL_T::SCRIPT_SERVER:
contextName = s_ScriptAnsiColor[0];
break;
case eDLL_T::SCRIPT_CLIENT:
contextName = s_ScriptAnsiColor[1];
break;
case eDLL_T::SCRIPT_UI:
contextName = s_ScriptAnsiColor[2];
break;
case eDLL_T::SERVER:
case eDLL_T::CLIENT:
case eDLL_T::UI:
case eDLL_T::ENGINE:
case eDLL_T::FS:
case eDLL_T::RTECH:
case eDLL_T::MS:
case eDLL_T::AUDIO:
case eDLL_T::VIDEO:
case eDLL_T::NETCON:
case eDLL_T::COMMON:
contextName = s_DllAnsiColor[index];
break;
case eDLL_T::SYSTEM_WARNING:
case eDLL_T::SYSTEM_ERROR:
case eDLL_T::NONE:
default:
break;
}
if (!ansiColor)
{
// Shift # chars to skip ANSI row.
contextName += sizeof(s_DefaultAnsiColor) - 1;
}
return contextName;
}
bool LoggedFromClient(eDLL_T context)
{
#ifndef DEDICATED
return (context == eDLL_T::CLIENT || context == eDLL_T::SCRIPT_CLIENT
|| context == eDLL_T::UI || context == eDLL_T::SCRIPT_UI
|| context == eDLL_T::NETCON);
#else
NOTE_UNUSED(context);
return false;
#endif // !DEDICATED
}
//-----------------------------------------------------------------------------
// Purpose: Show logs to all console interfaces (va_list version)
// Input : logType -
// logLevel -
// context -
// *pszLogger -
// *pszFormat -
// args -
// exitCode -
// *pszUptimeOverride -
//-----------------------------------------------------------------------------
void EngineLoggerSink(LogType_t logType, LogLevel_t logLevel, eDLL_T context,
const char* pszLogger, const char* pszFormat, va_list args,
const UINT exitCode /*= NO_ERROR*/, const char* pszUptimeOverride /*= nullptr*/)
{
const char* pszUpTime = pszUptimeOverride ? pszUptimeOverride : Plat_GetProcessUpTime();
string message = g_bSpdLog_PostInit ? pszUpTime : "";
const bool bToConsole = (logLevel >= LogLevel_t::LEVEL_CONSOLE);
const bool bUseColor = (bToConsole && g_bSpdLog_UseAnsiClr);
const char* pszContext = GetContextNameByIndex(context, bUseColor);
message.append(pszContext);
#if !defined (DEDICATED) && !defined (NETCONSOLE)
ImVec4 overlayColor = GetColorForContext(logType, context);
eDLL_T overlayContext = context;
#endif // !DEDICATED && !NETCONSOLE
#if !defined (NETCONSOLE)
bool bSquirrel = false;
bool bWarning = false;
bool bError = false;
#else
NOTE_UNUSED(pszLogger);
#endif // !NETCONSOLE
//-------------------------------------------------------------------------
// Setup logger and context
//-------------------------------------------------------------------------
switch (logType)
{
case LogType_t::LOG_WARNING:
#if !defined (DEDICATED) && !defined (NETCONSOLE)
overlayContext = eDLL_T::SYSTEM_WARNING;
#endif // !DEDICATED && !NETCONSOLE
if (bUseColor)
{
message.append(g_svYellowF);
}
break;
case LogType_t::LOG_ERROR:
#if !defined (DEDICATED) && !defined (NETCONSOLE)
overlayContext = eDLL_T::SYSTEM_ERROR;
#endif // !DEDICATED && !NETCONSOLE
if (bUseColor)
{
message.append(g_svRedF);
}
break;
#ifndef NETCONSOLE
case LogType_t::SQ_INFO:
bSquirrel = true;
break;
case LogType_t::SQ_WARNING:
#ifndef DEDICATED
overlayContext = eDLL_T::SYSTEM_WARNING;
overlayColor = ImVec4(1.00f, 1.00f, 0.00f, 0.80f);
#endif // !DEDICATED
bSquirrel = true;
bWarning = true;
break;
#endif // !NETCONSOLE
default:
break;
}
//-------------------------------------------------------------------------
// Format actual input
//-------------------------------------------------------------------------
va_list argsCopy;
va_copy(argsCopy, args);
const string formatted = FormatV(pszFormat, argsCopy);
va_end(argsCopy);
#ifndef NETCONSOLE
//-------------------------------------------------------------------------
// Colorize script warnings and errors
//-------------------------------------------------------------------------
if (bToConsole && bSquirrel)
{
if (bWarning && g_bSQAuxError)
{
if (formatted.find("SCRIPT ERROR:") != string::npos ||
formatted.find(" -> ") != string::npos)
{
bError = true;
}
}
else if (g_bSQAuxBadLogic)
{
if (formatted.find("There was a problem processing game logic.") != string::npos)
{
bError = true;
g_bSQAuxBadLogic = false;
}
}
// Append warning/error color before appending the formatted text,
// so that this gets marked as such while preserving context colors.
if (bError)
{
#ifndef DEDICATED
overlayContext = eDLL_T::SYSTEM_ERROR;
overlayColor = ImVec4(1.00f, 0.00f, 0.00f, 0.80f);
#endif // !DEDICATED
if (bUseColor)
{
message.append(g_svRedF);
}
}
else if (bUseColor && bWarning)
{
message.append(g_svYellowF);
}
}
#endif // !NETCONSOLE
message.append(formatted);
//-------------------------------------------------------------------------
// Emit to all interfaces
//-------------------------------------------------------------------------
std::lock_guard<std::mutex> lock(g_LogMutex);
if (bToConsole)
{
g_TermLogger->debug(message);
if (bUseColor)
{
// Remove ANSI rows before emitting to file or over wire.
message = std::regex_replace(message, s_AnsiRowRegex, "");
}
}
#ifndef NETCONSOLE
// Output is always logged to the file.
std::shared_ptr<spdlog::logger> ntlogger = spdlog::get(pszLogger); // <-- Obtain by 'pszLogger'.
assert(ntlogger.get() != nullptr);
ntlogger->debug(message);
if (bToConsole)
{
#ifndef CLIENT_DLL
if (!LoggedFromClient(context) && RCONServer()->ShouldSend(sv_rcon::response_t::SERVERDATA_RESPONSE_CONSOLE_LOG))
{
RCONServer()->SendEncode(formatted.c_str(), pszUpTime, sv_rcon::response_t::SERVERDATA_RESPONSE_CONSOLE_LOG,
int(context), int(logType));
}
#endif // !CLIENT_DLL
#ifndef DEDICATED
g_ImGuiLogger->debug(message);
if (g_bSpdLog_PostInit)
{
g_pConsole->AddLog(ConLog_t(g_LogStream.str(), overlayColor));
if (logLevel >= LogLevel_t::LEVEL_NOTIFY) // Draw to mini console.
{
g_pOverlay->AddLog(overlayContext, g_LogStream.str());
}
}
#endif // !DEDICATED
}
#ifndef DEDICATED
g_LogStream.str(string());
g_LogStream.clear();
#endif // !DEDICATED
#endif // !NETCONSOLE
if (exitCode) // Terminate the process if an exit code was passed.
{
if (MessageBoxA(NULL, Format("%s- %s", pszUpTime, message.c_str()).c_str(),
"SDK Error", MB_ICONERROR | MB_OK))
{
TerminateProcess(GetCurrentProcess(), exitCode);
}
}
}

8
r5dev/core/logger.h Normal file
View File

@ -0,0 +1,8 @@
#ifndef LOGGER_H
#define LOGGER_H
void EngineLoggerSink(LogType_t logType, LogLevel_t logLevel, eDLL_T context,
const char* pszLogger, const char* pszFormat, va_list args,
const UINT exitCode /*= NO_ERROR*/, const char* pszUptimeOverride /*= nullptr*/);
#endif // LOGGER_H

92
r5dev/core/shared_pch.h Normal file
View File

@ -0,0 +1,92 @@
//===========================================================================//
//
// Purpose: Shared precompiled header file.
//
//===========================================================================//
#ifndef SHARED_PCH_H
#define SHARED_PCH_H
#if defined(_DEBUG) || defined(_PROFILE)
#pragma message ("Profiling is turned on; do not release this binary!\n")
#endif // _DEBUG || _PROFILE
#define WIN32_LEAN_AND_MEAN // Prevent winsock2 redefinition.
#include <windows.h>
#include <WinSock2.h>
#include <Ws2tcpip.h>
#include <bcrypt.h>
#include <comdef.h>
#include <direct.h>
#include <gdiplus.h>
#include <dbghelp.h>
#include <timeapi.h>
#include <shellapi.h>
#include <Psapi.h>
#include <setjmp.h>
#include <tchar.h>
#include <stdio.h>
#include <shlobj.h>
#include <objbase.h>
#include <intrin.h>
#include <emmintrin.h>
#include <cmath>
#include <regex>
#include <mutex>
#include <thread>
#include <vector>
#include <string>
#include <sstream>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <filesystem>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <functional>
#include <smmintrin.h>
// Windows specifics, to support compiling the SDK with older versions of the Windows 10 SDK.
#ifndef FILE_SUPPORTS_GHOSTING
#define FILE_SUPPORTS_GHOSTING 0x40000000 // winnt
#endif
#ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
#endif
// Thirdparty includes.
#include "thirdparty/detours/include/detours.h"
#include "thirdparty/detours/include/idetour.h"
#include "thirdparty/lzham/include/lzham_assert.h"
#include "thirdparty/lzham/include/lzham_types.h"
#include "thirdparty/lzham/include/lzham.h"
#include "thirdparty/curl/include/curl/curl.h"
// Core includes.
#include "core/assert.h"
#include "core/termutil.h"
// Common includes.
#include "common/experimental.h"
#include "common/pseudodefs.h"
#include "common/x86defs.h"
#include "common/sdkdefs.h"
// Tier0 includes.
#include "tier0/utility.h"
#include "tier0/memaddr.h"
#include "tier0/module.h"
#include "tier0/basetypes.h"
#include "tier0/platform.h"
#include "tier0/annotations.h"
#include "tier0/commonmacros.h"
#include "tier0/memalloc.h"
#include "tier0/tier0_iface.h"
#include "tier0/dbg.h"
#endif // SHARED_PCH_H

View File

@ -1,50 +1,5 @@
#pragma once
#if defined(_DEBUG) || defined(_PROFILE)
#pragma message ("Profiling is turned on; do not release this binary!\n")
#endif // _DEBUG || _PROFILE
#define WIN32_LEAN_AND_MEAN // Prevent winsock2 redefinition.
#include <windows.h>
#include <WinSock2.h>
#include <Ws2tcpip.h>
#include <bcrypt.h>
#include <comdef.h>
#include <direct.h>
#include <gdiplus.h>
#include <dbghelp.h>
#include <timeapi.h>
#include <shellapi.h>
#include <Psapi.h>
#include <setjmp.h>
#include <tchar.h>
#include <stdio.h>
#include <shlobj.h>
#include <objbase.h>
#include <intrin.h>
#include <emmintrin.h>
#include <cmath>
#include <regex>
#include <thread>
#include <vector>
#include <string>
#include <sstream>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <filesystem>
#include <set>
#include <unordered_set>
#include <smmintrin.h>
// Windows specifics.
#ifndef FILE_SUPPORTS_GHOSTING
#define FILE_SUPPORTS_GHOSTING 0x40000000 // winnt
#endif
#ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
#endif
#include "shared_pch.h"
#if !defined(DEDICATED) && !defined(SDKLAUNCHER) && !defined (NETCONSOLE) && !defined(PLUGINSDK)
#include <d3d11.h>
@ -99,66 +54,6 @@
#include "thirdparty/curl/include/curl/curl.h"
#include "common/experimental.h"
#include "common/pseudodefs.h"
#include "common/x86defs.h"
#include "common/sdkdefs.h"
#include "core/assert.h"
#include "core/termutil.h"
#include "tier0/memaddr.h"
#include "tier0/module.h"
#include "tier0/basetypes.h"
#include "tier0/platform.h"
#include "tier0/annotations.h"
#include "tier0/commonmacros.h"
#include "tier1/utility.h"
#if !defined(SDKLAUNCHER) && !defined(PLUGINSDK)
#include "tier0/dbg.h"
#endif // !SDKLAUNCHER && !NETCONSOLE && !PLUGINSDK
#if !defined(SDKLAUNCHER) && !defined (NETCONSOLE) && !defined(PLUGINSDK)
#if !defined (DEDICATED)
inline CModule g_GameDll = CModule("r5apex.exe");
inline CModule g_RadVideoToolsDll = CModule("bink2w64.dll");
inline CModule g_RadAudioDecoderDll = CModule("binkawin64.dll");
inline CModule g_RadAudioSystemDll = CModule("mileswin64.dll");
#if !defined (CLIENT_DLL)
inline CModule g_SDKDll = CModule("gamesdk.dll");
#else // This dll is loaded from 'bin/x64_retail//'
inline CModule g_SDKDll = CModule("client.dll");
#endif // !CLIENT_DLL
#else // No DirectX and Miles imports.
inline CModule g_GameDll = CModule("r5apex_ds.exe");
inline CModule g_SDKDll = CModule("dedicated.dll");
#endif // !DEDICATED
inline const string g_ProcessTimestamp = CreateTimedFileName();
#define VAR_NAME(varName) #varName
#define MEMBER_AT_OFFSET(varType, varName, offset) \
varType& varName() \
{ \
static int _##varName = offset; \
return *(varType*)((std::uintptr_t)this + _##varName); \
}
template <typename ReturnType, typename ...Args>
ReturnType CallVFunc(int index, void* thisPtr, Args... args)
{
return (*reinterpret_cast<ReturnType(__fastcall***)(void*, Args...)>(thisPtr))[index](thisPtr, args...);
}
inline void LogFunAdr(const char* szFun, uintptr_t nAdr) // Logging function addresses.
{
spdlog::debug("| {:s}: {:42s}: {:#18x} |\n", "FUN", szFun, nAdr);
}
inline void LogVarAdr(const char* szVar, uintptr_t nAdr) // Logging variable addresses.
{
spdlog::debug("| {:s}: {:42s}: {:#18x} |\n", "VAR", szVar, nAdr);
}
inline void LogConAdr(const char* szCon, uintptr_t nAdr) // Logging constant addresses.
{
spdlog::debug("| {:s}: {:42s}: {:#18x} |\n", "CON", szCon, nAdr);
}
#endif // !SDKLAUNCHER && !NETCONSOLE && !PLUGINSDK
#include "tier1/cvar.h"
#include "tier1/cmd.h"
#include "common/global.h"

View File

@ -1,19 +1,19 @@
#include "core/stdafx.h"
#include "core/termutil.h"
std::string g_svGreyF = "";
std::string g_svRedF = "";
std::string g_svGreenF = "";
std::string g_svBlueF = "";
std::string g_svYellowF = "";
const char* g_svGreyF = "";
const char* g_svRedF = "";
const char* g_svGreenF = "";
const char* g_svBlueF = "";
const char* g_svYellowF = "";
std::string g_svGreyB = "";
std::string g_svRedB = "";
std::string g_svGreenB = "";
std::string g_svBlueB = "";
std::string g_svYellowB = "";
const char* g_svGreyB = "";
const char* g_svRedB = "";
const char* g_svGreenB = "";
const char* g_svBlueB = "";
const char* g_svYellowB = "";
std::string g_svReset = "";
const char* g_svReset = "";
std::string g_svCmdLine;

View File

@ -1,17 +1,17 @@
#pragma once
extern std::string g_svGreyF;
extern std::string g_svRedF;
extern std::string g_svGreenF;
extern std::string g_svBlueF;
extern std::string g_svYellowF;
extern const char* g_svGreyF;
extern const char* g_svRedF;
extern const char* g_svGreenF;
extern const char* g_svBlueF;
extern const char* g_svYellowF;
extern std::string g_svGreyB;
extern std::string g_svRedB;
extern std::string g_svGreenB;
extern std::string g_svBlueB;
extern std::string g_svYellowB;
extern const char* g_svGreyB;
extern const char* g_svRedB;
extern const char* g_svGreenB;
extern const char* g_svBlueB;
extern const char* g_svYellowB;
extern std::string g_svReset;
extern const char* g_svReset;
extern std::string g_svCmdLine;

View File

@ -0,0 +1,21 @@
cmake_minimum_required( VERSION 3.16 )
project( datacache )
add_library( ${PROJECT_NAME} )
start_sources()
add_sources( SOURCE_GROUP "Core"
"mdlcache.cpp"
"mdlcache.h"
)
add_sources( SOURCE_GROUP "Public"
"${ENGINE_SOURCE_DIR}/public/datacache/idatacache.h"
"${ENGINE_SOURCE_DIR}/public/datacache/imdlcache.h"
)
end_sources()
target_include_directories( ${PROJECT_NAME} PRIVATE "${ENGINE_SOURCE_DIR}/tier0/" "${ENGINE_SOURCE_DIR}/tier1/" )
target_precompile_headers( ${PROJECT_NAME} REUSE_FROM tier0 )

View File

@ -0,0 +1,20 @@
cmake_minimum_required( VERSION 3.16 )
project( EbisuSDK )
add_library( ${PROJECT_NAME} )
start_sources()
add_sources( SOURCE_GROUP "Private"
"EbisuSDK.cpp"
"EbisuSDK.h"
)
add_sources( SOURCE_GROUP "Public"
"${ENGINE_SOURCE_DIR}/public/ebisusdk/EbisuTypes.h"
)
end_sources()
target_include_directories( ${PROJECT_NAME} PRIVATE "${ENGINE_SOURCE_DIR}/tier0/" "${ENGINE_SOURCE_DIR}/tier1/" )
target_precompile_headers( ${PROJECT_NAME} REUSE_FROM tier0 )

View File

@ -1,5 +1,4 @@
#pragma once
#include "vstdlib/completion.h"
//#ifdef DEDICATED
inline CMemory p_EbisuSDK_Tier0_Init;

173
r5dev/engine/CMakeLists.txt Normal file
View File

@ -0,0 +1,173 @@
cmake_minimum_required( VERSION 3.16 )
project( engine )
add_library( ${PROJECT_NAME} )
start_sources()
add_sources( SOURCE_GROUP "Engine"
"clockdriftmgr.cpp"
"clockdriftmgr.h"
"cmd.cpp"
"cmd.h"
"common.cpp"
"common.h"
)
add_sources( SOURCE_GROUP "Collision"
"enginetrace.cpp"
"enginetrace.h"
"traceinit.h"
)
add_sources( SOURCE_GROUP "Debug"
"debugoverlay.cpp"
"debugoverlay.h"
)
add_sources( SOURCE_GROUP "Render"
"gl_matsysiface.h"
"gl_model_private.h"
"gl_rmain.cpp"
"gl_rmain.h"
"gl_rsurf.cpp"
"gl_rsurf.h"
"gl_screen.cpp"
"gl_screen.h"
"matsys_interface.cpp"
"matsys_interface.h"
)
add_sources( SOURCE_GROUP "Network"
"datablock.h"
"framesnapshot.h"
"net.cpp"
"net.h"
"net_chan.cpp"
"net_chan.h"
"networkstringtable.cpp"
"networkstringtable.h"
"packed_entity.h"
"staticpropmgr.cpp"
"staticpropmgr.h"
)
add_sources( SOURCE_GROUP "Model"
"cmodel_bsp.cpp"
"cmodel_bsp.h"
"modelinfo.cpp"
"modelinfo.h"
"modelloader.cpp"
"modelloader.h"
)
add_sources( SOURCE_GROUP "Host"
"host.cpp"
"host.h"
"host_cmd.cpp"
"host_cmd.h"
"host_state.cpp"
"host_state.h"
)
add_sources( SOURCE_GROUP "System"
"sys_dll.cpp"
"sys_dll.h"
"sys_dll2.cpp"
"sys_dll2.h"
"sys_engine.cpp"
"sys_engine.h"
"sys_getmodes.cpp"
"sys_getmodes.h"
"sys_mainwind.cpp"
"sys_mainwind.h"
"sys_utils.cpp"
"sys_utils.h"
"sdk_dll.cpp"
"sdk_dll.h"
)
add_sources( SOURCE_GROUP "Server"
"server/persistence.cpp"
"server/persistence.h"
"server/server.cpp"
"server/server.h"
"server/sv_main.cpp"
"server/sv_main.h"
"server/sv_rcon.cpp"
"server/sv_rcon.h"
"server/vengineserver_impl.cpp"
"server/vengineserver_impl.h"
"shared/base_rcon.cpp"
"shared/base_rcon.h"
"shared/shared_rcon.cpp"
"shared/shared_rcon.h"
)
add_sources( SOURCE_GROUP "Client"
"client/cdll_engine_int.cpp"
"client/cdll_engine_int.h"
"client/cl_ents_parse.cpp"
"client/cl_ents_parse.h"
"client/cl_main.h"
"client/cl_rcon.cpp"
"client/cl_rcon.h"
"client/client.cpp"
"client/client.h"
"client/clientstate.cpp"
"client/clientstate.h"
"client/vengineclient_impl.cpp"
"client/vengineclient_impl.h"
)
add_sources( SOURCE_GROUP "GameUI"
"${ENGINE_SOURCE_DIR}/gameui/IBrowser.cpp"
"${ENGINE_SOURCE_DIR}/gameui/IBrowser.h"
"${ENGINE_SOURCE_DIR}/gameui/IConsole.cpp"
"${ENGINE_SOURCE_DIR}/gameui/IConsole.h"
)
add_sources( SOURCE_GROUP "Launcher"
"${ENGINE_SOURCE_DIR}/launcher/launcher.cpp"
"${ENGINE_SOURCE_DIR}/launcher/launcher.h"
"${ENGINE_SOURCE_DIR}/launcher/launcherdefs.h"
"${ENGINE_SOURCE_DIR}/launcher/prx.cpp"
"${ENGINE_SOURCE_DIR}/launcher/prx.h"
)
add_sources( SOURCE_GROUP "Windows"
"${ENGINE_SOURCE_DIR}/windows/console.cpp"
"${ENGINE_SOURCE_DIR}/windows/console.h"
"${ENGINE_SOURCE_DIR}/windows/id3dx.cpp"
"${ENGINE_SOURCE_DIR}/windows/id3dx.h"
"${ENGINE_SOURCE_DIR}/windows/input.cpp"
"${ENGINE_SOURCE_DIR}/windows/input.h"
"${ENGINE_SOURCE_DIR}/windows/resource.cpp"
"${ENGINE_SOURCE_DIR}/windows/resource.h"
"${ENGINE_SOURCE_DIR}/windows/system.cpp"
"${ENGINE_SOURCE_DIR}/windows/system.h"
)
add_sources( SOURCE_GROUP "Common"
"${ENGINE_SOURCE_DIR}/common/callback.cpp"
"${ENGINE_SOURCE_DIR}/common/callback.h"
"${ENGINE_SOURCE_DIR}/common/completion.cpp"
"${ENGINE_SOURCE_DIR}/common/completion.h"
"${ENGINE_SOURCE_DIR}/common/engine_launcher_api.h"
"${ENGINE_SOURCE_DIR}/common/experimental.h"
"${ENGINE_SOURCE_DIR}/common/global.cpp"
"${ENGINE_SOURCE_DIR}/common/global.h"
"${ENGINE_SOURCE_DIR}/common/igameserverdata.h"
"${ENGINE_SOURCE_DIR}/common/netmessages.cpp"
"${ENGINE_SOURCE_DIR}/common/netmessages.h"
"${ENGINE_SOURCE_DIR}/common/opcodes.cpp"
"${ENGINE_SOURCE_DIR}/common/opcodes.h"
"${ENGINE_SOURCE_DIR}/common/protocol.h"
"${ENGINE_SOURCE_DIR}/common/pseudodefs.h"
"${ENGINE_SOURCE_DIR}/common/qlimits.h"
"${ENGINE_SOURCE_DIR}/common/sdkdefs.h"
"${ENGINE_SOURCE_DIR}/common/x86defs.h"
)
end_sources()
target_precompile_headers( ${PROJECT_NAME} REUSE_FROM vpc )

View File

@ -7,12 +7,12 @@
/*****************************************************************************/
#include "tier1/cvar.h"
#include "tier0/commandline.h"
#include "client/vengineclient_impl.h"
#include "client/cdll_engine_int.h"
#include "engine/net_chan.h"
#include "engine/client/cl_rcon.h"
#include "networksystem/bansystem.h"
#include "vpc/keyvalues.h"
#include "vengineclient_impl.h"
#include "cdll_engine_int.h"
/*****************************************************************************/
#ifndef DEDICATED

View File

@ -9,9 +9,9 @@
//
/////////////////////////////////////////////////////////////////////////////////
#include "core/stdafx.h"
#include "client/cdll_engine_int.h"
#include "engine/host.h"
#include "engine/client/clientstate.h"
#include "clientstate.h"
#include "cdll_engine_int.h"
//------------------------------------------------------------------------------

View File

@ -5,8 +5,8 @@
//=============================================================================//
#include "core/stdafx.h"
#include "client/vengineclient_impl.h"
#include "engine/client/clientstate.h"
#include "clientstate.h"
#include "vengineclient_impl.h"
//---------------------------------------------------------------------------------
// Purpose: define if commands from the server should be restricted or not.

74
r5dev/engine/cmd.cpp Normal file
View File

@ -0,0 +1,74 @@
#include "core/stdafx.h"
#include "tier1/cmd.h"
#include "tier1/cvar.h"
#include "engine/cmd.h"
//-----------------------------------------------------------------------------
// Purpose: Returns current player calling this function
// Output : ECommandTarget_t -
//-----------------------------------------------------------------------------
ECommandTarget_t Cbuf_GetCurrentPlayer(void)
{
// Always returns 'CBUF_FIRST_PLAYER' in Respawn's code.
return ECommandTarget_t::CBUF_FIRST_PLAYER;
}
//-----------------------------------------------------------------------------
// Purpose: Sends the entire command line over to the server
// Input : *args -
// Output : true on success, false otherwise
//-----------------------------------------------------------------------------
bool Cmd_ForwardToServer(const CCommand* args)
{
#ifndef DEDICATED
// Client -> Server command throttling.
static double flForwardedCommandQuotaStartTime = -1;
static int nForwardedCommandQuotaCount = 0;
// No command to forward.
if (args->ArgC() == 0)
return false;
double flStartTime = Plat_FloatTime();
int nCmdQuotaLimit = cl_quota_stringCmdsPerSecond->GetInt();
const char* pszCmdString = nullptr;
// Special case: "cmd whatever args..." is forwarded as "whatever args...";
// in this case we strip "cmd" from the input.
if (Q_strcasecmp(args->Arg(0), "cmd") == 0)
pszCmdString = args->ArgS();
else
pszCmdString = args->GetCommandString();
if (nCmdQuotaLimit)
{
if (flStartTime - flForwardedCommandQuotaStartTime >= 1.0)
{
flForwardedCommandQuotaStartTime = flStartTime;
nForwardedCommandQuotaCount = 0;
}
++nForwardedCommandQuotaCount;
if (nForwardedCommandQuotaCount > nCmdQuotaLimit)
{
// If we are over quota commands per second, dump this on the floor.
// If we spam the server with too many commands, it will kick us.
Warning(eDLL_T::CLIENT, "Command '%s' ignored (submission quota of '%d' per second exceeded!)\n", pszCmdString, nCmdQuotaLimit);
return false;
}
}
return v_Cmd_ForwardToServer(args);
#else // !DEDICATED
return false; // Client only.
#endif // DEDICATED
}
///////////////////////////////////////////////////////////////////////////////
void VCmd::Attach() const
{
DetourAttach((LPVOID*)&v_Cmd_ForwardToServer, &Cmd_ForwardToServer);
}
void VCmd::Detach() const
{
DetourDetach((LPVOID*)&v_Cmd_ForwardToServer, &Cmd_ForwardToServer);
}

41
r5dev/engine/cmd.h Normal file
View File

@ -0,0 +1,41 @@
#ifndef CMD_H
#define CMD_H
ECommandTarget_t Cbuf_GetCurrentPlayer(void);
/* ==== COMMAND_BUFFER ================================================================================================================================================== */
inline CMemory p_Cbuf_AddText;
inline auto Cbuf_AddText = p_Cbuf_AddText.RCast<void (*)(ECommandTarget_t eTarget, const char* pText, cmd_source_t cmdSource)>();
inline CMemory p_Cbuf_Execute;
inline auto Cbuf_Execute = p_Cbuf_Execute.RCast<void (*)(void)>();
inline CMemory p_Cmd_ForwardToServer;
inline auto v_Cmd_ForwardToServer = p_Cmd_ForwardToServer.RCast<bool (*)(const CCommand* args)>();
///////////////////////////////////////////////////////////////////////////////
class VCmd : public IDetour
{
virtual void GetAdr(void) const
{
LogFunAdr("Cbuf_AddText", p_Cbuf_AddText.GetPtr());
LogFunAdr("Cbuf_Execute", p_Cbuf_Execute.GetPtr());
LogFunAdr("Cmd_ForwardToServer", p_Cmd_ForwardToServer.GetPtr());
}
virtual void GetFun(void) const
{
p_Cbuf_AddText = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 74 24 ?? 57 48 83 EC 20 48 63 D9 41 8B F8 48 8D 0D ?? ?? ?? ?? 48 8B F2 FF 15 ?? ?? ?? ?? 48 8D 05 ?? ?? ?? ?? 41 B9 ?? ?? ?? ??");
p_Cbuf_Execute = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 48 83 EC 20 FF 15 ?? ?? ?? ??");
p_Cmd_ForwardToServer = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 48 81 EC ?? ?? ?? ?? 44 8B 59 04");
Cbuf_AddText = p_Cbuf_AddText.RCast<void (*)(ECommandTarget_t, const char*, cmd_source_t)>(); /*48 89 5C 24 ?? 48 89 74 24 ?? 57 48 83 EC 20 48 63 D9 41 8B F8 48 8D 0D ?? ?? ?? ?? 48 8B F2 FF 15 ?? ?? ?? ?? 48 8D 05 ?? ?? ?? ?? 41 B9 ?? ?? ?? ??*/
Cbuf_Execute = p_Cbuf_Execute.RCast<void (*)(void)>(); /*48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 48 83 EC 20 FF 15 ?? ?? ?? ??*/
v_Cmd_ForwardToServer = p_Cmd_ForwardToServer.RCast<bool (*)(const CCommand*)>(); /*48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 48 81 EC ?? ?? ?? ?? 44 8B 59 04*/
}
virtual void GetVar(void) const { }
virtual void GetCon(void) const { }
virtual void Attach(void) const;
virtual void Detach(void) const;
};
#endif // CMD_H

View File

@ -1,6 +1,6 @@
#pragma once
#include "tier1/cmd.h"
#include "launcher/IApplication.h"
#include "sys_dll.h"
//-------------------------------------------------------------------------------------
// Forward declarations

View File

@ -10,7 +10,6 @@
#include "tier0/jobthread.h"
#include "tier0/commandline.h"
#include "tier0/fasttimer.h"
#include "tier1/cmd.h"
#include "tier1/cvar.h"
#include "tier1/NetAdr.h"
#include "tier2/socketcreator.h"
@ -24,6 +23,7 @@
#include "engine/client/cl_main.h"
#include "engine/client/clientstate.h"
#endif // DEDICATED
#include "engine/cmd.h"
#include "engine/net.h"
#include "engine/gl_screen.h"
#include "engine/host.h"
@ -210,7 +210,7 @@ void CHostState::Setup(void)
#ifndef CLIENT_DLL
g_pBanSystem->Load();
#endif // !CLIENT_DLL
ConVar::PurgeHostNames();
ConVar_PurgeHostNames();
#ifndef CLIENT_DLL
RCONServer()->Init();

View File

@ -7,18 +7,16 @@
#include "core/stdafx.h"
#include "engine/net.h"
#ifndef NETCONSOLE
#include "core/logdef.h"
#include "tier0/frametask.h"
#include "tier1/cvar.h"
#include "vpc/keyvalues.h"
#include "vstdlib/callback.h"
#include "mathlib/color.h"
#include "engine/net.h"
#include "engine/net_chan.h"
#include "vpc/keyvalues.h"
#include "common/callback.h"
#include "net.h"
#include "net_chan.h"
#ifndef CLIENT_DLL
#include "engine/server/server.h"
#include "engine/client/client.h"
#include "server/server.h"
#include "client/client.h"
#endif // !CLIENT_DLL
#endif // !NETCONSOLE
@ -98,7 +96,7 @@ void NET_SetKey(const string& svNetKey)
v_NET_SetKey(g_pNetKey, svTokenizedKey.c_str());
DevMsg(eDLL_T::ENGINE, "Installed NetKey: %s'%s%s%s'\n",
g_svReset.c_str(), g_svGreyB.c_str(), g_pNetKey->GetBase64NetKey(), g_svReset.c_str());
g_svReset, g_svGreyB, g_pNetKey->GetBase64NetKey(), g_svReset);
}
else
{

View File

@ -6,7 +6,6 @@
#include "core/stdafx.h"
#include "tier1/cvar.h"
#include "tier1/utility.h"
#include "engine/sdk_dll.h"
#ifndef DEDICATED
#include "gameui/IBrowser.h"

View File

@ -1,6 +1,6 @@
#include "core/stdafx.h"
#include "server/vengineserver_impl.h"
#include "server/persistence.h"
#include "vengineserver_impl.h"
#include "persistence.h"
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
bool Persistence_SetXP(int a1, int* a2)

View File

@ -5,7 +5,7 @@
#include "engine/networkstringtable.h"
#include "public/iserver.h"
#ifndef CLIENT_DLL
#include "server/vengineserver_impl.h"
#include "vengineserver_impl.h"
#endif // !CLIENT_DLL
enum class server_state_t

View File

@ -5,10 +5,10 @@
//===========================================================================//
#include "core/stdafx.h"
#include "tier1/cmd.h"
#include "tier1/cvar.h"
#include "tier1/NetAdr.h"
#include "tier2/socketcreator.h"
#include "engine/cmd.h"
#include "engine/net.h"
#include "engine/server/sv_rcon.h"
#include "protoc/sv_rcon.pb.h"

View File

@ -8,7 +8,7 @@
#include "tier1/cvar.h"
#include "common/protocol.h"
#include "engine/client/client.h"
#include "server/vengineserver_impl.h"
#include "vengineserver_impl.h"
//-----------------------------------------------------------------------------
// Purpose: sets the persistence var in the CClient instance to 'ready'

View File

@ -1,6 +1,167 @@
//=============================================================================//
//
// Purpose: IApplication methods
//
//=============================================================================//
#include "core/stdafx.h"
#include "tier0/frametask.h"
#include "tier0/commandline.h"
#include "tier1/cvar.h"
#include "vpc/interfaces.h"
#include "common/engine_launcher_api.h"
#include "pluginsystem/pluginsystem.h"
#include "pluginsystem/modsystem.h"
#include "ebisusdk/EbisuSDK.h"
#include "engine/cmodel_bsp.h"
#include "engine/sys_engine.h"
#include "engine/sys_dll2.h"
#include "engine/sdk_dll.h"
#include "engine/host_cmd.h"
#include "engine/enginetrace.h"
#ifndef CLIENT_DLL
#include "engine/server/sv_main.h"
#include "server/vengineserver_impl.h"
#include "game/server/gameinterface.h"
#endif // !CLIENT_DLL
#ifndef DEDICATED
#include "client/cdll_engine_int.h"
#include "game/client/cliententitylist.h"
#include "gameui/IConsole.h"
#include "windows/id3dx.h"
#include "windows/input.h"
#endif // !DEDICATED
#include "public/idebugoverlay.h"
#include "vstdlib/keyvaluessystem.h"
#include "engine/sys_dll.h"
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool CSourceAppSystemGroup::StaticPreInit(CSourceAppSystemGroup* pSourceAppSystemGroup)
{
if (pSourceAppSystemGroup->GetCurrentStage() == CSourceAppSystemGroup::CREATION)
{
ConVar_InitShipped();
ConVar_PurgeShipped();
ConCommand_StaticInit();
ConCommand_InitShipped();
ConCommand_PurgeShipped();
}
return CSourceAppSystemGroup__PreInit(pSourceAppSystemGroup);
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool CSourceAppSystemGroup::StaticCreate(CSourceAppSystemGroup* pSourceAppSystemGroup)
{
return CSourceAppSystemGroup__Create(pSourceAppSystemGroup);
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
int CModAppSystemGroup::StaticMain(CModAppSystemGroup* pModAppSystemGroup)
{
std::thread fixed(&CEngineSDK::FixedFrame, g_EngineSDK);
fixed.detach();
int nRunResult = RUN_OK;
HEbisuSDK_Init(); // Not here in retail. We init EbisuSDK here though.
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1) // !TODO: rebuild does not work for S1 (CModAppSystemGroup and CEngine member offsets do align with all other builds).
return CModAppSystemGroup_Main(pModAppSystemGroup);
#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
g_pEngine->SetQuitting(IEngine::QUIT_NOTQUITTING);
if (g_pEngine->Load(pModAppSystemGroup->IsServerOnly(), g_pEngineParms->baseDirectory))
{
if (CEngineAPI_MainLoop())
{
nRunResult = RUN_RESTART;
}
g_pEngine->Unload();
#ifndef CLIENT_DLL
SV_ShutdownGameDLL();
#endif // !CLIENT_DLL
}
return nRunResult;
#endif
}
//-----------------------------------------------------------------------------
// Purpose: Instantiate all main libraries
//-----------------------------------------------------------------------------
bool CModAppSystemGroup::StaticCreate(CModAppSystemGroup* pModAppSystemGroup)
{
#ifdef DEDICATED
pModAppSystemGroup->SetServerOnly();
*m_bIsDedicated = true;
#endif // DEDICATED
g_pFactory->GetFactoriesFromRegister();
g_pFactory->AddFactory(FACTORY_INTERFACE_VERSION, g_pFactory);
g_pFactory->AddFactory(INTERFACEVERSION_PLUGINSYSTEM, g_pPluginSystem);
g_pFactory->AddFactory(KEYVALUESSYSTEM_INTERFACE_VERSION, g_pKeyValuesSystem);
//InitPluginSystem(pModAppSystemGroup);
//CALL_PLUGIN_CALLBACKS(g_pPluginSystem->GetCreateCallbacks(), pModAppSystemGroup);
g_pModSystem->Init();
g_pDebugOverlay = g_pFactory->GetFactoryPtr(VDEBUG_OVERLAY_INTERFACE_VERSION, false).RCast<CIVDebugOverlay*>();
#ifndef CLIENT_DLL
g_pServerGameDLL = g_pFactory->GetFactoryPtr(INTERFACEVERSION_SERVERGAMEDLL, false).RCast<CServerGameDLL*>();
g_pServerGameClients = g_pFactory->GetFactoryPtr(INTERFACEVERSION_SERVERGAMECLIENTS_NEW, false).RCast<CServerGameClients*>();
if (!g_pServerGameClients)
g_pServerGameClients = g_pFactory->GetFactoryPtr(INTERFACEVERSION_SERVERGAMECLIENTS, false).RCast<CServerGameClients*>();
g_pServerGameEntities = g_pFactory->GetFactoryPtr(INTERFACEVERSION_SERVERGAMEENTS, false).RCast<CServerGameEnts*>();
#endif // !CLIENT_DLL
#ifndef DEDICATED
g_pClientEntityList = g_pFactory->GetFactoryPtr(VCLIENTENTITYLIST_INTERFACE_VERSION, false).RCast<CClientEntityList*>();
g_pEngineTraceClient = g_pFactory->GetFactoryPtr(INTERFACEVERSION_ENGINETRACE_CLIENT, false).RCast<CEngineTraceClient*>();
g_pImGuiConfig->Load(); // Load ImGui configs.
for (auto& map : g_pCVar->DumpToMap())
{
g_pConsole->m_vsvCommandBases.push_back(
CSuggest(map.first, map.second->GetFlags()));
}
DirectX_Init();
#endif // !DEDICATED
if (CommandLine()->CheckParm("-devsdk"))
{
cv->EnableDevCvars();
}
g_FrameTasks.push_back(std::move(g_TaskScheduler));
g_bAppSystemInit = true;
return CModAppSystemGroup_Create(pModAppSystemGroup);
}
//-----------------------------------------------------------------------------
// Purpose: Initialize plugin system
//-----------------------------------------------------------------------------
void CModAppSystemGroup::InitPluginSystem(CModAppSystemGroup* pModAppSystemGroup)
{
// DEBUG CODE FOR PLUGINS
g_pPluginSystem->PluginSystem_Init();
for (auto& it : g_pPluginSystem->GetPluginInstances())
{
if (g_pPluginSystem->LoadPluginInstance(it))
DevMsg(eDLL_T::ENGINE, "Loaded plugin: '%s'\n", it.m_svPluginName.c_str());
else
Warning(eDLL_T::ENGINE, "Failed loading plugin: '%s'\n", it.m_svPluginName.c_str());
}
}
//-----------------------------------------------------------------------------
// Sys_Error_Internal
//
@ -19,10 +180,22 @@ int HSys_Error_Internal(char* fmt, va_list args)
void VSys_Dll::Attach() const
{
DetourAttach((LPVOID*)&CSourceAppSystemGroup__PreInit, &CSourceAppSystemGroup::StaticPreInit);
DetourAttach((LPVOID*)&CSourceAppSystemGroup__Create, &CSourceAppSystemGroup::StaticCreate);
DetourAttach((LPVOID*)&CModAppSystemGroup_Main, &CModAppSystemGroup::StaticMain);
DetourAttach((LPVOID*)&CModAppSystemGroup_Create, &CModAppSystemGroup::StaticCreate);
DetourAttach(&Sys_Error_Internal, &HSys_Error_Internal);
}
void VSys_Dll::Detach() const
{
DetourDetach((LPVOID*)&CSourceAppSystemGroup__PreInit, &CSourceAppSystemGroup::StaticPreInit);
DetourDetach((LPVOID*)&CSourceAppSystemGroup__Create, &CSourceAppSystemGroup::StaticCreate);
DetourDetach((LPVOID*)&CModAppSystemGroup_Main, &CModAppSystemGroup::StaticMain);
DetourDetach((LPVOID*)&CModAppSystemGroup_Create, &CModAppSystemGroup::StaticCreate);
DetourDetach(&Sys_Error_Internal, &HSys_Error_Internal);
}

View File

@ -1,5 +1,58 @@
#pragma once
#include "engine/common.h"
#include "public/appframework/IAppSystem.h"
#include "public/appframework/IAppSystemGroup.h"
//-------------------------------------------------------------------------
//
//-------------------------------------------------------------------------
class CSourceAppSystemGroup : public CAppSystemGroup
{
public:
static bool StaticPreInit(CSourceAppSystemGroup* pSourceAppSystemGroup);
static bool StaticCreate(CSourceAppSystemGroup* pSourceAppSystemGroup);
private:
CFileSystem_Stdio* m_pFileSystem;
};
//-------------------------------------------------------------------------
//
//-------------------------------------------------------------------------
class CModAppSystemGroup : public CAppSystemGroup
{
public:
static int StaticMain(CModAppSystemGroup* pModAppSystemGroup);
static bool StaticCreate(CModAppSystemGroup* pModAppSystemGroup);
static void InitPluginSystem(CModAppSystemGroup* pModAppSystemGroup);
bool IsServerOnly(void) const
{
return m_bServerOnly;
}
void SetServerOnly(void)
{
m_bServerOnly = true;
}
private:
bool m_bServerOnly;
};
/* ==== CAPPSYSTEMGROUP ================================================================================================================================================= */
inline CMemory p_CModAppSystemGroup_Main;
inline auto CModAppSystemGroup_Main = p_CModAppSystemGroup_Main.RCast<int(*)(CModAppSystemGroup* pModAppSystemGroup)>();
inline CMemory p_CModAppSystemGroup_Create;
inline auto CModAppSystemGroup_Create = p_CModAppSystemGroup_Create.RCast<bool(*)(CModAppSystemGroup* pModAppSystemGroup)>();
inline CMemory p_CSourceAppSystemGroup__PreInit;
inline auto CSourceAppSystemGroup__PreInit = p_CSourceAppSystemGroup__PreInit.RCast<bool(*)(CSourceAppSystemGroup* pModAppSystemGroup)>();
inline CMemory p_CSourceAppSystemGroup__Create;
inline auto CSourceAppSystemGroup__Create = p_CSourceAppSystemGroup__Create.RCast<bool(*)(CSourceAppSystemGroup* pModAppSystemGroup)>();
inline bool g_bAppSystemInit = false;
/* ==== UTILITY ========================================================================================================================================================= */
inline CMemory p_Sys_Error_Internal;
@ -15,13 +68,35 @@ class VSys_Dll : public IDetour
{
virtual void GetAdr(void) const
{
LogFunAdr("CModAppSystemGroup::Main", p_CModAppSystemGroup_Main.GetPtr());
LogFunAdr("CModAppSystemGroup::Create", p_CModAppSystemGroup_Create.GetPtr());
LogFunAdr("CSourceAppSystemGroup::PreInit", p_CSourceAppSystemGroup__PreInit.GetPtr());
LogFunAdr("CSourceAppSystemGroup::Create", p_CSourceAppSystemGroup__Create.GetPtr());
LogFunAdr("Sys_Error_Internal", p_Sys_Error_Internal.GetPtr());
LogVarAdr("gfExtendedError", reinterpret_cast<uintptr_t>(gfExtendedError));
}
virtual void GetFun(void) const
{
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
p_CModAppSystemGroup_Main = g_GameDll.FindPatternSIMD("48 83 EC 28 80 B9 ?? ?? ?? ?? ?? 48 8B 15 ?? ?? ?? ??");
p_CModAppSystemGroup_Create = g_GameDll.FindPatternSIMD("48 8B C4 57 41 54 41 55 41 56 41 57 48 83 EC 60 48 C7 40 ?? ?? ?? ?? ?? 48 89 58 08");
p_CSourceAppSystemGroup__Create = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 48 83 EC 20 48 8B F9 E8 ?? ?? ?? ?? 33 C9");
#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
p_CModAppSystemGroup_Main = g_GameDll.FindPatternSIMD("40 53 48 83 EC 20 80 B9 ?? ?? ?? ?? ?? BB ?? ?? ?? ??");
p_CModAppSystemGroup_Create = g_GameDll.FindPatternSIMD("48 8B C4 55 41 54 41 55 41 56 41 57 48 8B EC 48 83 EC 60");
p_CSourceAppSystemGroup__Create = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 74 24 ?? 57 48 83 EC 20 48 8B F9 E8 ?? ?? ?? ?? 33 C9");
#endif
p_CSourceAppSystemGroup__PreInit = g_GameDll.FindPatternSIMD("48 89 74 24 ?? 55 48 8D AC 24 ?? ?? ?? ?? 48 81 EC ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ??");
CModAppSystemGroup_Main = p_CModAppSystemGroup_Main.RCast<int(*)(CModAppSystemGroup*)>();
CModAppSystemGroup_Create = p_CModAppSystemGroup_Create.RCast<bool(*)(CModAppSystemGroup*)>();
CSourceAppSystemGroup__PreInit = p_CSourceAppSystemGroup__PreInit.RCast<bool(*)(CSourceAppSystemGroup*)>();
CSourceAppSystemGroup__Create = p_CSourceAppSystemGroup__Create.RCast<bool(*)(CSourceAppSystemGroup*)>();
p_Sys_Error_Internal = g_GameDll.FindPatternSIMD("48 89 5C 24 08 48 89 74 24 10 57 48 81 EC 30 08 ?? ?? 48 8B DA 48 8B F9 E8 ?? ?? ?? FF 33 F6 48");
Sys_Error_Internal = p_Sys_Error_Internal.RCast<int (*)(char*, va_list)>(); /*48 89 5C 24 08 48 89 74 24 10 57 48 81 EC 30 08 00 00 48 8B DA 48 8B F9 E8 ?? ?? ?? FF 33 F6 48*/
Sys_Error_Internal = p_Sys_Error_Internal.RCast<int (*)(char*, va_list)>();
}
virtual void GetVar(void) const
{

View File

@ -1,6 +1,6 @@
#pragma once
#include "vpc/interfaces.h"
#include "appframework/engine_launcher_api.h"
#include "common/engine_launcher_api.h"
class CEngineAPI : public IEngineAPI
{

View File

@ -1,5 +1,4 @@
#pragma once
#include <launcher/IApplication.h>
#include <public/iengine.h>
class CEngine : public IEngine

View File

@ -5,7 +5,6 @@
//=============================================================================//
#include "core/stdafx.h"
#include "core/logdef.h"
#include "tier0/commandline.h"
#include "tier1/cvar.h"
#include "engine/sys_utils.h"

View File

@ -2,10 +2,10 @@
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
inline CMemory p_Error;
inline auto v_Error = p_Error.RCast<void (*)(char* fmt, ...)>();
inline auto v_Error = p_Error.RCast<void (*)(const char* fmt, ...)>();
inline CMemory p_Warning;
inline auto v_Warning = p_Warning.RCast<void (*)(int, char* fmt, ...)>();
inline auto v_Warning = p_Warning.RCast<void (*)(int, const char* fmt, ...)>();
inline CMemory p_Sys_GetProcessUpTime;
inline auto v_Sys_GetProcessUpTime = p_Sys_GetProcessUpTime.RCast<int (*)(char* szBuffer)>();
@ -38,11 +38,11 @@ class VSys_Utils : public IDetour
#ifndef DEDICATED
p_Con_NPrintf = g_GameDll.FindPatternSIMD("48 89 4C 24 ?? 48 89 54 24 ?? 4C 89 44 24 ?? 4C 89 4C 24 ?? C3");
#endif // !DEDICATED
v_Error = p_Error.RCast<void (*)(char*, ...)>(); /*48 89 4C 24 08 48 89 54 24 10 4C 89 44 24 18 4C 89 4C 24 20 53 55 41 54 41 56 B8 58 10 00 00 E8*/
v_Warning = p_Warning.RCast<void (*)(int, char*, ...)>(); /*48 89 54 24 ?? 4C 89 44 24 ?? 4C 89 4C 24 ?? 48 83 EC 28 4C 8D 44 24 ?? E8 ?? ?? ?? ?? 48 83 C4 28 C3 CC CC CC CC CC CC CC CC CC CC CC CC CC CC 48 89 5C 24 ?? 48 89 74 24 ?? 48 89 7C 24 ?? 8B 05 ?? ?? ?? ??*/
v_Sys_GetProcessUpTime = p_Sys_GetProcessUpTime.RCast<int (*)(char*)>(); /*40 57 48 83 EC 30 48 8B F9 8B 0D ?? ?? ?? ??*/
v_Error = p_Error.RCast<void (*)(const char*, ...)>();
v_Warning = p_Warning.RCast<void (*)(int, const char*, ...)>();
v_Sys_GetProcessUpTime = p_Sys_GetProcessUpTime.RCast<int (*)(char*)>();
#ifndef DEDICATED
v_Con_NPrintf = p_Con_NPrintf.RCast<void (*)(int, const char*, ...)>(); /*48 89 4C 24 ?? 48 89 54 24 ?? 4C 89 44 24 ?? 4C 89 4C 24 ?? C3*/
v_Con_NPrintf = p_Con_NPrintf.RCast<void (*)(int, const char*, ...)>();
#endif // !DEDICATED
}
virtual void GetVar(void) const { }

View File

@ -0,0 +1,23 @@
cmake_minimum_required( VERSION 3.16 )
project( filesystem )
add_library( ${PROJECT_NAME} )
start_sources()
add_sources( SOURCE_GROUP "Private"
"basefilesystem.cpp"
"basefilesystem.h"
"filesystem.cpp"
"filesystem.h"
)
add_sources( SOURCE_GROUP "Public"
"${ENGINE_SOURCE_DIR}/public/ifile.h"
"${ENGINE_SOURCE_DIR}/public/ifilesystem.h"
)
end_sources()
target_include_directories( ${PROJECT_NAME} PRIVATE "${ENGINE_SOURCE_DIR}/tier0/" "${ENGINE_SOURCE_DIR}/tier1/" )
target_precompile_headers( ${PROJECT_NAME} REUSE_FROM tier0 )

View File

@ -1,11 +1,7 @@
#include "core/stdafx.h"
#include "core/logdef.h"
#include "tier1/cvar.h"
#include "filesystem/basefilesystem.h"
#include "filesystem/filesystem.h"
#ifndef DEDICATED
#include "gameui/IConsole.h"
#endif // !DEDICATED
//---------------------------------------------------------------------------------
// Purpose: prints the output of the filesystem based on the warning level

79
r5dev/game/CMakeLists.txt Normal file
View File

@ -0,0 +1,79 @@
cmake_minimum_required( VERSION 3.16 )
project( gamedll )
add_library( ${PROJECT_NAME} )
start_sources()
add_sources( SOURCE_GROUP "Shared"
"shared/ai_utility_shared.cpp"
"shared/ai_utility_shared.h"
"shared/animation.cpp"
"shared/animation.h"
"shared/collisionproperty.cpp"
"shared/collisionproperty.h"
"shared/ehandle.h"
"shared/entitylist_base.cpp"
"shared/entitylist_base.h"
"shared/imovehelper.h"
"shared/playernet_vars.h"
"shared/predictioncopy.h"
"shared/shared_classnames.h"
"shared/shareddefs.h"
"shared/takedamageinfo.h"
"shared/usercmd.h"
"shared/util_shared.cpp"
"shared/util_shared.h"
"shared/vscript_shared.cpp"
"shared/vscript_shared.h"
)
add_sources( SOURCE_GROUP "Server"
"server/ai_network.cpp"
"server/ai_network.h"
"server/ai_networkmanager.cpp"
"server/ai_networkmanager.h"
"server/ai_node.h"
"server/ai_utility.cpp"
"server/ai_utility.h"
"server/baseanimating.cpp"
"server/baseanimating.h"
"server/baseanimatingoverlay.h"
"server/basecombatcharacter.h"
"server/baseentity.cpp"
"server/baseentity.h"
"server/detour_impl.h"
"server/entitylist.cpp"
"server/entitylist.h"
"server/fairfight_impl.h"
"server/gameinterface.cpp"
"server/gameinterface.h"
"server/movehelper_server.cpp"
"server/movehelper_server.h"
"server/networkproperty.cpp"
"server/networkproperty.h"
"server/physics_main.cpp"
"server/physics_main.h"
"server/player.cpp"
"server/player.h"
"server/playerlocaldata.h"
)
add_sources( SOURCE_GROUP "Client"
"client/c_baseentity.cpp"
"client/c_baseentity.h"
"client/c_baseplayer.h"
"client/cliententitylist.h"
"client/enginesprite.h"
"client/hud.h"
"client/movehelper_client.cpp"
"client/movehelper_client.h"
"client/spritemodel.cpp"
"client/viewrender.cpp"
"client/viewrender.h"
)
end_sources()
target_include_directories( ${PROJECT_NAME} PRIVATE "${ENGINE_SOURCE_DIR}/tier0/" "${ENGINE_SOURCE_DIR}/tier1/" )
target_precompile_headers( ${PROJECT_NAME} REUSE_FROM tier0 )

View File

@ -8,7 +8,6 @@
#include "tier0/fasttimer.h"
#include "tier1/cvar.h"
#include "tier1/cmd.h"
#include "tier1/utility.h"
#include "mathlib/crc32.h"
#include "public/edict.h"
#include "filesystem/filesystem.h"

View File

@ -0,0 +1,18 @@
cmake_minimum_required( VERSION 3.16 )
project( gameui )
add_library( ${PROJECT_NAME} )
start_sources()
add_sources( SOURCE_GROUP "Core"
"IBrowser.cpp"
"IBrowser.h"
"IConsole.cpp"
"IConsole.h"
)
end_sources()
target_include_directories( ${PROJECT_NAME} PRIVATE "${ENGINE_SOURCE_DIR}/tier0/" "${ENGINE_SOURCE_DIR}/tier1/" )
target_precompile_headers( ${PROJECT_NAME} REUSE_FROM tier0 )

View File

@ -17,11 +17,11 @@ History:
#include "tier0/fasttimer.h"
#include "tier0/frametask.h"
#include "tier0/commandline.h"
#include "tier1/cvar.h"
#include "windows/id3dx.h"
#include "windows/console.h"
#include "windows/resource.h"
#include "engine/net.h"
#include "engine/cmd.h"
#include "engine/cmodel_bsp.h"
#include "engine/host_state.h"
#ifndef CLIENT_DLL
@ -32,7 +32,7 @@ History:
#include "networksystem/pylon.h"
#include "networksystem/listmanager.h"
#include "vpc/keyvalues.h"
#include "vstdlib/callback.h"
#include "common/callback.h"
#include "gameui/IBrowser.h"
#include "public/edict.h"
#include "game/shared/vscript_shared.h"

View File

@ -17,10 +17,10 @@ History:
#include "core/resource.h"
#include "tier0/frametask.h"
#include "tier0/commandline.h"
#include "tier1/cvar.h"
#include "windows/id3dx.h"
#include "windows/console.h"
#include "windows/resource.h"
#include "engine/cmd.h"
#include "gameui/IConsole.h"
//-----------------------------------------------------------------------------

View File

@ -0,0 +1,18 @@
cmake_minimum_required( VERSION 3.16 )
project( inputsystem )
add_library( ${PROJECT_NAME} )
start_sources()
add_sources( SOURCE_GROUP "Core"
"inputsystem.cpp"
"inputsystem.h"
)
add_sources( SOURCE_GROUP "Public"
"${ENGINE_SOURCE_DIR}/public/inputsystem/ButtonCode.h"
)
end_sources()
target_precompile_headers( ${PROJECT_NAME} REUSE_FROM vpc )

View File

@ -0,0 +1,17 @@
cmake_minimum_required( VERSION 3.16 )
project( launcher )
add_library( ${PROJECT_NAME} )
start_sources()
add_sources( SOURCE_GROUP "Core"
"launcher.cpp"
"launcher.h"
"launcherdefs.h"
"prx.cpp"
"prx.h"
)
end_sources()
target_precompile_headers( ${PROJECT_NAME} REUSE_FROM vpc )

View File

@ -1,162 +0,0 @@
//=============================================================================//
//
// Purpose: IApplication methods
//
//=============================================================================//
#include "core/stdafx.h"
#include "tier0/frametask.h"
#include "tier0/commandline.h"
#include "tier1/cvar.h"
#include "vpc/interfaces.h"
#include "appframework/engine_launcher_api.h"
#include "launcher/IApplication.h"
#include "pluginsystem/pluginsystem.h"
#include "pluginsystem/modsystem.h"
#include "ebisusdk/EbisuSDK.h"
#include "engine/cmodel_bsp.h"
#include "engine/sys_engine.h"
#include "engine/sys_dll2.h"
#include "engine/sdk_dll.h"
#include "engine/host_cmd.h"
#include "engine/enginetrace.h"
#ifndef CLIENT_DLL
#include "engine/server/sv_main.h"
#include "server/vengineserver_impl.h"
#include "game/server/gameinterface.h"
#endif // !CLIENT_DLL
#ifndef DEDICATED
#include "client/cdll_engine_int.h"
#include "game/client/cliententitylist.h"
#include "gameui/IConsole.h"
#include "windows/id3dx.h"
#include "windows/input.h"
#endif // !DEDICATED
#include "public/idebugoverlay.h"
#include <vstdlib/keyvaluessystem.h>
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool CSourceAppSystemGroup::StaticPreInit(CSourceAppSystemGroup* pSourceAppSystemGroup)
{
if (pSourceAppSystemGroup->GetCurrentStage() == CSourceAppSystemGroup::CREATION)
{
ConVar::InitShipped();
ConVar::PurgeShipped();
ConCommand::StaticInit();
ConCommand::InitShipped();
ConCommand::PurgeShipped();
}
return CSourceAppSystemGroup__PreInit(pSourceAppSystemGroup);
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool CSourceAppSystemGroup::StaticCreate(CSourceAppSystemGroup* pSourceAppSystemGroup)
{
return CSourceAppSystemGroup__Create(pSourceAppSystemGroup);
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
int CModAppSystemGroup::StaticMain(CModAppSystemGroup* pModAppSystemGroup)
{
std::thread fixed(&CEngineSDK::FixedFrame, g_EngineSDK);
fixed.detach();
int nRunResult = RUN_OK;
HEbisuSDK_Init(); // Not here in retail. We init EbisuSDK here though.
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1) // !TODO: rebuild does not work for S1 (CModAppSystemGroup and CEngine member offsets do align with all other builds).
return CModAppSystemGroup_Main(pModAppSystemGroup);
#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
g_pEngine->SetQuitting(IEngine::QUIT_NOTQUITTING);
if (g_pEngine->Load(pModAppSystemGroup->IsServerOnly(), g_pEngineParms->baseDirectory))
{
if (CEngineAPI_MainLoop())
{
nRunResult = RUN_RESTART;
}
g_pEngine->Unload();
#ifndef CLIENT_DLL
SV_ShutdownGameDLL();
#endif // !CLIENT_DLL
}
return nRunResult;
#endif
}
//-----------------------------------------------------------------------------
// Purpose: Instantiate all main libraries
//-----------------------------------------------------------------------------
bool CModAppSystemGroup::StaticCreate(CModAppSystemGroup* pModAppSystemGroup)
{
#ifdef DEDICATED
pModAppSystemGroup->SetServerOnly();
*m_bIsDedicated = true;
#endif // DEDICATED
g_pFactory->GetFactoriesFromRegister();
g_pFactory->AddFactory(FACTORY_INTERFACE_VERSION, g_pFactory);
g_pFactory->AddFactory(INTERFACEVERSION_PLUGINSYSTEM, g_pPluginSystem);
g_pFactory->AddFactory(KEYVALUESSYSTEM_INTERFACE_VERSION, g_pKeyValuesSystem);
//InitPluginSystem(pModAppSystemGroup);
//CALL_PLUGIN_CALLBACKS(g_pPluginSystem->GetCreateCallbacks(), pModAppSystemGroup);
g_pModSystem->Init();
g_pDebugOverlay = g_pFactory->GetFactoryPtr(VDEBUG_OVERLAY_INTERFACE_VERSION, false).RCast<CIVDebugOverlay*>();
#ifndef CLIENT_DLL
g_pServerGameDLL = g_pFactory->GetFactoryPtr(INTERFACEVERSION_SERVERGAMEDLL, false).RCast<CServerGameDLL*>();
g_pServerGameClients = g_pFactory->GetFactoryPtr(INTERFACEVERSION_SERVERGAMECLIENTS_NEW, false).RCast<CServerGameClients*>();
if (!g_pServerGameClients)
g_pServerGameClients = g_pFactory->GetFactoryPtr(INTERFACEVERSION_SERVERGAMECLIENTS, false).RCast<CServerGameClients*>();
g_pServerGameEntities = g_pFactory->GetFactoryPtr(INTERFACEVERSION_SERVERGAMEENTS, false).RCast<CServerGameEnts*>();
#endif // !CLIENT_DLL
#ifndef DEDICATED
g_pClientEntityList = g_pFactory->GetFactoryPtr(VCLIENTENTITYLIST_INTERFACE_VERSION, false).RCast<CClientEntityList*>();
g_pEngineTraceClient = g_pFactory->GetFactoryPtr(INTERFACEVERSION_ENGINETRACE_CLIENT, false).RCast<CEngineTraceClient*>();
g_pImGuiConfig->Load(); // Load ImGui configs.
for (auto& map : g_pCVar->DumpToMap())
{
g_pConsole->m_vsvCommandBases.push_back(
CSuggest(map.first, map.second->GetFlags()));
}
DirectX_Init();
#endif // !DEDICATED
if (CommandLine()->CheckParm("-devsdk"))
{
cv->EnableDevCvars();
}
g_FrameTasks.push_back(std::move(g_TaskScheduler));
g_bAppSystemInit = true;
return CModAppSystemGroup_Create(pModAppSystemGroup);
}
//-----------------------------------------------------------------------------
// Purpose: Initialize plugin system
//-----------------------------------------------------------------------------
void CModAppSystemGroup::InitPluginSystem(CModAppSystemGroup* pModAppSystemGroup)
{
// DEBUG CODE FOR PLUGINS
g_pPluginSystem->PluginSystem_Init();
for (auto& it : g_pPluginSystem->GetPluginInstances())
{
if (g_pPluginSystem->LoadPluginInstance(it))
DevMsg(eDLL_T::ENGINE, "Loaded plugin: '%s'\n", it.m_svPluginName.c_str());
else
Warning(eDLL_T::ENGINE, "Failed loading plugin: '%s'\n", it.m_svPluginName.c_str());
}
}

View File

@ -1,109 +0,0 @@
#pragma once
#include "public/appframework/IAppSystem.h"
#include "public/appframework/IAppSystemGroup.h"
//-------------------------------------------------------------------------
//
//-------------------------------------------------------------------------
class CSourceAppSystemGroup : public CAppSystemGroup
{
public:
static bool StaticPreInit(CSourceAppSystemGroup* pSourceAppSystemGroup);
static bool StaticCreate(CSourceAppSystemGroup* pSourceAppSystemGroup);
private:
CFileSystem_Stdio* m_pFileSystem;
};
//-------------------------------------------------------------------------
//
//-------------------------------------------------------------------------
class CModAppSystemGroup : public CAppSystemGroup
{
public:
static int StaticMain(CModAppSystemGroup* pModAppSystemGroup);
static bool StaticCreate(CModAppSystemGroup* pModAppSystemGroup);
static void InitPluginSystem(CModAppSystemGroup* pModAppSystemGroup);
bool IsServerOnly(void) const
{
return m_bServerOnly;
}
void SetServerOnly(void)
{
m_bServerOnly = true;
}
private:
bool m_bServerOnly;
};
//-------------------------------------------------------------------------
// Methods of IApplication
//-------------------------------------------------------------------------
/* ==== CAPPSYSTEMGROUP ================================================================================================================================================= */
inline CMemory p_CModAppSystemGroup_Main;
inline auto CModAppSystemGroup_Main = p_CModAppSystemGroup_Main.RCast<int(*)(CModAppSystemGroup* pModAppSystemGroup)>();
inline CMemory p_CModAppSystemGroup_Create;
inline auto CModAppSystemGroup_Create = p_CModAppSystemGroup_Create.RCast<bool(*)(CModAppSystemGroup* pModAppSystemGroup)>();
inline CMemory p_CSourceAppSystemGroup__PreInit;
inline auto CSourceAppSystemGroup__PreInit = p_CSourceAppSystemGroup__PreInit.RCast<bool(*)(CSourceAppSystemGroup* pModAppSystemGroup)>();
inline CMemory p_CSourceAppSystemGroup__Create;
inline auto CSourceAppSystemGroup__Create = p_CSourceAppSystemGroup__Create.RCast<bool(*)(CSourceAppSystemGroup* pModAppSystemGroup)>();
inline bool g_bAppSystemInit = false;
///////////////////////////////////////////////////////////////////////////////
class VApplication : public IDetour
{
virtual void GetAdr(void) const
{
LogFunAdr("CModAppSystemGroup::Main", p_CModAppSystemGroup_Main.GetPtr());
LogFunAdr("CModAppSystemGroup::Create", p_CModAppSystemGroup_Create.GetPtr());
LogFunAdr("CSourceAppSystemGroup::PreInit", p_CSourceAppSystemGroup__PreInit.GetPtr());
LogFunAdr("CSourceAppSystemGroup::Create", p_CSourceAppSystemGroup__Create.GetPtr());
}
virtual void GetFun(void) const
{
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
p_CModAppSystemGroup_Main = g_GameDll.FindPatternSIMD("48 83 EC 28 80 B9 ?? ?? ?? ?? ?? 48 8B 15 ?? ?? ?? ??");
p_CModAppSystemGroup_Create = g_GameDll.FindPatternSIMD("48 8B C4 57 41 54 41 55 41 56 41 57 48 83 EC 60 48 C7 40 ?? ?? ?? ?? ?? 48 89 58 08");
p_CSourceAppSystemGroup__Create = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 48 83 EC 20 48 8B F9 E8 ?? ?? ?? ?? 33 C9");
#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
p_CModAppSystemGroup_Main = g_GameDll.FindPatternSIMD("40 53 48 83 EC 20 80 B9 ?? ?? ?? ?? ?? BB ?? ?? ?? ??");
p_CModAppSystemGroup_Create = g_GameDll.FindPatternSIMD("48 8B C4 55 41 54 41 55 41 56 41 57 48 8B EC 48 83 EC 60");
p_CSourceAppSystemGroup__Create = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 74 24 ?? 57 48 83 EC 20 48 8B F9 E8 ?? ?? ?? ?? 33 C9");
#endif
p_CSourceAppSystemGroup__PreInit = g_GameDll.FindPatternSIMD("48 89 74 24 ?? 55 48 8D AC 24 ?? ?? ?? ?? 48 81 EC ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ??");
CModAppSystemGroup_Main = p_CModAppSystemGroup_Main.RCast<int(*)(CModAppSystemGroup*)>(); /*40 53 48 83 EC 20 80 B9 ?? ?? ?? ?? ?? BB ?? ?? ?? ??*/
CModAppSystemGroup_Create = p_CModAppSystemGroup_Create.RCast<bool(*)(CModAppSystemGroup*)>(); /*48 8B C4 55 41 54 41 55 41 56 41 57 48 8B EC 48 83 EC 60*/
CSourceAppSystemGroup__PreInit = p_CSourceAppSystemGroup__PreInit.RCast<bool(*)(CSourceAppSystemGroup*)>(); /*48 89 74 24 ?? 55 48 8D AC 24 ?? ?? ?? ?? 48 81 EC ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ??*/
CSourceAppSystemGroup__Create = p_CSourceAppSystemGroup__Create.RCast<bool(*)(CSourceAppSystemGroup*)>(); /*48 89 5C 24 ?? 48 89 74 24 ?? 57 48 83 EC 20 48 8B F9 E8 ?? ?? ?? ?? 33 C9*/
}
virtual void GetVar(void) const { }
virtual void GetCon(void) const { }
virtual void Attach(void) const
{
DetourAttach((LPVOID*)&CSourceAppSystemGroup__PreInit, &CSourceAppSystemGroup::StaticPreInit);
DetourAttach((LPVOID*)&CSourceAppSystemGroup__Create, &CSourceAppSystemGroup::StaticCreate);
DetourAttach((LPVOID*)&CModAppSystemGroup_Main, &CModAppSystemGroup::StaticMain);
DetourAttach((LPVOID*)&CModAppSystemGroup_Create, &CModAppSystemGroup::StaticCreate);
}
virtual void Detach(void) const
{
DetourDetach((LPVOID*)&CSourceAppSystemGroup__PreInit, &CSourceAppSystemGroup::StaticPreInit);
DetourDetach((LPVOID*)&CSourceAppSystemGroup__Create, &CSourceAppSystemGroup::StaticCreate);
DetourDetach((LPVOID*)&CModAppSystemGroup_Main, &CModAppSystemGroup::StaticMain);
DetourDetach((LPVOID*)&CModAppSystemGroup_Create, &CModAppSystemGroup::StaticCreate);
}
};
///////////////////////////////////////////////////////////////////////////////

View File

@ -15,14 +15,10 @@ void h_exit_or_terminate_process(UINT uExitCode)
void VPRX::Attach() const
{
#ifdef DEDICATED
//DetourAttach(&v_exit_or_terminate_process, &h_exit_or_terminate_process);
#endif // DEDICATED
}
void VPRX::Detach() const
{
#ifdef DEDICATED
//DetourDetach(&v_exit_or_terminate_process, &h_exit_or_terminate_process);
#endif // DEDICATED
}

View File

@ -0,0 +1,14 @@
cmake_minimum_required( VERSION 3.16 )
project( localize )
add_library( ${PROJECT_NAME} )
start_sources()
add_sources( SOURCE_GROUP "Core"
"localize.cpp"
"localize.h"
)
end_sources()
target_precompile_headers( ${PROJECT_NAME} REUSE_FROM vpc )

View File

@ -0,0 +1,18 @@
cmake_minimum_required( VERSION 3.16 )
project( materialsystem )
add_library( ${PROJECT_NAME} )
start_sources()
add_sources( SOURCE_GROUP "Core"
"cmaterialglue.cpp"
"cmaterialglue.h"
"cmaterialsystem.cpp"
"cmaterialsystem.h"
"cshaderglue.cpp"
"cshaderglue.h"
)
end_sources()
target_precompile_headers( ${PROJECT_NAME} REUSE_FROM vpc )

View File

@ -0,0 +1,65 @@
cmake_minimum_required( VERSION 3.16 )
project( mathlib )
add_library( ${PROJECT_NAME} )
start_sources()
add_sources( SOURCE_GROUP "Hash"
"adler32.cpp"
"adler32.h"
"crc32.cpp"
"crc32.h"
"IceKey.cpp"
"IceKey.H"
"sha1.cpp"
"sha1.h"
"sha256.cpp"
"sha256.h"
)
add_sources( SOURCE_GROUP "RNG"
"halton.cpp"
"halton.h"
"randsse.cpp"
"ssenoise.cpp"
)
add_sources( SOURCE_GROUP "Vector"
"bitvec.h"
"color.h"
"color_conversion.cpp"
"compressed_vector.h"
"fltx4.h"
"ssemath.h"
"ssequaternion.h"
"transform.cpp"
"transform.h"
"vector.h"
"vector2d.h"
"vector4d.h"
"vmatrix.cpp"
"vmatrix.h"
"vplane.h"
)
add_sources( SOURCE_GROUP "Math"
"almostequal.cpp"
"fbits.cpp"
"fbits.h"
"math_pfns.h"
"mathlib.h"
"mathlib_base.cpp"
"noisedata.h"
"parallel_for.h"
"powsse.cpp"
"sseconst.cpp"
"ssemath.h"
"swap.h"
)
end_sources()
# Setup precompiled header
target_precompile_headers( ${PROJECT_NAME} PRIVATE mathlib_pch.h )
target_compile_definitions( ${PROJECT_NAME} PRIVATE -DBUILDING_MATHLIB )

View File

@ -1,7 +1,6 @@
// Purpose: C++ implementation of the ICE encryption algorithm.
// Taken from public domain code, as written by Matthew Kwan - July 1996
// http://www.darkside.com.au/ice/
#include "core/stdafx.h"
#include "mathlib/IceKey.H"
#if !defined(_STATIC_LINKED) || defined(_SHARED_LIB)

View File

@ -1,5 +1,4 @@
#include "core/stdafx.h"
#include "mathlib/adler32.h"
#include "adler32.h"
// Mark Adler's compact Adler32 hashing algorithm
// Originally from the public domain stb.h header.

View File

@ -6,8 +6,7 @@
// Source: http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm
//=====================================================================================//
#include "core/stdafx.h"
#include "mathlib/mathlib.h"
#include "mathlib.h"
static inline bool AE_IsInfinite(float a)
{

View File

@ -4,9 +4,6 @@
//
//=====================================================================================//
#include "core/stdafx.h"
#include "tier0/basetypes.h"
#include "tier0/dbg.h"
#include "mathlib/mathlib.h"
#include "mathlib/vector.h"

View File

@ -1,4 +1,3 @@
#include "core/stdafx.h"
#include "mathlib/crc32.h"
// Karl Malbrain's compact CRC-32, with pre and post conditioning.

View File

@ -4,7 +4,6 @@
//
//=============================================================================//
#include "core/stdafx.h"
#include "mathlib/fbits.h"
//-----------------------------------------------------------------------------

View File

@ -4,11 +4,10 @@
//
//=====================================================================================//
#include "core/stdafx.h"
#include "mathlib/halton.h"
// NOTE: This has to be the last file included!
//#include "tier0/memdbgon.h"
#include "tier0/memdbgon.h"
HaltonSequenceGenerator_t::HaltonSequenceGenerator_t(int b)

View File

@ -6,8 +6,6 @@
/// FIXME: As soon as all references to mathlib.c are gone, include it in here
#include "core/stdafx.h"
#include "tier0/basetypes.h"
//#include <memory.h>
#include "tier0/dbg.h"
@ -36,7 +34,7 @@
#include "mathlib/ssequaternion.h"
// memdbgon must be the last include file in a .cpp file!!!
//#include "tier0/memdbgon.h"
#include "tier0/memdbgon.h"
bool s_bMathlibInitialized = false;
#ifdef PARANOID

View File

@ -0,0 +1,30 @@
#ifndef MATHLIB_PCH_H
#define MATHLIB_PCH_H
#include <windows.h>
#include <assert.h>
#include <cmath>
#include <cstring>
#include <cstdint>
#include <smmintrin.h>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <string>
#include <regex>
#include <mutex>
#include <tchar.h>
#include <unordered_map>
#include <map>
#include <vector>
#include "..\common\pseudodefs.h"
#include "..\common\sdkdefs.h"
#include "tier0/platform.h"
#include "tier0/basetypes.h"
#define Assert assert // TODO: Include actual assert header
#endif // MATHLIB_PCH_H

View File

@ -4,11 +4,10 @@
//
//=====================================================================================//
#include "core/stdafx.h"
#include "mathlib/ssemath.h"
// NOTE: This has to be the last file included!
//#include "tier0/memdbgon.h"
#include "tier0/memdbgon.h"
fltx4 Pow_FixedPoint_Exponent_SIMD(const fltx4& x, int exponent)

View File

@ -4,15 +4,13 @@
//
//=====================================================================================//
#include "core/stdafx.h"
#include "tier0/dbg.h"
#include "tier0/threadtools.h"
#include "mathlib/mathlib.h"
#include "mathlib/vector.h"
#include "mathlib/ssemath.h"
// memdbgon must be the last include file in a .cpp file!!!
//#include "tier0/memdbgon.h"
#include "tier0/memdbgon.h"
// see knuth volume 3 for insight.

View File

@ -15,7 +15,6 @@
-- Volker Grabsch <vog@notjusthosting.com>
*/
#include "core/stdafx.h"
#include "mathlib/sha1.h"
/* Help macros */

View File

@ -1,4 +1,3 @@
#include "core/stdafx.h"
#include "mathlib/sha256.h"
const uint32 SHA256::sha256_k[64] = //UL = uint32

View File

@ -13,13 +13,12 @@
//#include "ps3/spu_job_shared.h"
#endif
#include "core/stdafx.h"
#include "mathlib/ssemath.h"
#include "mathlib/ssequaternion.h"
//#include "mathlib/compressed_vector.h"
// NOTE: This has to be the last file included!
//#include "tier0/memdbgon.h"
#include "tier0/memdbgon.h"
const fltx4 g_SIMD_Identity[4] =
{

View File

@ -4,8 +4,6 @@
//
//=====================================================================================//
#include "core/stdafx.h"
#include "tier0/dbg.h"
#include "mathlib/mathlib.h"
#include "mathlib/vector.h"
#include "mathlib/ssemath.h"

View File

@ -6,7 +6,6 @@
//
//===========================================================================//
#include "core/stdafx.h"
#if !defined(_STATIC_LINKED) || defined(_SHARED_LIB)
#include "mathlib/transform.h"

View File

@ -5,9 +5,6 @@
// $NoKeywords: $
//
//=============================================================================//
#include "core/stdafx.h"
#include "tier0/dbg.h"
#if !defined(_STATIC_LINKED) || defined(_SHARED_LIB)
#include "mathlib/vmatrix.h"
@ -16,7 +13,7 @@
#include "mathlib/ssemath.h"
// memdbgon must be the last include file in a .cpp file!!!
//#include "tier0/memdbgon.h"
#include "tier0/memdbgon.h"
#pragma warning (disable : 4700) // local variable 'x' used without having been initialized

View File

@ -0,0 +1,110 @@
cmake_minimum_required( VERSION 3.16 )
project( naveditor )
add_executable( ${PROJECT_NAME} )
start_sources()
add_sources( SOURCE_GROUP "Builder"
"Editor_TileMesh.cpp"
"InputGeom.cpp"
)
add_sources( SOURCE_GROUP "Builder/Include"
"include/Editor_TileMesh.h"
"include/InputGeom.h"
)
add_sources( SOURCE_GROUP "Contrib"
"imgui.cpp"
"imguiRenderGL.cpp"
)
add_sources( SOURCE_GROUP "Contrib/Include"
"include/imgui.h"
"include/imguiRenderGL.h"
)
add_sources( SOURCE_GROUP "Core"
"Editor.cpp"
"main.cpp"
"../thirdparty/recast/Pch.cpp"
)
add_sources( SOURCE_GROUP "Core/Include"
"include/Editor.h"
"../thirdparty/recast/Pch.h"
)
add_sources( SOURCE_GROUP "IO"
"Filelist.cpp"
"MeshLoaderBsp.cpp"
"MeshLoaderObj.cpp"
"MeshLoaderPly.cpp"
)
add_sources( SOURCE_GROUP "IO/Include"
"include/Filelist.h"
"include/FileTypes.h"
"include/MeshLoaderBsp.h"
"include/MeshLoaderObj.h"
"include/MeshLoaderPly.h"
)
add_sources( SOURCE_GROUP "Tools"
"ChunkyTriMesh.cpp"
"ConvexVolumeTool.cpp"
"CrowdTool.cpp"
"NavMeshPruneTool.cpp"
"NavMeshTesterTool.cpp"
"OffMeshConnectionTool.cpp"
)
add_sources( SOURCE_GROUP "Tools/Include"
"include/ChunkyTriMesh.h"
"include/ConvexVolumeTool.h"
"include/CrowdTool.h"
"include/NavMeshPruneTool.h"
"include/NavMeshTesterTool.h"
"include/OffMeshConnectionTool.h"
)
add_sources( SOURCE_GROUP "Utils"
"Editor_Debug.cpp"
"EditorInterfaces.cpp"
"GameUtils.cpp"
"PerfTimer.cpp"
"TestCase.cpp"
"ValueHistory.cpp"
)
add_sources( SOURCE_GROUP "Utils/Include"
"include/Editor_Debug.h"
"include/EditorInterfaces.h"
"include/GameUtils.h"
"include/PerfTimer.h"
"include/TestCase.h"
"include/ValueHistory.h"
)
end_sources()
target_compile_definitions( ${PROJECT_NAME} PRIVATE WIN32 )
target_precompile_headers( ${PROJECT_NAME} PRIVATE ${ENGINE_SOURCE_DIR}/thirdparty/recast/Pch.h )
target_link_libraries( ${PROJECT_NAME} PRIVATE
"navdebugutils"
"libsdl2"
"libdetour"
"libdetourcrowd"
"libdetourtilecache"
"librecast"
"FastLZ"
"Rpcrt4.lib"
"ws2_32.lib"
"winmm.lib"
"imm32.lib"
"version.lib"
"setupapi.lib"
"OpenGL32.lib"
"Glu32.lib"
)

View File

@ -0,0 +1,26 @@
cmake_minimum_required( VERSION 3.16 )
project( netconsole )
add_executable( ${PROJECT_NAME} )
start_sources()
add_sources( SOURCE_GROUP "Core"
"netconsole.cpp"
"netconsole.h"
"plat_time.cpp"
)
end_sources()
target_precompile_headers( ${PROJECT_NAME} REUSE_FROM vpc )
set_target_properties( ${PROJECT_NAME} PROPERTIES OUTPUT_NAME "netcon32" )
target_link_libraries( ${PROJECT_NAME} PRIVATE
"tier0"
"libprotobuf"
"libspdlog"
"protocol_pb"
"engine_ds"
"Rpcrt4.lib"
"ws2_32.lib"
)

View File

@ -5,9 +5,8 @@
//=====================================================================================//
#include "core/stdafx.h"
#include "core/termutil.h"
#include "core/logdef.h"
#include "tier1/utility.h"
#include "tier0/utility.h"
#include "tier1/NetAdr.h"
#include "tier2/socketcreator.h"
#include "windows/console.h"

View File

@ -0,0 +1,20 @@
cmake_minimum_required( VERSION 3.16 )
project( networksystem )
add_library( ${PROJECT_NAME} )
start_sources()
add_sources( SOURCE_GROUP "Core"
"bansystem.cpp"
"bansystem.h"
"listmanager.cpp"
"listmanager.h"
"pylon.cpp"
"pylon.h"
"serverlisting.h"
"sm_protocol.h"
)
end_sources()
target_precompile_headers( ${PROJECT_NAME} REUSE_FROM vpc )

View File

@ -9,13 +9,11 @@
#include "core/stdafx.h"
#include "tier0/threadtools.h"
#include "tier0/frametask.h"
#include "tier1/cmd.h"
#include "tier1/cvar.h"
#include "engine/cmd.h"
#include "engine/net.h"
#include "engine/host_state.h"
#ifndef CLIENT_DLL
#include "engine/server/server.h"
#endif // !CLIENT_DLL
#include "vpc/keyvalues.h"
#include "pylon.h"
#include "listmanager.h"
@ -59,8 +57,6 @@ void CServerListManager::ClearServerList(void)
//-----------------------------------------------------------------------------
void CServerListManager::LaunchServer(void) const
{
#ifndef CLIENT_DLL
if (!ThreadInMainThread())
{
g_TaskScheduler->Dispatch([this]()
@ -82,8 +78,6 @@ void CServerListManager::LaunchServer(void) const
mp_gamemode->SetValue(m_Server.m_svPlaylist.c_str());
ProcessCommand(Format("%s \"%s\"", g_pServer->IsActive() ? "changelevel" : "map", m_Server.m_svHostMap.c_str()).c_str());
#endif // !CLIENT_DLL
}
//-----------------------------------------------------------------------------

View File

@ -9,9 +9,7 @@
#include <tier1/cvar.h>
#include <tier2/curlutils.h>
#include <networksystem/pylon.h>
#ifndef CLIENT_DLL
#include <engine/server/server.h>
#endif // !CLIENT_DLL
//-----------------------------------------------------------------------------
// Purpose: gets a vector of hosted servers.
@ -189,7 +187,6 @@ bool CPylon::PostServerHost(string& outMessage, string& outToken,
return true;
}
#ifdef DEDICATED
//-----------------------------------------------------------------------------
// Purpose: Send keep alive request to Pylon Master Server.
// Input : &netGameServer -
@ -220,14 +217,13 @@ bool CPylon::KeepAlive(const NetGameServer_t& netGameServer)
{
m_Token = hostToken;
DevMsg(eDLL_T::SERVER, "Published server with token: %s'%s%s%s'\n",
g_svReset.c_str(), g_svGreyB.c_str(),
hostToken.c_str(), g_svReset.c_str());
g_svReset, g_svGreyB,
hostToken, g_svReset);
}
}
return result;
}
#endif // DEDICATED
//-----------------------------------------------------------------------------
// Purpose: Checks a list of clients for their banned status.

View File

@ -20,12 +20,10 @@ public:
bool SendRequest(const char* endpoint, const nlohmann::json& requestJson, nlohmann::json& responseJson, string& outMessage, CURLINFO& status, const char* errorText = nullptr) const;
bool QueryServer(const char* endpoint, const char* request, string& outResponse, string& outMessage, CURLINFO& outStatus) const;
#ifdef DEDICATED
bool KeepAlive(const NetGameServer_t& netGameServer);
private:
string m_Token;
string m_ErrorMsg;
#endif // DEDICATED
};
extern CPylon* g_pMasterServer;

View File

@ -0,0 +1,26 @@
cmake_minimum_required( VERSION 3.16 )
project( PluginSDK )
add_library( ${PROJECT_NAME} SHARED )
start_sources()
add_sources( SOURCE_GROUP "Core"
"dllmain.cpp"
"ifactory.h"
"pluginsdk.cpp"
"pluginsdk.h"
)
end_sources()
target_precompile_headers( ${PROJECT_NAME} REUSE_FROM vpc )
target_link_libraries( ${PROJECT_NAME} PRIVATE
"tier0"
"libdetours"
"libprotobuf"
"liblzham"
"protocol_pb"
"Rpcrt4.lib"
)

View File

@ -1,6 +1,7 @@
#pragma once
struct FactoryInfo_t;
class CMemory;
// TODO: Make this abstract and make it base class of CFactory.
class IFactory
@ -13,5 +14,3 @@ public:
virtual CMemory GetFactoryPtr(const string& svFactoryName, bool versionLess = true) const = 0;
virtual const char* GetFactoryFullName(const string& svFactoryName) const = 0;
};
constexpr const char* FACTORY_INTERFACE_VERSION = "VFactorySystem001";

View File

@ -0,0 +1,17 @@
cmake_minimum_required( VERSION 3.16 )
project( pluginsystem )
add_library( ${PROJECT_NAME} )
start_sources()
add_sources( SOURCE_GROUP "Core"
"ipluginsystem.h"
"modsystem.cpp"
"modsystem.h"
"pluginsystem.cpp"
"pluginsystem.h"
)
end_sources()
target_precompile_headers( ${PROJECT_NAME} REUSE_FROM vpc )

View File

@ -0,0 +1,21 @@
cmake_minimum_required( VERSION 3.16 )
project( protocol_pb )
add_library( ${PROJECT_NAME} )
start_sources()
add_sources( SOURCE_GROUP "NetCon"
"cl_rcon.pb.cc"
"cl_rcon.pb.h"
"sv_rcon.pb.cc"
"sv_rcon.pb.h"
)
add_sources( SOURCE_GROUP "SigCache"
"sig_map.pb.cc"
"sig_map.pb.h"
)
end_sources()
target_precompile_headers( ${PROJECT_NAME} REUSE_FROM vpc )

View File

@ -1,7 +1,4 @@
#pragma once
#ifndef DEDICATED
#include "launcher/IApplication.h"
#endif // !DEDICATED
#include "public/globalvars_base.h"
#ifndef CLIENT_DLL
#include "engine/server/sv_main.h"

Some files were not shown because too many files have changed in this diff Show More