Skip to content

Commit

Permalink
feat(hook): add uncheck hook option and fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
RimuruChan committed Jan 13, 2025
1 parent 197a033 commit e1ee08d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src-test/server/HookTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ class TestPtrClass {
int test(int a, int b) { return a + b; }
};

// they will choose non-const version if possible
// test unchecked function pointer
LL_TYPE_INSTANCE_HOOK(
TestPtrHook,
HookPriority::Normal,
TestPtrClass,
ll::memory::toFuncPtr(&TestPtrClass::test),
ll::memory::unchecked(&TestPtrClass::test),
int,
__int64 a,
__int64 b
Expand Down
5 changes: 5 additions & 0 deletions src/ll/api/memory/Hook.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ constexpr FuncPtr resolveIdentifier(uintptr_t address) {
return toFuncPtr(address);
}

template <class T>
constexpr uintptr_t unchecked(T identifier) {
return reinterpret_cast<uintptr_t>(toFuncPtr(identifier));
}

template <class T, auto>
requires(!std::is_member_function_pointer_v<T>)
consteval bool virtualDetector() noexcept {
Expand Down

0 comments on commit e1ee08d

Please sign in to comment.