fix packer tuple docstring order and add packer="lz4hc" - #378
Open
com55 wants to merge 2 commits into
Open
Conversation
The save(packer=...) docstring listed the custom tuple as (block_info_flag, data_flag), but save_fs(writer, *packer) expects (data_flag, block_info_flag). LZ4HC compression was already wired through CompressionHelper; add packer="lz4hc" (data_flag=195, block_info_flag=3) and update the stale "not implemented" comment.
There was a problem hiding this comment.
Pull request overview
This PR improves the BundleFile.save(packer=...) UX/documentation by correcting the documented tuple argument order and adding an explicit "lz4hc" preset consistent with the existing compression flag handling.
Changes:
- Fix the documented custom packer tuple order to match
save_fs(data_flag, block_info_flag). - Add
packer="lz4hc"preset (and update related in-code comments / docstrings). - Expand documented packer options (including
lzma) in relevant docstrings.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
UnityPy/files/BundleFile.py |
Corrects packer tuple doc and adds "lz4hc" preset + updates flag comments. |
UnityPy/environment.py |
Updates Environment.save() docstring to list additional pack options. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Environment.save forwards pack to every file's save(); BundleFile and WebFile accept different packer values, so do not list BundleFile-only presets as if they were universal.
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.
Hi, I noticed two small issues around
BundleFile.save(packer=...).1) Docstring tuple order is wrong
The docstring currently says the custom packer tuple is
(block_info_flag, data_flag), but the code does:and
save_fsis defined as:So the actual order is
(data_flag, block_info_flag).Using the documented order raises:
(because
2gets passed asdata_flag).2) Add
packer="lz4hc"LZ4HC is already supported through
CompressionHelper:and
compress_lz4already usesmode="high_compression".packer="original"can also preserve LZ4HC flags from existing bundles.But there is no string preset for it, and the comment in
save_fsstill sayslz4hc [not implemented], which is outdated.This PR adds:
195(0xC3) mirrors the existing"lz4"preset (194/0xC2):0x80BlocksInfoAtTheEnd0x40BlocksAndDirectoryInfoCombined2= LZ4,3= LZ4HC)So
0x80 | 0x40 | 3 = 195.Changes
(data_flag, block_info_flag)lzma/lz4hcin the allowed strings listpacker="lz4hc"lz4hc [not implemented]commentEnvironment.savedocstring pack optionsRelated issues
I searched existing issues first — I didn't find one specifically about the docstring order or a missing
lz4hcpreset.Closest nearby issue is #377 (different
packer="lz4"save quirk).Example