44 Commits

Author SHA1 Message Date
Kawe Mazidjatari
dab5133e07 Rename 2022-06-08 23:35:46 +02:00
Amos
d909878624 Optimizations 2022-06-08 14:03:04 +02:00
Kawe Mazidjatari
9938c724a2 Cleanup 2022-06-07 13:57:29 +02:00
Kawe Mazidjatari
805cf59ad9 Update packedstore.cpp 2022-06-07 13:49:41 +02:00
Kawe Mazidjatari
872b39514f Add file extension support to .vpkignore 2022-06-07 13:46:18 +02:00
Kawe Mazidjatari
719fd3b8d2 Fix small mistake 2022-06-07 13:02:21 +02:00
Kawe Mazidjatari
b62cf7c017 Add support for .vpkignore file
Folders can be globally excluded using the '.vpkignore' file (placed in the workspace root).
To exclude specific files, use the manifest file.
2022-06-06 23:08:53 +02:00
Kawe Mazidjatari
461920a970 Update terminology entirely for packedstore.h/.cpp
VPK tooling also works on the R1 game (Titanfall 1)
2022-06-06 14:54:22 +02:00
Kawe Mazidjatari
6e6e791c10 Fix terminology
Log actual entry index ('j') when sharing bytes, 'i' was block.
2022-06-06 01:55:42 +02:00
Kawe Mazidjatari
76d8da3db2 Fix return bug
CPackedStore::GetManifest() did not return a value in all control paths.
Use proper size types for entry block constructor.
2022-06-06 00:21:13 +02:00
Kawe Mazidjatari
616f9b34fb Log number of descriptors build into VPK directory file 2022-06-06 00:06:54 +02:00
Kawe Mazidjatari
c9e3ea1f08 Rename to use correct terminology 2022-06-05 22:30:29 +02:00
Kawe Mazidjatari
f446ee03dd Correct terminology 2022-06-05 22:27:43 +02:00
Kawe Mazidjatari
0ff27bb20d Fixed bug where logged total directory size is wrong
changed writer.GetPosition() to sizeof(VPKDirHeader_t) + m_vHeader.m_nDirectorySize because we seek back to the offset of m_vHeader.m_nDirectorySize.
2022-06-05 22:12:22 +02:00
Kawe Mazidjatari
13f518d773 Fixed VPK manifest bug
Fixed bug where VPK root character gets written to the manifest file.
Show detailed data sharing statistics.
2022-06-05 20:55:34 +02:00
Kawe Mazidjatari
d005626aa0 Fix VPK root files bug
Files names of files located in the root of a VPK weren't formatted properly
2022-06-05 18:01:23 +02:00
Kawe Mazidjatari
92daef5a32 VPK system improvements
More detailed operation statistics.
Discard VPK directory files who's header doesn't match engine requirements.
Separated manifest properly between language and context (you can now package for each language and context from a single workspace).
2022-06-05 17:28:39 +02:00
Kawe Mazidjatari
15c1908478 Additional cleanup
Cast to proper types.
Set the archive offset only instead of the entire block. The entry could still have its own flags. The only thing needed for saving data is sharing the same offset and size.
2022-06-05 12:28:49 +02:00
Kawe Mazidjatari
c7e7a38b08 Set maximum compression level 2022-06-05 02:25:00 +02:00
Kawe Mazidjatari
22029abfc2 Fixed compression bug for VPK system
Fixed bug where the compressed buffer size equals the source buffer size getting packed into the VPK chunk. In all occurrences this resulted in corrupted data upon export.

The reason for data being corrupt upon export is because the engine checks the equality of the compressed and decompressed size fields in the directory file, if they are equal, the engine doesn't attempt to decompress the block. So we end up with a still compressed block on the disk (technically not corrupt in the context of the compression lib, but useless as-is on the disk).

If a compressed file doesn't get lower in size we are better out storing it rather than compressing it.

