Skip to main content

Il2Cpp

Struct Il2Cpp 

Source
pub struct Il2Cpp { /* private fields */ }
Expand description

The game’s Il2Cpp runtime.

Implementations§

Source§

impl Il2Cpp

Source

pub fn loaded() -> Result<&'static Il2Cpp>

The runtime of the game binary already loaded in this process.

Source

pub fn load(path: impl AsRef<Path>) -> Result<&'static Il2Cpp>

Loads a game binary into this process, e.g. to run a game’s code without Unity.

Source

pub fn get() -> Option<&'static Il2Cpp>

The instance set up by Il2Cpp::loaded or Il2Cpp::load.

Source

pub fn api(&self) -> &Api

Source

pub fn init_standalone(&self, data_dir: impl AsRef<Path>) -> Result<()>

Starts the runtime without Unity, given the game’s <Game>_Data/il2cpp_data folder. Only the game’s pure .NET code can run this way; anything calling into Unity will fail.

Source

pub fn attach_thread(&self)

Lets the calling thread run managed code. Needed on threads the game didn’t start.

Source

pub fn class( &'static self, assembly: &str, namespace: &str, name: &str, ) -> Result<Class>

Finds a class, e.g. class("Assembly-CSharp", "Game.Player", "Health").

Source

pub fn string(&self, value: &str) -> Result<Il2CppString>

A new managed string.

Source

pub fn byte_array(&'static self, bytes: &[u8]) -> Result<Object>

A new managed byte[] holding a copy of bytes, e.g. to pass to Texture2D.LoadRawTextureData.

Source

pub unsafe fn read_string(&self, string: Object) -> Option<String>

Reads a managed string, None for null.

§Safety

string must be null or a live System.String.

Source

pub fn assemblies(&'static self) -> Vec<Image>

Every assembly loaded in the current domain.

Source

pub unsafe fn class_of(&'static self, object: Object) -> Class

The class of a managed object.

§Safety

object must be a live managed object.

Source

pub unsafe fn exception_message(&self, exception: Ptr) -> String

Extracts a human-readable message from a managed exception object by calling its ToString() method. Falls back to the class name if ToString() fails.

§Safety

exception must be a non-null, live managed exception object.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more