115 Commits

Author SHA1 Message Date
Kawe Mazidjatari
359820615f Move low level code to tier0/tier1
Moved to tier0/tier1 so it could be compiled into a static library in the future.
2023-05-06 22:59:01 +02:00
Kawe Mazidjatari
e8f6bf0eda Bump signature cache version
Force a full rebuild as some signatures have changed.
2023-05-01 23:45:42 +02:00
Kawe Mazidjatari
8ffe04c736 Bump cache version
Force full rebuild of cache map due to changed/added/removed signatures.
2023-04-30 21:49:04 +02:00
Kawe Mazidjatari
c354d7ae02 Add ability to compare IPv6 addresses 2023-04-16 11:55:57 +02:00
Kawe Mazidjatari
350dd4fcca Bump cache version
Force full rebuild; a new signature was added.
2023-04-10 23:45:33 +02:00
Kawe Mazidjatari
7c6094fc19 Bump sigcache version
Bumped to force a full rebuild of the signature cache map.
2023-04-10 00:13:05 +02:00
Kawe Mazidjatari
3dd4054838 'IsValidUTF8' const correctness
Does not modify the string; make it const.
2023-04-09 23:34:06 +02:00
Kawe Mazidjatari
1d04f837f8 Fix many high level compiler warnings
* Put initializer values inside brackets.
* Put logical AND conditions within parentheses.
* Put assignments within conditional statements within parentheses.
* Mark unused variables as such to suppress compiler warnings.
* Fix vftable shadow warnings caused by ConVar::CreateInternal (does not implement, only interface. Renamed to yield desired behavior).
* Fix 'never' initialized class members for 'CCVarIteratorInternal'.
* Return values in interface vftables that cannot be pure virtual.
2023-04-08 19:00:28 +02:00
Kawe Mazidjatari
60b38e8904 Implement 'StringUnescape' properly 2023-04-08 18:05:05 +02:00
Kawe Mazidjatari
4890593203 Add absolute array comparators
Check for highest/lowest value in array (absolute).
2023-04-08 13:32:34 +02:00
Kawe Mazidjatari
fe0cce731b Explicitly disable certain warnings in code
This code is good as-is, they cannot be adjusted to suppress the warnings while still guaranteeing its functionality.
2023-04-03 14:55:16 +02:00
Kawe Mazidjatari
c729b6faa8 Fix symbol shadowing warnings in VDF parser 2023-04-03 14:52:22 +02:00
Kawe Mazidjatari
e79ed464e9 Improve HexDump utility
* Improved formatting.
* Get default logger directly instead of using a string identifier.
* Promoted size type to 'size_t'.
* Removed extraneous static variables.
2023-04-02 21:51:15 +02:00
Kawe Mazidjatari
09553e3e2c /W4: Fix incorrect instantiation of string transformer
The case transformation didn't work properly as the char value was not casted to an unsigned char, causing undefined behavior. Added new utility function 'IsEqualNoCase' which allows for comparing 2 strings case insensitively. Code has been tested with module strings containing irregular cases, and was still able to obtain the imported function address correctly.
2023-04-02 15:16:32 +02:00
Kawe Mazidjatari
978f108526 /W4: Fix incorrect type cast
Values passed to functions from '<cctype>' must be representable as unsigned chars to avoid undefined behavior.
2023-04-02 14:58:02 +02:00
Kawe Mazidjatari
0f461b7695 /W4: Fix unreferenced functions and light cleanup
* Fully commented 'UTF8Decode' to suppress warnings (currently unsupported).
* Cleaned up 'GetModuleInfo' and 'DbgPrint' to use the non-wide string versions instead.
* Added error handling in 'PrintLastError'.
2023-04-02 14:52:12 +02:00
Kawe Mazidjatari
a4a2f34c10 /W4: Fix signed/unsigned mismatch
This commit fixes warnings and bugs caused by signed/unsigned mismatch.
2023-04-02 12:09:43 +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
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
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
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
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
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
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
500a7c1925 Finish libcurl implementation
Master server queries now use SSL.
2023-01-26 20:06:48 +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
Kawe Mazidjatari
eede2b65f3 Force signature dictionary full rebuild
Launch times become slower in debug builds due to the many added signatures; force full rebuild of dictionary.
2023-01-23 02:24:41 +01:00
Kawe Mazidjatari
4022fbd3ad Fix bad assert
Field 'm_bInitialized' should be set prior to calling this, this field was named differently and its use case was inverted, forgot to reflect changes in assert.
2023-01-21 14:49:53 +01:00
Kawe Mazidjatari
d5ef71200f Update sig cache minor version
Invalidate old databases and rebuild as signature for 'gpGlobals' has changed.
2023-01-18 01:35:27 +01:00
Kawe Mazidjatari
94bf515ba7 Add gpGlobals to SDK 2023-01-17 11:21:10 +01:00
Amos
39920283c0 Fix arithmetic register formatting for high number
High values would cause the formatting to be decimal while it should be hexadecimal if the value equals or exceeds one million.
2023-01-16 15:28:39 +01:00
Kawe Mazidjatari
d8dd9aba93 Fix CCrashHandler method name
Renamed from APU to ALU (typo).
2023-01-04 14:55:58 +01:00
Kawe Mazidjatari
08ed169cf3 Only run game's exception filter if ours didn't handle it
This is required as otherwise the game's exception filter will be called after ours. If we didn't handle the exception, the game's implementation, or an exception handler associated to the exception raised by address will take care of it. Unlike the game's implementation, our exception handler does not handle unknown exceptions. We only do the low level stuff reliably.
2022-12-28 21:44:51 +01:00
Kawe Mazidjatari
f00153ccb4 Rename exception filter 2022-12-28 21:39:58 +01:00
Kawe Mazidjatari
3c7ad57650 CCrashHandler improvements
* Move large module instance array to the heap.
* Add ability to query whether or not an exception was handled.
2022-12-28 21:38:47 +01:00
Kawe Mazidjatari
2c70283397 CCrashHandler improvements
* Only handle exceptions we could handle (anything that isn't in the switch case is not getting handled).
* Only show hexadecimal representation of decimal integer if could contain hexadecimal digits.
2022-12-28 20:30:33 +01:00
Kawe Mazidjatari
5de241b807 CCrashHandler: light cleanup 2022-12-28 16:36:52 +01:00