diff options
author | bunnei <bunneidev@gmail.com> | 2023-05-07 21:18:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-07 21:18:09 +0200 |
commit | e58090c9c731701662d0824c2fd081467f21f5c3 (patch) | |
tree | f35c9a080f3b5a9067381b615eca928e8825ee20 /src/core/hle/service/service.h | |
parent | Merge pull request #10192 from bunnei/update-dynarmic-2 (diff) | |
parent | service: nfc: Merge device interfaces and create the device manager (diff) | |
download | yuzu-e58090c9c731701662d0824c2fd081467f21f5c3.tar yuzu-e58090c9c731701662d0824c2fd081467f21f5c3.tar.gz yuzu-e58090c9c731701662d0824c2fd081467f21f5c3.tar.bz2 yuzu-e58090c9c731701662d0824c2fd081467f21f5c3.tar.lz yuzu-e58090c9c731701662d0824c2fd081467f21f5c3.tar.xz yuzu-e58090c9c731701662d0824c2fd081467f21f5c3.tar.zst yuzu-e58090c9c731701662d0824c2fd081467f21f5c3.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/service/service.h | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index 0f79a1b7e..45b2c43b7 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h @@ -142,7 +142,8 @@ template <typename Self> class ServiceFramework : public ServiceFrameworkBase { protected: /// Contains information about a request type which is handled by the service. - struct FunctionInfo : FunctionInfoBase { + template <typename T> + struct FunctionInfoTyped : FunctionInfoBase { // TODO(yuriks): This function could be constexpr, but clang is the only compiler that // doesn't emit an ICE or a wrong diagnostic because of the static_cast. @@ -155,12 +156,13 @@ protected: * the request * @param name_ human-friendly name for the request. Used mostly for logging purposes. */ - FunctionInfo(u32 expected_header_, HandlerFnP<Self> handler_callback_, const char* name_) + FunctionInfoTyped(u32 expected_header_, HandlerFnP<T> handler_callback_, const char* name_) : FunctionInfoBase{ expected_header_, // Type-erase member function pointer by casting it down to the base class. static_cast<HandlerFnP<ServiceFrameworkBase>>(handler_callback_), name_} {} }; + using FunctionInfo = FunctionInfoTyped<Self>; /** * Initializes the handler with no functions installed. @@ -175,8 +177,8 @@ protected: : ServiceFrameworkBase(system_, service_name_, max_sessions_, Invoker) {} /// Registers handlers in the service. - template <std::size_t N> - void RegisterHandlers(const FunctionInfo (&functions)[N]) { + template <typename T = Self, std::size_t N> + void RegisterHandlers(const FunctionInfoTyped<T> (&functions)[N]) { RegisterHandlers(functions, N); } @@ -184,13 +186,14 @@ protected: * Registers handlers in the service. Usually prefer using the other RegisterHandlers * overload in order to avoid needing to specify the array size. */ - void RegisterHandlers(const FunctionInfo* functions, std::size_t n) { + template <typename T = Self> + void RegisterHandlers(const FunctionInfoTyped<T>* functions, std::size_t n) { RegisterHandlersBase(functions, n); } /// Registers handlers in the service. - template <std::size_t N> - void RegisterHandlersTipc(const FunctionInfo (&functions)[N]) { + template <typename T = Self, std::size_t N> + void RegisterHandlersTipc(const FunctionInfoTyped<T> (&functions)[N]) { RegisterHandlersTipc(functions, N); } @@ -198,7 +201,8 @@ protected: * Registers handlers in the service. Usually prefer using the other RegisterHandlers * overload in order to avoid needing to specify the array size. */ - void RegisterHandlersTipc(const FunctionInfo* functions, std::size_t n) { + template <typename T = Self> + void RegisterHandlersTipc(const FunctionInfoTyped<T>* functions, std::size_t n) { RegisterHandlersBaseTipc(functions, n); } |