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.
This commit is contained in:
parent
322349e8cc
commit
1a954b2a59
222 changed files with 1221 additions and 907 deletions
|
@ -23,7 +23,7 @@ enum class RequestState : u32 {
|
|||
|
||||
class IScanRequest final : public ServiceFramework<IScanRequest> {
|
||||
public:
|
||||
explicit IScanRequest() : ServiceFramework("IScanRequest") {
|
||||
explicit IScanRequest(Core::System& system_) : ServiceFramework{system_, "IScanRequest"} {
|
||||
// clang-format off
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, nullptr, "Submit"},
|
||||
|
@ -40,7 +40,7 @@ public:
|
|||
|
||||
class IRequest final : public ServiceFramework<IRequest> {
|
||||
public:
|
||||
explicit IRequest(Core::System& system) : ServiceFramework("IRequest") {
|
||||
explicit IRequest(Core::System& system_) : ServiceFramework{system_, "IRequest"} {
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, &IRequest::GetRequestState, "GetRequestState"},
|
||||
{1, &IRequest::GetResult, "GetResult"},
|
||||
|
@ -140,7 +140,7 @@ private:
|
|||
|
||||
class INetworkProfile final : public ServiceFramework<INetworkProfile> {
|
||||
public:
|
||||
explicit INetworkProfile() : ServiceFramework("INetworkProfile") {
|
||||
explicit INetworkProfile(Core::System& system_) : ServiceFramework{system_, "INetworkProfile"} {
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, nullptr, "Update"},
|
||||
{1, nullptr, "PersistOld"},
|
||||
|
@ -152,7 +152,7 @@ public:
|
|||
|
||||
class IGeneralService final : public ServiceFramework<IGeneralService> {
|
||||
public:
|
||||
IGeneralService(Core::System& system);
|
||||
explicit IGeneralService(Core::System& system_);
|
||||
|
||||
private:
|
||||
void GetClientId(Kernel::HLERequestContext& ctx) {
|
||||
|
@ -169,7 +169,7 @@ private:
|
|||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.PushIpcInterface<IScanRequest>();
|
||||
rb.PushIpcInterface<IScanRequest>(system);
|
||||
}
|
||||
void CreateRequest(Kernel::HLERequestContext& ctx) {
|
||||
LOG_DEBUG(Service_NIFM, "called");
|
||||
|
@ -207,7 +207,7 @@ private:
|
|||
IPC::ResponseBuilder rb{ctx, 6, 0, 1};
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.PushIpcInterface<INetworkProfile>();
|
||||
rb.PushIpcInterface<INetworkProfile>(system);
|
||||
rb.PushRaw<u128>(uuid);
|
||||
}
|
||||
void IsWirelessCommunicationEnabled(Kernel::HLERequestContext& ctx) {
|
||||
|
@ -239,11 +239,10 @@ private:
|
|||
rb.Push<u8>(1);
|
||||
}
|
||||
}
|
||||
Core::System& system;
|
||||
};
|
||||
|
||||
IGeneralService::IGeneralService(Core::System& system)
|
||||
: ServiceFramework("IGeneralService"), system(system) {
|
||||
IGeneralService::IGeneralService(Core::System& system_)
|
||||
: ServiceFramework{system_, "IGeneralService"} {
|
||||
// clang-format off
|
||||
static const FunctionInfo functions[] = {
|
||||
{1, &IGeneralService::GetClientId, "GetClientId"},
|
||||
|
@ -296,8 +295,8 @@ IGeneralService::IGeneralService(Core::System& system)
|
|||
|
||||
class NetworkInterface final : public ServiceFramework<NetworkInterface> {
|
||||
public:
|
||||
explicit NetworkInterface(const char* name, Core::System& system)
|
||||
: ServiceFramework{name}, system(system) {
|
||||
explicit NetworkInterface(const char* name, Core::System& system_)
|
||||
: ServiceFramework{system_, name} {
|
||||
static const FunctionInfo functions[] = {
|
||||
{4, &NetworkInterface::CreateGeneralServiceOld, "CreateGeneralServiceOld"},
|
||||
{5, &NetworkInterface::CreateGeneralService, "CreateGeneralService"},
|
||||
|
@ -305,6 +304,7 @@ public:
|
|||
RegisterHandlers(functions);
|
||||
}
|
||||
|
||||
private:
|
||||
void CreateGeneralServiceOld(Kernel::HLERequestContext& ctx) {
|
||||
LOG_DEBUG(Service_NIFM, "called");
|
||||
|
||||
|
@ -320,9 +320,6 @@ public:
|
|||
rb.Push(RESULT_SUCCESS);
|
||||
rb.PushIpcInterface<IGeneralService>(system);
|
||||
}
|
||||
|
||||
private:
|
||||
Core::System& system;
|
||||
};
|
||||
|
||||
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
namespace Service::SM {
|
||||
class ServiceManager;
|
||||
}
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
}
|
||||
|
||||
namespace Service::SM {
|
||||
class ServiceManager;
|
||||
}
|
||||
|
||||
namespace Service::NIFM {
|
||||
|
||||
/// Registers all NIFM services with the specified service manager.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue