Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Jujstme committed Oct 15, 2023
1 parent 5691fa5 commit aa5eead
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
12 changes: 10 additions & 2 deletions src/game_engine/unity/il2cpp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,10 @@ impl<const CAP: usize> UnityPointer<CAP> {
image: &Image,
) -> Result<Address, Error> {
self.find_offsets(process, module, image)?;
self.deep_pointer.get().ok_or(Error {})?.deref_offsets(process)
self.deep_pointer
.get()
.ok_or(Error {})?
.deref_offsets(process)
}

/// Dereferences the pointer path, returning the value stored at the final memory address
Expand All @@ -610,7 +613,12 @@ impl<const CAP: usize> UnityPointer<CAP> {

/// Recovers the `DeepPointer` struct contained inside this `UnityPointer`,
/// if the offsets have been found
pub fn get_deep_pointer(&self, process: &Process, module: &Module, image: &Image) -> Option<DeepPointer<CAP>> {
pub fn get_deep_pointer(
&self,
process: &Process,
module: &Module,
image: &Image,
) -> Option<DeepPointer<CAP>> {
self.find_offsets(process, module, image).ok()?;
self.deep_pointer.get().cloned()
}
Expand Down
23 changes: 17 additions & 6 deletions src/game_engine/unity/mono.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
//! backend.
use crate::{
deep_pointer::{DeepPointer, DerefType},
file_format::pe,
future::retry,
signature::Signature,
string::ArrayCString,
Address, Address32, Address64, Error, Process, deep_pointer::{DeepPointer, DerefType},
Address, Address32, Address64, Error, Process,
};
use core::{iter, cell::OnceCell};
use core::{cell::OnceCell, iter};

use arrayvec::{ArrayString, ArrayVec};
#[cfg(feature = "derive")]
Expand Down Expand Up @@ -454,7 +455,9 @@ impl Class {
)
.ok()?;

Some(Class { class: module.read_pointer(process, parent_addr).ok()? })
Some(Class {
class: module.read_pointer(process, parent_addr).ok()?,
})
}

/// Tries to find a field with the specified name in the class. This returns
Expand Down Expand Up @@ -599,7 +602,7 @@ impl<const CAP: usize> Pointer<CAP> {
// In every iteration of the loop, except the last one, we then need to find the Class address for the next offset
if i != self.fields.len() - 1 {
let vtable = module.read_pointer(process, target_field.field)?;

current_class = Class {
class: module.read_pointer(process, vtable)?,
};
Expand Down Expand Up @@ -627,7 +630,10 @@ impl<const CAP: usize> Pointer<CAP> {
image: &Image,
) -> Result<Address, Error> {
self.find_offsets(process, module, image)?;
self.deep_pointer.get().ok_or(Error {})?.deref_offsets(process)
self.deep_pointer
.get()
.ok_or(Error {})?
.deref_offsets(process)
}

/// Dereferences the pointer path, returning the value stored at the final memory address
Expand All @@ -643,7 +649,12 @@ impl<const CAP: usize> Pointer<CAP> {

/// Recovers the `DeepPointer` struct contained inside this `UnityPointer`,
/// if the offsets have been found
pub fn get_deep_pointer(&self, process: &Process, module: &Module, image: &Image) -> Option<DeepPointer<CAP>> {
pub fn get_deep_pointer(
&self,
process: &Process,
module: &Module,
image: &Image,
) -> Option<DeepPointer<CAP>> {
self.find_offsets(process, module, image).ok()?;
self.deep_pointer.get().cloned()
}
Expand Down

0 comments on commit aa5eead

Please sign in to comment.