3683 Commits

Author SHA1 Message Date
Kawe Mazidjatari
a17a2c9feb Recast: remove use of auto
Useless use of auto
2024-04-05 17:56:53 +02:00
Kawe Mazidjatari
115b8e214a utility: fix STL string formatter bug
Must reserve a buf size of len+1 before resizing it, else we are 1 byte too short when copying the entire string. Also just clear when 0.
2024-04-05 17:56:53 +02:00
Kawe Mazidjatari
60a3cee531 Engine: hoststate loop cleanup
Logic hasn't been changed, conditions have been brought into the loop itself
2024-04-05 17:56:53 +02:00
Kawe Mazidjatari
8feffd2487 Engine: add missing include
Needed for NucleusID_t.
2024-04-05 17:56:53 +02:00
Kawe Mazidjatari
f27454aef1 NVIDIA: disable gfx_nvnUseMarkersToOptimize by default
Causes rubber banding on some systems.
2024-04-05 17:56:52 +02:00
Kawe Mazidjatari
ff9aa78d0d Thirdparty: upgrade SpdLog to 1.13.0 2024-04-05 17:56:52 +02:00
Kawe Mazidjatari
f0907ca9f1 BanSystem: refactor & fix bugs
* Make sure we read the banlist from platform as well, just like how we write to it.
* Use strtoull() instead of atoll() for nucleus id values, nucleus id is unsigned so we must convert to unsigned.
* Remove extraneous try catches, these were previously used for integral type conversions that threw exceptions, but the current ones do not throw so the try catch is unnecessary.
2024-04-05 17:56:52 +02:00
Kawe Mazidjatari
e59c6c88c9 Tier1: add V_IsAllDigit()
This function checks if a string consists of only numeric characters.
2024-04-05 17:56:52 +02:00
Kawe Mazidjatari
dd20e9f4aa Engine: use NucleusID_t type for CClient 2024-04-05 17:56:51 +02:00
Kawe Mazidjatari
4f4b029538 RapidJSON: use iterative parsing instead
Use iterative parsing to protect against stack overflows in rare cases
2024-04-05 17:56:51 +02:00
Kawe Mazidjatari
c8e5d263bd Thirdparty: upgrade to latest RapidJSON 2024-04-05 17:56:51 +02:00
Kawe Mazidjatari
6edd80e506 RTech: mark const 2024-04-05 17:56:51 +02:00
Kawe Mazidjatari
f5424f4bd0 Core: use forward slash when formatting logger files
Minor cleanup
2024-04-05 17:56:51 +02:00
Kawe Mazidjatari
6434b8abe9 Tier0: crash handler refactor & bug fix
Fix syntax error on page protection flags check when determining whether we encountered a return address. Also limit the amount of dynamic memory allocation calls, offer a large enough static buffer where we can just write into when we crash without needing to alloc or realloc anything. Also removed some hacky code like the whitelist set, and made the module handle array static into the class as well. The CrashHandler singleton is now a static class instance.
2024-04-05 17:56:51 +02:00
Kawe Mazidjatari
a2ceab52da Tier1: fix type demotion warning
Promote type to signed size type.
2024-04-05 17:56:51 +02:00
Kawe Mazidjatari
eae0d0964b Tier0: iostream light cleanup
- Take const char* directly instead of making extraneous copies
- Add overload for reading strings into fixed size buffers
2024-04-05 17:56:51 +02:00
Kawe Mazidjatari
fed4ce80bf RTech: properly disable asset streaming on dedicated server
Just set the mode to 0, required as we rebuilt the functions and can't really check for dedicated there, we have to initialize it with this mode.
2024-04-05 17:56:51 +02:00
Kawe Mazidjatari
79cee02a62 Tier0: bump sigcache minor version
Force rebuild of local cache since many signatures have changed.
2024-04-05 17:56:50 +02:00
Kawe Mazidjatari
41a114bb54 ReVPK:
Fix usage text, there were some errors in it.
2024-04-05 17:56:50 +02:00
Kawe Mazidjatari
241aefd6f3 VpkLib: actually search for corresponding data block file
Instead of just using English as default, actually scan for all supported directory tree files, error if not found. This completes the sanitization logic which allows the user to only pass in the data block file to load the directory tree file
2024-04-05 17:56:50 +02:00
Kawe Mazidjatari
6a60a46fc0 RTech: make PakPatchDataHeader_t fields unsigned and add static assert for struct size 2024-04-05 17:56:50 +02:00
Kawe Mazidjatari
63f55578eb RTech: rename AsyncHandleTracker_t fields
Better names
2024-04-05 17:56:50 +02:00
Kawe Mazidjatari
f78d04dda8 RTech: use Max() from our own headers 2024-04-05 17:56:50 +02:00
Kawe Mazidjatari
29c7cc9e58 ZStd: explicitly set debug level
Explicitly set to 0 for release
2024-04-05 17:56:50 +02:00
Kawe Mazidjatari
ff98df556c Fix unresolved external symbols
These projects used 'V_FixSlashes' but weren't licked to Tier1.
2024-04-05 17:56:50 +02:00
Kawe Mazidjatari
0b7805101c RTech: cleanup & const correctness 2024-04-05 17:56:50 +02:00
Kawe Mazidjatari
b92c2daea1 RTech: fix bug when string is NULL
Fixes a crash because string can be NULL when this is called
2024-04-05 17:56:50 +02:00
Kawe Mazidjatari
f2e49c8a4a IOStream: improve seeking logic
Instead of seeking to the very start again when GetSize() is called, seek back to the original position. Also added dedicated methods for seeking put or get instead of using the mode since this is a fstream
2024-04-05 17:56:49 +02:00
Kawe Mazidjatari
f5a8ca3e7a RTech: fix numeric overflow caused by massive pak files
Pak files above 4GB caused the async file system to throw an error about failing to load audio banks, removed casts and promoted everything correctly. Also removed irrelevant comments in the public pakfile header.
2024-04-05 17:56:49 +02:00
Kawe Mazidjatari
4d74dc5052 RTech: fix bug when trying to print fourcc as string
The printf specifier does not allow limiting buffer reads. Made the FourCCToString more performant by using a fixed size stack array and creating the fourcc into that which we now use to properly print out the asset magic.
2024-04-05 17:56:49 +02:00
Kawe Mazidjatari
082a8e4ef7 RTech: minor cleanup and renaming 2024-04-05 17:56:49 +02:00
Kawe Mazidjatari
2322e3a9be Tier1: remove parameter description that doesn't exist 2024-04-05 17:56:49 +02:00
Kawe Mazidjatari
05b51fbd8c RTech: update comment on pak header flag
Patches can actually use different compression algorithms, but the patch headers must accommodate for pak file sizes properly. One pak could also be compressed while the others aren't if patch headers present correct sizes (both RTech and ZStream)
2024-04-05 17:56:49 +02:00
Kawe Mazidjatari
3b9626612f RTech: add buffered decompress function, cleanup and bug fixes
The pak_decompress callback has been fully moved to a dedicated buffered pak decoder function, also added descriptive error to the buffered pak encode function. Fixed a bug in the streamed pak decoder where the next required streamed buffer size would always be below actually required on any subsequent patch rpaks that are getting loaded. Also fixed assert in Pak_ZStreamDecode, as the inbuf position can equal total streamed size, but shall never exceed it!
2024-04-05 17:56:49 +02:00
Kawe Mazidjatari
c7471dc472 RTech: add several new pak tools
Added tools to reduce noise in pak code in a planned refactor
2024-04-05 17:56:49 +02:00
Kawe Mazidjatari
3eb3c27975 Utility: fix bug in CreateDirHierarchy
Fix bug where even the last path would be processed in the loop, making the return call always return an error as the path would've been created by that time. This ensures that we always return the value returned by mkdir when creating the last path
2024-04-05 17:56:48 +02:00
Kawe Mazidjatari
22431e903c FileSystem: make CreateDirHierarchy and IsDirectory general function
Moved to general utility
2024-04-05 17:56:48 +02:00
Kawe Mazidjatari
1c2b02b972 RTech: cleanup ZStd pak decoder and fix bugs
* Pak_InitDecoder() now takes the output buf and mask as parameters.
* Pak_InitDecoder() checks if provided masks are a power of 2 (required).
* Pak_ComputeRingBufferFrame() now uses the bit mask instead of modulo to determine # bytes used.
* Fixed a bug where PakDecoder_t::bufferSizeNeeded could be bigger than the file stream, causing a deadlock.
2024-04-05 17:56:48 +02:00
Kawe Mazidjatari
5ea886ab65 RTech: move ZStd free code to actual decoder
Let the decoder free it to avoid memory leaks
2024-04-05 17:56:48 +02:00
Kawe Mazidjatari
2d6533adf1 RTech: add info about small pak file's ring buffers 2024-04-05 17:56:48 +02:00
Kawe Mazidjatari
e1c889719a RTech: properly implement ring buffer stream decode for Zstd decoder
The new decoder can now decode patched and custom rpaks files, all issues so far have been fixed. The code still needs some testing and bench marking to make sure
2024-04-05 17:56:48 +02:00
Kawe Mazidjatari
e90349cc0f RTech: properly deal with patch headers when encoding pak files
Patch header must be updated to accommodate the new pak file sizes the patch pak patches.
2024-04-05 17:56:48 +02:00
Kawe Mazidjatari
10af9ac695 Tier0: add overload for reading pointer data and fix write overload
Write should've been a pointer instead.
2024-04-05 17:56:48 +02:00
Kawe Mazidjatari
a529a16822 RTech: add helpers for parsing patch header data
Should significantly reduce noise in code
2024-04-05 17:56:48 +02:00
Kawe Mazidjatari
cbae59a158 ZStd: fix typo in CMakeLists
Incorrect filter name
2024-04-05 17:56:47 +02:00
Kawe Mazidjatari
a9ed0762e1 ZStd: suppress thirdparty code warnings 2024-04-05 17:56:47 +02:00
Kawe Mazidjatari
f16bf580f4 RTech: use define for invalid async file handle 2024-04-05 17:56:47 +02:00
Kawe Mazidjatari
7a03238fc9 RTech: add simple pak encoder command
Encodes a pak file with ZSTD.
2024-04-05 17:54:06 +02:00
Kawe Mazidjatari
3020abeed7 RTech: remove temp debugging code 2024-04-05 17:54:06 +02:00
Kawe Mazidjatari
da0ecd8ae1 RTech: fix bug in decompress error format
Must not include pak header size since we parse compressed frame header and determine actual frame size from there, else we get 2 equal number that somehow don't equal (Pak_InitDecoder returns frame size + pak header size)
2024-04-05 17:54:06 +02:00