diff --git a/include/stratosphere/ipc/ipc_serialization.hpp b/include/stratosphere/ipc/ipc_serialization.hpp index 07a5ee7a..278626c3 100644 --- a/include/stratosphere/ipc/ipc_serialization.hpp +++ b/include/stratosphere/ipc/ipc_serialization.hpp @@ -19,7 +19,6 @@ #include #include #include -#include #include #include @@ -36,16 +35,6 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-but-set-variable" -template -struct PopFront; - -template -struct PopFront> { - using type = std::tuple; -}; - -template struct WhichType; - template struct TypeList{}; @@ -560,12 +549,31 @@ struct Encoder> { /* ================================================================================= */ -template> +template +struct MemberFunctionTraits { + private: + template + static R GetReturnTypeImpl(R(C::*)(A...)); + + template + static C GetClassTypeImpl(R(C::*)(A...)); + + template + static std::tuple GetArgsImpl(R(C::*)(A...)); + public: + using ReturnType = decltype(GetReturnTypeImpl(MemberFunction)); + using ClassType = decltype(GetClassTypeImpl(MemberFunction)); + using ArgsType = decltype(GetArgsImpl(MemberFunction)); +}; + +template::ClassType> constexpr Result WrapIpcCommandImpl(IpcResponseContext *ctx) { - using InArgs = typename PopFront>::type; - using OutArgs = typename boost::callable_traits::return_type_t; - static_assert(std::is_base_of_v, ClassType>, "Override class type incorrect"); - using CommandMetaData = CommandMetaInfo; + using Traits = MemberFunctionTraits; + using ArgsType = typename Traits::ArgsType; + using ReturnType = typename Traits::ReturnType; + using BaseClassType = typename Traits::ClassType; + static_assert(std::is_base_of_v, "Override class type incorrect"); + using CommandMetaData = CommandMetaInfo; static_assert(CommandMetaData::ReturnsResult || CommandMetaData::ReturnsVoid, "IpcCommandImpls must return Result or void");