239 Commits

Author SHA1 Message Date
Kawe Mazidjatari
2740d4edad Fix compile errors when using clang-cl to compile the SDK
Add global define for the clang compiler, and leave non-member 'fltx4' operator functions out when using clang to compile the SDK as these are causing errors. 'fltx4' is a typedef of __m128; not a user defined class, so these operators couldn't be added.
2023-04-01 22:13:58 +02:00
Kawe Mazidjatari
b9bf4195a0 Rename DevMsg logger
Renamed to 'sdk'.
2023-04-01 10:58:15 +02:00
Kawe Mazidjatari
5aea2f4261 RCON system upgrade
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.
2023-03-27 02:01:48 +02:00
Kawe Mazidjatari
d9926af80c Fix compiler error for project 'dedicated' 2023-03-26 17:45:34 +02:00
Kawe Mazidjatari
793fcd62f2 End of logger refactor
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.
2023-03-26 16:09:05 +02:00
Kawe Mazidjatari
0f76c864fd Start of logger refactor
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.
2023-03-25 21:27:49 +01:00
Kawe Mazidjatari
d9a6ab5cf6 Optimize script functions
Light cleanup and optimizations for Squirrel script functions. Use existing pointers or references as much as possible in place of extraneous string copies.
2023-03-25 17:54:05 +01:00
Kawe Mazidjatari
193c5bdeba Move sdk specific cfg files to different folder
Move all SDK internal CFG's to 'cfg/system'.
2023-03-24 00:04:45 +01:00
Kawe Mazidjatari
371e15db41 Fix many verbose compiler warnings
Many compiler warnings regarding implicit conversions.
2023-03-18 16:45:43 +01:00
Kawe Mazidjatari
62be540702 Properly shutdown SpdLog
Shutdown SpdLog on SDK shutdown or crash, this makes sure the buffers gets flushed.
2023-03-18 14:10:29 +01:00
Kawe Mazidjatari
6cb8e8854b Add 'Verify' macro stub in dbg.h 2023-03-17 00:04:08 +01:00
Kawe Mazidjatari
50d380df29 Define 'MAX_FILEPATH' in platform.h 2023-03-17 00:01:00 +01:00
Kawe Mazidjatari
1d82fd4903 Add 'FORCENOINLINE' macro 2023-02-15 17:53:15 +01:00
Kawe Mazidjatari
2d7e2d5567 Fix bug in CPU detection code caused in recent commit
Should be 0x49, not 49. Thanks rexx!
2023-02-12 10:33:46 +01:00
Amos
8f4a5f45e7 Fixup L3 cache case 0x49
If EAX descriptor is 0x49, a check must be performed to determine whether or not to set the L3 cache.
2023-02-11 17:15:43 +01:00
Amos
c0fe74a321 Set cache desc to whole descriptor for Intel CPU's 2023-02-11 16:31:53 +01:00
Kawe Mazidjatari
4690f6f2e0 Add note in 'CPUInformation' 2023-02-11 16:23:09 +01:00
Amos
9145030b77 Cleanup InterpretIntelCacheDescriptors
Pass 'CPUInformation' by reference instead of using the static directly.
2023-02-11 15:19:29 +01:00
Amos
78288796e2 Fix bug in 'FindIntelCacheDesc'
It never iterates over the static arrays.
2023-02-11 15:15:52 +01:00
Amos
2e7786a4cf Add cache descriptor for Intel CPU using function code 4 2023-02-11 15:15:06 +01:00
Amos
b92d442596 Fix missing cache information on Intel processors
'cpuidex' should return true.
2023-02-10 00:05:58 +01:00
Kawe Mazidjatari
14aff2d7b7 CCrashHandler: improve readability
Use macro instead of the code directly.
2023-02-04 01:04:06 +01:00
Kawe Mazidjatari
b0880f8f0e Fix wrong function name
Should be 'ThreadInterlockedCompareExchange'.
2023-02-01 21:41:16 +01:00
Kawe Mazidjatari
34f69a5b1e Move crashhandler implementation to tier0 2023-01-31 22:13:40 +01:00
Kawe Mazidjatari
c17913bfe9 Light cleanup of pak load api var names
* Rename some pakload api vars.
* Removed 2 duplicate pointers from (g_ClientState_Shifted and g_pakLoadJobID).
* Removed unnecessary signonstate check in 'Mod_ProcessPakQueue' for dedicated.
2023-01-31 16:09:30 +01:00
Kawe Mazidjatari
5f56c23af2 Compile CRConServer for gamesdk
RCON can now be used on the host game as well (previously dedicated exclusive).
2023-01-29 16:07:02 +01:00
Kawe Mazidjatari
a618990937 Detour code refactor
This change was planned for a long time. This moves all REGISTER calls to a single translation unit, this is required as we currently added a very dirty workaround for not registering duplicates by checking if VFTable pointer was already present in the vector... Registering from single translation unit prevents duplicate instances that gets created if header is included by more cpp files.
Reworking this reduced 100kb+ of compiled code. This commit also reworked the way functions/variables/constant gets logged with their addresses; the new code formats them on the fly, and allows for resize at any time. Formatting is no longer required by programmer.

