Properly decouple squirrel and game code. This makes it easier to reverse engineer more of this squirrel system, and to compile them as individual libraries later on when moving to CMake to significantly decrease compile times.
* Decoding and encoding is done into a single buffer, from raw buffers to avoid extraneous copies.
* Added base class holding all core logic for encoding, decoding, receiving and processing of the RCON protocol. This code was initially identical between all implementations of RCON, deduplicating this avoids bugs.
* Added more sophisticated error handling, stop right away when decoding for example fails.
* Added ability to have more than one active authenticated net console on the server. Controlled by cvar 'sv_rcon_maxconnections' (default 1).
* Max packet size for accepted, but not authenticated sockets is now controled by cvar 'sv_rcon_maxpacketsize' (default 1024).
Fixed bug causing script warnings/errors to not override the log level. Warnings/errors should always be printed to the console. This commit also fixes a bug that causes warnings/errors to not show in red/yellow colors in the imgui console when '-ansicolor' command line parameter isn't used. The imgui console always logs colors and does not rely on '-ansicolor', this is only for the external terminal window.
Fixed bugs that was caused by symbols that were defined, but never used.
* 'UnsignedIntConvertToFltSIMD' never used its input parameter.
* The results from the call to 'sq_call' were never checked, so if a failure took place, it was never logged.
* 'CheckForWarnings' never used the 'context' parameter, but this was required as context types of 'eDLL_T::SYSTEM_WARNING' or 'context == eDLL_T::SYSTEM_ERROR', should be returning the warning/error color as well.
* Renamed 'GetHiddenServerConnectStatus' to 'GetHiddenServerName' and added more dedicated error handling within its logic, as the results from the call 'g_pMasterServer->GetServerByToken' was never checked.
RCON upgrade with additional logging system improvements:
* Netconsole's can now log received messages in color, even when the RCON server has ANSI colors disabled; logs are fully composed locally.
* RCON server now also sends the log type over the wire, along with the (already existing) context.
* SDK logging code is now shared with the standalone netconsole application.
* Improved logging readability for the standalone netconsole application.
Changed all loggers to use the internal 'CoreMsg/CoreMsgV' functions. Significantly reduced duplicate code and CPU time. Code is also much more robust.
* Code now only acquires mutex lock when the actual logging part takes place.
* Code now only checks and strip ANSI rows if its enabled to begin with.
* Code now supports setting log levels, which ultimately could be tweaked with a cvar.
* Changed logger and file names to be more readable.
TODO:
* The RCON protocol has to be modified to accommodate these changes.
Start of refactoring entire logging system. This refactor should remove all duplicate code across all loggers. The logic behind DevMsg, Warning and Error has now been successfully refactored into a single helper function.
* Change qualifiers for some types (make const, static const, etc..).
* Renamed 'CNotifyText' to 'CTextNotify'.
* Renamed 's_LogMutex' to 'g_LogMutex' (mutex was not static).
* Use single static buffer instead of each overlay having its own (its only used in the material system thread).
* Improved readability by using ternary operators and c++ style casts.
* Replaced the boolean 'fatal' parameter with a error code parameter, anything non-null will prompt a message (fatal) and terminate the process with given error code.
* Fixed bug where the global ostreamsink for spdlog did NOT get cleared in 'SQVM_PrintFunc' when cvar 'sq_showvmoutput' was < 3. Moved to global scope.
* Added error message for when detouring the process has failed, with the error code.
* Only call 'Plat_GetProcessUpTime()' once per log, (improves performance and fixes bug where the error message box would show a different time stamp than what is logged into the console or file).
* All TIER0 loggers only log to notify and console when the SDK engine has fully initialized and detoured all functions.
When fatal is set, the function will show a error dialogue, which will halt the process and close when the message is dismissed. Else we will end up in a crash.
Renamed to EGlobalContext_t and used globally for all context types combined into one (required for rcon messages for example, as we do native and script messages, while also retaining colors).
* Use responceid from server to determine in which context to log.
* Moved all script loggers from combined enums to minus instead (SERVER = -3, CLIENT = -2, UI = -1 SERVER_CODE = 0, etc), this makes it much easier to align stuff in combined systems such as the RUI logger or NetMsg().
* Color log networked RCON messages properly on the client.
* Added dedicated logger for all received RCON messages (net_console.log).
* Log commands submitted through in-game console (allows for easier debugging when going through log files).
* Implemented robust length-prefix framing logic for non-blocking sockets (previously used character sequences to determine length, but you cannot use character sequences on protocol buffers as its binary data. This logic should fix all problems regarding some commands not getting networked properly to the server and stuff not getting printed on the client).
* Increased buffer size to std::vector::max_size when netconsole is authenticated (MAX_NETCONSOLE_INPUT_LEN still remains enforced on accepted but not authenticated connections to prevent attackers from crashing the server).
* Process max 1024 bytes each recv buffer iteration.
* Additional optimizations and cleanup.
* Changing RCON passwords on the server now closes all connections and re-initializes the system.
* Fully mapped out VFTable interface for IConVar* (used for ConVar callbacks, see callback.cpp).
SourceSDK mathlib port with light modifications.
Renamed Vector to Vector3D (to avoid confusion with std::vector (declared as vector) and Vector2D/Vector4D).
CConsole now uses a dedicated class for logging text (modified CTextEditor class (CTextLogger)). The class uses an ImDraw list with a character vector to draw the text.
Text could be selected by double click (word), triple click (line), a selection by dragging the cursor, or everything with 'ctrl + a'.
Moved logging functions to dbg.h (tier0) and export them from the dll.
Added additional functions for checking bad pointers (debug only!).
Reduced output code size.