265 Commits

Author SHA1 Message Date
Kawe Mazidjatari
8dbc2024c6 CMake code improvements
Use the 'add_module' macro to add modules without creating duplicate code. This macro also takes a reuse PCH as parameter, so modules that need a precompiled header, could reuse those from different targets that compile them. This commit also restructures the group order of the generated solution files for easier code navigation.
2023-05-13 00:14:53 +02:00
Kawe Mazidjatari
f120354e96 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!
2023-05-10 00:05:38 +02:00
Kawe Mazidjatari
359820615f Move low level code to tier0/tier1
Moved to tier0/tier1 so it could be compiled into a static library in the future.
2023-05-06 22:59:01 +02:00
Kawe Mazidjatari
75ccebb4b6 Squirrel system restructure
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.
2023-05-06 16:23:56 +02:00
Kawe Mazidjatari
179bd31ee6 Initial large refactor of the RCON implementation
* 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).
2023-04-19 01:35:31 +02:00
Kawe Mazidjatari
d22b91fd72 Rename enumerant in 'CCrashHandler' 2023-04-18 20:13:51 +02:00
Kawe Mazidjatari
050a27e387 Fix compiler warning on dedicated server
Mark parameter as unused.
2023-04-16 15:51:51 +02:00
Kawe Mazidjatari
5f4b436ec6 Only attempt to send RCON log if its not from the client 2023-04-16 11:59:56 +02:00
Kawe Mazidjatari
021242ece9 Fix unused variable warning for netconsole project 2023-04-16 01:25:39 +02:00
Kawe Mazidjatari
8611a0c607 Small logger system optimization
Only perform colorization operation for script errors when log level is at least that of the console.
2023-04-14 00:37:57 +02:00
Kawe Mazidjatari
dee5b36088 Fix bug in script print logger
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.
2023-04-14 00:30:50 +02:00
Kawe Mazidjatari
a2bb707902 Fix unhandled enumerants in switch statement 2023-04-08 18:30:38 +02:00
Kawe Mazidjatari
d49f252f4d Write minidump and slight code improvements
* Write minidumps to disk when the game crashes.
* Initialize global process timestamp as early as possible and separate from log dir.
2023-04-08 16:09:23 +02:00
Kawe Mazidjatari
b089c59062 Properly implement 'CCrashHandler::FormatFPU'
Fixes a bug causing decimal numbers to be displayed while negative numbers in register equals or exceeds one million.
2023-04-08 13:34:31 +02:00
Kawe Mazidjatari
16910aa45c Use custom string formatter
Enforce consistency through code base by using the same format specifiers.
2023-04-08 10:50:32 +02:00
Kawe Mazidjatari
9f428f1567 Move tier0 lib headers to public
This commit does not change any logic or behavior of the code.
2023-04-06 23:50:48 +02:00
Kawe Mazidjatari
596e827352 Add platform defines for endianness 2023-04-05 23:01:46 +02:00
Kawe Mazidjatari
8809f17504 Compile NetMsg out entirely for dedicated 2023-04-03 14:34:46 +02:00
Kawe Mazidjatari
a1f7cc9a0d Make code compatible with older C++ versions
Made compatible with earlier C++ versions without having verbose compiler warnings.
2023-04-03 01:41:46 +02:00
Kawe Mazidjatari
2d87e082f1 /W4: Fix unreferenced symbol bugs
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.
2023-04-02 17:11:14 +02:00
Kawe Mazidjatari
ae431c6ac2 /W4: Fix unreferenced symbol warnings
Fix verbose unreferenced symbol warnings.
2023-04-02 17:02:04 +02:00
Kawe Mazidjatari
24a06f28c6 /W4: Fix verbose compiler warnings in 'Debug' build mode
Warnings caused by symbol ambiguity. Fixed by removing the duplicate definition in 'platform.h'.
2023-04-02 15:58:55 +02:00
Kawe Mazidjatari
a4a2f34c10 /W4: Fix signed/unsigned mismatch
This commit fixes warnings and bugs caused by signed/unsigned mismatch.
2023-04-02 12:09:43 +02:00
Kawe Mazidjatari
7de717d47c /W4: Use 'constexpr' to evaluate branch at compile time
Fixes many compiler warnings.
2023-04-02 11:19:23 +02:00
Kawe Mazidjatari
2bf86375d7 /W4: Fix unreachable code 2023-04-02 02:17:52 +02:00
Kawe Mazidjatari
4357c9dbf3 Fix many compiler warnings
Fix many compiler warnings indicating potentially unwanted implicit conversions/truncations.
2023-04-02 00:59:24 +02:00
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