78 Commits

Author SHA1 Message Date
Kawe Mazidjatari
4710b51fa3 Experimental bot simulation implementation
Simulate bot user commands on the server. The simulation system is experimental and only runs if cvar 'sv_simulateBots' is set, and bots are created on the server.
2023-01-20 01:23:08 +01:00
rexx
6695a9bdaf add MilesQueueEventRun debug print 2022-11-27 20:44:17 +00:00
rexx
b15b876eed Revert "add more miles debug hooks"
This reverts commit feeaf5c54536a6ff7dae385314f9036ff45c4cd2.
2022-11-27 20:26:58 +00:00
rexx
feeaf5c545 add more miles debug hooks 2022-11-27 20:14:41 +00:00
Kawe Mazidjatari
9e7495e407 Added new logger types (AudioSystem & VideoSystem)
These loggers are to be used for hooking and logging Miles Audio and Bink Video systems.
2022-11-27 10:19:23 +01:00
Kawe Mazidjatari
4ba88963ff Fix bugs and many compiler warnings
* Promoted size types in CUtlBuffer to int64.
* Fixed bug where CUtlBuffer::GetPtr returns a 64bit pointer that was promoted from a 32bit integral type.
* Use int64/size_t for anything strlen, pointer subtraction, etc..
* Removed invalid structure alignment declarations.
2022-11-24 15:41:52 +01:00
Kawe Mazidjatari
bfa875394f Definitions for 'fs_packedstore_max_helper_threads' 2022-11-17 20:37:55 +01:00
Amos
bf88ecbc4a Update command names in help descriptions 2022-11-02 14:30:43 +01:00
Kawe Mazidjatari
5cfcc12ba5 Add new cvar for logging missing materials
The behavior has been changed; when a material is missing and bComplain is false, nothing gets printed to the console unless 'mat_alwaysComplain' is nonzero.
2022-10-21 21:49:10 +02:00
Kawe Mazidjatari
44f2f87460 CConsole: heavy cleanup
* Move all default assignments to constructor.
* Rename cvar 'con_max_size_logvector' to 'con_max_lines'.
* Rename cvar 'con_max_size_history' to 'con_max_history'.
* Use array indexes instead of hardcoding context prefixes.
* Added netcon context prefix to help legend.
* Added public method to obtain history as string vector.
* Added public method to clear history.
* Internal CConsole::AddLog no longer locks the mutex.
* CConsole::LoadFlagIcons accesses resource vector by reference.
* Implemented "HELP", "HISTORY" and "CLEAR" as real console commands: "con_help", "con_history", "con_clearlines".
* Added a new command "con_clearhistory" (clears the dev console submission history).
2022-10-20 12:29:50 +02:00
Kawe Mazidjatari
f215ca0720 Improve bullet-hit trajectory debug
The ConVar 'bhit_abs_origin' will now draw a sphere at the predicted abs origin of the entity upon hit. This is useful for debugging lag compensation on the server (white star).
2022-10-01 00:27:51 +02:00
Kawe Mazidjatari
cc26113c9e Implement debug draw AIN node links to nearest node
Feature can be toggled using the "ai_script_nodes_draw_nearest" cvar.
2022-09-28 00:14:33 +02:00
Kawe Mazidjatari
23eba316df Cmd: add rate limit logic for 'Cmd_ForwardToServer'
If the client happens to exceed the quota by accident, the client will not be disconnected. This is a quality of life change. Client could still increase cl_quota_stringCmdsPerSecond to allow more submissions per second, or disabling the throttle entirely by setting cl_quota_stringCmdsPerSecond to 0.
2022-09-22 21:37:58 +02:00
Kawe Mazidjatari
eec4d9598e CSquirrelVM: define "DEVELOPER" to value of "ceveloper" convar
In this retail engine, "DEV" is always zero, except for scripts.rson. I think Respawn Entertainment defined this as zero for production builds under each context except the global one.. To fix this problem, we define a new constant named "DEVELOPER", change all references in scripts that where DEV (now R5DEV due to legacy reasons to mitigate this problem), to DEVELOPER. When the game is launched with -dev, anything within #if DEVELOPER with compiled, like the development behavior of DEV.
2022-09-22 15:00:01 +02:00
Kawe Mazidjatari
df986f7d3b ConVar renames
Renamed:
- sv_pylonRefreshInterval => sv_pylonRefreshRate.
- sv_banlistRefreshInterval  => sv_banlistRefreshRate.
- sv_statusRefreshInterval => sv_statusRefreshRate.
2022-09-21 21:23:09 +02:00
Kawe Mazidjatari
7804241376 CClient: add rate limit logic for 'ProcessStringCmd'
Client's can run string commands on the server with no rate limit. This means when you run 50k+ commands that are unknown, or spam 30k 'status' commands, you will be able to hang the server for 800/1200ms (15k/30kms if script printing to console is enabled!). Although the netchan processing budget system will kick you, the damage has already been done at this point. This change effectively breaks the ability to DOS the server from the client using networked string commands.
In easier words; binding 'status' to your mousewheel will get you kicked from the server, without hitching the server.
2022-09-20 22:48:55 +02:00
Kawe Mazidjatari
dcc2c6224b Improve NetChan process time limit
* Check if m_MessageHandler is removed before running limit test.
* Add warning DevMsg if client exceeds value.
* Default 'net_processTimeBudget' value to '200'.
2022-09-20 02:00:52 +02:00
Kawe Mazidjatari
fdd74aa622 Implement net message processing budget
Implement net message process budget (channel gets removed if value is exceeded).
Use 'net_processLimit' to enable the implementation on the server. It will get enabled by default after testing and some cleanup. This helps against people trying to slow the server down by spamming net messages with a higher rate, e.g. using 'bind "mousewheel_up" "status"'.
2022-09-18 23:19:50 +02:00
rexx
f81780a72d fix flags on sv_forceChatToTeamOnly 2022-09-18 21:49:14 +01:00
Kawe Mazidjatari
d9ddb575e2 Add ConVar to auto-reload the server after x seconds.
This should allow users to host dedicated servers without looking back, as you should reload/restart a server every 3 hours (a full process restart is the most recommended option, but a 'soft' reload works like a charm most of the time).
2022-09-15 01:37:45 +02:00
Kawe Mazidjatari
23a95f84a8 ConVar names cleanup 2022-09-12 00:44:03 +02:00
Kawe Mazidjatari
1b754fd0b9 'con_notify' improvements
* Fade notify text by a fixed amount regardless of the frame times.
* Implement Valve's 'lerping' animation for text when entries fade away and expire.
* Don't run/push/remove anything if 'con_drawnotify' is disabled.
2022-09-11 23:48:11 +02:00
Kawe Mazidjatari
705b81a9e3 Set VPK compression level through ConVar 2022-09-11 00:16:31 +02:00
Kawe Mazidjatari
34a06147d7 Fix spelling errors
Overall spelling improvements and cleanup..
2022-09-09 19:47:31 +02:00
Kawe Mazidjatari
c35829013e Change VFTavle indexes from read only to contant 2022-08-31 14:38:49 +02:00
Kawe Mazidjatari
1285d15623 Ban system and authentication improvements
* Fixed bug where multiple of the same entries get added to the global ban/refuse list.
* Fixed bug where we still use the client instance after deleting it in 'CBanSystem::BanListCheck()'.
* Load banlist at a later state (not at construction of class), this is needed for a future change of adapting the 'business' code to feature the game's FileSystem.
* CServer cleanup.
* More detailed ban messages (banned, added to refused list, removed from slot, etc..).
* Use localization key for banned message ("#Valve_Reject_Banned").
* Add const qualifiers to all CPylon methods.

