107 Commits

Author SHA1 Message Date
Kawe Mazidjatari
7d869ca189 Extra dedicated server optimizations 2022-04-17 02:00:06 +02:00
Kawe Mazidjatari
73a3748e7c Dedicated optimizations
Strip 'CWin32Surface::InitStaticData()' and 'KeyboardLayout_Init()' from dedicated
2022-04-16 23:53:03 +02:00
Kawe Mazidjatari
f2a5c8ac68 See description
* Renamed 'r5apexsdkd64.dll' to 'gamesdk.dll'.
* Added required dedicated parameters to code instead.
* Bug fixes around CCommandLine class (fixed misaligned VTable indexes).
* SDK now supports being directly launched by the game executable.

The SDK launcher will pass '-launcher' to the game, which indicated its being launched by the launcher. If the game does not receive '-launcher', it assumes its being launched directly from the game executable, which will instead load 'startup_(dedi_)default.cfg'.

The sdk dll's are now added to the game's IAT by their dummy exports allowing for them to be loaded when the exe is loaded (the dll's do everything on init).
2022-04-16 00:30:46 +02:00
Kawe Mazidjatari
196db8660e Dedicated and SDK improvements
* Improve ConVar class (fixed several bugs).
* Hook CEngineAPI::ModInit() and set m_bRestrictServerCommands from there.
* Disable unused ConVar's and purge unused ConCommands in CEngineAPI::ModInit() for dedicated.
* Small relocation of malloc related signatures.
2022-04-15 04:02:33 +02:00
Kawe Mazidjatari
b753295a49 SDK improvements
* Dedicated SDK now supports ASLR enabled executables.
* Complete removal of CEngineClient on the dedicated server.
* Complete removal of gHLClient and g_pHLClient on the dedicated server.
* Performance improvements for the dedicated server frame loop.
* ConVar 'CVCallback_t' structure rebuild.
* Reduced overhead throughout SDK.
2022-04-14 19:18:59 +02:00
Kawe Mazidjatari
64f5935ba6 Light optimization 2022-04-13 01:37:49 +02:00
Kawe Mazidjatari
e1f5e7d46b Un-hardcode all CHostState dependencies
The SDK now works on executables with ASLR enabled.
!TODO: Dedicated.
2022-04-12 02:48:46 +02:00
Kawe Mazidjatari
092b7e9d43 Start of migration to IDetour interface
Migrating to this to initialize all patterns and prototypes in Systems_Init() instead.
This should make debugging missing/not found patterns easier and allow for opting out variable/constant search (some of these require other patterns to be found, thus resulting in seg faults..).

Also added check to detect if user has a eligible CPU to run this SDK.
The game requires SSE and SSE2 instruction sets. Our SDK requires this too due to the use of SSE intrinsics, so we cannot let the game handle this. We have to check it ourselves.
2022-04-11 01:44:30 +02:00
Kawe Mazidjatari
8c1dfb50f4 Address class cleanup/improvements
* Move most definitions to implementation file to avoid recompiling whole program for small changes
* Pass strings by reference for where possible.
* Split Module class to dedicated file.
* Add const qualifiers to all eligible methods for address/module class
* Some renaming
2022-04-10 19:59:34 +02:00
Kawe Mazidjatari
2dcbf59041 Move ConVar/ConCommand stuff to tier1 instead and cleanup KeyValues/KeyValuesSystem 2022-04-09 16:16:40 +02:00
Kawe Mazidjatari
b3631facbe Update all function casts 2022-04-09 06:05:47 +02:00
Kawe Mazidjatari
e2f06a8a68 Massive performance improvements
Inline every signature defined in the SDK (previously each translation unit had its own copy of the signature and function prototype). DLL init is near instant now (85% speed improvements).
2022-04-09 02:18:57 +02:00
Kawe Mazidjatari
aa57170e0d Start of pattern search refactor 2022-04-09 01:14:22 +02:00
Kawe Mazidjatari
36a9c2779b Fix debug dll assertions
+ cleanup/optimizations
2022-04-06 00:49:17 +02:00
Kawe Mazidjatari
f4b263b412 Cleanup 2022-04-05 01:13:27 +02:00
Kawe Mazidjatari
5d69d7284e Slight project cleanup 2022-04-02 12:27:35 +02:00
Kawe Mazidjatari
f2223d8bd7 Fix CNetChan structure for anything lower than S3 2022-04-02 04:11:44 +02:00
Kawe Mazidjatari
6feb41c285 Partial CNetChan class rebuild and implementation (see description)
* Adapt codebase to new class to reduce rune-like code.
* Fixed several bugs where the global CClient pointer was used instead of the instance in question to issue bans and display information about a certain client in CBanSystem and Pylon.
* Upgraded CBanSystem and Pylon to use IPv6 instead (including IPv4 mapped IPv6 addresses). This breaks all existing banlist files! All bans have to be re-issued or the existing file has to be updated to use IPv4 mapped IPv6 addresses and renamed to 'banlist.json', and moved to the root of the 'platform' folder.
2022-04-02 02:48:54 +02:00
Kawe Mazidjatari
446f13680f Improve SQVM function registration and add SERVER and CLIENT logic
SERVER and CLIENT functions can now be registered as well.
For checking whether to register for CLIENT or UI, we now check its context instead of comparing pointers. For server, a dedicated function was build.
2022-03-28 19:34:51 +02:00
PixieCore
56a71aba56 A few RTech changes.
* Renamed pak_asyncload to pak_requestload
* Added new ConCommand to unload rpaks. It's called pak_requestunload.
* When CHostState requests an rpak unload, it will now print the name of it.
* Turned a few static addresses onto patternscans.
2022-03-28 18:47:11 +02:00
PixieCore
433a3b27a2 Changed CBaseClient::Clear to void type. 2022-03-28 14:22:27 +02:00
Kawe Mazidjatari
73cdaf18e3 Slight cleanup 2022-03-28 12:02:11 +02:00
PixieCore
5939c00fe1 Avoid potential crash for unloading rpaks. 2022-03-28 00:59:39 +02:00
PixieCore
2045f52ad8 Unloading rpaks poperly now that we load on map load. 2022-03-28 00:57:04 +02:00
PixieCore
d930cb66e0 Migrated CClient to CBaseClient. 2022-03-27 23:50:35 +02:00
Kawe Mazidjatari
b1a806dccb Rename 'GAMECLIENTONLY' definition to 'CLIENT_DLL' 2022-03-27 22:17:30 +02:00
PixieCore
404ef9255c New fields for CBaseClient, fixed CBaseServer functions. 2022-03-27 19:35:33 +02:00
Kawe Mazidjatari
4a5823023d Add CHostState::Think ConVar's and new method to return double value 2022-03-27 11:42:24 +02:00
Kawe Mazidjatari
4cbb4746bd Fix Pylon backend not working on dedicated server
Also fix dual thread for backend, and main thread pausing when request is slow
2022-03-26 18:06:54 +01:00
Kawe Mazidjatari
4e9ae9c350 Better no-level status names 2022-03-26 02:19:07 +01:00
Kawe Mazidjatari
1388215b1a Finish 'CBaseServer::GetNumFakeClients()' function 2022-03-26 02:00:40 +01:00
Kawe Mazidjatari
66ec11079e Optimizations 2022-03-26 01:19:02 +01:00
Kawe Mazidjatari
ba379f4712 Small optimizations 2022-03-26 00:44:23 +01:00
Kawe Mazidjatari
1038ba786e CBaseClient overhaul and partial class rebuild
Also added initial CBaseServer rebuild
TODO: INetChannel rebuild..
2022-03-26 00:24:13 +01:00
Kawe Mazidjatari
96bf41655a Use CBuf_AddText() and Cbuf_Execute() instead
Small improvement
2022-03-25 13:17:57 +01:00
Kawe Mazidjatari
699b1c33a6 Use timer instead for banlist and pylon checks 2022-03-25 02:30:36 +01:00
Kawe Mazidjatari
9b511edbb2 Properly shutdown dedicated again
Small oversight during file refactor
2022-03-25 01:19:27 +01:00
Kawe Mazidjatari
bc3d42d0be Add client build only to SDK (client.dll)
For future S4 debugging
2022-03-23 23:05:43 +01:00
Amos
9f24bc01b0 Update sv_rcon.cpp 2022-03-16 02:04:45 +01:00
Amos
24cd3aa2d5 Small improvements 2022-03-12 13:19:31 +01:00
Amos
faac1232be Make run on S1 again 2022-03-07 13:15:45 +01:00
Amos
16f2bbc45c Adapt even more to new log system 2022-03-07 11:32:12 +01:00
Amos
2fee28ae96 Adapt to new loggers 2022-03-04 15:59:33 +01:00
Amos
6e4a4bde2f Implement SQVM error rebuild in engine with new Warning and Error loggers 2022-03-04 15:34:09 +01:00
Amos
8e1953cc8d Load STBSP file specified in prereq file
The game now loads a override STBSP file for the BSP if field 'stbsp' in level prereq settings is populated.
2022-03-02 01:16:35 +01:00
Amos
6583e174de Implement custom paks loading per level
Game will check scripts/levels/mapname.json and load all rpaks in the rpak field.
Game now also unloads pak files loaded by the SDK preventing crashes and unnecessary memory usage.

VPK's and STBSP's are planned to be added as well.
2022-03-01 02:39:46 +01:00
Amos
0509fb0358 Cleanup all redundant empty control statements 2022-02-28 01:05:55 +01:00
Amos
2719a85504 Debug overlay QOL improvements + Con_NPrintf() hook
* Added ability to invert rect to calculate offsets from bottom/right as well so debug text doesn't get out of view, or obstruct view when window is resized.
* Added Con_NPrintf() hook which shows detailed systems running times and VGUI panel debug information.
2022-02-28 01:01:40 +01:00
Amos
0774ebf9ff Fix exception during SDK shutdown
Run in a fixed interval manner within same thread instead of separate threads.
2022-02-27 19:47:29 +01:00
Amos
62604e8fe9 CAI related stuff (see description)
* Partially rebuild CGlobalVarsBase and CGlobalVars struct.
* Partially implement BuildAINFile (disk builder) written by BobTheBob9. All that needs to be found are the addresses/offsets for 'pUnkStruct0Count' and 'pUnkLinkStruct1Count' (see ai_node.h). I didn't have time for it yet.
* Patch call which restarts the engine once AIN file has been build (so it doesn't get cleared from memory).
* Temporarily patch write operation in 'Detours_LevelInit()' which writes out of scope since the navmesh structure is misaligned somewhere still with a few bytes.

NOTE: 'CAI_NetworkBuilder::BuildFile()' is for now commented out until the 2 other structs are found in the game dll. Once found then we could start fixing the struct offsets and hope it works as-is.
2022-02-27 03:15:00 +01:00