209 Commits

Author SHA1 Message Date
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
ae431c6ac2 /W4: Fix unreferenced symbol warnings
Fix verbose unreferenced symbol warnings.
2023-04-02 17:02:04 +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
7024ecc7d9 Add missing include
Add 'smmintrin.h' for newly utilized intrinsic '_mm_extract_epi64' which is portable, unlike accessing union members of the __m128i structure.
2023-04-01 22:19:30 +02:00
Kawe Mazidjatari
7cc58a642f Rename and mark detour globals as static
Renamed to 'g_DetourVector' and 'g_DetourSet', marked as static.
2023-04-01 13:17:23 +02:00
Kawe Mazidjatari
69e6c4718e Rename static 'Init' method in ConVar
Renamed to 'StaticInit' to avoid base class override. Also commented '__restrict' qualifiers.
2023-04-01 13:09:02 +02:00
Kawe Mazidjatari
b9bf4195a0 Rename DevMsg logger
Renamed to 'sdk'.
2023-04-01 10:58:15 +02:00
Kawe Mazidjatari
f9c5986245 Upgrade Dear ImGui to 1.89.4
Upgrade and light restructure of ImGui directory.
2023-03-29 00:19:19 +02:00
Kawe Mazidjatari
47aabf244b Remove redundant tier1 files
These files are no longer necessary.
2023-03-28 01:30:09 +02:00
Kawe Mazidjatari
9e7fbdca54 ConVar/ConCommand class refactor and bug fixes
* Refactored ConCommandBase, ConCommand and ConVar class to make them all virtual, so it could interface with the game's implementation.
* Properly initialize members for ConCommand and ConVar instead of just calling memset.
* Fixed bug in ConVar registration function causing the virtual base table pointer to point to the ConCommand implementation instead of the ConVar implementation.
2023-03-28 00:50:08 +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
4cb8f3f019 Enable SpdLog file rotation
Enable logger rotation. Rotation takes place when log file hits the limit defined by 'SPDLOG_MAX_SIZE'.
2023-03-26 17:47:42 +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
68b5fc24fb Remove CSigCache singleton from PCH
Removed from precompiled header, and only used where needed.
2023-03-20 00:24:40 +01:00
Kawe Mazidjatari
dd48093c23 Add experimental switch header
This header allows us to properly switch between experimental/finished STD implementations without having to adjust the source code (required for compiling on older versions of the Visual Studio 2017 compiler).
2023-03-20 00:17:29 +01:00
Kawe Mazidjatari
767049e38f Add support for Windows SDK 10.0.10240.0
Defined missing types from this particular version of the SDK.
2023-03-20 00:10:49 +01:00
Kawe Mazidjatari
a67de5bc58 Fix init crash on builds compiled with MSVC14
The MSVC14 (Visual Studio 2017) compiler doesn't support creating threads during dll entry. SDK fixed frame thread init has been moved to 'CModAppSystemGroup::Main'. SpdLog buffer flush worker init has been moved to 'SpdLog_PostInit', and 'SpdLog_PostInit' has been moved to 'LauncherMain'.
2023-03-18 21:42:30 +01:00
Kawe Mazidjatari
b7b9068870 Indicate when PCH is compiled 2023-03-18 16:46:15 +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
fd7e981e8c Upgrade SpdLog library to 1.11.0
* Upgrade SpdLog library to 1.11.0.
* Compile SpdLog as static library.
2023-03-18 13:34:43 +01:00
Kawe Mazidjatari
52c14c5590 Add warning message during pch compile
Add warning message when binary is compiled in debug/profile mode; these should never be released.
2023-03-18 09:08:29 +01:00
Kawe Mazidjatari
877c867e08 Add 'tier0/annotations.h' to precompiled header 2023-03-17 00:00:37 +01:00
Kawe Mazidjatari
4e7626dc4d Update system info formatting
Improve formatting; move logical processor count and virtual memory size to the same line.
2023-02-23 23:50:40 +01:00
Kawe Mazidjatari
526179878d Fix client.dll compile error
Must be included in init.cpp.
2023-02-18 13:22:34 +01:00
Kawe Mazidjatari
270cd8f1e7 Activate hook for server side CPU statistics 2023-02-18 00:32:29 +01:00
Kawe Mazidjatari
367b2cf5bc Renames and new setters for CNetChan
* Renamed hooking class to 'VNetChan'
* Added new setters for setting the remote frame times, and the remote server CPU statistics.
2023-02-18 00:05:55 +01:00
Amos
100b538548 Light format change 2023-02-11 17:44:16 +01:00
Kawe Mazidjatari
cd8b5d3111 Improve CPU info log format
Pack level cache and descriptors on the same line.
2023-02-11 16:25:26 +01:00
Kawe Mazidjatari
a8ef2b74cd Implement ConCommand completion logic
Implementation of the ConCommand completion logic for the Dear ImGui console panel.
2023-02-05 19:21:39 +01:00
Kawe Mazidjatari
dc10b2305a Remove 'cdll_engine_int' from dedicated
No longer required.
2023-02-05 19:19:03 +01:00
Kawe Mazidjatari
df7e80077f Make sure winsock errors always gets logged
Make sure it always gets logged to the disk.
2023-02-04 19:14:45 +01:00
Kawe Mazidjatari
34f69a5b1e Move crashhandler implementation to tier0 2023-01-31 22:13:40 +01:00
Kawe Mazidjatari
281addc68e Fix crash whitelist not working on client.dll
Unregister gamesdk's crash handler if -noworkerdll is passed. This is required as both crashhandlers will be called during an exception, and on one, the whitelist wouldn't work.
2023-01-31 21:48:42 +01:00
Kawe Mazidjatari
ad71360dcd Don't register 'HSV_Main' on client dll 2023-01-31 20:55:15 +01:00
Kawe Mazidjatari
b33c8794a0 Reorder registration order
Slight reorder, removed 'VStudioRenderContext' from dedicated.
2023-01-31 17:21:16 +01:00
Kawe Mazidjatari
b7dd5e11c1 Fix bug causing init errors not getting logged
Initialize console and spdlog before anything else that is using the console to log errors to (in this case, winsock init errors were never getting logged).
2023-01-31 17:09:56 +01:00
Kawe Mazidjatari
fd5d09d843 Fix small mistake
Input hooking must be done during SDK init, only DX should be initialized later due to late binding of game pointers.
2023-01-30 21:44:28 +01:00
Kawe Mazidjatari
c84622cfd6 DirectX hook refactor
Refactored code to only feature game pointers, this avoids the unnecessary overhead that was previously caused by creating our own device pointers, swapchain, etc.. This commit also fixes the classic 'black screen' problem when the aspect ratio is set to 4:3 - 5:4, however, a similar bug returned for this causing Dear ImGui to not draw at all when the aspect ratio is set to 4:3 - 5:4. This commit also moves the old HwndProc hook to 'CGame::WindowProc'.
2023-01-30 20:18:11 +01:00
Kawe Mazidjatari
b98eee0268 RCON system refactor and improvements
* Use game's CNetAdr RCON and socket creator.
* Add support for constructing host from [ip]:port format in the netconsole client.
* Pass 'netadr_t' parameter by reference to 'CSocketCreator::OnSocketAccepted'.
2023-01-29 15:24:24 +01:00
Kawe Mazidjatari
500a7c1925 Finish libcurl implementation
Master server queries now use SSL.
2023-01-26 20:06:48 +01:00
Kawe Mazidjatari
684b1e561a Initialize libcurl 2023-01-26 19:58:21 +01:00
Kawe Mazidjatari
f47fb63e5f Fix dedicated server compile errors
Huge cleanup for dedicated. All patches in 'opcodes.cpp' are now directly applied to the executable, and kept as reference in the source file. The patch logic is commented. Any other patches for the dedicated server executable should be documented in the patch file found in 'r5dev/resource/patch'.
2023-01-26 02:59:50 +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
82c914c2fd Detour 'Physics_RunThinkFunctions'
Hook will be used to run simulation for bots.
2023-01-19 22:53:45 +01:00
Kawe Mazidjatari
754c986e3d Add server movehelper to SDK
Initial implementation of server movehelper. IMoveHelper interface class is fully reversed and aligns with implementation in engine. CMoveHelperServer is also reversed, excect for CGameTrace, though this isn't necessary for now.
2023-01-19 18:52:46 +01:00
Kawe Mazidjatari
81adf428ff Add GPU model info on startup
Kept in for dedicated as the main executable imports the same DLL used for 'EnumDisplayDevices'. No GPU will be displayed if there is none installed or set as primary.
2022-12-27 17:39:00 +01:00
Kawe Mazidjatari
7dfef9c9c8 CCrashHandler and logging improvements
* CCrashHandler now calls the crashmsg executable to display the error to the user.
* Logs are now placed into directories named to the current time to avoid overwriting them or having 2 instances of the game writing to the same logs.
2022-12-27 02:28:43 +01:00
Kawe Mazidjatari
5502dcb8f1 Add 'build_id' to crash log
Also performed light cleanup.
2022-12-26 23:35:41 +01:00