Skip to main content

Module bundle

Module bundle 

Source
Expand description

UnityFS bundles: the archive AssetBundles, Addressables content and a player’s data.unity3d are.

Layout (format version 8, header flags 0x243; every number big-endian): the signature UnityFS\0, the format version, the player version and the engine version (NUL-terminated), the bundle’s size (u64), the compressed and the uncompressed size of the block table (u32 each) and the header flags; then, aligned to 16 bytes, the block table, compressed as the low six bits of the flags say (0 none, 2 LZ4, 3 LZ4HC), and, when flag 0x200 is set, padding to 16 bytes; then the blocks. The decompressed block table holds a 16-byte hash, the blocks (u32 uncompressed size, u32 compressed size, u16 flags whose low six bits are the block’s compression) and the nodes: the files in the blocks’ concatenated bytes (i64 offset, i64 size, u32 flags, a NUL-terminated path; flag 4 marks a SerializedFile, 0 a stream file such as .resS).

What it reads, from the bundles of PEAK, Sledding Game and Big Walk: format 8, flags 0x243, blocks stored or LZ4HC of at most 128 KiB. What it refuses, as Error::Unsupported: another format version, header flags other than those (the block table at the end of the file, a table not stored with the directory), a LZMA or LZHAM compressed block table or block, and compression numbers it does not know. A bundle whose sizes do not add up is Error::Invalid. A node is read by range: only the blocks it touches are decompressed, a few recent blocks are kept, so a node of a gigabyte costs its reader nothing until it asks for bytes.

Structs§

Block
One block of the bundle’s data.
Bundle
An open UnityFS bundle: its header, blocks and nodes, with the file kept open to read nodes by range.
BundleHeader
The fixed fields of a bundle’s header, as stored.
BundleNode
One file in a bundle.

Constants§

FORMAT_VERSION
The format version read.
NODE_SERIALIZED
Node flag: the node is a SerializedFile.

Traits§

BundleSource
What a bundle’s bytes come from: a file, or any reader that can seek.