Note:
* This commit requires changes on the master server, these changes are already performed, however the new master server isn't live yet until we publish the new release.
2022-08-30 12:07:09 +02:00
Kawe Mazidjatari
0f488c685c Move simple task to global fixed frame
Avoids having to create threads for tiny little things.
2022-08-29 02:21:32 +02:00
Kawe Mazidjatari
d7df115543 Properly check bounds for Q_strncat in PrintListHeader()/PrintCommand().
Calculate remaining size for the buffer.
2022-08-28 23:54:52 +02:00
Kawe Mazidjatari
656b0be3ec Improve threading (work in progress)
* Only run '_DownloadPlaylists_f()' in the main thread, schedule for next frame if we aren't in the main thread. (this should fix crash cases related to disconnecting from the game).

* Locked read/write to CBrowser members (thread for obtaining the server list is detached, but once the 'slow' post operation in this thread is complete, mutex lock is acquired (locking the render thread if the browser is active) to set the string members of CBrowser, this operation is very fast as we only set the string and the color after the http post operation (this never caused a crash, but the behavior without any lock mechanism is technically undefined regardless).

* Obtain the host name dynamically from the ConVar 'pylon_matchmaking_hostname' (atomic operation). Initial approach was deleting the whole master server pointer just to construct a new httpclient object..
2022-08-27 18:57:56 +02:00
Kawe Mazidjatari
ca0172ed1f Add cvar for RTech debugging and removed dev flag from 'launchplaylist' 2022-08-22 21:15:46 +02:00
Kawe Mazidjatari
3414a2cd2c ImGui panel improvements
* Eliminated all forms of concurrency for CConsole logger.
* Used enum for determining which theme user loaded (DEFAULT, LEGACY, MODERN).
* Fixed issue where browser panel doesn't have the same frame padding as the console for the modern theme.
* Fixed issue where the history items count shows number higher than maximum until updated (updates vector before displaying, else this happens in g_pConsole->RunTask which is the operation that happens before we add new elements to the vector, thus showing the wrong count as this size is getting corrected the next frame after we painted, we don't update the summary each frame for performance reasons).
2022-08-22 01:10:18 +02:00
Kawe Mazidjatari
5548a74d59 Major cleanup (see description)
* Fix all compiler error for GameSDK on S0 and S1.
* Remove some unused patterns and globals (launch performance gains of 100ms).
* Remove most duplicate patterns.
* Relocate globals from engine to a more appropriate location.
* Renamed some unknown vars to a more appropriate name (most of these where obtained a while back, but as we reversed more parts of the engine, some of these vars become known).
* Renamed some vars to fit the naming convention used in the SDK.
* Fixed pattern debug logging using the wrong pointer, thus displaying the wrong address.
2022-08-18 02:15:23 +02:00
Kawe Mazidjatari
619ac76452 Implement client rcon send log request
If 'cl_rcon_request_sendlogs' is set, the netconsole will request the server to send console logs to the rcon client after successful auth.
2022-08-17 11:50:40 +02:00
Kawe Mazidjatari
39b95a9716 Add cvar for determining whether or not to send rcon console logs to netconsole 2022-08-17 02:20:04 +02:00
Kawe Mazidjatari
cf824aa2fc Remove FCVAR_DEVELOPMENTONLY from 'origin_disconnectWhenOffline'
Allow 100% offline play in retail mode.
2022-08-14 16:00:40 +02:00
Kawe Mazidjatari
9f7d4f57d3 CCVarIteratorInternal cleanup
* Improve readability.
* Free allocated iterator memory.
* Enforce FCVAR_HIDDEN ConVar's in ImGui console (there are only 17 ConVar's marked 'hidden', and most of these are stryder/platform related stuff. This is usefull for if we ever wish to create a hidden cvar).
2022-08-14 02:51:15 +02:00
Kawe Mazidjatari
61dbda67f7 Address reported issues
Addressed:
* 'Expression: vector subscript out of range' (we only ever ensured capacity upon construction).
* Compiler error as AssertMsg1 is unimplemented, used Assert instead.
2022-08-14 00:48:29 +02:00
Kawe Mazidjatari
8068bcf176 Mask off FCVAR_DEVELOPMENTONLY from essential commands
Only mask FCVAR_DEVELOPMENTONLY off from essential commands if launched in retail mode (this hardens security and increases performance).
2022-08-13 21:38:44 +02:00
Kawe Mazidjatari
515487c63a Changed behavior of ConCommandBase::IsFlagSet (read description)
This commit breaks the indev branch for the time being (this will be solved very soon).
We no longer mask off dev flags from every commandbase, we only mask them off from the essential ones (map, connect, give, etc..), unless the SDK is launched as dev, then we mask everything off like usual, but this time at initialization and not whenever we encounter a var with this flag.
2022-08-13 20:21:32 +02:00
Kawe Mazidjatari
fad1a092e4 More CCvar reversing
Still work-in-progress
2022-08-13 19:41:45 +02:00
Kawe Mazidjatari
b18f9148e4 Renames
* Rename FCVAR_ARCHIVE_GAMECONSOLE to FCVAR_ARCHIVE_PLAYERPROFILE.
* Rename CONVARFLAG(UNLOGGED, "log") to CONVARFLAG(UNLOGGED, "ulog").
2022-08-13 15:35:38 +02:00
Kawe Mazidjatari
8740c7261a Add ARCHIVE_GAMECONSOLE to g_ConVarFlags 2022-08-13 13:58:27 +02:00
Kawe Mazidjatari
dbdfdc2b3a Only log changed convars for 'convar_differences' 2022-08-13 12:53:08 +02:00
Kawe Mazidjatari
4551f6d494 Implement convar_list and convar_differences
Also added more CCvarUtilities methods which are yet to be implemented.
2022-08-13 12:39:57 +02:00
Kawe Mazidjatari
9d06a02614 General cleanup
* Use Cbuf functions for executing commands in ImGui panels.
* Use const qualifiers for all vftable indexes.
2022-08-09 02:35:00 +02:00
Kawe Mazidjatari
0cad187587 Fix client.dll compile errors 2022-08-04 17:52:34 +02:00
Kawe Mazidjatari
238e145818 Implement ConVar change callbacks
CUtlVector containing callbacks (you can have several callbacks for each ConVar).

also, in 'ConVar::InternalSetValue' Valve and Respawn run V_atod (atof) on function param 'pszValue', but they also check if input param 'pszValue' is a nullptr (which in this case, 'pszNewValue' gets set to an empty string), but yet they deref 'pszValue' (nullptr or not) in 'SetColorFromString' and V_atod, is this correct behavior?

For now I swapped these out with 'pszNewValue' for the very rare event the string happens to be nullptr.
2022-08-04 11:06:56 +02:00
Kawe Mazidjatari
0fe554b3d1 Fix crash cases when setting ConVar string using SetValue
Added IsMaterialThreadSetAllowed and QueueMaterialThreadSetValue checks.
2022-08-04 00:21:48 +02:00
Kawe Mazidjatari
19d057fc5e Add 'bhit_enable' ConVar and only run bhit callback if set 2022-08-03 18:27:25 +02:00
Kawe Mazidjatari
068e50ea40 'bhit' command implementation
The command is only implemented on the dedicated server or debug servers, so i cannot tell for sure what exactly 'bhit' does. But its either some form of telemetry or debug.
The command sends the player index that got hit on the prediction engine, the bullet fire origin and the angles relative to the target that got hit.
For now the command draws the bullet trajectory if it hits a player.
This commit also fixes the 'Unknown command: bhit' message.
2022-07-30 00:54:33 +02:00