43 Commits

Author SHA1 Message Date
Kawe Mazidjatari
5548a74d59 Major cleanup (see description)
* Fix all compiler error for GameSDK on S0 and S1.
* Remove some unused patterns and globals (launch performance gains of 100ms).
* Remove most duplicate patterns.
* Relocate globals from engine to a more appropriate location.
* Renamed some unknown vars to a more appropriate name (most of these where obtained a while back, but as we reversed more parts of the engine, some of these vars become known).
* Renamed some vars to fit the naming convention used in the SDK.
* Fixed pattern debug logging using the wrong pointer, thus displaying the wrong address.
2022-08-18 02:15:23 +02:00
Kawe Mazidjatari
8bf6dac3d8 Code improvements
* Use GetVirtualMethodTable for VFTable pointers.
* Pack CClientState to 4 bytes (this aligns it properly in memory).
* Use CClientState members directly for setting m_bRestrictServerCommands/m_bRestrictClientCommands.
2022-08-15 22:29:16 +02:00
Kawe Mazidjatari
88b3336758 Many small code improvements and optimizations
* Use c++ methods as much as possible.
* Use enum types for accessing NavMesh objects from array.
* Use size_t for for loops when testing against size types.
* Don't compute strlen twice of more on the same string.
* Don't use unnecessary c string casts if there is a method with a std::string overload.
* Don't create string objects from string pointers if we could use them directly.
* Don't initialize RCON password twice on each change, and don't set if the new password equals the old.
2022-08-11 11:07:45 +02:00
Kawe Mazidjatari
8c6ee8a834 Remove 'm' prefix from dll globals
Large commit.
2022-08-09 03:02:00 +02:00
PixieCore
178aeeb3fd Use GetVirtualMethodTable for VTable consts. 2022-07-21 20:36:47 +02:00
PixieCore
f57da25341 RTech changes.
* Added RPakAssetBinding_t.
* Added RPakUnknownStruct_t
* PatternScan the global RPakUnknownStruct_t.
* Renamed Members of CMaterialGlue
* RTechTextureInfo_t now has another unknown member named.
2022-07-20 11:27:42 +02:00
rexx
dad356b0c3 rename materialglue/shaderglue members 2022-07-18 22:00:03 +01:00
PixieCore
746e7e9996 CMaterialGlue changes.
* Reversed more of the class and fixed up member names.
2022-07-16 12:33:02 +02:00
PixieCore
1b2c0cecd0 CShaderGlue changes and RTech implementation.
* Added RTech::LoadShaderSet for the asset load routine
* Grabbing CShaderGlue::SetupShader and CShaderGlue::m_pVTable dynamically now
* Everything verified for every season, cross-compatible!
2022-07-04 22:52:10 +02:00
PixieCore
8860d9b1b8 fix compilation 2022-07-03 22:57:07 +02:00
PixieCore
2b1374cff8 Added CShaderGlue VTable context 2022-07-03 22:44:25 +02:00
PixieCore
1e2bfe6dd2 90% Fully reversed CShaderGlue 2022-07-03 21:55:35 +02:00
PixieCore
6a90314fc1 Update cshaderglue.h 2022-07-03 13:57:24 +02:00
PixieCore
3efd7ece3b Changed a datatype in CShaderGlue 2022-07-01 22:53:46 +02:00
PixieCore
2e559863a8 CMaterialGlue and CShaderGlue
* Cleaned up CMaterialGlue
* Added slight implementation of CShaderGlue
2022-07-01 22:50:22 +02:00
Kawe Mazidjatari
2678fe2ec8 StreamDB_Init cleanup
Removed unused third parameter from DevMsg call.
Added log for loading non override STBSP files.
2022-06-23 20:08:07 +02:00
Kawe Mazidjatari
7c0c541405 FileExist cleanup
Use fs::path constructor for all strings.
Renamed CPakFile::AsyncLoad to CPakFile::LoadAsync.
Renamed CPakFile::Load to CPakFile::LoadPak.
2022-06-12 12:40:26 +02:00
Kawe Mazidjatari
2cc47f60e2 Cleanup for 'StreamDB_Init' 2022-05-27 22:31:52 +02:00
Kawe Mazidjatari
4b72afb74f Light refactor for logging
Moved logging functions to dbg.h (tier0) and export them from the dll.
Added additional functions for checking bad pointers (debug only!).
Reduced output code size.
2022-05-25 14:18:29 +02:00
Kawe Mazidjatari
c19dc30898 Fix S1 compiler error 2022-05-18 01:22:59 +02:00
Kawe Mazidjatari
42bb077e8e Update cmaterialsystem.h 2022-05-18 01:01:49 +02:00
Kawe Mazidjatari
637041d5e7 Use 'fs' instead of 'std::filesystem' 2022-05-16 21:54:46 +02:00
Kawe Mazidjatari
81dcfa60a0 Cleanup 2022-05-13 17:51:01 +02:00
Kawe Mazidjatari
3144227ec8 Update GetAdr implementations to feature spdlog
Fixed all alignments and reduced code verbosity
2022-05-13 14:53:25 +02:00
Kawe Mazidjatari
a479b4ac78 See description
Fixed rare crash in CMDLCache when buffer itteration returns invalid pointer (not null!) for handle.

Made all variables and functions used by BuildPropStaticFrustumCullMap searched dynamically (these should also work on s0, s1 and s2, they are compared but at the moment untested).

TODO: Fix deref crash properly (see bsplib.cpp l291).
2022-05-01 05:38:51 +02:00
Kawe Mazidjatari
4ead3ab1c9 Fix rare crash
This crash happens when the BSP is missing a lot of shaders and materials.
The call originates from 'R_DrawWorldMeshesDepthOnly()', but it is unclear which missing shader is causing the nullptr.  checking for a nullptr here should be sufficient to deal with this kind of missing shader
2022-04-30 20:35:08 +02:00
Kawe Mazidjatari
e32cc6ae6a Code overhaul
Moved every pattern to IDetour interface. This allows for debugging patterns scans more easily, and create threads during pattern searching (Operation is now fired in APIENTRY).

Also cleaned up some unused code/extraneous comments.
Slightly increased performance by purging duplicate patterns.
Made variable search less dependent from other results (except if pattern-to-scan results is within the same header)
2022-04-18 03:35:08 +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
a5a8f85764 Rename materialsystem to cmaterialsystem
Naming it the same as Valve did
2022-03-26 01:04:20 +01:00
PixieCore
70b6bb038c CMaterialGlue: Replaced padding at the end with unknown members.
They all have proper sizes.
2022-03-23 19:29:23 +01:00
PixieCore
9476897018 Forgot to add namespace on datatype. 2022-03-18 21:39:55 +01:00
PixieCore
8a672f4dfc CMaterialGlue changes.
Discovered new potential names for class vars.
2022-03-18 21:38:57 +01:00
PixieCore
96ee0a834d Added DXTexture fields to CMaterialGlue 2022-03-18 20:13:28 +01:00
PixieCore
0c9e184e3f GetMaterialAtCrossHair changes, CMaterialGlue changes.
CShaderGlue still needs to be reverse engineered.
CMaterialGlue still needs verification for S0-S2 to see if the struct matches.

Patterscanning GetMaterialAtCrossHair now.
2022-03-18 18:34:27 +01:00
PixieCore
627b25c120 Initial implementation of CMaterialGlue.
Some GUID's are still unknown.

Class members need verification like the material resolution member.

Added a ConCommand for getting the material we are currently looking it and printing it to the console.

Porting to other seasons still need to be done.
2022-03-18 13:47:22 +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
0177c17da9 Draw simulation stats and GPU stats to debug text overlay 2022-01-09 16:14:41 +01:00
Amos
84e7729ca0 Add client and debug utilities + cleanup 2022-01-04 11:56:31 +01:00