130 Commits

Author SHA1 Message Date
Kawe Mazidjatari
d46061a55a Don't log GPU device on dedicated 2023-04-29 12:16:09 +02:00
rexx
f520cab44b fix static prop exceptions
This fixes the exceptions that were caused by loading ported bsps with replaced models
CStaticProp::Init was using static prop lump data to request non-existent skins due to the replaced models, causing invalid material pointers to be fetched.
When encountered, these skins will be forced to 0 and an error will be printed.
Ideally these issues are fixed from within the bsp file before they are shipped.
2023-04-18 16:56:35 +01:00
Kawe Mazidjatari
1d04f837f8 Fix many high level compiler warnings
* Put initializer values inside brackets.
* Put logical AND conditions within parentheses.
* Put assignments within conditional statements within parentheses.
* Mark unused variables as such to suppress compiler warnings.
* Fix vftable shadow warnings caused by ConVar::CreateInternal (does not implement, only interface. Renamed to yield desired behavior).
* Fix 'never' initialized class members for 'CCVarIteratorInternal'.
* Return values in interface vftables that cannot be pure virtual.
2023-04-08 19:00:28 +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
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
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
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
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
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
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
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
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
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
ebf7bb5e0b Fix engine bug regarding forcing application borders
In Respawn's engine, the '-forceborder' command line parameter does the same thing as '-noborder'. '-forceborder' should remove the flags (nand) while '-noborder' should append the borderless flag. This code is an attempt to mitigate the problem. There was not enough bytes to assemble the nand operation for this code path without involving code caves or shifting.
2022-12-06 00:48:11 +01:00
Kawe Mazidjatari
e9e323f9d4 Add option to disable cache map
* Add '-nosmap' command line parameter to disable signature caching.
* Invalidate the cache map after initialization.
* Add const qualifiers where possible.
2022-12-04 14:16:12 +01:00
Kawe Mazidjatari
b90d6f929c Finish Signature Cache Map implementation
* Fixed bug where the system still added entries after we are initialized (file has already been written to the disk).
* Moved loading logic to CSigCache class.
* Dedicated and Host/Client now have their own cache files.
2022-12-02 12:12:13 +01:00
Kawe Mazidjatari
9c2b2b681a Fix cache map load bug
* Fix bug where the version wasn't read correctly during cache map load.
* Pass address of array to CIOStream Read wrapper.
2022-12-02 00:28:01 +01:00
Kawe Mazidjatari
f999372f37 Work in progress signature cache map loading and parsing 2022-12-01 22:47:39 +01:00
Kawe Mazidjatari
03dc4eada5 Move Miles and Bink hooks/implementations to shared 'codecs' folder 2022-11-27 17:27:35 +01:00
Kawe Mazidjatari
4de66e7866 Add logging hook for Bink Video error output
Hook BinkOpen, and retrieve error message from exported function BinkGetError if BinkOpen failed.
2022-11-27 17:07:03 +01:00
Kawe Mazidjatari
6fbf78a4eb Add logging hook for Miles Sound System debug output
Miles Sound System sets a pointer to a logger function in the exported function "MilesStartup", which can be set by passing a pointer to your logging function in the first parameter. Since this call is inline, we just hook the function that Respawn used for the audio logger instead, which has the actual print within the function stripped.
2022-11-27 15:02:22 +01:00
Kawe Mazidjatari
9c1efe20ad Remove ConVar and ConCommand singletons
Extraneous singletons.
2022-11-18 22:10:20 +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
6266549cd7 CEngineAPI::SetStartupInfo rebuild
Full rebuild of assembled function "CEngineAPI::SetStartupInfo". The assembly seems to match original function after rebuild. Does NOT support S1 yet, because TRACEINIT is inline in S1.
2022-11-07 22:25:20 +01:00
Kawe Mazidjatari
7be85c03a7 Implement '-nodfs'
Allow skipping DFS initialization.
2022-11-07 19:29:55 +01:00
Kawe Mazidjatari
bef7f352d6 Implement '-novid' param check
the parameter check for '-novid' has been removed from S2 onwards, but later added back in. Our S3 build doesn't have it as well. This commit adds it back in and allows user to launch the game without the startup video's by adding '-novid' to the launch arguments. ('-dev' also works, but this enables developer and sv_cheats..).
2022-09-25 13:36:55 +02:00
Kawe Mazidjatari
7912b79fa2 CL_CopyExistingEntity: implement missing bounds check
Implement bounds check for non-sanitized value of u.m_nNewEntity.
Debug builds of the engine have an assertion, however in release these are stripped.
This fixes a full chain client RCE exploit, for more information, see: https://ctf.re/source-engine/exploitation/2021/05/01/source-engine-2/
2022-09-21 02:38:58 +02:00
Kawe Mazidjatari
fdd74aa622 Implement net message processing budget
Implement net message process budget (channel gets removed if value is exceeded).
Use 'net_processLimit' to enable the implementation on the server. It will get enabled by default after testing and some cleanup. This helps against people trying to slow the server down by spamming net messages with a higher rate, e.g. using 'bind "mousewheel_up" "status"'.
2022-09-18 23:19:50 +02:00
rexx
7d8d515190 add global text chat
use sv_forceChatToTeamOnly 0 to enable global chat
2022-09-18 20:42:16 +01:00
Kawe Mazidjatari
4ec7239b57 Add 'CNetChan::ProcessMessages(..)' hook body
Compat from S0 to S7.
2022-09-17 23:34:36 +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
e0504d2828 Perform CPU check as early as possible
Check CPU as early as possible (first routine during init). This is required because SpdLog compiles down to SSE instructions.
2022-09-14 01:35:05 +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
0f488c685c Move simple task to global fixed frame
Avoids having to create threads for tiny little things.
2022-08-29 02:21:32 +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
6764b5e56e Implement frame tasks
Run all Cbuf_Execute calls in the main thread. This should fix every problem related to (but not only):
* Connecting to server while RUI dialogue is still open.
* Connecting to server while in an active game.
* Running 'weapon_reparse'.
2022-08-19 21:33:31 +02:00
Kawe Mazidjatari
48cc2979ec Remove 'vengineclient_impl.h/.cpp' entirely from dedi 2022-08-17 02:04:01 +02:00