/// Inner entry point for the library.
///
/// Should not be invoked directly, but via the `hook!` macro which will
/// also provide the `WinMain` entry point.
///
/// This function finds the `IDXGISwapChain::Present` function address,
/// creates and enables the hook via `MinHook`. Returns the callback to the
/// trampoline function, if successful.
Inner entry point for the library.
Should not be invoked directly, but via the `hook!` macro which will
also provide the `WinMain` entry point.

This function finds the `IDXGISwapChain::Present` function address,
creates and enables the hook via `MinHook`. Returns the callback to the
trampoline function, if successful.
Inner entry point for the library . Should not be invoked directly but via the ` hook! ` macro which will also provide the ` WinMain ` entry point . This function finds the ` IDXGISwapChain :: Present ` function address creates and enables the hook via ` MinHook ` . Returns the callback to the trampoline function if successful .
pub unsafe fn apply_hook(
  render_loop: Box<dyn RenderLoop>,
) -> Result<(DXGISwapChainPresentType, XInputGetStateType)> {
  let xinput_addr = get_xinput_addr();
  info!("XInputGetState = {:p}", xinput_addr);
  let dxgi_swap_chain_present_addr = get_present_addr().unwrap();
  info!(
    "IDXGISwapChain::Present = {:p}",
    dxgi_swap_chain_present_addr
  );
  let mut xinput_get_state_trampoline = MaybeUninit::<XInputGetStateType>::uninit();
  let mut dxgi_swap_chain_present_trampoline = MaybeUninit::<DXGISwapChainPresentType>::uninit();
  let status = mh::MH_Initialize();
  info!("MH_Initialize: {:?}", status);
  // Hook IDXGISwapCHain::Present
  let status = mh::MH_CreateHook(
    dxgi_swap_chain_present_addr,
    DXGISwapChainPresentOverride as LPVOID,
    &mut dxgi_swap_chain_present_trampoline as *mut _ as _,
  );
  info!("MH_CreateHook: {:?}", status);
  let status = mh::MH_QueueEnableHook(dxgi_swap_chain_present_addr);
  info!("MH_QueueEnableHook: {:?}", status);
  // Hook XInputGetState
  let status = mh::MH_CreateHook(
    xinput_addr,
    XInputGetStateOverride as LPVOID,
    &mut xinput_get_state_trampoline as *mut _ as _,
  );
  info!("MH_CreateHook: {:?}", status);
  let status = mh::MH_QueueEnableHook(xinput_addr);
  info!("MH_QueueEnableHook: {:?}", status);
  let status = mh::MH_ApplyQueued();
  info!("MH_ApplyQueued: {:?}", status);
  Ok((
    dxgi_swap_chain_present_trampoline.assume_init(),
    xinput_get_state_trampoline.assume_init(),
  ))
}
pub unsafe fn apply_hook ( render_loop : Box < dyn RenderLoop > , ) -> Result < ( DXGISwapChainPresentType , XInputGetStateType ) > { let xinput_addr = get_xinput_addr ( ) ; info ! ( " " xinput_addr ) ; let dxgi_swap_chain_present_addr = get_present_addr ( ) . unwrap ( ) ; info ! ( " " dxgi_swap_chain_present_addr ) ; let mut xinput_get_state_trampoline = MaybeUninit :: < XInputGetStateType > :: uninit ( ) ; let mut dxgi_swap_chain_present_trampoline = MaybeUninit :: < DXGISwapChainPresentType > :: uninit ( ) ; let status = mh :: MH_Initialize ( ) ; info ! ( " " status ) ; // Hook IDXGISwapCHain::Present let status = mh :: MH_CreateHook ( dxgi_swap_chain_present_addr , DXGISwapChainPresentOverride as LPVOID , & mut dxgi_swap_chain_present_trampoline as * mut _ as _ , ) ; info ! ( " " status ) ; let status = mh :: MH_QueueEnableHook ( dxgi_swap_chain_present_addr ) ; info ! ( " " status ) ; // Hook XInputGetState let status = mh :: MH_CreateHook ( xinput_addr , XInputGetStateOverride as LPVOID , & mut xinput_get_state_trampoline as * mut _ as _ , ) ; info ! ( " " status ) ; let status = mh :: MH_QueueEnableHook ( xinput_addr ) ; info ! ( " " status ) ; let status = mh :: MH_ApplyQueued ( ) ; info ! ( " " status ) ; Ok ( ( dxgi_swap_chain_present_trampoline . assume_init ( ) , xinput_get_state_trampoline . assume_init ( ) , ) ) }
Inner entry point for the library.
Inner entry point for the library .
render_loop
Box<dyn RenderLoop>