Expand description
global-metadata.dat: names and the shape of every type, method and field.
Types of fields, parameters and return values are indices into the
Il2CppType table, which lives in the game binary, not in this file.
Three metadata versions are supported:
- v29 (Unity 2021.2 – 2023.x): header entries are
(offset, size)pairs. - v31 (later Unity 2022.3 LTS / 2023.x): identical to v29 except the
method record gained a
returnParameterTokenfield (so each record is 4 bytes larger). The section list, header-entry size and all other record layouts match v29. Implemented from the Il2CppDumper/Il2CppInspector reference layouts; unverified against a real v31 game (none available). - v39 (Unity 6): each header entry also carries a record count, so the
entries are 12 bytes. Several records shrank:
type_definitionsdroppedelement_type_indexand narrowedgeneric_container_index;methodsnarrowed its middle index fields (movingparameter_start);imagesandassemblieswere reordered;generic_parametersnarrowedowner_index. The v39 layout was reverse-engineered and validated against real Unity 6 games (which ship Windows PE binaries, read via pewter’s PE support).
use hao_il2cpp::Metadata;
let metadata = Metadata::from_path("Game_Data/il2cpp_data/Metadata/global-metadata.dat")?;
println!("metadata v{}", metadata.version);
for image in &metadata.images {
println!("{}:", metadata.image_name(image));
for index in metadata.image_types(image) {
let ty = &metadata.type_definitions[index as usize];
println!(" {} ({} methods)", metadata.type_full_name(index), ty.method_count);
}
}Structs§
- Assembly
Definition Il2CppAssemblyDefinition: an assembly’s identity and the image that holds it.- Event
Definition Il2CppEventDefinition: an event and its accessors.- Field
Default Value Il2CppFieldDefaultValue: a constant value for a field, stored in the default value data section.- Field
Definition Il2CppFieldDefinition: one field’s name and type.- Generic
Container Il2CppGenericContainer: the generic parameter list of a generic type or method.- Generic
Parameter Il2CppGenericParameter: one generic parameter, e.g. theTofList<T>.- Image
Definition Il2CppImageDefinition: one image (module) of the game, e.g.Assembly-CSharp.dll, and the range of type definitions it owns.- Metadata
- A parsed
global-metadata.dat: its tables, decoded, and its string and data sections, read on demand. - Method
Definition Il2CppMethodDefinition: one method’s name, signature and flags.- Parameter
Definition Il2CppParameterDefinition: one method parameter’s name and type.- Property
Definition Il2CppPropertyDefinition: a property and its accessors.- Type
Definition Il2CppTypeDefinition: one type’s name, flags, base type and the ranges of its members in the other tables.
Type Aliases§
- Type
Definition Index - An index into
Metadata::type_definitions. - Type
Index - An index into the binary’s
Il2CppTypetable.