Expand description
The game binary (GameAssembly): the registration tables and the
Il2CppType table that metadata type indices refer to.
The binary is read through pewter’s LoadedImage, which abstracts over
ELF (.so) and PE (.dll) and resolves virtual addresses after relocation.
use hao_il2cpp::{AnyImage, Binary, Metadata};
let metadata = Metadata::from_path("Game_Data/il2cpp_data/Metadata/global-metadata.dat")?;
let bytes = std::fs::read("GameAssembly.so")?;
let image = AnyImage::load(&bytes).expect("not an ELF or PE file");
let binary = Binary::read(&image, &metadata)?;
// A field's type index points into the binary's type table.
let field = &metadata.fields[0];
if let Some(ty) = binary.type_at(field.type_index) {
println!("{} {}", ty.name(&metadata), metadata.string(field.name_index));
}Structs§
- Binary
- The game binary’s type table, decoded.
- Code
GenModule - Per-image method pointer table, from
Il2CppCodeGenModule. - Code
Registration Il2CppCodeRegistration— the code-side registration that holds method pointers, invoker pointers, and per-module code generation tables.- ElfImage
- A loaded ELF image (e.g. a
.so). Pointers are resolved through the relocation table, since ELF stores relative relocations rather than absolute addresses. - Il2Cpp
Type - One entry of the binary’s
Il2CppTypetable: the type of a field, parameter or return value, which metadata refers to by type index. - Metadata
Registration Il2CppMetadataRegistration(v29).- PeImage
- A loaded PE image (e.g. a
.dll). Pointers stored in a PE hold absolute virtual addresses at the preferred image base, so no relocation step is needed: the on-disk values and the addresses computed here share that base.
Enums§
- Type
Kind - What an
Il2CppTypeis: its element type and the data that goes with it.
Traits§
- Loaded
Image - Reads a loaded binary by virtual address, as it will be after relocation.