Skip to main content

hao_il2cpp/
lib.rs

1//! Reads Unity Il2Cpp games, to generate .NET declaration assemblies with hao.
2//!
3//! Work in progress: metadata v29 with ELF game binaries.
4//!
5//! [`Game`] is the entry point. It finds a game's `global-metadata.dat` and
6//! `GameAssembly`, and gives types, fields and methods by name with their types
7//! resolved:
8//!
9//! ```no_run
10//! use hao_il2cpp::Game;
11//!
12//! let game = Game::open("path/to/game")?;
13//! let string = game.find_type("System.String").unwrap();
14//! for method in string.methods() {
15//!     println!("{}", method); // `static string Concat(string str0, string str1)`
16//! }
17//! game.write_assemblies("out")?;
18//! # Ok::<(), hao_il2cpp::Error>(())
19//! ```
20//!
21//! Underneath, [`Metadata`] reads `global-metadata.dat`, [`Binary`] reads the
22//! `Il2CppType` table from the game binary, and [`generate()`] builds the
23//! declaration assemblies.
24
25pub mod binary;
26mod error;
27pub mod game;
28pub mod generate;
29pub mod metadata;
30#[cfg(feature = "reflect")]
31pub mod reflect;
32
33pub use binary::{Binary, LoadedImage};
34pub use error::{Error, Result};
35pub use game::{FieldView, Game, MethodView, ParameterView, TypeView};
36pub use generate::{generate, GeneratedAssembly};
37pub use metadata::Metadata;
38pub use pewter::image::{AnyImage, ElfImage, PeImage};