diff --git a/src/ll/api/event/player/PlayerSwingEvent.cpp b/src/ll/api/event/player/PlayerSwingEvent.cpp index c48e8b2cf6..325ae46bbf 100644 --- a/src/ll/api/event/player/PlayerSwingEvent.cpp +++ b/src/ll/api/event/player/PlayerSwingEvent.cpp @@ -11,7 +11,7 @@ LL_TYPE_INSTANCE_HOOK( PlayerSwingEventHook, HookPriority::Normal, ServerNetworkHandler, - "?handle@ServerNetworkHandler@@UEAAXAEBVNetworkIdentifier@@AEBVAnimatePacket@@@Z", + &ServerNetworkHandler::handle, void, NetworkIdentifier const& id, AnimatePacket const& packet diff --git a/src/ll/api/memory/Hook.h b/src/ll/api/memory/Hook.h index 37609681ef..4020e3746f 100644 --- a/src/ll/api/memory/Hook.h +++ b/src/ll/api/memory/Hook.h @@ -67,8 +67,8 @@ struct AddConstAtMemberFun { template using AddConstAtMemberFunT = typename AddConstAtMemberFun::type; -template -using AddConstAtMemberFunIfOriginIs = std::conditional_t, AddConstAtMemberFunT, T>; +template +using AddConstAtMemberFunIfOriginIs = std::conditional_t, T>; /** * @brief Hook priority enum. @@ -166,8 +166,11 @@ class HookRegistrar { struct DEF_TYPE TYPE { \ using FuncPtr = ::ll::memory::FuncPtr; \ using HookPriority = ::ll::memory::HookPriority; \ - using OriginFuncType = \ - ::ll::memory::AddConstAtMemberFunIfOriginIs; \ + template \ + static constexpr bool isConstMemberFunction = \ + requires(T const&) { static_cast(IDENTIFIER); }; \ + using OriginFuncType = ::ll::memory:: \ + AddConstAtMemberFunIfOriginIs>; \ \ inline static FuncPtr target__{}; \ inline static OriginFuncType originFunc__{}; \ @@ -177,10 +180,10 @@ class HookRegistrar { template \ static consteval void detector() { \ if constexpr (requires { \ - ::ll::memory::virtualDetector(); \ + ::ll::memory::virtualDetector(IDENTIFIER)>(); \ ll::memory::resolveIdentifier(IDENTIFIER); \ }) { \ - if constexpr (::ll::memory::virtualDetector()) { \ + if constexpr (::ll::memory::virtualDetector(IDENTIFIER)>()) { \ static_assert( \ ::ll::concepts::always_false, \ #IDENTIFIER " is a virtual function, for now you can't use function pointer to hook it." \