Expand description
Unity asset bundles, serialized files and typetrees, read with the semantics of UnityPy 1.25.2 and UnityPyBoost.
The plan is docs/plans/core.md. These modules are its shared interfaces:
every public type and signature here is the contract the P1 work packages
build against. A module whose first line is a STUB allow still has
todo!() bodies; the package that owns it (plan section 7) fills it and
deletes the allow.
Layering, bottom up:
raw,limits,budget,once,error,options,pin: shared plumbing;tables,classid: generated tables pinned to the oracle’s UnityPy and Python;stream,version,detect,codec: UnityPy’s readers and rules;files:BundleFile,WebFile,SerializedFileand raw files;typetree: node rows, UnityPy’s tree-building rule, the compiledtypetree::Tree;valueandwalk: the dict model, UnityPyBoost’s reader, the pure-Python reader and UnityPy’s writer;provider,object,container,env: typetree sources, objects, container paths and theEnvironment.
Under the test-counters feature, for tests alone (docs/plans/batch.md
section 6, CR8), testing counts the refusals the core meets and the
span reads of its bundles; a build without it has none of that code.
Re-exports§
pub use error::Error;pub use error::LimitError;pub use error::LimitKind;pub use error::NotFound;pub use error::Unsupported;pub use files::BundleFile;pub use files::File;pub use files::RawFile;pub use files::SerializedFile;pub use files::WebFile;pub use object::ObjectRef;pub use options::FileContext;pub use raw::RawStr;pub use value::Built;pub use value::Map;pub use value::Parsed;pub use value::PrimArray;pub use value::PrimRun;pub use value::ReadBy;pub use value::Value;pub use value::ValueBuilder;pub use version::UnityVersion;
Modules§
- budget
- Memory budgets: the mechanism in the core, the policy in the batch engine.
- classid
- Class ids and their names, from UnityPy’s MIT
enums/ClassIDType.py(368 ids in 1.25.2). Names are for people and output naming; the core works ini32and never needs a name to read a file. UnityPy extends its enum at runtime for an unknown id;class_namereturnsNonefor one. - codec
- Block codecs with UnityPy’s semantics (
helpers/CompressionHelper.py:238-244). - config
- Fallback retrieval and warning filtering (
config.py:21-40). A binding shares one warning state across call sites, and supplies its warning emitter. Retrieval does not validate version syntax; parsing happens later. - container
- The AssetBundle container (
files/SerializedFile.py:316-324,classes/generated.pyAssetBundle,environment.py:208-226). - detect
ImportHelper.check_file_typeandparse_file’s naming rule (helpers/ImportHelper.py:44-156), quirks included: every rule ofdocs/CANONICAL_DUMP.mdsection 4.2 (l0) and section 7 (L0 detection).- env
- UnityPy’s
Environment(environment.py:28-363): loaded files, the CAB registry, dependency loading, pointer dereference, resource reads and the container. - error
- The file-level error type.
- files
- Files: what
ImportHelper.parse_filebuilds (helpers/ImportHelper.py:127-156). - limits
- Hard bounds on what untrusted input can make the library allocate or do, and the one meter that enforces the memory bound.
- object
ObjectReader(files/ObjectReader.py:44-311): one object of aSerializedFile, read on demand.- objmode
- An object-mode view: a dict-mode value the core read, viewed as the objects UnityPy’s object mode builds from it.
- once
- Lazily computed values, published without holding anything while they are computed.
- options
- The options every file loaded through one environment shares.
- pin
- What a slice keeps alive (plan sections 3.15 and 8, R3). A
Bytesslice of a decoded run, or of an input’s own bytes, keeps the whole buffer alive, with its charge, for as long as the slice lives: on the corpus one value kept past its input’s handles kept the input’s whole decoded run alive (up to 69.4 MB), through its strings and byte arrays and through the node lists that name its keys, whose strings are slices of the file too. - provider
- Typetree providers for stripped files, keyed by
(class, version). - pyfloat
- Python’s
reprof a float, which the dump’sstr()of an index value and the cutter’s JSON (json.dumpswrites a float as itsrepr) both give. - pystr
- Python string semantics on raw bytes, as UnityPy applies them to names.
- raw
- Raw strings: the bytes UnityPy holds as a
strdecoded withsurrogateescape. - stream
- A bounded reader over a byte slice with the semantics of UnityPy’s
EndianBinaryReader: the memory reader,EndianBinaryReader_Memoryview(streams/EndianBinaryReader.py:231-284), or the stream reader,EndianBinaryReader_Streamable(:287-324), which UnityPy reads a file it loads from a path with (ReaderKind;kind’s module docs list what it reads that way and its rules). - tables
- Unicode tables pinned to the oracle’s Python (3.11, Unicode 14.0), so the core’s string rules do not drift with Rust’s newer Unicode.
- typetree
- Typetrees: stored rows, UnityPy’s tree-building rule, the parsers that read
rows from a file, and the compiled
Treethe walker runs on. - value
- The dynamic value: UnityPy’s
parse_as_dict()model, made self-describing. - version
- Unity versions with UnityPy’s semantics, and UnityPy’s two version chains.
- walk
- Reading and writing values through a typetree.
- zip
- ZIP indexing and stored/deflate reads, following
CPython’s central-directory, ZIP64, local-name and CRC rules. All buffers and work are bounded.
Structs§
- Bytes
- A cheaply cloneable and sliceable chunk of contiguous memory.
Constants§
- VERSION
- The crate version, as built.