This ensures that we can never allocate more memory than the maximum value that type could hold, without triggering a compile warning. There was a mention about shorts being slow on PowerPC platforms for utllinkedlist, but the index local type could be overridden (defaults to index storage type). In case it gets used for PowerPC, use 32bit ints as index local types; as the local type gets used for arithmetic operations while storage type is what's getting cached off in memory. This patch had no effect on generated output code, it was mostly implemented to avoid future problems.
Determine proper stack buf size for ssize_t += operator. If its 64bits then the buf should be doubled to accommodate for the maximum number of digits in a 64bit decimal number. Also properly determine stack buf size of double += operator. For FormatV, instead of a fixed stack buffer, perform a dry run to determine required buflen, reserve num char bytes of memory and write into it again on the next call.
Only update statistics, this code was mainly added for testing, but testing revealed no additional performance or smoothness improvements, even during >6 hour sessions. The clock drift already gets corrected each frame from Host_RunFrame(). Only update statistics to update CPU and frame times on the client's debug panels if enabled.
* 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.
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.
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
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
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.
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.
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)
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!
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