Skip to main content

Module bundle

Module bundle 

Source
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§

BlockOverride
Overrides for one block, so a test can place a malformed block before the entry it reads (plan section 7.4, “one layout”).
BundleSpec
A UnityFS bundle.
EntrySpec
One directory entry.

Enums§

TestCodec
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 by encode(codec, decoded) instead of compress: 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: UnityWeb or UnityRaw at 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 but UnityFS.
compress
data compressed by codec: LZMA as Unity stores it (the property byte 0x5D, 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 every SerializedFile format 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.py records UnityPy’s L0 and L1 records for each.