3572 Commits

Author SHA1 Message Date
Kawe Mazidjatari
1f2d4462d3 VpkLib: fix bug when parsing directory tree base name
After the regex update in commit 5266a2e9, this function had to be updated as well since the underscore is no longer returned.
2024-01-14 22:56:52 +01:00
Kawe Mazidjatari
e51dfccc16 VpkLib: simplify tree header writer
Make sure the VPK header is always initialized to 0 instead of actual values, as otherwise it would cause the reader to succeed on truncated files if at least the first byte matches that of the VPK magic. This also lead to the simplification of the tree header writer; instead of writing the tree size apart from the header, write the whole thing at once.
2024-01-14 13:34:11 +01:00
Kawe Mazidjatari
884e1c5014 Netconsole: don't process empty input strings
Caught by assert in CUtlBuffer ctor when tokenizing the input.
2024-01-14 11:48:42 +01:00
Kawe Mazidjatari
1b0cc4d188 Netconsole: refactor & improvements
* Fix multiple issues related to threading, such as not locking the mutex when using thread-unsafe members or methods.
* Netconsole now logs its output to a file on the disk.
* Properly handle close events, to allow netconsole to shutdown properly, so stuff like log buffers could flush properly. Input is now ran in a separate thread so main thread could check if we need to shutdown, and do so if needed. This was needed as previously input was ran in the main thread and the issue is that its blocking until an input is given.
2024-01-14 11:31:16 +01:00
Kawe Mazidjatari
0d1104bc0e System: handle other close events as well
Give the engine and SDK time to shutdown properly.
2024-01-14 11:25:50 +01:00
Kawe Mazidjatari
a809816f70 SpdLog: flush the tools logger
Must manually kill the pointer on shutdown to flush it since this one is allocated by us and thus not managed by SpdLog.
2024-01-14 11:24:42 +01:00
Kawe Mazidjatari
3fa0f25616 SpdLog: add truncate option for tools file logger, and default it on
By default spdlog will append on top of existing logs, but for ReVPK we want to truncate the old ones and start over again.
2024-01-14 02:14:22 +01:00
Kawe Mazidjatari
ecfb1fe2bf SpdLog: fix warning for tools code
Static linkage and not used for tools; idfed'd out.
2024-01-14 02:07:31 +01:00
Kawe Mazidjatari
f48bdbfa82 Engine: fix compiler warning caused by empty control statement
Remove trailing ';', else this branch wouldn't even be compiled in.
2024-01-14 02:03:27 +01:00
Kawe Mazidjatari
2a4516f3cb SpdLog: fix compile error caused by undeclared function
SpdLog_Create() is no longer externed through its header as its a static internal function. Moved SpdLog_Create() above SpdLog_Init() to fix the compile error and rename it to SpdLog_CreateRotatingLoggers(), which is a more suitable name.
2024-01-14 02:01:42 +01:00
Kawe Mazidjatari
f49fbffa9a Sync ReVPK fixes to packedstore concommand
* Check if workspace directory exists.
* Check if VPK directory tree file was successfully parsed.
2024-01-14 01:51:17 +01:00
Kawe Mazidjatari
5266a2e9de ReVPK: bug fixes & improvements
* Make sure the workspace path actually exists before attempting to pack it.
* Make sure the VPK directory tree file was parsed correctly before unpacking store.
* Log debug output for each pack operation to a file.
* Fix bug in s_DirFileRegex regex pattern, which would include a trailing '_' in the context part of the directory tree file name.
* Fix bug in 'GetLevelName()' and 'GetDirNameParts()' causing it to parse the path as well, prune the path before running the regex.
* Renamed 'GetLevelName()' to 'PackedStore_GetDirLevelName()'.
* Renamed 'GetDirNameParts()' to 'PackedStore_GetDirNameParts()'.
* Write a front-end enable file when building client VPK's.
2024-01-14 01:39:11 +01:00
Kawe Mazidjatari
65a80914ec VpkLib: move header check to dir construction and flag error on failure
Moved the construction as otherwise we would iterate over potentially bad or incompatible data.
2024-01-14 00:43:15 +01:00
Kawe Mazidjatari
b1199efc64 VpkLib: add comments to name sanitizer
Make it clear what it does.
2024-01-14 00:18:30 +01:00
Kawe Mazidjatari
0dc4b1d697 VpkLib: fix bug in dir tree file name sanitizer
The sanitizer never worked as we never replaced the corresponding string.
2024-01-13 23:58:31 +01:00
Kawe Mazidjatari
11fd516b50 VpkLib: fix bug in GetManifest()
Check if the parsing was actually successful, else free and return nullptr. The null check at call site never worked since we never return null on failure.
2024-01-13 23:56:47 +01:00
Kawe Mazidjatari
069daff4f0 VpkLib: check for manifest file first before opening the pack file
We do this as if we happen to not have any manifest whatsoever, but already opened the block file, and the block file already existed and was still valid, it would be emptied out. Only open it if we are actually going to write into it!
2024-01-13 23:55:01 +01:00
Kawe Mazidjatari
8eb2561fcf FileSystem: implement IsDirectory in STD implementation 2024-01-13 19:38:06 +01:00
Kawe Mazidjatari
dd4fdb6cbd VokLib: rename pack/unpack methods
More correct names.
2024-01-13 14:09:37 +01:00
Kawe Mazidjatari
0dd630e13a ReVPK: add option for num helper threads and compress levels
Allow the user to set the # amount of helper threads and the compress level of the VPK's.
2024-01-13 14:02:46 +01:00
Kawe Mazidjatari
49b82dc61c ReVPK: add documentation and options for custom paths 2024-01-13 02:18:02 +01:00
Kawe Mazidjatari
9793cdaa36 VpkLib: allow directory recursion
This is offline tools code, no security risks here.
2024-01-13 02:16:47 +01:00
Kawe Mazidjatari
5fd69ae3fb Tier1: feature proper size types for CFmtStrN
Promote to 64bit for target platform.
2024-01-13 01:23:19 +01:00
Kawe Mazidjatari
05a84339ce Tools: check CPU for SSE2
SSE and SSE2 instructions are being used, check for them instead of crashing somewhere in the program.
2024-01-12 15:49:22 +01:00
Kawe Mazidjatari
3fec8793e9 RTech: fix bug in pakfile decompress callback
* Fix decompress size check.
* Fix incorrect decompress buffer allocation size.
2024-01-12 11:07:16 +01:00
Kawe Mazidjatari
a92847fa7a VpkLib: rename CPackedStore to CPackedStoreBuilder
Avoid confusion with the game's CPackedStore class.
2024-01-12 11:02:54 +01:00
Kawe Mazidjatari
106670d940 VpkLib: cleanup packed store class
Make the utility methods statics within the implementation so it could be used by other structs/classes of the VPK builder as well, these utility functions weren't useful outside the class. This also allowed for the removal of the singleton which had no purpose whatsoever.
2024-01-12 11:01:04 +01:00
Kawe Mazidjatari
cb38e14683 FileSystem: fix bug in tools implementation
Should read element count of bytes instead of element count of file size, else this always returns 1 instead of the actual number of bytes read/written.
2024-01-12 03:09:49 +01:00
Kawe Mazidjatari
4d1d737b48 KeyValues: fix bug when loading from file
Read file as binary, and check if the file we're opening has a size.
2024-01-12 03:08:31 +01:00
Kawe Mazidjatari
d21cf191f0 Tier0: fix netconsole and revpk compile error in debug
CCommandLine isn't implemented in tools, thus unresolved external symbol errors will be thrown. HushAsserts() was unused and therefore removed which fixes these errors.
2024-01-12 01:58:35 +01:00
Kawe Mazidjatari
1f6b1c7d60 KeyValues: fix singleton accessor compile errors
Make each instance implement the accessor instead of the KeyValues system itself.
2024-01-12 01:51:28 +01:00
Kawe Mazidjatari
f0714a43bb CMake: add ReVPK project, standalone VPK tool
Standalone VPK tool that does everything the VPK tool implemented in the dedicated server does (pack, unpack), but independent from the game's runtime.
2024-01-12 01:26:33 +01:00
Kawe Mazidjatari
55e82c08fd FileSystem: add standalone implementation
Standalone FileSystem implementation, allowing SDK code to be used in tools without adjusting them as the vtables remain identical. NOTE that this reimplementation is partial and only contains the reading and writing of files to/from buffers or disk as that's what we are mainly interested at. We can always implement the other methods when needed.

