mirror of
https://git.recroomarchive.org/Radium/libradhook.git
synced 2026-08-07 09:10:59 +00:00
22 lines
410 B
C++
22 lines
410 B
C++
#include <cassert>
|
|
#include "radhook/radhook.h"
|
|
|
|
static int fn() { return 42; }
|
|
static int detour() { return 1337; }
|
|
|
|
using Fn = int(*)();
|
|
|
|
int main() {
|
|
RadHookHandle h = nullptr;
|
|
|
|
RadHookCreate((void*)fn, (void*)detour, &h);
|
|
|
|
auto orig = RadHookGetOriginalAs<Fn>(h);
|
|
assert(orig != nullptr);
|
|
|
|
// trampoline must bypass hook
|
|
assert(orig() == 42);
|
|
|
|
RadHookDestroy(h);
|
|
return 0;
|
|
} |