Module typetree

Module typetree 

Source
Expand description

Unity TypeTree processing module

This module provides comprehensive TypeTree processing capabilities, organized following UnityPy and unity-rs best practices.

§Architecture

The module is organized into several sub-modules:

  • types - Core data structures (TypeTree, TypeTreeNode, etc.)
  • parser - TypeTree parsing from binary data
  • builder - TypeTree construction and validation
  • serializer - Object serialization using TypeTree information

§Examples

use unity_asset_binary::typetree::{TypeTreeParser, TypeTreeBuilder, TypeTreeSerializer};
use unity_asset_binary::reader::BinaryReader;

// Create mock data for demonstration
let data = vec![0u8; 100];
let object_data = vec![0u8; 50];

// Parse TypeTree from binary data
let mut reader = BinaryReader::new(&data, unity_asset_binary::reader::ByteOrder::Little);
let tree = TypeTreeParser::from_reader(&mut reader, 19)?;

// Use TypeTree to parse object data
let serializer = TypeTreeSerializer::new(&tree);
let mut object_reader = BinaryReader::new(&object_data, unity_asset_binary::reader::ByteOrder::Little);
let parsed_object = serializer.parse_object(&mut object_reader)?;

// Build TypeTree programmatically
let mut builder = TypeTreeBuilder::new().version(19);
builder.add_simple_node("GameObject".to_string(), "Base".to_string(), -1, 0)?;
let built_tree = builder.build()?;

Re-exports§

pub use builder::TypeTreeBuilder;
pub use builder::TypeTreeValidator;
pub use builder::ValidationReport;
pub use parser::ParsingStats;
pub use parser::TypeTreeParser;
pub use registry::CompositeTypeTreeRegistry;
pub use registry::InMemoryTypeTreeRegistry;
pub use registry::JsonTypeTreeRegistry;
pub use registry::TypeTreeRegistry;
pub use serializer::PPtrScanResult;
pub use serializer::TypeTreeParseMode;
pub use serializer::TypeTreeParseOptions;
pub use serializer::TypeTreeParseOutput;
pub use serializer::TypeTreeParseWarning;
pub use serializer::TypeTreeSerializer;
pub use tpk::TpkTypeTreeRegistry;
pub use types::TypeInfo;
pub use types::TypeRegistry;
pub use types::TypeTree;
pub use types::TypeTreeNode;
pub use types::TypeTreeStatistics;

Modules§

builder
TypeTree builder and validation
parser
TypeTree parser implementation
registry
External TypeTree registry (UnityPy TPK-like fallback).
serializer
TypeTree serialization and deserialization
tpk
TPK (Type Package) support for external TypeTree registries.
types
TypeTree data structures

Structs§

TypeTreeInfo
TypeTree information summary
TypeTreeProcessor
Main TypeTree processing facade

Functions§

build_common_typetree
Build a simple TypeTree for common Unity types
create_processor
Convenience functions for common operations Create a TypeTree processor with default settings
get_parsing_method
Get recommended parsing method for Unity version
get_typetree_info
Get TypeTree information summary
is_version_supported
Check if TypeTree format is supported
parse_object_with_typetree
Parse object using TypeTree
parse_typetree
Parse TypeTree from binary data with version detection
serialize_object_with_typetree
Serialize object using TypeTree
validate_typetree
Validate TypeTree structure