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
25#![cfg_attr(docsrs, feature(doc_cfg))]
26#![warn(missing_docs)]
27
28pub mod binary;
29mod error;
30pub mod game;
31pub mod generate;
32pub mod metadata;
33#[cfg(feature = "reflect")]
34pub mod reflect;
35
36pub use binary::{Binary, LoadedImage};
37pub use error::{Error, Result};
38pub use game::{FieldView, Game, MethodView, ParameterView, TypeView};
39pub use generate::{generate, GeneratedAssembly};
40pub use metadata::Metadata;
41pub use pewter::image::{AnyImage, ElfImage, PeImage};