summaryrefslogtreecommitdiff
path: root/src/core/hle/service/service.cpp
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.cpp
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.cpp')
-rw-r--r--src/core/hle/service/service.cpp69
1 files changed, 35 insertions, 34 deletions
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index fb4979af2..360e0bf37 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -90,9 +90,10 @@ namespace Service {
90 return function_string; 90 return function_string;
91} 91}
92 92
93ServiceFrameworkBase::ServiceFrameworkBase(const char* service_name, u32 max_sessions, 93ServiceFrameworkBase::ServiceFrameworkBase(Core::System& system_, const char* service_name_,
94 InvokerFn* handler_invoker) 94 u32 max_sessions_, InvokerFn* handler_invoker_)
95 : service_name(service_name), max_sessions(max_sessions), handler_invoker(handler_invoker) {} 95 : system{system_}, service_name{service_name_}, max_sessions{max_sessions_},
96 handler_invoker{handler_invoker_} {}
96 97
97ServiceFrameworkBase::~ServiceFrameworkBase() = default; 98ServiceFrameworkBase::~ServiceFrameworkBase() = default;
98 99
@@ -146,8 +147,8 @@ void ServiceFrameworkBase::ReportUnimplementedFunction(Kernel::HLERequestContext
146 } 147 }
147 buf.push_back('}'); 148 buf.push_back('}');
148 149
149 Core::System::GetInstance().GetReporter().SaveUnimplementedFunctionReport( 150 system.GetReporter().SaveUnimplementedFunctionReport(ctx, ctx.GetCommand(), function_name,
150 ctx, ctx.GetCommand(), function_name, service_name); 151 service_name);
151 UNIMPLEMENTED_MSG("Unknown / unimplemented {}", fmt::to_string(buf)); 152 UNIMPLEMENTED_MSG("Unknown / unimplemented {}", fmt::to_string(buf));
152} 153}
153 154
@@ -171,7 +172,7 @@ ResultCode ServiceFrameworkBase::HandleSyncRequest(Kernel::HLERequestContext& co
171 } 172 }
172 case IPC::CommandType::ControlWithContext: 173 case IPC::CommandType::ControlWithContext:
173 case IPC::CommandType::Control: { 174 case IPC::CommandType::Control: {
174 Core::System::GetInstance().ServiceManager().InvokeControlRequest(context); 175 system.ServiceManager().InvokeControlRequest(context);
175 break; 176 break;
176 } 177 }
177 case IPC::CommandType::RequestWithContext: 178 case IPC::CommandType::RequestWithContext:
@@ -197,7 +198,7 @@ Services::Services(std::shared_ptr<SM::ServiceManager>& sm, Core::System& system
197 198
198 system.GetFileSystemController().CreateFactories(*system.GetFilesystem(), false); 199 system.GetFileSystemController().CreateFactories(*system.GetFilesystem(), false);
199 200
200 SM::ServiceManager::InstallInterfaces(sm, system.Kernel()); 201 SM::ServiceManager::InstallInterfaces(sm, system);
201 202
202 Account::InstallInterfaces(system); 203 Account::InstallInterfaces(system);
203 AM::InstallInterfaces(*sm, *nv_flinger, system); 204 AM::InstallInterfaces(*sm, *nv_flinger, system);
@@ -205,51 +206,51 @@ Services::Services(std::shared_ptr<SM::ServiceManager>& sm, Core::System& system
205 APM::InstallInterfaces(system); 206 APM::InstallInterfaces(system);
206 Audio::InstallInterfaces(*sm, system); 207 Audio::InstallInterfaces(*sm, system);
207 BCAT::InstallInterfaces(system); 208 BCAT::InstallInterfaces(system);
208 BPC::InstallInterfaces(*sm); 209 BPC::InstallInterfaces(*sm, system);
209 BtDrv::InstallInterfaces(*sm, system); 210 BtDrv::InstallInterfaces(*sm, system);
210 BTM::InstallInterfaces(*sm, system); 211 BTM::InstallInterfaces(*sm, system);
211 Capture::InstallInterfaces(*sm); 212 Capture::InstallInterfaces(*sm, system);
212 ERPT::InstallInterfaces(*sm); 213 ERPT::InstallInterfaces(*sm, system);
213 ES::InstallInterfaces(*sm); 214 ES::InstallInterfaces(*sm, system);
214 EUPLD::InstallInterfaces(*sm); 215 EUPLD::InstallInterfaces(*sm, system);
215 Fatal::InstallInterfaces(*sm, system); 216 Fatal::InstallInterfaces(*sm, system);
216 FGM::InstallInterfaces(*sm); 217 FGM::InstallInterfaces(*sm, system);
217 FileSystem::InstallInterfaces(system); 218 FileSystem::InstallInterfaces(system);
218 Friend::InstallInterfaces(*sm, system); 219 Friend::InstallInterfaces(*sm, system);
219 Glue::InstallInterfaces(system); 220 Glue::InstallInterfaces(system);
220 GRC::InstallInterfaces(*sm); 221 GRC::InstallInterfaces(*sm, system);
221 HID::InstallInterfaces(*sm, system); 222 HID::InstallInterfaces(*sm, system);
222 LBL::InstallInterfaces(*sm); 223 LBL::InstallInterfaces(*sm, system);
223 LDN::InstallInterfaces(*sm); 224 LDN::InstallInterfaces(*sm, system);
224 LDR::InstallInterfaces(*sm, system); 225 LDR::InstallInterfaces(*sm, system);
225 LM::InstallInterfaces(system); 226 LM::InstallInterfaces(system);
226 Migration::InstallInterfaces(*sm); 227 Migration::InstallInterfaces(*sm, system);
227 Mii::InstallInterfaces(*sm); 228 Mii::InstallInterfaces(*sm, system);
228 MM::InstallInterfaces(*sm); 229 MM::InstallInterfaces(*sm, system);
229 NCM::InstallInterfaces(*sm); 230 NCM::InstallInterfaces(*sm, system);
230 NFC::InstallInterfaces(*sm); 231 NFC::InstallInterfaces(*sm, system);
231 NFP::InstallInterfaces(*sm, system); 232 NFP::InstallInterfaces(*sm, system);
232 NIFM::InstallInterfaces(*sm, system); 233 NIFM::InstallInterfaces(*sm, system);
233 NIM::InstallInterfaces(*sm, system); 234 NIM::InstallInterfaces(*sm, system);
234 NPNS::InstallInterfaces(*sm); 235 NPNS::InstallInterfaces(*sm, system);
235 NS::InstallInterfaces(*sm, system); 236 NS::InstallInterfaces(*sm, system);
236 Nvidia::InstallInterfaces(*sm, *nv_flinger, system); 237 Nvidia::InstallInterfaces(*sm, *nv_flinger, system);
237 OLSC::InstallInterfaces(*sm); 238 OLSC::InstallInterfaces(*sm, system);
238 PCIe::InstallInterfaces(*sm); 239 PCIe::InstallInterfaces(*sm, system);
239 PCTL::InstallInterfaces(*sm); 240 PCTL::InstallInterfaces(*sm, system);
240 PCV::InstallInterfaces(*sm); 241 PCV::InstallInterfaces(*sm, system);
241 PlayReport::InstallInterfaces(*sm, system); 242 PlayReport::InstallInterfaces(*sm, system);
242 PM::InstallInterfaces(system); 243 PM::InstallInterfaces(system);
243 PSC::InstallInterfaces(*sm); 244 PSC::InstallInterfaces(*sm, system);
244 PSM::InstallInterfaces(*sm); 245 PSM::InstallInterfaces(*sm, system);
245 Set::InstallInterfaces(*sm); 246 Set::InstallInterfaces(*sm, system);
246 Sockets::InstallInterfaces(*sm, system); 247 Sockets::InstallInterfaces(*sm, system);
247 SPL::InstallInterfaces(*sm); 248 SPL::InstallInterfaces(*sm, system);
248 SSL::InstallInterfaces(*sm); 249 SSL::InstallInterfaces(*sm, system);
249 Time::InstallInterfaces(system); 250 Time::InstallInterfaces(system);
250 USB::InstallInterfaces(*sm); 251 USB::InstallInterfaces(*sm, system);
251 VI::InstallInterfaces(*sm, *nv_flinger); 252 VI::InstallInterfaces(*sm, system, *nv_flinger);
252 WLAN::InstallInterfaces(*sm); 253 WLAN::InstallInterfaces(*sm, system);
253} 254}
254 255
255Services::~Services() = default; 256Services::~Services() = default;