hao-il2cpp 0.0.14

Read Unity Il2Cpp metadata and generate .net proxy assemblies with hao
Documentation
use thiserror::Error;

/// A `Result` whose error is this crate's [`Error`](enum@Error).
pub type Result<T> = std::result::Result<T, Error>;

/// Why reading a game, its metadata or its binary failed.
#[derive(Error, Debug)]
pub enum Error {
    /// The file doesn't start with IL2CPP's metadata magic (`0xFAB11BAF`),
    /// so it isn't a `global-metadata.dat` (or it's encrypted).
    #[error("not an il2cpp metadata file (bad sanity value {0:#x})")]
    BadSanity(u32),
    /// The metadata's version has no known layout (supported: 29, 31 and 39).
    #[error("metadata version {0} is not supported")]
    UnsupportedVersion(u32),
    /// A section of the metadata header points outside the file, or its size
    /// isn't a whole number of entries.
    #[error("metadata section {0} is out of bounds or misaligned")]
    BadSection(&'static str),
    /// An index into a metadata table (named by the first field) is out of range.
    #[error("index {1} is out of range for {0}")]
    BadIndex(&'static str, i64),
    /// The game binary couldn't be parsed, its registration structs weren't
    /// found, or a type in its table couldn't be read.
    #[error("binary: {0}")]
    Binary(String),
    /// [`Game::open`](crate::Game::open) couldn't find `global-metadata.dat`
    /// or `GameAssembly` in the game folder.
    #[error("could not find {0}")]
    NotFound(String),
    /// Building or writing a declaration assembly failed in hao.
    #[error(transparent)]
    Hao(#[from] hao::error::HaoError),
    /// A file couldn't be read or written.
    #[error("io error: {0}")]
    Io(#[from] std::io::Error),
}