182 Commits

Author SHA1 Message Date
Kawe Mazidjatari
7ba4f4021b Remove last hardcoded addresses for GameSDK 2022-04-13 01:25:33 +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
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
2045f52ad8 Unloading rpaks poperly now that we load on map load. 2022-03-28 00:57:04 +02:00
Kawe Mazidjatari
7628ae6ff9 Rename pak asyncload and decompress commands 2022-03-24 00:05:19 +01:00
Kawe Mazidjatari
1bd9d6f97d Fix compile order for ClientSDK 2022-03-23 23:54:13 +01:00
PixieCore
ef5abb16ea Added the ability to disable rUI drawing. By @r-ex. 2022-03-23 23:28:12 +01:00
PixieCore
7d9b125d93 Formating. 2022-03-23 20:33:24 +01:00
PixieCore
7b5676210b Added new ConCommand to list all loaded rpaks. By @r-ex 2022-03-23 20:31:29 +01:00
Amos
ff06cb71eb Fix build for S1 2022-03-07 11:36:45 +01:00
Amos
16f2bbc45c Adapt even more to new log system 2022-03-07 11:32:12 +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
7b971d0398 Disable starpak error handling on the dedicated server
Server could be ran without any starpak files
2022-02-19 20:30:09 +01:00
IcePixelx
308160369e RTech::UnloadAsset comment and rpak header rename. 2022-02-13 17:13:54 +01:00
IcePixelx
71dabb52e1 RTech var renames and struct renames. 2022-02-13 17:07:02 +01:00
Amos
381b97eb65 Remove unnecessary include
basetypes.h is now precompiled
2022-01-16 01:40:27 +01:00
Amos
5612c7a3a7 This seems no longer needed for dedicated servers
Shader/texture assets are no longer loaded where the pointer parameters to the asset unloading function won't be out of scope anymore
2022-01-12 13:11:26 +01:00
Amos
c486c2d593 Portability to S2 completed
CServer functions are evolving quite heavily over these seasons, so these need a bit of work
2022-01-05 02:11:21 +01:00
Amos
83129e88f8 Fix LLVM compiler error 2021-12-29 22:59:34 +01:00
IcePixelx
f5208d2b61 Fixed NET::ShutDown recursive calling, fixed decompressed patch header size on decompress. 2021-12-27 20:44:37 +01:00
Amos
e03d74b753 Rename RTech decompression methods 2021-12-27 16:58:07 +01:00
Amos
69161ae6c0 Implement RTech_AsyncLoad hook and concommand
The ConCommand 'rtech_asyncload' allows the user to load specific pak files on-demand.
2021-12-27 16:53:35 +01:00
IcePixelx
c81aca28de Fixed a few asserts regarding the gui. RPak things. Check description.
* Fixed assert on ImGui on IBrowser because ImGui::Begin wasn't followed up by ImGui::End
* FileExists got modernized. Using std library instead of Windows native functions now.
* RTech::DecompressedSize is actually readable now thanks to steyk.
* Same goes for RTech::Decompress
* rtech_decompress prints the decompressed file CRC32 now and writes the file all at once.
* Fixed ImGui assert on spamming SetupImGui();
2021-12-26 02:30:20 +01:00
Amos
d5b2e58dae Code base refactor + major performance and readability improvement. Read description for details.
* Codebase restructured to SourceSDK codebase style and .cpp/.h assertion paths in the game executable.
* Document most functions with valve style 'Purpose' blocks.
* Rename variables to match the rest of the codebase and Valve's naming convention.
* Dedicated DLL and the SDKLauncher now share the same codebase as the DevSDK.

* Obtain globals or pointers directly instead of waiting for runtime initialized data.
* Dynamically search for all functions and globals (this doesn't count for dedicated yet!).
* Initialize most in-SDK variables.

* Move certain prints and other utilities under ConVars to reduce verbosity and increase performance.
* Print all pattern scan results through a virtual function to make it easier to add and debug new patterns in the future.
* Type global var pointers appropriately if class or type is known and implemented.
* Forward declare 'CClient' class to avoid having 2 'g_pClient' copies.
* Add IDA's pseudo definitions for easier prototyping with decompiled assembly code.

* RPAK decompress Command callback implementation.
* Load decompressed RPaks from 'paks\Win32\' overriding the ones in 'paks\Win64\' (the decompress callback will automatically fix the header and write it to 'paks\Win32\').

* VPK decompress Command callback implementation.
* Move CRC32 ands Adler32 to implementation files.

* Server will print out more details about the connecting client.

* Upgrade ImGui lib to v1.86.
* Don't compile id3dx.h for dedicated.
* Don't compile id3dx.cpp for dedicated
* Implement DevMsg print function allowing to print information to the in-game VGUI/RUI console overlay, ImGui console overlay and the external windows console

* Fixed bug where the Error function would not properly terminate the process when an error is called. This caused access violations for critical/non-recoverable errors.
* Fixed bug where the game would crash if the console or server browser was enabled while the game was still starting up.
* Several bug fixes for the dedicated server (warning: dedicated is still considered work-in-progress!).
2021-12-25 22:36:38 +01:00