summaryrefslogtreecommitdiff
path: root/src/core/hle/service/service.h
diff options
context:
space:
mode:
authorGravatar Lioncash2020-11-26 15:19:08 -0500
committerGravatar Lioncash2020-11-26 20:03:11 -0500
commit1a954b2a596fdfd4fc4b5feb9b43c8147de4cc7f (patch)
tree3593cd42e0ba676c3919561983f7e9766fcb641c /src/core/hle/service/service.h
parentMerge pull request #4975 from comex/invalid-syncpoint-id (diff)
downloadyuzu-1a954b2a596fdfd4fc4b5feb9b43c8147de4cc7f.tar.gz
yuzu-1a954b2a596fdfd4fc4b5feb9b43c8147de4cc7f.tar.xz
yuzu-1a954b2a596fdfd4fc4b5feb9b43c8147de4cc7f.zip
service: Eliminate usages of the global system instance
Completely removes all usages of the global system instance within the services code by passing in the using system instance to the services.
Diffstat (limited to 'src/core/hle/service/service.h')
-rw-r--r--src/core/hle/service/service.h18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h
index ed4792289..62a182310 100644
--- a/src/core/hle/service/service.h
+++ b/src/core/hle/service/service.h
@@ -80,6 +80,9 @@ protected:
80 template <typename Self> 80 template <typename Self>
81 using HandlerFnP = void (Self::*)(Kernel::HLERequestContext&); 81 using HandlerFnP = void (Self::*)(Kernel::HLERequestContext&);
82 82
83 /// System context that the service operates under.
84 Core::System& system;
85
83private: 86private:
84 template <typename T> 87 template <typename T>
85 friend class ServiceFramework; 88 friend class ServiceFramework;
@@ -93,7 +96,8 @@ private:
93 using InvokerFn = void(ServiceFrameworkBase* object, HandlerFnP<ServiceFrameworkBase> member, 96 using InvokerFn = void(ServiceFrameworkBase* object, HandlerFnP<ServiceFrameworkBase> member,
94 Kernel::HLERequestContext& ctx); 97 Kernel::HLERequestContext& ctx);
95 98
96 ServiceFrameworkBase(const char* service_name, u32 max_sessions, InvokerFn* handler_invoker); 99 explicit ServiceFrameworkBase(Core::System& system_, const char* service_name_,
100 u32 max_sessions_, InvokerFn* handler_invoker_);
97 ~ServiceFrameworkBase() override; 101 ~ServiceFrameworkBase() override;
98 102
99 void RegisterHandlersBase(const FunctionInfoBase* functions, std::size_t n); 103 void RegisterHandlersBase(const FunctionInfoBase* functions, std::size_t n);
@@ -151,11 +155,15 @@ protected:
151 155
152 /** 156 /**
153 * Initializes the handler with no functions installed. 157 * Initializes the handler with no functions installed.
154 * @param max_sessions Maximum number of sessions that can be 158 *
155 * connected to this service at the same time. 159 * @param system_ The system context to construct this service under.
160 * @param service_name_ Name of the service.
161 * @param max_sessions_ Maximum number of sessions that can be
162 * connected to this service at the same time.
156 */ 163 */
157 explicit ServiceFramework(const char* service_name, u32 max_sessions = DefaultMaxSessions) 164 explicit ServiceFramework(Core::System& system_, const char* service_name_,
158 : ServiceFrameworkBase(service_name, max_sessions, Invoker) {} 165 u32 max_sessions_ = DefaultMaxSessions)
166 : ServiceFrameworkBase(system_, service_name_, max_sessions_, Invoker) {}
159 167
160 /// Registers handlers in the service. 168 /// Registers handlers in the service.
161 template <std::size_t N> 169 template <std::size_t N>