Added a new condition in lzham::lzham_lib_compress_memory which checks source and destination buffer size equality.
2022-06-05 02:24:44 +02:00
Kawe Mazidjatari
ad0f94e973 Implement data sharing algorithm in VPK packing
This reduces size of the resulting VPK (checks entry block in hash map).
mp_common compresses to 32mb instead of 37.3mb (original is 38.5mb).
2022-06-04 13:55:24 +02:00
Kawe Mazidjatari
3dd96964e3 Cast and format to proper types 2022-06-04 03:19:05 +02:00
Kawe Mazidjatari
6e32775c71 Additional VPK system improvements
Added DevMsg logs to show the elapsed time of the operation.
Fixed post decompress CRC/ADLER error checking.
Slight cleanup.
2022-06-04 03:12:46 +02:00
Kawe Mazidjatari
b3dd9c8ad6 Revert declaration 2022-06-04 01:30:18 +02:00
Kawe Mazidjatari
2e77c584b4 Cleanup 2022-06-04 01:17:07 +02:00
Kawe Mazidjatari
655d1c65b2 Proper VPK repacking
Initial proper implementation pending cleanup.

The new system builds a manifest file when a VPK is unpacked. The manifest files contains data such as the entry flags and texture flags. It also contains a field determining whether the file should be compressed or not.

