hudhook

A DirectX 11 render loop hook library with memory manipulation API and Dear ImGui overlays, largely inspired by CheatEngine.

Read up on the underlying architecture here.

Example

```rust // src/lib.rs use std::time::Instant;

use hudhook::memory::; use hudhook::; use imgui::im_str;

pub struct HelloWorld { start: Instant, counter: f64, }

impl RenderLoop for HelloWorld { fn render(&mut self, ctx: hudhook::RenderContext) { self.counter += 0.001;

let baddr: usize = base_address();
let ptr = PointerChain::<f64>::new(&[baddr + 0x1BAF0, 0x18]);
ptr.write(self.counter);

imgui::Window::new(im_str!("Hello"))
  .size([320.0, 256.0], imgui::Condition::FirstUseEver)
  .build(ctx.frame, || {
    ctx.frame.text(im_str!("Hello world!"));
    ctx
      .frame
      .text(format!("Time elapsed: {:?}", self.start.elapsed()));
    ctx.frame.text(format!("Counter: {}", self.counter));
    ctx.frame.separator();
  });

} fn isvisible(&self) -> bool { true } fn iscapturing(&self) -> bool { true } }

hudhook!(Box::new(HelloWorld { start: Instant::now(), counter: 1000. })); ```

```rust // src/main.rs use hudhook::inject; use std::process::Command;

[test]

fn testrunagainstsample() { let mut child = Command::new("mydx11application.exe") .spawn() .expect("Failed to run child process"); std::thread::sleep(std::time::Duration::frommillis(250));

inject::inject("mydx11application.exe", "target/release/libmycrate.dll").ok();

child.wait().expect("Child process error"); } ```