Repository navigation
Fix legacy pak compression method mapping - #62
Open
gravenuance wants to merge 1 commit into
Open
gravenuance wants to merge 1 commit into
gravenuance wants to merge 1 commit into
Conversation
Paks older than FNameBasedCompression store no compression method names; the entry's compression field is an ECompressionFlags value (0x01 ZLIB, 0x02 GZIP, 0x04 COMPRESS_Custom), so slot = flag - 1. The fallback list put Oodle at slot 2 (flag 0x03), so COMPRESS_Custom entries (slot 3) indexed past the end of the list and panicked, and writing Oodle to a legacy pak stored flag 0x03. Use Zlib, Gzip, None, Oodle for both reading and writing, and return an error instead of panicking when an entry's slot is out of range.
gravenuance
added a commit
to gravenuance/repak
that referenced
this pull request
Nov 4, 2026
11fa9fa described slot = ECompressionFlags - 1 with a None hole at 0x03 and Oodle at 0x04, but the footer pushed Zlib, Gzip, Oodle, Zstd, so 0x03 read as Oodle and COMPRESS_Custom (0x04) as Zstd, and Pak::new kept the old three-entry list, so writing Oodle to a legacy pak stored 0x03. Days Gone's 0x04 blocks are Oodle. Use one list, Zlib, Gzip, None, Oodle, for reading and writing, as on pr/legacy-compression-flags (trumank#62). The raw-block Zstd fallback stays for paks whose names say Zstd.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Paks older than FNameBasedCompression (UE < 4.22) store no compression method names. There the entry's compression field is an
ECompressionFlagsvalue: 0x01 ZLIB, 0x02 GZIP, 0x04 COMPRESS_Custom.Entry::readturns it into slotflag - 1, but the hardcoded fallback list was[Zlib, Gzip, Oodle]. As a result:This sets the list to
[Zlib, Gzip, None, Oodle]for both reading and writing, and returns an error instead of panicking when an entry's slot is out of range.Found on Days Gone (UE 4.17): only the values 0 and 4 appear in its 216,747 entries, and the 0x04 blocks decompress correctly as Oodle. COMPRESS_Custom is game-defined, but Oodle is the common case.
Tests: footer and
Pak::newslot lists, plus an out-of-range slot that now errors instead of panicking. All three fail without the change.cargo testandcargo fmt --checkpass.test_readme_helpfails on Windows with and without this change (repak.exein the usage line).Risk: legacy paks whose custom codec isn't Oodle still fail, now with a decompression error.