diff --git a/src-test/server/HookTest.cpp b/src-test/server/HookTest.cpp index 81c157c724..f1ef70dc84 100644 --- a/src-test/server/HookTest.cpp +++ b/src-test/server/HookTest.cpp @@ -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 diff --git a/src/ll/api/memory/Hook.h b/src/ll/api/memory/Hook.h index 11f9f144fe..49c2e15677 100644 --- a/src/ll/api/memory/Hook.h +++ b/src/ll/api/memory/Hook.h @@ -80,6 +80,11 @@ constexpr FuncPtr resolveIdentifier(uintptr_t address) { return toFuncPtr(address); } +template +constexpr uintptr_t unchecked(T identifier) { + return reinterpret_cast(toFuncPtr(identifier)); +} + template requires(!std::is_member_function_pointer_v) consteval bool virtualDetector() noexcept {