When a user repacks a pack, the system attempts to load this manifest file and does a lookup to the object to retrieve the flags (most of these flags are unknown, but they are used by the engine and are necessary for stuff like cubemaps and texture files to work correctly. Cubemaps won't work with proper flags, and textures (decals, particle system components, etc..) will look washed out without them.

I think some also determine whether a file within the VPK should be cached or not, so simply marking everything as 0x101 will probably end up in more CPU time and higher filesystem cache usage (depot/ is only 0x1, I don't think anything there is getting cached ever without the 0x100 flag).

User could also repack a VPK while excluding anything that is not in the manifest file. So you could unpack all VPK's into a single directory (each VPK has its own manifest file tied to its level name), and rebuild all the VPK's with only the files that where originally in them.

fs_pack_vpk command usage: <locale> <context> <level_name> <manifest_only>

locale determines the pak language (default english), context determines whether is a server/client vpk, level_name determines the BSP name of the pak, manifest_only determines whether the pack system should only include files within the manifest (leaving this arg out will build all files into the vpk).

The VPK workspace path is determined with ConVar 'fs_packedstore_workspace'.
2022-06-04 01:08:23 +02:00
Amos
07533cb0c4 packedstore cleanup
Add const qualifiers to params.
Enable compression flags.
2022-06-02 15:20:22 +02:00
Kawe Mazidjatari
14f409c8c6 Update packedstore.cpp 2022-06-02 02:00:35 +02:00
Kawe Mazidjatari
649060c8cc Update packedstore.cpp 2022-06-02 01:59:03 +02:00
Kawe Mazidjatari
f824954640 Update packedstore.cpp 2022-06-02 01:58:29 +02:00
Kawe Mazidjatari
ec7582e476 Fixed VPK repack with multiple files
VPK's could now be repacked with compression and multiple files. The output is identical to the input as far as currently tested (mp_rr_canyonlands_staging).
2022-06-02 01:57:18 +02:00
Kawe Mazidjatari
6fbe900ba9 Initial implementation of compressed VPK rebuilding
The 'fs_pack_vpk' allows compressing specific files into a VPK (compressed). This implementation has better compression ratio's then currently available VPK tools with compression (at the cost of speed).
The implementation is early, a directory iterator with a files for flags is planned soon to fully rebuild VPK's on-demand. A dedicated standalone program is also planned.

The output dir and archive formats should match 1:1 with the original game
2022-05-30 02:56:15 +02:00
Kawe Mazidjatari
4b72afb74f Light refactor for logging
Moved logging functions to dbg.h (tier0) and export them from the dll.
Added additional functions for checking bad pointers (debug only!).
Reduced output code size.
2022-05-25 14:18:29 +02:00
Kawe Mazidjatari
637041d5e7 Use 'fs' instead of 'std::filesystem' 2022-05-16 21:54:46 +02:00
Kawe Mazidjatari
9960ff06d4 Improve tree logging 2022-05-07 02:05:49 +02:00
Kawe Mazidjatari
2dcbf59041 Move ConVar/ConCommand stuff to tier1 instead and cleanup KeyValues/KeyValuesSystem 2022-04-09 16:16:40 +02:00
Kawe Mazidjatari
6a46486e99 See description
* Added 2 new FileSystem pointers with new features in their classes.
* Register all factory instances created by the GameDLL in the SDK.
* Added new command 'fs_mount_vpk' to mount a specified VPK file.
* Renamed 'fs_decompress_pak' to 'fs_unpack_vpk'.
* Some renaming of Factory and VPK types.
* Some light optimizations/cleanup.
2022-04-09 00:59:42 +02:00
Amos
2fee28ae96 Adapt to new loggers 2022-03-04 15:59:33 +01:00
Amos
1058a6fa10 Use unicode character set instead and light cleanup/bug fixes 2022-03-04 12:22:17 +01:00
Amos
ee82a58133 Create RCON ConCommand 2022-02-06 15:59:46 +01:00
Amos
40204c6b84 Fix typo 2022-01-18 13:21:42 +01:00
Amos
de3b3f53bd Optimizations + QoL improvements/cleanup
* IConsole overlay now clears the oldest log entries to stay under the vector limit instead of clearing the whole vector.
* IConsole code cleanup.
* IBrowser code cleanup, reordered class methods.
* Use ConVar utilities to get/set values for strings in IBrowser and IConsole.
* New ConVar's for RUI console overlay to tweak colors.
2022-01-12 02:56:17 +01:00
Amos
64c07af6e0 Cleanup to use new ConVar utilities 2022-01-09 17:17:05 +01:00
Amos
d5b2e58dae Code base refactor + major performance and readability improvement. Read description for details.
* Codebase restructured to SourceSDK codebase style and .cpp/.h assertion paths in the game executable.
* Document most functions with valve style 'Purpose' blocks.
* Rename variables to match the rest of the codebase and Valve's naming convention.
* Dedicated DLL and the SDKLauncher now share the same codebase as the DevSDK.

* Obtain globals or pointers directly instead of waiting for runtime initialized data.
* Dynamically search for all functions and globals (this doesn't count for dedicated yet!).
* Initialize most in-SDK variables.

* Move certain prints and other utilities under ConVars to reduce verbosity and increase performance.
* Print all pattern scan results through a virtual function to make it easier to add and debug new patterns in the future.
* Type global var pointers appropriately if class or type is known and implemented.
* Forward declare 'CClient' class to avoid having 2 'g_pClient' copies.
* Add IDA's pseudo definitions for easier prototyping with decompiled assembly code.

* RPAK decompress Command callback implementation.
* Load decompressed RPaks from 'paks\Win32\' overriding the ones in 'paks\Win64\' (the decompress callback will automatically fix the header and write it to 'paks\Win32\').

* VPK decompress Command callback implementation.
* Move CRC32 ands Adler32 to implementation files.

* Server will print out more details about the connecting client.

* Upgrade ImGui lib to v1.86.
* Don't compile id3dx.h for dedicated.
* Don't compile id3dx.cpp for dedicated
* Implement DevMsg print function allowing to print information to the in-game VGUI/RUI console overlay, ImGui console overlay and the external windows console

* Fixed bug where the Error function would not properly terminate the process when an error is called. This caused access violations for critical/non-recoverable errors.
* Fixed bug where the game would crash if the console or server browser was enabled while the game was still starting up.
* Several bug fixes for the dedicated server (warning: dedicated is still considered work-in-progress!).
2021-12-25 22:36:38 +01:00