Skip to main content

Module encode

Module encode 

Source
Expand description

Bundle packers following helpers/CompressionHelper.py:158-231. LZ4 and LZ4HC both use pristine liblz4 1.9.4 HC at level 9.

Structs§

BlockInfo
One UnityFS block-table row, before it is serialized.
PackedBlocks
Packed bundle payload and its metered block table.

Functions§

chunk_based_compress
UnityPy 1.25.2’s chunk_based_compress (helpers/CompressionHelper.py:158-231): 128 KiB for LZ4, at most u32::MAX for LZMA. A chunk is stored only when compression strictly increases its size; all other flag bits survive. Stored empty data has one empty row; a compressing packer has no row for empty data.
compress
Compress one block, including Unity’s five-byte LZMA properties prefix. Both LZ4 codec IDs select compress_lz4 (helpers/CompressionHelper.py:97-105).
head_chunk_based_compress
HEAD 417d595’s chunk_based_compress: the bytes already written, with padding, determine whether the next block is stored. From format 9 each compressed-packer block has an offset and trailing 16-byte alignment.
registered_chunks
Compress through the context’s registered block codecs and chunk policy. head selects the later bundle layout when explicitly requested.
registered_compress
Compress a single registered block, such as a bundle’s directory table.