mirror of https://github.com/pozm/gdke.git
crazy person
This commit is contained in:
parent
994eedf40c
commit
cf2a8f23c4
|
@ -14,10 +14,12 @@ static_detour! {
|
||||||
pub static OpenAndParse: unsafe extern "fastcall" fn(*const i32, *const i32, *const u8, bool) -> ();
|
pub static OpenAndParse: unsafe extern "fastcall" fn(*const i32, *const i32, *const u8, bool) -> ();
|
||||||
}
|
}
|
||||||
|
|
||||||
const SIGS: [&str; 2] = [
|
const SIGS: [&str; 4] = [
|
||||||
// call into open_and_parse
|
// call into open_and_parse
|
||||||
"E8 ? ? ? ? 85 C0 0F 84 ? ? ? ? 49 8B 8C 24 ? ? ? ?", // 4.x (4.2.1)
|
"E8 ? ? ? ? 85 C0 0F 84 ? ? ? ? 49 8B 8C 24 ? ? ? ?", // 4.x (4.2.1)
|
||||||
"E8 ? ? ? ? 8B D8 85 C0 0F 84 ? ? ? ? 49 8B 04 24", // 3.x
|
"E8 ? ? ? ? 89 44 24 50 83 7C 24 ? ? 0F 84 ? ? ? ? 48 8B 44 24 ?", // 3.5.1
|
||||||
|
"E8 ? ? ? ? 89 44 24 50 83 7C 24 ? ? 0F 84 ? ? ? ? 48 8B 44 24 ?", // 3.5.1
|
||||||
|
"E8 ? ? ? ? 8B D8 85 C0 0F 84 ? ? ? ? 49 8B 04 24", // 3.x
|
||||||
];
|
];
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -28,13 +30,11 @@ fn find_sig_addr(sig_type: usize) -> Result<*const c_void, SigErrors> {
|
||||||
let proc = Process::this_process();
|
let proc = Process::this_process();
|
||||||
let modd = proc.get_base_module().unwrap();
|
let modd = proc.get_base_module().unwrap();
|
||||||
|
|
||||||
let sig = SIGS
|
let sig = SIGS.get(sig_type).ok_or(SigErrors::NotFound)?;
|
||||||
.get(sig_type as usize)
|
|
||||||
.ok_or_else(|| SigErrors::NotFound)?;
|
|
||||||
let addr = modd
|
let addr = modd
|
||||||
.scan(sig)
|
.scan(sig)
|
||||||
.map_err(|_| SigErrors::NotFound)?
|
.map_err(|_| SigErrors::NotFound)?
|
||||||
.ok_or_else(|| SigErrors::NotFound)? as isize;
|
.ok_or(SigErrors::NotFound)? as isize;
|
||||||
println!("sig found: {:x} ", addr);
|
println!("sig found: {:x} ", addr);
|
||||||
let ptr_to_fn = (addr as usize + size_of::<u8>()) as *const u8;
|
let ptr_to_fn = (addr as usize + size_of::<u8>()) as *const u8;
|
||||||
let mut addr_offset = [0; 4];
|
let mut addr_offset = [0; 4];
|
||||||
|
|
13
src/lib.rs
13
src/lib.rs
|
@ -142,13 +142,14 @@ pub unsafe fn spawn_and_inject(proc: &str) -> anyhow::Result<[u8; 32]> {
|
||||||
};
|
};
|
||||||
let game_ver = check_gd_ver(pth)?;
|
let game_ver = check_gd_ver(pth)?;
|
||||||
println!("gamever = {game_ver}");
|
println!("gamever = {game_ver}");
|
||||||
let sig_id = match game_ver
|
let sig_id = match &game_ver
|
||||||
.chars()
|
.chars().collect::<Vec<char>>()[..]
|
||||||
.next()
|
// .next()
|
||||||
.ok_or(anyhow::anyhow!("unable to check gd version"))?
|
// .ok_or(anyhow::anyhow!("unable to check gd version"))?
|
||||||
{
|
{
|
||||||
'4' => 0u32,
|
['4',..] => 0u32,
|
||||||
'3' => 1u32,
|
['3','.','6',..] => 2u32,
|
||||||
|
['3',..] => 1u32,
|
||||||
_ => return Err(anyhow::anyhow!("invalid godot version")),
|
_ => return Err(anyhow::anyhow!("invalid godot version")),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue