Skip to content

Commit

Permalink
Fix assemblies_pointer vs assemblies
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexKnauth committed Oct 17, 2023
1 parent a17517d commit 87b4842
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/game_engine/unity/mono.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ impl Module {
let sig_function_array: Signature<0x100> = Signature::Simple(function_array);
let mono_assembly_foreach_address = sig_function_array.scan_process_range(process, module_range)?;

let assemblies: Address = match is_64_bit {
let assemblies_pointer: Address = match is_64_bit {
true => {
const SIG_MONO_64_DYLIB: Signature<3> = Signature::new("48 8B 3D");
// RIP-relative addressing
Expand All @@ -140,12 +140,21 @@ impl Module {
}
};

Some(Self {
is_64_bit,
version,
offsets,
assemblies,
})
let assemblies: Address = match is_64_bit {
true => process.read::<Address64>(assemblies_pointer).ok()?.into(),
false => process.read::<Address32>(assemblies_pointer).ok()?.into(),
};

if assemblies.is_null() {
None
} else {
Some(Self {
is_64_bit,
version,
offsets,
assemblies,
})
}
}

fn assemblies<'a>(&'a self, process: &'a Process) -> impl Iterator<Item = Assembly> + 'a {
Expand Down

0 comments on commit 87b4842

Please sign in to comment.