diff options
author | David Marcec <dmarcecguzman@gmail.com> | 2019-09-21 11:07:13 +0200 |
---|---|---|
committer | David Marcec <dmarcecguzman@gmail.com> | 2019-09-22 08:30:33 +0200 |
commit | ad53dc010688bb1059dfb933f202c159c81331cb (patch) | |
tree | 9428247042b4f3cc2cecfc568ab616be5e0bdb0f /src | |
parent | Deglobalize System: NFP (diff) | |
download | yuzu-ad53dc010688bb1059dfb933f202c159c81331cb.tar yuzu-ad53dc010688bb1059dfb933f202c159c81331cb.tar.gz yuzu-ad53dc010688bb1059dfb933f202c159c81331cb.tar.bz2 yuzu-ad53dc010688bb1059dfb933f202c159c81331cb.tar.lz yuzu-ad53dc010688bb1059dfb933f202c159c81331cb.tar.xz yuzu-ad53dc010688bb1059dfb933f202c159c81331cb.tar.zst yuzu-ad53dc010688bb1059dfb933f202c159c81331cb.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/core/hle/service/nifm/nifm.cpp | 30 | ||||
-rw-r--r-- | src/core/hle/service/nifm/nifm.h | 6 |
2 files changed, 23 insertions, 13 deletions
diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp index 76b12b482..24d1813a7 100644 --- a/src/core/hle/service/nifm/nifm.cpp +++ b/src/core/hle/service/nifm/nifm.cpp @@ -31,7 +31,7 @@ public: class IRequest final : public ServiceFramework<IRequest> { public: - explicit IRequest() : ServiceFramework("IRequest") { + explicit IRequest(Core::System& system) : ServiceFramework("IRequest") { static const FunctionInfo functions[] = { {0, &IRequest::GetRequestState, "GetRequestState"}, {1, &IRequest::GetResult, "GetResult"}, @@ -61,7 +61,7 @@ public: }; RegisterHandlers(functions); - auto& kernel = Core::System::GetInstance().Kernel(); + auto& kernel = system.Kernel(); event1 = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Automatic, "IRequest:Event1"); event2 = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Automatic, @@ -130,7 +130,7 @@ public: class IGeneralService final : public ServiceFramework<IGeneralService> { public: - IGeneralService(); + IGeneralService(Core::System& system); private: void GetClientId(Kernel::HLERequestContext& ctx) { @@ -155,7 +155,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); - rb.PushIpcInterface<IRequest>(); + rb.PushIpcInterface<IRequest>(system); } void RemoveNetworkProfile(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_NIFM, "(STUBBED) called"); @@ -198,9 +198,11 @@ private: rb.Push(RESULT_SUCCESS); rb.Push<u8>(0); } + Core::System& system; }; -IGeneralService::IGeneralService() : ServiceFramework("IGeneralService") { +IGeneralService::IGeneralService(Core::System& system) + : ServiceFramework("IGeneralService"), system(system) { static const FunctionInfo functions[] = { {1, &IGeneralService::GetClientId, "GetClientId"}, {2, &IGeneralService::CreateScanRequest, "CreateScanRequest"}, @@ -245,7 +247,8 @@ IGeneralService::IGeneralService() : ServiceFramework("IGeneralService") { class NetworkInterface final : public ServiceFramework<NetworkInterface> { public: - explicit NetworkInterface(const char* name) : ServiceFramework{name} { + explicit NetworkInterface(const char* name, Core::System& system) + : ServiceFramework{name}, system(system) { static const FunctionInfo functions[] = { {4, &NetworkInterface::CreateGeneralServiceOld, "CreateGeneralServiceOld"}, {5, &NetworkInterface::CreateGeneralService, "CreateGeneralService"}, @@ -258,7 +261,7 @@ public: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); - rb.PushIpcInterface<IGeneralService>(); + rb.PushIpcInterface<IGeneralService>(system); } void CreateGeneralService(Kernel::HLERequestContext& ctx) { @@ -266,14 +269,17 @@ public: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); - rb.PushIpcInterface<IGeneralService>(); + rb.PushIpcInterface<IGeneralService>(system); } + +private: + Core::System& system; }; -void InstallInterfaces(SM::ServiceManager& service_manager) { - std::make_shared<NetworkInterface>("nifm:a")->InstallAsService(service_manager); - std::make_shared<NetworkInterface>("nifm:s")->InstallAsService(service_manager); - std::make_shared<NetworkInterface>("nifm:u")->InstallAsService(service_manager); +void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) { + std::make_shared<NetworkInterface>("nifm:a", system)->InstallAsService(service_manager); + std::make_shared<NetworkInterface>("nifm:s", system)->InstallAsService(service_manager); + std::make_shared<NetworkInterface>("nifm:u", system)->InstallAsService(service_manager); } } // namespace Service::NIFM diff --git a/src/core/hle/service/nifm/nifm.h b/src/core/hle/service/nifm/nifm.h index 4616b3b48..6857e18f9 100644 --- a/src/core/hle/service/nifm/nifm.h +++ b/src/core/hle/service/nifm/nifm.h @@ -8,9 +8,13 @@ namespace Service::SM { class ServiceManager; } +namespace Core { +class System; +} + namespace Service::NIFM { /// Registers all NIFM services with the specified service manager. -void InstallInterfaces(SM::ServiceManager& service_manager); +void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system); } // namespace Service::NIFM |