Skip to main content

forge_sys/
hook.rs

1use core::ffi::c_void;
2
3#[repr(C)]
4#[derive(Debug, Clone, Copy)]
5pub struct Hook {
6    pub target: *const c_void,
7    pub detour: *const c_void,
8    pub original: *const c_void,
9    jit1: [u8; 24], // Opaque data for libnx JIT structure
10    jit2: [u8; 24], // Opaque data for libnx JIT structure
11    has_ctx: bool,
12}
13
14unsafe extern "C" {
15    pub fn forge_hook_create(target: *const c_void, detour: *const c_void, original: *mut *const c_void) -> Hook;
16    pub fn forge_hook_createWithContext(
17        target: *const c_void,
18        detour: *const c_void,
19        original: *mut *const c_void,
20        context: *const c_void,
21    ) -> Hook;
22    pub fn forge_hook_getContext() -> *const c_void;
23    pub fn forge_hook_updateContext(hook: *mut Hook, new_ctx: *const c_void) -> u32;
24}