NOTE: the filesystem singleton accessor (CFileSystem_Stdio* FileSystem()) has been moved to an implementation file instead of being inline as this would allow existing code to link to the tools implementation instead.
2024-01-12 01:24:11 +01:00
Kawe Mazidjatari
47d334e32e AppSystem: implement destructors
Need to be implemented when these are subclassed and implemented (not declared) in the SDK or tools.
2024-01-12 01:19:49 +01:00
Kawe Mazidjatari
b29762e553 FileSystem: fix subclassing
Should use CTier1AppSystem.
2024-01-12 01:01:58 +01:00
Kawe Mazidjatari
cd82e22ea3 Tier1: move KeyValues class to Tier1
The KeyValues class belongs here. Also reimplemented most loading methods for KeyValues, and adjusted the VPK building code to account for it. Pointers to the engine's implementation of KeyValues have been moved to a separate header ('keyvalues_iface.h'), as this allows external tools code to utilize the standalone KeyValues class implementation. Playlist utilities are completely separated from the KeyValues header; these have nothing to do with KeyValues other than manipulating a global KeyValues object for the playlists, and thus have been named as such and moved to rtech/playlists.
2024-01-12 00:52:07 +01:00
Kawe Mazidjatari
9f51c2424e VstdLib: reimplement CKeyValuesSystem
NOTE: reimplementation is for tools only, the game and SDK still uses the engine's implementation.
2024-01-12 00:32:17 +01:00
Kawe Mazidjatari
078c241a0d Tools: rename NETCONSOLE define to _TOOLS
Rename since this would actually be used for all tools. Also moved 'plat_time.cpp' to tier0 so anything could compile it.
2024-01-12 00:25:19 +01:00
Kawe Mazidjatari
057ccd3f86 Tier1: enable CUtlBuffer char conversion
Changed types to const char* instead of char*.
2024-01-12 00:17:53 +01:00
Kawe Mazidjatari
05f12ab6cc Tier1: fix CUtlMemoryPool::CBlob structure
Only contains the 'previous' pointer, freeing memory now works.
2024-01-12 00:16:36 +01:00
Kawe Mazidjatari
8d4ca8a59f Tier1: update memstack implementation
CMemoryStack::m_unkSize is always initialized to 0x100000 in apex.
2024-01-09 00:58:31 +01:00
Kawe Mazidjatari
6bdc8f2426 Tier1: enable CMemoryStack and fix compile errors in debug
Define missing MemAlloc_* inlines.
2024-01-08 22:59:35 +01:00
Kawe Mazidjatari
92639b6793 Tier1: reimplement CUtlMemoryPool
Class is slightly modified; it uses 2 CBlob pointers instead of a single CBlob member. CUtlMemoryPool::m_pHeadOfFreeList is also replaced with the new CUtlMemoryPool::m_pPrev pointer. Code has been modified to accommodate this change and aligns with the assembly code of r5.
2024-01-08 22:48:58 +01:00
Kawe Mazidjatari
dda8c1255d Pylon: fix bulkCheck request body
Array should be in "players".
2024-01-07 15:24:40 +01:00
Kawe Mazidjatari
fc1c911c81 VPhysics: add CPhysicsCollision singleton
Used for CStudioVCollide::~CStudioVCollide().
2024-01-07 14:19:31 +01:00
Kawe Mazidjatari
8aa8323ea4 DataCache: enable old gather props in proper location
Fix hack and handle this properly.
2024-01-07 12:28:31 +01:00
Kawe Mazidjatari
5b5effa964 DataCache: rework datacache invalid data handling
This is a more reliable solution as pretty much all code patch in CMDLCache checks the ptr for NULL, but none of them do for 0xDEADFEEDDEADFEED (probably a debug only thing that somehow made it into this build). Patched out so the engine could deal with it properly. Anything interesting already gets logged from the SDK so we won't miss out on anything patching this out.
2024-01-07 11:45:03 +01:00
Kawe Mazidjatari
c54777d370 DataCache: rework FindUncachedMDL error handling
Remove unnecessary/duplicate code.
2024-01-07 02:57:54 +01:00
Kawe Mazidjatari
743074ac47 DataCache: rename studiodata_t member 2024-01-07 02:57:30 +01:00
Kawe Mazidjatari
51858ed012 DataCache: improve FindUncachedMDL error handling
Just use a single branch.
2024-01-07 02:05:14 +01:00