3630 Commits

Author SHA1 Message Date
Kawe Mazidjatari
c72cf89465 RapidJSON: use iterative parsing instead
Use iterative parsing to protect against stack overflows in rare cases
2024-02-04 12:50:02 +01:00
Kawe Mazidjatari
5e10fde155 Thirdparty: upgrade to latest RapidJSON 2024-02-04 11:18:55 +01:00
Kawe Mazidjatari
bed3bc87a0 RTech: mark const 2024-02-04 00:55:48 +01:00
Kawe Mazidjatari
cd39a68b48 Core: use forward slash when formatting logger files
Minor cleanup
2024-02-04 00:55:33 +01:00
Kawe Mazidjatari
e728877035 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-02-04 00:55:07 +01:00
Kawe Mazidjatari
063d8d7cad Tier1: fix type demotion warning
Promote type to signed size type.
2024-02-03 23:53:22 +01:00
Kawe Mazidjatari
b89f72ac36 Tier0: iostream light cleanup
- Take const char* directly instead of making extraneous copies
- Add overload for reading strings into fixed size buffers
2024-02-03 23:34:14 +01:00
Kawe Mazidjatari
2ed42296db 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-01-30 14:30:20 +01:00
Kawe Mazidjatari
21addb83ea Tier0: bump sigcache minor version
Force rebuild of local cache since many signatures have changed.
2024-01-30 13:50:07 +01:00
Kawe Mazidjatari
dd4c9c2637 ReVPK:
Fix usage text, there were some errors in it.
2024-01-30 13:49:30 +01:00
Kawe Mazidjatari
d767824932 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-01-30 13:49:09 +01:00
Kawe Mazidjatari
f3dc26d2cb RTech: make PakPatchDataHeader_t fields unsigned and add static assert for struct size 2024-01-30 13:47:25 +01:00
Kawe Mazidjatari
e154762746 RTech: rename AsyncHandleTracker_t fields
Better names
2024-01-30 13:46:52 +01:00
Kawe Mazidjatari
07af98abd9 RTech: use Max() from our own headers 2024-01-30 13:46:31 +01:00
Kawe Mazidjatari
207bd5588c ZStd: explicitly set debug level
Explicitly set to 0 for release
2024-01-30 13:46:05 +01:00
Kawe Mazidjatari
0938eb2415 Fix unresolved external symbols
These projects used 'V_FixSlashes' but weren't licked to Tier1.
2024-01-30 13:45:37 +01:00
Kawe Mazidjatari
2a9ad5b382 RTech: cleanup & const correctness 2024-01-29 23:00:18 +01:00
Kawe Mazidjatari
82860e164b RTech: fix bug when string is NULL
Fixes a crash because string can be NULL when this is called
2024-01-29 23:00:18 +01:00
Kawe Mazidjatari
89ff792dd3 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-01-29 23:00:18 +01:00
Kawe Mazidjatari
0452720cf8 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-01-29 23:00:18 +01:00
Kawe Mazidjatari
52edcc6d84 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-01-29 23:00:18 +01:00
Kawe Mazidjatari
5ddf69c764 RTech: minor cleanup and renaming 2024-01-29 23:00:18 +01:00
Kawe Mazidjatari
ea1befbb61 Tier1: remove parameter description that doesn't exist 2024-01-29 23:00:18 +01:00
Kawe Mazidjatari
e901a32c18 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-01-29 23:00:18 +01:00
Kawe Mazidjatari
a2d869d572 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-01-29 23:00:18 +01:00
Kawe Mazidjatari
511c700fde RTech: add several new pak tools
Added tools to reduce noise in pak code in a planned refactor
2024-01-29 23:00:18 +01:00
Kawe Mazidjatari
5c0e7a944f 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-01-29 23:00:17 +01:00
Kawe Mazidjatari
7a09219002 FileSystem: make CreateDirHierarchy and IsDirectory general function
Moved to general utility
2024-01-29 23:00:17 +01:00
Kawe Mazidjatari
26ce3c50c2 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-01-29 23:00:17 +01:00
Kawe Mazidjatari
86f9dbe30f RTech: move ZStd free code to actual decoder
Let the decoder free it to avoid memory leaks
2024-01-29 23:00:17 +01:00
Kawe Mazidjatari
b81beecdf1 RTech: add info about small pak file's ring buffers 2024-01-29 23:00:17 +01:00
Kawe Mazidjatari
9b9562c8d9 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-01-29 23:00:17 +01:00
Kawe Mazidjatari
e2898802e8 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-01-29 23:00:17 +01:00
Kawe Mazidjatari
7f25ce7e42 Tier0: add overload for reading pointer data and fix write overload
Write should've been a pointer instead.
2024-01-29 23:00:17 +01:00
Kawe Mazidjatari
b65d74e8c7 RTech: add helpers for parsing patch header data
Should significantly reduce noise in code
2024-01-29 23:00:17 +01:00
Kawe Mazidjatari
b707fba198 ZStd: fix typo in CMakeLists
Incorrect filter name
2024-01-29 23:00:17 +01:00
Kawe Mazidjatari
005453a606 ZStd: suppress thirdparty code warnings 2024-01-29 23:00:16 +01:00
Kawe Mazidjatari
f61e2e1201 RTech: use define for invalid async file handle 2024-01-29 23:00:16 +01:00
Kawe Mazidjatari
31e9042eee RTech: add simple pak encoder command
Encodes a pak file with ZSTD.
2024-01-29 23:00:16 +01:00
Kawe Mazidjatari
1e949056ac RTech: remove temp debugging code 2024-01-29 23:00:16 +01:00
Kawe Mazidjatari
095f41bbe2 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-01-29 23:00:16 +01:00
Kawe Mazidjatari
4803afe6d9 RTech: initial custom pak compression implementation
Allows paks compressed with ZSTD, to be stream decoded at run time. Currently seems to work pretty good, but needs to be further battle tested + cleaned up still.
2024-01-29 23:00:16 +01:00
Kawe Mazidjatari
45e95039e8 Add ZSTD to SDK 2024-01-29 23:00:16 +01:00
Kawe Mazidjatari
39d16fa4d7 NetworkSystem: rename NetGameServer_t member vars 2024-01-29 23:00:15 +01:00
Kawe Mazidjatari
1410ecd79c MaterialSystem: rename CMaterialGlue member vars 2024-01-29 23:00:15 +01:00
Kawe Mazidjatari
8911bfa81a GameUI: cleanup and fix race condition
* Use CThreadFastMutex instead
* Rename ISurface to IDebugSurface to prevent a potential name collision with VGUI's ISurface iface if we ever add it
* Fix race condition when setting CPylon::m_HostIP from materialsystem thread, this has been dispatched to the main thread
* Marked 'pylon_matchmaking_hostname' FCVAR_MATERIAL_SYSTEM_THREAD as we use it in the server browser panel.
2024-01-21 23:06:26 +01:00
Kawe Mazidjatari
f6e6e7c30b Engine: fix out of bound access
Even though this is handles by the class, it really shouldn't happen.
2024-01-21 21:53:48 +01:00
Kawe Mazidjatari
1361bfb172 Make singletons use static memory
Avoid heap memory allocation and a level of indirection. This allows the compiler to optimize the program even more. No logic has been changed in this patch.
2024-01-21 21:29:23 +01:00
Kawe Mazidjatari
c9b80a70cd Playlists: fix resource/memory leak
Remove workaround that was implemented to counter a crash during the beginning of this project, this issue was long solved but the workaround was never removed. Clearing the last precached VPK name prevents the engine from helping other threads to properly unload existing handles, if at all.
2024-01-21 20:24:44 +01:00
Kawe Mazidjatari
c9a9b01bf2 RTech: major pak system overhaul and rebuild
* split rtech_game and rtech_utils cpp files into multiple files
* rebuilt several large pak load routines for debugging and custom implementations
* moved rson code to rtech_game
* reworked and improved engine and sdk pak precache system
* reversed more of the jobthreads system
2024-01-21 20:23:25 +01:00