Switch to using retour for better cross-platform support#5
Switch to using retour for better cross-platform support#5ccptr wants to merge 1 commit intoW1lliam1337:mainfrom
Conversation
|
|
||
| let mut hk = | ||
| Self { target: target.cast_mut(), detour: detour.cast_mut(), original: null_mut() }; | ||
| let hook = unsafe { retour::RawDetour::new(target as _, detour as _)? }; |
There was a problem hiding this comment.
This can also be wrapped in ManuallyDrop instead of storing it in the struct below
|
Any input on this? I'm actually planning to turn this into a CS2 base as a library. I'm hoping to make something where you can pretty much just use cs2lib::{Hooks, make_entry_point};
unsafe extern "system" fn create_move(a1: *mut f32, a2: u64, a3: i8, a4: u64, a5: u64, a6: u64) -> u64 {
println!("create move called");
originals::create_move(a1, a2, a3, a4, a5, a6)
}
fn startup() {
let hooks = Hooks {
create_move: Some(create_move),
// add the rest of the functions you want to hook here
..Default::default()
};
let originals = cs2lib::initialize(&hooks);
}
make_entry_point!(startup);The cheat developer would get type checking for hook functions, signatures for hooks, and would make it easier to contribute due to the library not being coupled with the cheat, making it easier for everyone when CS2 updates break things. I completely understand if you're not interested in doing this, but if you're willing to just add Linux support please let me know, as I have a PR in the works that I'll just squash if you're not interested. |
+1 for Retour also a +1 If you would add a Offset Manager. |
I'm planning on adding Linux support if you're open to it. I tested it on Windows and the behavior hasn't changed. Using retour also has the advantage of being written in Rust, so it's one less system dependency :)