26 Commits

Author SHA1 Message Date
Amos
d76ed1098a Improve VFTable address logging
More standardized VFTable address logging.
2023-01-25 11:19:53 +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
Marvin D
22506fa689 Fix VEH.
* Make sure IsMaterialInternal won't be inlined.
* Fix recurssive VEH throwing.
* Check if IsMaterialInternal caused exception and ignore it.
2022-12-24 16:40:04 +01:00
Kawe Mazidjatari
2501c37044 Globally convert all byte patterns to strings
These get reconverted to masked byte patterns at runtime. With the signature map cache system, this will only happen when building the cache.
2022-12-01 22:44:55 +01:00
Kawe Mazidjatari
bc361c7c85 Fix texture streaming debug overlay bug
Fix bug where we did not log the actual total streaming texture memory.
2022-10-30 10:18:22 +01:00
Marvin D
136ac06b7c ClipTransform, ScreenTransform (W2S) 2022-10-23 01:20:49 +02:00
Kawe Mazidjatari
fb7f77f7cb Fix dedicated.dll compile errors 2022-10-13 02:41:09 +02:00
Kawe Mazidjatari
50fee7414d Missing material error logging
This commit implements missing material error logging.
When a material does not exist, it will get replaced with an error material, we log which material is missing, and with which error material it gets replaced with.
This commit also comes with some updates regarding the CMaterialGlue class, and some new types used by this class from the RePak project.
2022-10-13 02:22:50 +02:00
Kawe Mazidjatari
a68fda98c1 Fix crash when loading arena maps caused by recent BSP crash fix
CMaterial and CMaterialGlue derive from the same abstract classes. The function that builds the culling map uses IMaterialInternal, which is used by CMaterial, CMaterialInternal and CMaterialSubRect. Added a check for CMaterialGlue as these are valid too.
2022-10-05 01:59:22 +02:00
Kawe Mazidjatari
7af660d613 Fixed rare bug where models where missing during level load
Some CMaterial instances are allocated on the heap, and we only check for bounds in .data/.pdata. Checking bounds is cheap, checking valid ptr's is not. However we are lucky most of the data is within the segments, so running this isn't too costly.
This fixes the problem where the large leaf model in worlds edge was missing.
2022-10-03 01:15:02 +02:00
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
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
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
2cc47f60e2 Cleanup for 'StreamDB_Init' 2022-05-27 22:31:52 +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
3144227ec8 Update GetAdr implementations to feature spdlog
Fixed all alignments and reduced code verbosity
2022-05-13 14:53:25 +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
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