94 Commits

Author SHA1 Message Date
Marvin D
35afca2cf4 Unify string conversion and __FUNCTION__ uses in callback 2022-12-22 01:01:29 +01:00
Kawe Mazidjatari
277e05b2b8 Improve logging throughout SDK
Used proper enum for context. The low level tier1 stuff should print in COMMON.
Also added newlines where missing, the logging system will undergo a change where a newline will only be appended if we are logging in the same context without a newline.
2022-11-25 23:03:56 +01:00
Kawe Mazidjatari
00bf56a6bb Log RPak patch header descriptors as well 2022-11-25 02:15:25 +01:00
Kawe Mazidjatari
9bc1a7f4e4 Fix RPak patch header size fields not getting set properly
Small mistake that happened when porting the decompressor over to the engine FileSystem API.
2022-11-25 02:12:54 +01:00
Kawe Mazidjatari
ad690379ab Log RPak build date/time properly during decompress
Log the date stored in the RPak header in full detail.
2022-11-25 00:57:32 +01:00
Kawe Mazidjatari
57f17a3aad Use engine's FileSystem API for decompressing and patching RPak files 2022-11-25 00:11:17 +01:00
Kawe Mazidjatari
634184eb56 Fix bug where 'atof' was used instead of 'atoi'
This operation obtains the entity index, which requires 'atoi'. compiler casted it to int, but ideally we just convert it to an int right away.
2022-11-24 15:43:26 +01:00
Kawe Mazidjatari
368c4218b4 Move some CPackedStore methods to VPKDir_t
These methods where only used for and by the VPKDir_t structure.
Also renamed variable and method names to reflect new changes regarding the use of KeyValues by creating a structure with all values defined during file lookup rather than doing this during the pack process.
2022-11-23 17:09:48 +01:00
Kawe Mazidjatari
0ab31606eb CPackedStore refactor
The CPackedStore class now heavily relies on the engine's FileSystem and KeyValues API. Since its part of the engine, it would make more sense to utilize the engine's features instead. It also allows for easier modifications.
* The logic behind the build process hasn't changed.
2022-11-23 12:18:33 +01:00
Kawe Mazidjatari
a9ac75cfee Improve VPK pack/unpack callback code
* Use CFastTimer class for logging performance.
* Don't create unnecessary threads for packing/unpacking.
2022-11-17 20:41:34 +01:00
Kawe Mazidjatari
34d8ea578a Improve consistency throughout packedstore class
No modifications to the existing logic have been performed. Some parameter names have been renamed to improve code readability and maintainability.
2022-11-16 00:54:51 +01:00
Kawe Mazidjatari
32a158903f Rename 'cl_showconsole' and 'cl_showbrowser' to 'toggleconsole' and 'togglebrowser'
Suppress engine warnings due to missing commands (stripped for retail but still bound to key).
2022-11-10 15:36:04 +01:00
Marvin D
d00aaa933d CRenderView init, GetWorldMatrixForView()
* Fixed .gitignore for root /game/
* Fixed bug in WalkVTable where it would offset self.
* General clean up: VAR -> CON, CON -> VAR
2022-11-10 00:53:12 +01:00
Kawe Mazidjatari
dc8ad3dd53 Log all mounted/unmounted VPK files
* Log all mounted/unmounted VPK files.
* Add command for unmounting a VPK file.
* Increased logging buffer size to 4096 for all loggers that weren't updated to this yet.
2022-11-06 12:21:21 +01:00
Kawe Mazidjatari
8147431b0f Rename Detour_Free() to Detour_LevelShutdown()
Added the missing call to v_Detour_LevelInit(), which was removed for debugging purposes.
2022-11-05 00:11:17 +01:00
Kawe Mazidjatari
4bd164a535 NavMesh hot swap system improvements
* Check if server is active in command callback before attempting to hot swap.
* Hook 'v_Detour_LevelInit', and log NavMeshes that failed to load.
* Split free/destroy logic into separate function.
* Created constants for NavMesh and AI Network paths/extensions.
* Added performance profiler for hot swap logic in command callback.
* Renamed "navmesh_reload" to "navmesh_hotswap".
* "navmesh_hotswap" is now development only.
2022-11-03 17:12:22 +01:00
Kawe Mazidjatari
ba252c8e98 Implement logic for hot swapping NavMesh
The new command 'navmesh_reload' hot swaps the current NavMesh for all hulls in memory, with that of the 'new' files on the disk. The memory of the old NavMesh gets freed and destroyed.
2022-11-03 10:44:59 +01: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
d113774a6d Console improvements and new command
* Commented "ImGui::SetItemDefaultFocus()", this seems to somewhat fix the issue where the input field does not claim focus on console invocation.
* Added command "con_removeline" (removes lines from start to end index).
2022-10-20 12:29:49 +02:00
Kawe Mazidjatari
19d514d7f4 Pak_ListPaks_f cleanup
* Get RPakLoadedInfo_t as const reference from g_pLoadedPakInfo array.
* Improve formatting.
2022-10-16 15:41:23 +02:00
Kawe Mazidjatari
ae8f0cb2ab RTech_Decompress_f cleanup
Improve log and code readability.
2022-10-16 15:31:21 +02:00
Kawe Mazidjatari
47beb282f2 RTech cleanup and improvements
* Combined members of TextureHeader_t and RTechTextureInfo_t.
* Renamed 's_pRTechBytesPerPixel' to 's_pBytesPerPixel' and declared const.
* Renamed 'dxgiToRPakFormat' to 's_DxgiToTxtrTable' and declared const.
* Renamed 'rpakToDxgiFormat' to 's_TxtrToDxgiTable' and declared const.
* Moved 'g_DxgiToTxtrTable' and 'g_TxtrToDxgiTable' to 'texture.g.h'.
* Moved 's_pBytesPerPixel' to 'texture.g.h'.
* Fixed defect where we used the [] operator on a std::map that should be const (s_TxtrToDxgiTable), replaced with the const version of std::map::at.
2022-10-13 21:59:06 +02:00
Kawe Mazidjatari
50fee7414d Missing material error logging
This commit implements missing material error logging.
When a material does not exist, it will get replaced with an error material, we log which material is missing, and with which error material it gets replaced with.
This commit also comes with some updates regarding the CMaterialGlue class, and some new types used by this class from the RePak project.
2022-10-13 02:22:50 +02:00
Amos
142c0d1de5 CPackedStore: fix directory file name sanitizer
The sanitizer can retrieve the directory file name from the block file name if this is passed instead. This was broken in the previous system. Sanitization can be opted out if the 3rd parameter of the 'fs_vpk_unpack' command is omitted.
2022-10-11 15:37:34 +02:00
Kawe Mazidjatari
addf815873 BHit_f light cleanup 2022-10-11 01:32:43 +02:00
Kawe Mazidjatari
f18f2f3e9e Store CCommand argument pointer
Only obtain it once.
2022-10-02 02:18:11 +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
1ed7fd8203 Light warning string cleanup 2022-09-19 01:17:34 +02:00
Kawe Mazidjatari
0b6eee20d3 Fix client.dll compile error 2022-09-18 00:48:00 +02:00
Kawe Mazidjatari
a68f55dac0 Move unban logic to CBanSystem and expose to Squirrel
New unban function in SERVER context 'UnbanPlayer(string criteria)'.
2022-09-16 00:51:35 +02:00
Kawe Mazidjatari
9c9843a0fc Centralize kick/ban wrappers to CBanSystem and add new server functions for kicking/banning players 2022-09-15 23:13:37 +02:00
Kawe Mazidjatari
729475c74c Light cleanup
Use NO_ERROR instead of NULL for error code parameter passed to Error(..).
2022-09-14 01:14:51 +02:00
Kawe Mazidjatari
3d6d6644bd Logging bug fix and error handling improvements
* 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.
2022-09-14 00:39:38 +02:00
Kawe Mazidjatari
34a06147d7 Fix spelling errors
Overall spelling improvements and cleanup..
2022-09-09 19:47:31 +02:00
Kawe Mazidjatari
570f6419df Add 'reload_playlists' concommand.
Allows reloading the playlists file from the console or the dedicated server.
2022-09-08 01:02:22 +02:00
Kawe Mazidjatari
83ce041b65 Fix client.dll compile errors. 2022-09-01 01:32:32 +02:00
Kawe Mazidjatari
f8f4504966 NetKey system improvements
* Installed change callback 'NET_UseRandomKeyChanged_f' for cvar 'net_useRandomKey' (when set, it will generate a random key as this is needed when this is enabled!).
2022-08-30 12:10:07 +02:00
Kawe Mazidjatari
8712f7db81 Fix concurrency of g_svNetKey
* Fix concurrency of g_svNetKey.
* Improve logging.
* Overall code cleanup.
2022-08-30 01:22:53 +02:00
Kawe Mazidjatari
23e85cae37 Use type alias for all pak handle variables
* Use type alias 'RPakHandle_t'.
* Improved debug/exception messages.
2022-08-29 17:00:50 +02:00
Kawe Mazidjatari
afad5b92ec Rename 'OriginID' to 'NucleusID'
Nucleus ID is the official internal term for the platform user id used by the OriginSDK.
2022-08-29 15:59:12 +02:00
Kawe Mazidjatari
22fa9bbef9 Fix bug where the originID field doesn't get set when banning by name 2022-08-29 14:59:21 +02:00
Kawe Mazidjatari
38c94eda27 Banlist writing optimizations
* Only write if there is something to write.
* Don't write each iteration, write after the loops are finished.
2022-08-28 00:11:33 +02:00
Kawe Mazidjatari
532b4125d5 More thread safety improvements
* Run 'CHostState::Think()' in the main thread.
* Construct 'NetGameServer_t' objects in main thread before dispatching (TODO: browser).
* Dispatch the call to 'CBanSystem::AddConnectionRefuse' from 'SV_IsClientBanned' to the main thread if we aren't main.
* Return bool for CBanSystem::AddEntry and CBanSystem::DeleteEntry for future optimizations (next commit).
2022-08-27 23:45:58 +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
2010e11310 Add 'fatal' functionality to Error()
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.
2022-08-22 12:42:41 +02:00
Kawe Mazidjatari
2c7aaf531f Host_Changelevel_f rebuild 2022-08-22 03:53:38 +02:00
Kawe Mazidjatari
8df311d126 Flip Cbuf_Execute() removal
Removed the wrong call
2022-08-21 01:44:01 +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
e4eb6d278f Hook up 'convar_findByFlags' command callback
In-engine implementation has logging stripped.
2022-08-13 13:06:30 +02:00
Kawe Mazidjatari
f08fbc8745 Hook up 'help' command callback
In-engine implementation has logging stripped.
2022-08-13 12:57:52 +02:00