Skip to content

Commit

Permalink
Repaired radarhack/maphack
Browse files Browse the repository at this point in the history
Repaired radarhack/maphack
  • Loading branch information
luadebug authored Aug 3, 2024
1 parent f0da601 commit 22654da
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 6 deletions.
8 changes: 7 additions & 1 deletion src/key_action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::utils::{read_memory, write_memory};
use crate::vars::game_vars::{LOCAL_PLAYER, SMOOTH};
use crate::vars::handles::AC_CLIENT_EXE_HMODULE;
use crate::vars::mem_patches::{
MAPHACK_MEMORY_PATCH, NO_RECOIL_MEMORY_PATCH, RAPID_FIRE_MEMORY_PATCH,
MAPHACK_MEMORY_PATCH, NO_RECOIL_MEMORY_PATCH, RADAR_MEMORY_PATCH, RAPID_FIRE_MEMORY_PATCH,
};
use crate::vars::ui_vars::IS_SMOOTH;
use crate::vec_structures::Vec3;
Expand Down Expand Up @@ -97,10 +97,16 @@ pub unsafe fn toggle_maphack(toggle: &mut bool) {
MAPHACK_MEMORY_PATCH
.patch_memory()
.expect("[ui] Failed to patch memory Maphack");
RADAR_MEMORY_PATCH
.patch_memory()
.expect("[ui] Failed to patch memory Radar");
} else {
MAPHACK_MEMORY_PATCH
.unpatch_memory()
.expect("[ui] Failed to unpatch memory Maphack");
RADAR_MEMORY_PATCH
.unpatch_memory()
.expect("[ui] Failed to unpatch memory Radar");
}
}
}
Expand Down
41 changes: 36 additions & 5 deletions src/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::pattern_mask::PatternMask;
use crate::triggerbot_hook::setup_trigger_bot;
use crate::utils::find_pattern;
use crate::vars::mem_patches::{
MAPHACK_MEMORY_PATCH, NO_RECOIL_MEMORY_PATCH, RAPID_FIRE_MEMORY_PATCH,
MAPHACK_MEMORY_PATCH, NO_RECOIL_MEMORY_PATCH, RADAR_MEMORY_PATCH, RAPID_FIRE_MEMORY_PATCH,
};
use crate::wallhack_hook::setup_wallhack;
use std::ffi::c_void;
Expand Down Expand Up @@ -71,7 +71,7 @@ pub unsafe fn init_mem_patches() {
}
});
thread::spawn(|| {
let pattern_mask = PatternMask::aob_to_pattern_mask("75 57 85 C9 ? ? ? ? ? ? 83 F9 04");
let pattern_mask = PatternMask::aob_to_pattern_mask("0F 8D ? ? ? ? 85 C9 74 64");

println!("[MapHack] {:#x}", &pattern_mask);

Expand All @@ -89,9 +89,40 @@ pub unsafe fn init_mem_patches() {
println!("[esp] maphack pattern not found");
}
unsafe {
MAPHACK_MEMORY_PATCH =
MemoryPatch::new(&[0x90, 0x90], 0x02, map_res as *mut c_void, 2usize)
.expect("Failed to patch map");
MAPHACK_MEMORY_PATCH = MemoryPatch::new(
&[0xE9, 0xCD, 0x00, 0x00, 0x00, 0x90],
0x06,
map_res as *mut c_void,
6usize,
)
.expect("Failed to patch map");
}

let pattern_mask2 = PatternMask::aob_to_pattern_mask("0F 8D ? ? ? ? 85 C9 74 68");

println!("[RadarHack] {:#x}", &pattern_mask2);

let radarhack_aob = find_pattern(
"ac_client.exe",
&*pattern_mask2.aob_pattern,
&pattern_mask2.mask_to_string(),
);

let mut radar_res: usize = 0;
if radarhack_aob.is_some() {
radar_res = radarhack_aob.unwrap();
println!("[esp] radarhack pattern found at: {:#x}", radar_res);
} else {
println!("[esp] radarhack pattern not found");
}
unsafe {
RADAR_MEMORY_PATCH = MemoryPatch::new(
&[0xE9, 0xD6, 0x00, 0x00, 0x00, 0x90],
0x06,
radar_res as *mut c_void,
6usize,
)
.expect("Failed to patch radar");
}
});
setup_trigger_bot();
Expand Down
1 change: 1 addition & 0 deletions src/vars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pub mod mem_patches {
pub static mut NO_RECOIL_MEMORY_PATCH: MemoryPatch = MemoryPatch::new_empty();
pub static mut RAPID_FIRE_MEMORY_PATCH: MemoryPatch = MemoryPatch::new_empty();
pub static mut MAPHACK_MEMORY_PATCH: MemoryPatch = MemoryPatch::new_empty();
pub static mut RADAR_MEMORY_PATCH: MemoryPatch = MemoryPatch::new_empty();
}
pub mod ui_vars {
use std::sync::atomic::AtomicBool;
Expand Down

0 comments on commit 22654da

Please sign in to comment.