Skip to content

Commit 22654da

Browse files
authored
Repaired radarhack/maphack
Repaired radarhack/maphack
1 parent f0da601 commit 22654da

3 files changed

Lines changed: 44 additions & 6 deletions

File tree

src/key_action.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::utils::{read_memory, write_memory};
99
use crate::vars::game_vars::{LOCAL_PLAYER, SMOOTH};
1010
use crate::vars::handles::AC_CLIENT_EXE_HMODULE;
1111
use crate::vars::mem_patches::{
12-
MAPHACK_MEMORY_PATCH, NO_RECOIL_MEMORY_PATCH, RAPID_FIRE_MEMORY_PATCH,
12+
MAPHACK_MEMORY_PATCH, NO_RECOIL_MEMORY_PATCH, RADAR_MEMORY_PATCH, RAPID_FIRE_MEMORY_PATCH,
1313
};
1414
use crate::vars::ui_vars::IS_SMOOTH;
1515
use crate::vec_structures::Vec3;
@@ -97,10 +97,16 @@ pub unsafe fn toggle_maphack(toggle: &mut bool) {
9797
MAPHACK_MEMORY_PATCH
9898
.patch_memory()
9999
.expect("[ui] Failed to patch memory Maphack");
100+
RADAR_MEMORY_PATCH
101+
.patch_memory()
102+
.expect("[ui] Failed to patch memory Radar");
100103
} else {
101104
MAPHACK_MEMORY_PATCH
102105
.unpatch_memory()
103106
.expect("[ui] Failed to unpatch memory Maphack");
107+
RADAR_MEMORY_PATCH
108+
.unpatch_memory()
109+
.expect("[ui] Failed to unpatch memory Radar");
104110
}
105111
}
106112
}

src/misc.rs

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::pattern_mask::PatternMask;
44
use crate::triggerbot_hook::setup_trigger_bot;
55
use crate::utils::find_pattern;
66
use crate::vars::mem_patches::{
7-
MAPHACK_MEMORY_PATCH, NO_RECOIL_MEMORY_PATCH, RAPID_FIRE_MEMORY_PATCH,
7+
MAPHACK_MEMORY_PATCH, NO_RECOIL_MEMORY_PATCH, RADAR_MEMORY_PATCH, RAPID_FIRE_MEMORY_PATCH,
88
};
99
use crate::wallhack_hook::setup_wallhack;
1010
use std::ffi::c_void;
@@ -71,7 +71,7 @@ pub unsafe fn init_mem_patches() {
7171
}
7272
});
7373
thread::spawn(|| {
74-
let pattern_mask = PatternMask::aob_to_pattern_mask("75 57 85 C9 ? ? ? ? ? ? 83 F9 04");
74+
let pattern_mask = PatternMask::aob_to_pattern_mask("0F 8D ? ? ? ? 85 C9 74 64");
7575

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

@@ -89,9 +89,40 @@ pub unsafe fn init_mem_patches() {
8989
println!("[esp] maphack pattern not found");
9090
}
9191
unsafe {
92-
MAPHACK_MEMORY_PATCH =
93-
MemoryPatch::new(&[0x90, 0x90], 0x02, map_res as *mut c_void, 2usize)
94-
.expect("Failed to patch map");
92+
MAPHACK_MEMORY_PATCH = MemoryPatch::new(
93+
&[0xE9, 0xCD, 0x00, 0x00, 0x00, 0x90],
94+
0x06,
95+
map_res as *mut c_void,
96+
6usize,
97+
)
98+
.expect("Failed to patch map");
99+
}
100+
101+
let pattern_mask2 = PatternMask::aob_to_pattern_mask("0F 8D ? ? ? ? 85 C9 74 68");
102+
103+
println!("[RadarHack] {:#x}", &pattern_mask2);
104+
105+
let radarhack_aob = find_pattern(
106+
"ac_client.exe",
107+
&*pattern_mask2.aob_pattern,
108+
&pattern_mask2.mask_to_string(),
109+
);
110+
111+
let mut radar_res: usize = 0;
112+
if radarhack_aob.is_some() {
113+
radar_res = radarhack_aob.unwrap();
114+
println!("[esp] radarhack pattern found at: {:#x}", radar_res);
115+
} else {
116+
println!("[esp] radarhack pattern not found");
117+
}
118+
unsafe {
119+
RADAR_MEMORY_PATCH = MemoryPatch::new(
120+
&[0xE9, 0xD6, 0x00, 0x00, 0x00, 0x90],
121+
0x06,
122+
radar_res as *mut c_void,
123+
6usize,
124+
)
125+
.expect("Failed to patch radar");
95126
}
96127
});
97128
setup_trigger_bot();

src/vars.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub mod mem_patches {
1717
pub static mut NO_RECOIL_MEMORY_PATCH: MemoryPatch = MemoryPatch::new_empty();
1818
pub static mut RAPID_FIRE_MEMORY_PATCH: MemoryPatch = MemoryPatch::new_empty();
1919
pub static mut MAPHACK_MEMORY_PATCH: MemoryPatch = MemoryPatch::new_empty();
20+
pub static mut RADAR_MEMORY_PATCH: MemoryPatch = MemoryPatch::new_empty();
2021
}
2122
pub mod ui_vars {
2223
use std::sync::atomic::AtomicBool;

0 commit comments

Comments
 (0)