From a9e9570d8424966e16ce8f683b21737c1188c134 Mon Sep 17 00:00:00 2001 From: David Marcec Date: Sat, 21 Sep 2019 18:43:16 +1000 Subject: Deglobalize System: Friend --- src/core/hle/service/friend/friend.cpp | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) (limited to 'src/core/hle/service/friend/friend.cpp') diff --git a/src/core/hle/service/friend/friend.cpp b/src/core/hle/service/friend/friend.cpp index d1ec12ef9..42b4ee861 100644 --- a/src/core/hle/service/friend/friend.cpp +++ b/src/core/hle/service/friend/friend.cpp @@ -149,7 +149,8 @@ private: class INotificationService final : public ServiceFramework { public: - INotificationService(Common::UUID uuid) : ServiceFramework("INotificationService"), uuid(uuid) { + INotificationService(Common::UUID uuid, Core::System& system) + : ServiceFramework("INotificationService"), uuid(uuid) { // clang-format off static const FunctionInfo functions[] = { {0, &INotificationService::GetEvent, "GetEvent"}, @@ -159,6 +160,9 @@ public: // clang-format on RegisterHandlers(functions); + + notification_event = Kernel::WritableEvent::CreateEventPair( + system.Kernel(), Kernel::ResetType::Manual, "INotificationService:NotifyEvent"); } private: @@ -167,13 +171,6 @@ private: IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(RESULT_SUCCESS); - - if (!is_event_created) { - auto& kernel = Core::System::GetInstance().Kernel(); - notification_event = Kernel::WritableEvent::CreateEventPair( - kernel, Kernel::ResetType::Manual, "INotificationService:NotifyEvent"); - is_event_created = true; - } rb.PushCopyObjects(notification_event.readable); } @@ -261,21 +258,21 @@ void Module::Interface::CreateNotificationService(Kernel::HLERequestContext& ctx IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); - rb.PushIpcInterface(uuid); + rb.PushIpcInterface(uuid, system); } -Module::Interface::Interface(std::shared_ptr module, const char* name) - : ServiceFramework(name), module(std::move(module)) {} +Module::Interface::Interface(std::shared_ptr module, Core::System& system, const char* name) + : ServiceFramework(name), module(std::move(module)), system(system) {} Module::Interface::~Interface() = default; -void InstallInterfaces(SM::ServiceManager& service_manager) { +void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) { auto module = std::make_shared(); - std::make_shared(module, "friend:a")->InstallAsService(service_manager); - std::make_shared(module, "friend:m")->InstallAsService(service_manager); - std::make_shared(module, "friend:s")->InstallAsService(service_manager); - std::make_shared(module, "friend:u")->InstallAsService(service_manager); - std::make_shared(module, "friend:v")->InstallAsService(service_manager); + std::make_shared(module, system, "friend:a")->InstallAsService(service_manager); + std::make_shared(module, system, "friend:m")->InstallAsService(service_manager); + std::make_shared(module, system, "friend:s")->InstallAsService(service_manager); + std::make_shared(module, system, "friend:u")->InstallAsService(service_manager); + std::make_shared(module, system, "friend:v")->InstallAsService(service_manager); } } // namespace Service::Friend -- cgit v1.2.3