diff options
| author | 2019-09-21 19:07:13 +1000 | |
|---|---|---|
| committer | 2019-09-22 16:30:33 +1000 | |
| commit | ad53dc010688bb1059dfb933f202c159c81331cb (patch) | |
| tree | 9428247042b4f3cc2cecfc568ab616be5e0bdb0f /src | |
| parent | Deglobalize System: NFP (diff) | |
| download | yuzu-ad53dc010688bb1059dfb933f202c159c81331cb.tar.gz yuzu-ad53dc010688bb1059dfb933f202c159c81331cb.tar.xz yuzu-ad53dc010688bb1059dfb933f202c159c81331cb.zip | |
Deglobalize System: Nifm
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: | |||
| 31 | 31 | ||
| 32 | class IRequest final : public ServiceFramework<IRequest> { | 32 | class IRequest final : public ServiceFramework<IRequest> { |
| 33 | public: | 33 | public: |
| 34 | explicit IRequest() : ServiceFramework("IRequest") { | 34 | explicit IRequest(Core::System& system) : ServiceFramework("IRequest") { |
| 35 | static const FunctionInfo functions[] = { | 35 | static const FunctionInfo functions[] = { |
| 36 | {0, &IRequest::GetRequestState, "GetRequestState"}, | 36 | {0, &IRequest::GetRequestState, "GetRequestState"}, |
| 37 | {1, &IRequest::GetResult, "GetResult"}, | 37 | {1, &IRequest::GetResult, "GetResult"}, |
| @@ -61,7 +61,7 @@ public: | |||
| 61 | }; | 61 | }; |
| 62 | RegisterHandlers(functions); | 62 | RegisterHandlers(functions); |
| 63 | 63 | ||
| 64 | auto& kernel = Core::System::GetInstance().Kernel(); | 64 | auto& kernel = system.Kernel(); |
| 65 | event1 = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Automatic, | 65 | event1 = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Automatic, |
| 66 | "IRequest:Event1"); | 66 | "IRequest:Event1"); |
| 67 | event2 = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Automatic, | 67 | event2 = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Automatic, |
| @@ -130,7 +130,7 @@ public: | |||
| 130 | 130 | ||
| 131 | class IGeneralService final : public ServiceFramework<IGeneralService> { | 131 | class IGeneralService final : public ServiceFramework<IGeneralService> { |
| 132 | public: | 132 | public: |
| 133 | IGeneralService(); | 133 | IGeneralService(Core::System& system); |
| 134 | 134 | ||
| 135 | private: | 135 | private: |
| 136 | void GetClientId(Kernel::HLERequestContext& ctx) { | 136 | void GetClientId(Kernel::HLERequestContext& ctx) { |
| @@ -155,7 +155,7 @@ private: | |||
| 155 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 155 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 156 | 156 | ||
| 157 | rb.Push(RESULT_SUCCESS); | 157 | rb.Push(RESULT_SUCCESS); |
| 158 | rb.PushIpcInterface<IRequest>(); | 158 | rb.PushIpcInterface<IRequest>(system); |
| 159 | } | 159 | } |
| 160 | void RemoveNetworkProfile(Kernel::HLERequestContext& ctx) { | 160 | void RemoveNetworkProfile(Kernel::HLERequestContext& ctx) { |
| 161 | LOG_WARNING(Service_NIFM, "(STUBBED) called"); | 161 | LOG_WARNING(Service_NIFM, "(STUBBED) called"); |
| @@ -198,9 +198,11 @@ private: | |||
| 198 | rb.Push(RESULT_SUCCESS); | 198 | rb.Push(RESULT_SUCCESS); |
| 199 | rb.Push<u8>(0); | 199 | rb.Push<u8>(0); |
| 200 | } | 200 | } |
| 201 | Core::System& system; | ||
| 201 | }; | 202 | }; |
| 202 | 203 | ||
| 203 | IGeneralService::IGeneralService() : ServiceFramework("IGeneralService") { | 204 | IGeneralService::IGeneralService(Core::System& system) |
| 205 | : ServiceFramework("IGeneralService"), system(system) { | ||
| 204 | static const FunctionInfo functions[] = { | 206 | static const FunctionInfo functions[] = { |
| 205 | {1, &IGeneralService::GetClientId, "GetClientId"}, | 207 | {1, &IGeneralService::GetClientId, "GetClientId"}, |
| 206 | {2, &IGeneralService::CreateScanRequest, "CreateScanRequest"}, | 208 | {2, &IGeneralService::CreateScanRequest, "CreateScanRequest"}, |
| @@ -245,7 +247,8 @@ IGeneralService::IGeneralService() : ServiceFramework("IGeneralService") { | |||
| 245 | 247 | ||
| 246 | class NetworkInterface final : public ServiceFramework<NetworkInterface> { | 248 | class NetworkInterface final : public ServiceFramework<NetworkInterface> { |
| 247 | public: | 249 | public: |
| 248 | explicit NetworkInterface(const char* name) : ServiceFramework{name} { | 250 | explicit NetworkInterface(const char* name, Core::System& system) |
| 251 | : ServiceFramework{name}, system(system) { | ||
| 249 | static const FunctionInfo functions[] = { | 252 | static const FunctionInfo functions[] = { |
| 250 | {4, &NetworkInterface::CreateGeneralServiceOld, "CreateGeneralServiceOld"}, | 253 | {4, &NetworkInterface::CreateGeneralServiceOld, "CreateGeneralServiceOld"}, |
| 251 | {5, &NetworkInterface::CreateGeneralService, "CreateGeneralService"}, | 254 | {5, &NetworkInterface::CreateGeneralService, "CreateGeneralService"}, |
| @@ -258,7 +261,7 @@ public: | |||
| 258 | 261 | ||
| 259 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 262 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 260 | rb.Push(RESULT_SUCCESS); | 263 | rb.Push(RESULT_SUCCESS); |
| 261 | rb.PushIpcInterface<IGeneralService>(); | 264 | rb.PushIpcInterface<IGeneralService>(system); |
| 262 | } | 265 | } |
| 263 | 266 | ||
| 264 | void CreateGeneralService(Kernel::HLERequestContext& ctx) { | 267 | void CreateGeneralService(Kernel::HLERequestContext& ctx) { |
| @@ -266,14 +269,17 @@ public: | |||
| 266 | 269 | ||
| 267 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 270 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 268 | rb.Push(RESULT_SUCCESS); | 271 | rb.Push(RESULT_SUCCESS); |
| 269 | rb.PushIpcInterface<IGeneralService>(); | 272 | rb.PushIpcInterface<IGeneralService>(system); |
| 270 | } | 273 | } |
| 274 | |||
| 275 | private: | ||
| 276 | Core::System& system; | ||
| 271 | }; | 277 | }; |
| 272 | 278 | ||
| 273 | void InstallInterfaces(SM::ServiceManager& service_manager) { | 279 | void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) { |
| 274 | std::make_shared<NetworkInterface>("nifm:a")->InstallAsService(service_manager); | 280 | std::make_shared<NetworkInterface>("nifm:a", system)->InstallAsService(service_manager); |
| 275 | std::make_shared<NetworkInterface>("nifm:s")->InstallAsService(service_manager); | 281 | std::make_shared<NetworkInterface>("nifm:s", system)->InstallAsService(service_manager); |
| 276 | std::make_shared<NetworkInterface>("nifm:u")->InstallAsService(service_manager); | 282 | std::make_shared<NetworkInterface>("nifm:u", system)->InstallAsService(service_manager); |
| 277 | } | 283 | } |
| 278 | 284 | ||
| 279 | } // namespace Service::NIFM | 285 | } // 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 { | |||
| 8 | class ServiceManager; | 8 | class ServiceManager; |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | namespace Core { | ||
| 12 | class System; | ||
| 13 | } | ||
| 14 | |||
| 11 | namespace Service::NIFM { | 15 | namespace Service::NIFM { |
| 12 | 16 | ||
| 13 | /// Registers all NIFM services with the specified service manager. | 17 | /// Registers all NIFM services with the specified service manager. |
| 14 | void InstallInterfaces(SM::ServiceManager& service_manager); | 18 | void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system); |
| 15 | 19 | ||
| 16 | } // namespace Service::NIFM | 20 | } // namespace Service::NIFM |