321 Commits

Author SHA1 Message Date
Kawe Mazidjatari
20b6b021d9 /W4: Fix verbose compiler warning caused by type demotion
Explicitly demote to unsigned char.
2023-04-02 09:43:08 +02:00
Kawe Mazidjatari
b648378574 Turn 'TxtrAssetToDxgiFormat' into constant table
Turned into an actual constant.
2023-04-02 01:40:28 +02:00
Kawe Mazidjatari
4357c9dbf3 Fix many compiler warnings
Fix many compiler warnings indicating potentially unwanted implicit conversions/truncations.
2023-04-02 00:59:24 +02:00
Kawe Mazidjatari
4c79b5af5d Change immediate from decimal to hexadecimal
Force consistency.
2023-04-01 21:43:16 +02:00
Kawe Mazidjatari
7a521d1d27 Turn static map into jump table
Slightly increase performance and reduce overhead during texture creation.
2023-04-01 11:27:53 +02:00
Kawe Mazidjatari
e3429705eb Fix crash caused by CAppSystemGroup changes
* Moved 'm_pFileSystem' to 'CSourceAppSystemGroup' (actually belongs there, CAppSystemGroup has to be 0xA8 in size in order for 'm_bDedicated' to line up in 'CModAppSystemGroup').
* Prefixed all static functions with 'Static' to avoid name collisions.
2023-04-01 01:27:04 +02:00
Kawe Mazidjatari
2fdcf2ce2c Reverse engineer 'CAppSystemGroup' class
Partially reverse engineered.
2023-04-01 01:07:20 +02:00
Kawe Mazidjatari
5056d8f040 Move interface types to public header 2023-04-01 01:05:43 +02:00
Kawe Mazidjatari
654d7a97e7 Remove extraneous trailing semicolon 2023-03-28 21:18:11 +02:00
Kawe Mazidjatari
5a0be4a275 Fix ConVar crash
Fix crash caused by vftable error. Since we are not implementing anything, but only interfacing with the game executable, we need to rename the IConVar variant's due to name ambiguity. Re-defining them in the actual class will lead into vftable misalignment and cause a crash (or other undesired behavior) as a result.
2023-03-28 01:24:55 +02:00
Kawe Mazidjatari
9e7fbdca54 ConVar/ConCommand class refactor and bug fixes
* Refactored ConCommandBase, ConCommand and ConVar class to make them all virtual, so it could interface with the game's implementation.
* Properly initialize members for ConCommand and ConVar instead of just calling memset.
* Fixed bug in ConVar registration function causing the virtual base table pointer to point to the ConCommand implementation instead of the ConVar implementation.
2023-03-28 00:50:08 +02:00
Kawe Mazidjatari
c86122f63e Add collision types to SDK
Merged from branch 'collision_debug'.
2023-03-27 17:42:55 +02:00
Kawe Mazidjatari
c29c2a9063 Adjust SMap path formatting
'/' is always a path separator, '\\' is implementation defined. The standard filesystem class takes care for OS regardless. Changed to standard separator.
2023-03-21 00:20:22 +01:00
Kawe Mazidjatari
68b5fc24fb Remove CSigCache singleton from PCH
Removed from precompiled header, and only used where needed.
2023-03-20 00:24:40 +01:00
Kawe Mazidjatari
1bd1ef6330 Make patching code compatible with older compilers
Make it compatible with older versions of the Visual Studio 2017 compiler.
2023-03-20 00:21:03 +01:00
Kawe Mazidjatari
b33fa424b5 Fix edge case crash in VDF parser
Check if 'curObj' isn't nullptr.
2023-03-19 11:25:19 +01:00
Kawe Mazidjatari
bdeadc039f Finish 'FindFileAbsoluteList' prototype
'CUtlString' has been implemented recently; finish function prototype.
2023-03-18 21:37:11 +01:00
Kawe Mazidjatari
f7e7858dae HexDump: optimizations
Optimize hexdump utility by packing as many trace calls as possible and by changing single character pointers to immediate values. Also adjusted function to support newer versions of the spdlog library.
2023-03-18 13:31:56 +01:00
Kawe Mazidjatari
ed7186e4d3 Add STL string formatters
Add STL string formatters, these formatters allow for formatting the STL strings using C-style format specifiers.
2023-03-13 21:34:09 +01:00
Kawe Mazidjatari
be3690d0b3 Light cleanup for IsValidUTF8 2023-03-13 21:30:16 +01:00
Kawe Mazidjatari
cae5037324 Initial fix for older game builds
SDK compiles and works for the S1 game now, still needs to be debugged further.
2023-03-01 00:09:38 +01:00
Kawe Mazidjatari
853aab9c81 Increment sigdb version
Protobuf has been updated, increased major version to enforce full rebuild.
2023-02-26 22:25:18 +01:00
Kawe Mazidjatari
367b2cf5bc Renames and new setters for CNetChan
* Renamed hooking class to 'VNetChan'
* Added new setters for setting the remote frame times, and the remote server CPU statistics.
2023-02-18 00:05:55 +01:00
Kawe Mazidjatari
eec9c21648 Implement SVC_ServerTick properly
* Message handler is now part of the CNetMessage base class.
* SVC_ServerTick has been implemented, and is ready for use.
2023-02-18 00:03:30 +01:00
Kawe Mazidjatari
7f127ddcbe Rename 'nettick_s' members 2023-02-15 21:43:15 +01:00
Kawe Mazidjatari
559f15a459 Fix compile errors
This belongs to commit 8550d7a8.
2023-02-15 20:46:37 +01:00
Kawe Mazidjatari
8550d7a865 Rename 'TickUpdate' to 'nettick_t' and move to public
Renamed, and moved to public. also added additional static assertions to avoid alignment mistakes in the future.
2023-02-15 17:52:25 +01:00
Kawe Mazidjatari
3d5ad71f25 Force full rebuild of SMap
Force rebuild due to invalid RVA in shipped cache map.
2023-02-13 23:53:53 +01:00
Kawe Mazidjatari
9a8db42575 Improve and fix 'CStudioHdr'
* Fixed crash that occurred due to misaligned member 'm_pMdlCacheVTable' which has been retyped to 'CMDLCache*' and renamed to 'm_pMDLCache' (actual object).
* Added mapped out member 'm_pModelName'.
2023-02-13 23:46:37 +01:00
Kawe Mazidjatari
246312840b Force full rebuild of SMap
Force full rebuild due to changed/added/removed signatures.
2023-02-12 20:07:27 +01:00
Kawe Mazidjatari
cbed704bab Performance improvements for str tools
Improve performance for 'StringToMaskedBytes' and 'PatternToMaskedBytes' by appending characters as immediate (char) values instead of pointers.
2023-02-12 19:05:34 +01:00
Kawe Mazidjatari
b1f2f47058 Update names across codebase 2023-02-12 15:06:08 +01:00
Kawe Mazidjatari
c888422d51 Remove unnecessary padding and add static assert 2023-02-12 14:57:39 +01:00
Kawe Mazidjatari
d2c8f7becc Update 'CGlobalVarsBase'
Mapped it out a little bit better.
2023-02-12 14:54:04 +01:00
Kawe Mazidjatari
a8c5ed45fd Fix IAppSystem VFTable
Destruvtor is prepended on every class in-engine. Reflected in SDK. Also removed extraneous method from ICvar causing other methods below it to misalign after the IAppSystem change.
2023-02-06 02:15:01 +01:00
Kawe Mazidjatari
a8ef2b74cd Implement ConCommand completion logic
Implementation of the ConCommand completion logic for the Dear ImGui console panel.
2023-02-05 19:21:39 +01:00
Kawe Mazidjatari
87ff71675b Implement ICvar interface class
Reversed ICvar interface class. Has been tested and verified on assembly level.
2023-02-05 11:01:27 +01:00
Kawe Mazidjatari
22d2cc5a7a Change 'FileFindHandle_t' type
Make 64 bits for target.
2023-02-04 16:00:14 +01:00
Kawe Mazidjatari
60ab35b5c4 Light optimizations for string utils
* Changed 'CreateDirectories' to only copy sanitized path if pointer to string is passed.
* Changed 'IsValidBase64' to only tokenize base64 value if pointer to string is passed.
2023-02-04 15:59:45 +01:00
Kawe Mazidjatari
4c123e20d0 CIOStream and CSigCache class improvements
CIOStream:
* Use flag based system instead (common flags are aliased; uses std::ios_base::openmode).
* 'ReadString' now writes into a string buffer (reference) that needs to be passed in by programmer (avoids copy).
* 'm_nSize' is now synced with any write operations.