TODO: currently there are some compile errors for dedicated and client dll's. These will be resolved very soon as they need to be properly worked out still (server & client only stuff needs to be properly split). Use the 'main' (stable) branch for the time being if you need to compile these dll's.
2023-01-25 02:26:52 +01:00
Kawe Mazidjatari
89bedf59d8 Fix typo 2022-12-26 21:58:39 +01:00
Kawe Mazidjatari
75ae4d2bcf Fix crash when loggers are used before detour init
'v_Plat_FloatTime' is only initialized during detour init. Using the loggers before will cause a crash. Code now logs 0.0 when v_Plat_FloatTime is nullptr. Showing 0.0 at this stage is correct as the game dll isn't initialized by then.
2022-12-02 21:54:34 +01:00
Kawe Mazidjatari
2501c37044 Globally convert all byte patterns to strings
These get reconverted to masked byte patterns at runtime. With the signature map cache system, this will only happen when building the cache.
2022-12-01 22:44:55 +01:00
Kawe Mazidjatari
3a4a5a08f8 Add CMemStack class 2022-11-29 00:01:47 +01:00
Kawe Mazidjatari
edeb8ea586 Add Valve Source SDK utl classes
These have pending modifications/implementations.
2022-11-28 23:54:38 +01:00
Kawe Mazidjatari
00deea0ccb Improve Audio logger color
A more vibrant orange.
Also improved consistency with RUI notify overlay.
2022-11-28 23:13:18 +01: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
27d00215ac Use memalloc pool pointer directly 2022-11-24 12:10:11 +01:00
Kawe Mazidjatari
7bbfa371be Enable KeyValues leak trace in debug
Assert fails when there is still an un-freed KeyValues structure in memory.
2022-11-23 17:34:20 +01:00
Kawe Mazidjatari
6672d15d9f Bring more context to 'eDLL_T' enumerants 2022-11-10 01:21:18 +01:00
Kawe Mazidjatari
196bf4c2b3 Logging code cleanup
* Change qualifiers for some types (make const, static const, etc..).
* Renamed 'CNotifyText' to 'CTextNotify'.
* Renamed 's_LogMutex' to 'g_LogMutex' (mutex was not static).
2022-10-30 10:08:14 +01:00
Kawe Mazidjatari
9c440e1e68 Overlay log system cleanup
* 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.
2022-10-26 01:55:36 +02:00
Kawe Mazidjatari
bcd379ecbf Update version gate (VGameSDK007)
New content will break older servers and clients
2022-10-21 21:29:25 +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
Marvin D
f9b51433ad Update basetypes.h 2022-10-04 00:52:59 +02:00
Kawe Mazidjatari
94db7b2faa Version gate (006) 2022-09-25 12:15:49 +02:00
Kawe Mazidjatari
678909f40f Increment SDK version
Version gate next release due to several security fixes.
2022-09-21 21:47:45 +02:00
Kawe Mazidjatari
21756f8057 Update SDK version to 'VGameSDK004' 2022-09-19 20:21:40 +02:00
Kawe Mazidjatari
e90d2572b1 Implement 'ThreadInServerFrameThread()'
Tier0 export in r2, inline in r5.
2022-09-18 19:01:37 +02:00
Kawe Mazidjatari
242320e735 Also check CPU for SSE 3, SSSE 3 and POPCNT.
Check for SSE 3, SSSE 3 and POPCNT in CheckCPU(), and SSE, SSE2 in MathLib_Init().
This should fix all crash cases caused by launching the game on unsupported CPU's.
2022-09-14 02:23:06 +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
5f56e5abd3 Update SDK interface version to 003
Version gate next release
2022-09-11 00:20:42 +02:00
Kawe Mazidjatari
34a06147d7 Fix spelling errors
Overall spelling improvements and cleanup..
2022-09-09 19:47:31 +02:00