Skip to main content

Module files

Module files 

Source
Expand description

Files: what ImportHelper.parse_file builds (helpers/ImportHelper.py:127-156).

A File is a handle (Arc) on an immutable, parsed file. Containers decode lazily and parse each entry once (BundleFile::entry); the UnityPy load order, where every entry is parsed and a failing entry fails the bundle, is BundleFile::load_all.

Memory. Every file charges its input’s Meter for itself and for every table it keeps, before it allocates them (plan section 3.15): a top-level load makes the meter and passes it to parse_file, and a container passes its own to each entry it parses, so one input’s files share one bound however many there are. Each file keeps its Charge (the bytes return when the file drops) and answers File::meter.

Owner: package C.

Re-exports§

pub use save::SaveError;
pub use save::SaveLayout;
pub use save::SaveOptions;
pub use bundle::BlockInfo;
pub use bundle::BundleCounts;
pub use bundle::BundleFile;
pub use bundle::BundleHeader;
pub use bundle::BundlePacker;
pub use bundle::BundleSaveOptions;
pub use bundle::DirEntry;
pub use bundle::FileSlot;
pub use bundle::LayoutKind;
pub use serialized::External;
pub use serialized::ObjectInfo;
pub use serialized::ScriptRef;
pub use serialized::SerializedFile;
pub use serialized::SerializedHeader;
pub use serialized::SerializedType;
pub use web::WebFile;
pub use web::WebPacker;
pub use web::WebSaveOptions;

Modules§

bundle
BundleFile (files/BundleFile.py), read lazily.
save
Metered primitives for file and tree writers, following streams/EndianBinaryWriter.py:41-97. Every growth charges memory; every byte copied or zeroed charges the reader’s cumulative work first.
serialized
SerializedFile metadata (files/SerializedFile.py:206-360, files/ObjectReader.py:67-130), ported from UnityPy, bytes-native.
web
WebFile (files/WebFile.py:15-56): UnityWebData/TuanjieWebData, plain, gzip or brotli. Inflation is eager, bounded by max_inflate and charged as decode work; directory members are parsed once on demand. WebFile::load_all provides UnityPy’s eager directory-order load.

Structs§

Parent
What a child knows of its container. A file loaded at top level has none (parent: None): UnityPy makes the Environment that loaded it its parent (environment.py:154), which is the container PPtr.deref scans (plan section 3.13, rule 4). The input’s meter travels separately, as every file’s File::meter, top-level ones included.
RawFile
A file UnityPy keeps as a reader.
WriteableCab
A shared, appendable resource writer. Clones refer to the same bytes.

Enums§

File
A parsed file.
ParentKind
A container kind, as the SerializedFile version chain and PPtr.deref distinguish them.

Functions§

parse_file
parse_file: builds the file ty says, under the name rule (crate::detect::parsed_as), from bytes (UnityPy’s memory reader). A file with a parent is an entry. Everything it keeps is charged to meter, the input’s.
parse_file_with_reader
parse_file by the rules of the reader UnityPy reads the file with: ReaderKind::Stream for a top-level file loaded from a path (environment.py:136-139; crate::env::Source::Path), whose SerializedFile, bundle header or kept reader follows them. A container’s entries are memory whatever its reader. WebFile members use memory readers after inflation.