CSigCache:
* Fixed bug causing crash when 'DecompressBlob' failed (results were never checked).
* Light formatting improvements.
2023-02-04 00:36:05 +01:00
Kawe Mazidjatari
3ea7cc1cd4 CModule: class improvements
* Added 'GetImportedFunction'.
* Remove extraneous std::string copy constructors during construction of 'm_vModuleSections'.
* Added extra constructor using base address.
2023-01-31 23:52:11 +01:00
Kawe Mazidjatari
af42dfafe3 Bump sig cache version
Signatures have changed, force rebuild of db.
2023-01-31 23:46:26 +01:00
Kawe Mazidjatari
34f69a5b1e Move crashhandler implementation to tier0 2023-01-31 22:13:40 +01:00
Kawe Mazidjatari
281addc68e Fix crash whitelist not working on client.dll
Unregister gamesdk's crash handler if -noworkerdll is passed. This is required as both crashhandlers will be called during an exception, and on one, the whitelist wouldn't work.
2023-01-31 21:48:42 +01:00
Kawe Mazidjatari
f0512d7f92 Add 'CAppSystemGroup::Destroy' callback
* Add hook for 'CAppSystemGroup::Destroy'.
* Moved 'IAppSystem.h' header file to public.
2023-01-30 21:22:17 +01:00
Kawe Mazidjatari
6df498e5c8 Rename 'v_netadr_t' to 'netadr_t'
Name was used for compatibility reasons. No longer necessary.
2023-01-29 15:12:27 +01:00
Kawe Mazidjatari
500a7c1925 Finish libcurl implementation
Master server queries now use SSL.
2023-01-26 20:06:48 +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
Kawe Mazidjatari
5a9824d30c Remove useless assert
Invalid assert as rebuilding cache map happens prior to initialization.
2023-01-24 00:54:13 +01:00
Kawe Mazidjatari
888989d2b3 Fully working implementation of 'sv_showhitboxes'
Setting 'sv_showhitboxes' to 0 will enable it on everything deriving from CBaseAnimating, and having a valid studiohdr/hitbox. -1 means off, value > 0 will select entity by index (value of 'sv_showhitbox').
2023-01-24 00:53:45 +01:00