27 Commits

Author SHA1 Message Date
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
1308ae30bf Additional CMDLCache cleanup 2022-05-06 02:49:38 +02:00
Kawe Mazidjatari
f851c29498 Optimize some CHLClient functions away for dedicated 2022-05-04 21:10:46 +02:00
Kawe Mazidjatari
26af720f7d Fill out cull map 2022-05-03 13:17:42 +02:00
Kawe Mazidjatari
6786d800cd More cleanup and slight performance boost 2022-05-03 03:40:47 +02:00
Kawe Mazidjatari
6bc638b7ce Little cleanup 2022-05-03 03:17:45 +02:00
Kawe Mazidjatari
84181f931c Remove redundant check 2022-05-03 03:10:55 +02:00
Kawe Mazidjatari
1d48574731 Refactored BuildPropStaticFrustumCullMap (see description)
Redacted most code to only perform operation to obtain studiohdr and staticprop material (read only operation, function does not modify memory used by the original 'v_BuildPropStaticFrustumCullMap()' implementation!)

The new function checks if pointer is within bounds (must stay within .data memory), if this isn't the case, the 'batch' is considered corrupt and function call to 'v_BuildPropStaticFrustumCullMap' won't proceed (note that the loop checks all bodygroups/LOD's of a model, it is possible that one doesn't have corrupt data, but a model where only one of its submeshes culls properly in the level is too much effort to fix as this function is based of disassembled output of the engine implementation, which in it self, comes with its own limitations).

For a better implementation we should proceed fully rebuilding the function (see commented function body).
The current and only problem with this is that it doesn't compute cull data properly (see bsplib.cpp line '222').
2022-05-03 02:37:37 +02:00
Kawe Mazidjatari
9178068c55 Added note to root cause of BSP problem 2022-05-02 14:53:48 +02:00
Kawe Mazidjatari
c02214748b Small bsplib improvement 2022-05-02 14:14:07 +02:00
Kawe Mazidjatari
8b4df33151 Use 'sqrtf' for computing fade distance
This has to be debugged still as the computed data does not match the one computed from the engine (this is the reason the larger maps show artifacts!)
2022-05-02 03:40:07 +02:00
Kawe Mazidjatari
7df48151d4 Some 'BuildPropStaticFrustumCullMap' improvements
Artifact problem for large maps is still not solved.
2022-05-02 03:13:39 +02:00
Kawe Mazidjatari
8ad4350f9f Improved BuildPropStaticFrustumCullMap
* Fixed bug where the address of g_pStaticPropMgr wasn't properly dereferenced and passed to function via its reference (engine addr).
* Fixed dword dereference.

Problems: engine still culls models improperly.
2022-05-01 21:09:05 +02:00
Kawe Mazidjatari
4877666fe9 Update bsplib.cpp 2022-05-01 18:00:15 +02:00
Kawe Mazidjatari
f036f2cc44 BuildPropStaticFrustumCullMap optimizations 2022-05-01 17:59:56 +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
f8f2ce6fa4 Initial working implementation of frustum building in SDK 2022-05-01 01:32:23 +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
aa57170e0d Start of pattern search refactor 2022-04-09 01:14:22 +02:00
Amos
1cc71342e8 Fix compile for clang-cl
Uncomment when this needs to be debugged again
2022-03-16 01:37:45 +01:00
Amos
fa8c9be8cc Small adjustment 2022-03-02 01:14:36 +01:00
IcePixelx
2d4c6c7f68 fixing CalcPropStaticFrustumCulling up. 2022-03-01 22:49:57 +01:00
IcePixelx
8cfc55289b Git client decided not to commit this. 2021-12-25 22:58:51 +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