Expand description
UnityFS bundles (formats 6 to 8) and UnityWeb/UnityRaw (P3), built
from a spec, with every block codec the core reads.
The layout is the one UnityPy 1.25.2’s BundleFile.read_fs reads
(files/BundleFile.py:96-186), big-endian throughout: the signature, the
format, both version strings, the total size, blocks-info’s stored and
decoded sizes and the data flags; the 16-byte alignment where UnityPy
applies it (format 7 and up, or a 2019 engine from 2019.4.15); blocks-info
(hash, blocks, directory) right there or at the end of the file (flag
0x80); the 16-byte padding before the data under the new flag set with
0x200; and the data blocks, each compressed on its own.
Owner: package C.
Structs§
- Block
Override - Overrides for one block, so a test can place a malformed block before the entry it reads (plan section 7.4, “one layout”).
- Bundle
Spec - A
UnityFSbundle. - Entry
Spec - One directory entry.
Enums§
- Test
Codec - A block codec, as the flags’ low six bits name it.
Constants§
- LZMA_
DICT - The dictionary size the LZMA blocks declare (Unity’s 512 KiB).
Functions§
- build
- The bundle’s bytes.
- build_
with_ encoder build_with_signature, each data block and the blocks info stored byencode(codec, decoded)instead ofcompress: for a caller whose blocks need another encoder of the same format (a real LZ4HC, say).- build_
with_ signature - The bundle’s bytes under another signature:
UnityWeborUnityRawat format 6 take the UnityFS layout with one more byte after the data flags (files/BundleFile.py:104-106), which this writes for any signature butUnityFS. - compress
datacompressed bycodec: LZMA as Unity stores it (the property byte0x5D, the 4-byte dictionary size, the raw LZMA1 stream), LZ4 and LZ4HC as one LZ4 block, anything else stored as it is.- matrix
- Package C’s synthetic matrix for the L0-L1 parity check (plan section
7.4, “Done when”):
(name, bytes)inputs covering everySerializedFileformat both endians, UnityFS 6-8 with every codec, blocks-info at either end, both alignment rules, padding, both flag sets, UnityWeb and UnityRaw at format 6, nested bundles, repeated paths, block overrides, and an AssetBundle (class 142) loose and inside a bundle, whose container rows the parse reads (C request 9).tools/fixtures/files.pyrecords UnityPy’s L0 and L1 records for each.