diff options
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/hle/service/friend/friend.cpp | 31 | ||||
| -rw-r--r-- | src/core/hle/service/friend/friend.h | 9 | ||||
| -rw-r--r-- | src/core/hle/service/friend/interface.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/service/friend/interface.h | 2 |
4 files changed, 24 insertions, 22 deletions
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: | |||
| 149 | 149 | ||
| 150 | class INotificationService final : public ServiceFramework<INotificationService> { | 150 | class INotificationService final : public ServiceFramework<INotificationService> { |
| 151 | public: | 151 | public: |
| 152 | INotificationService(Common::UUID uuid) : ServiceFramework("INotificationService"), uuid(uuid) { | 152 | INotificationService(Common::UUID uuid, Core::System& system) |
| 153 | : ServiceFramework("INotificationService"), uuid(uuid) { | ||
| 153 | // clang-format off | 154 | // clang-format off |
| 154 | static const FunctionInfo functions[] = { | 155 | static const FunctionInfo functions[] = { |
| 155 | {0, &INotificationService::GetEvent, "GetEvent"}, | 156 | {0, &INotificationService::GetEvent, "GetEvent"}, |
| @@ -159,6 +160,9 @@ public: | |||
| 159 | // clang-format on | 160 | // clang-format on |
| 160 | 161 | ||
| 161 | RegisterHandlers(functions); | 162 | RegisterHandlers(functions); |
| 163 | |||
| 164 | notification_event = Kernel::WritableEvent::CreateEventPair( | ||
| 165 | system.Kernel(), Kernel::ResetType::Manual, "INotificationService:NotifyEvent"); | ||
| 162 | } | 166 | } |
| 163 | 167 | ||
| 164 | private: | 168 | private: |
| @@ -167,13 +171,6 @@ private: | |||
| 167 | 171 | ||
| 168 | IPC::ResponseBuilder rb{ctx, 2, 1}; | 172 | IPC::ResponseBuilder rb{ctx, 2, 1}; |
| 169 | rb.Push(RESULT_SUCCESS); | 173 | rb.Push(RESULT_SUCCESS); |
| 170 | |||
| 171 | if (!is_event_created) { | ||
| 172 | auto& kernel = Core::System::GetInstance().Kernel(); | ||
| 173 | notification_event = Kernel::WritableEvent::CreateEventPair( | ||
| 174 | kernel, Kernel::ResetType::Manual, "INotificationService:NotifyEvent"); | ||
| 175 | is_event_created = true; | ||
| 176 | } | ||
| 177 | rb.PushCopyObjects(notification_event.readable); | 174 | rb.PushCopyObjects(notification_event.readable); |
| 178 | } | 175 | } |
| 179 | 176 | ||
| @@ -261,21 +258,21 @@ void Module::Interface::CreateNotificationService(Kernel::HLERequestContext& ctx | |||
| 261 | 258 | ||
| 262 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 259 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 263 | rb.Push(RESULT_SUCCESS); | 260 | rb.Push(RESULT_SUCCESS); |
| 264 | rb.PushIpcInterface<INotificationService>(uuid); | 261 | rb.PushIpcInterface<INotificationService>(uuid, system); |
| 265 | } | 262 | } |
| 266 | 263 | ||
| 267 | Module::Interface::Interface(std::shared_ptr<Module> module, const char* name) | 264 | Module::Interface::Interface(std::shared_ptr<Module> module, Core::System& system, const char* name) |
| 268 | : ServiceFramework(name), module(std::move(module)) {} | 265 | : ServiceFramework(name), module(std::move(module)), system(system) {} |
| 269 | 266 | ||
| 270 | Module::Interface::~Interface() = default; | 267 | Module::Interface::~Interface() = default; |
| 271 | 268 | ||
| 272 | void InstallInterfaces(SM::ServiceManager& service_manager) { | 269 | void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) { |
| 273 | auto module = std::make_shared<Module>(); | 270 | auto module = std::make_shared<Module>(); |
| 274 | std::make_shared<Friend>(module, "friend:a")->InstallAsService(service_manager); | 271 | std::make_shared<Friend>(module, system, "friend:a")->InstallAsService(service_manager); |
| 275 | std::make_shared<Friend>(module, "friend:m")->InstallAsService(service_manager); | 272 | std::make_shared<Friend>(module, system, "friend:m")->InstallAsService(service_manager); |
| 276 | std::make_shared<Friend>(module, "friend:s")->InstallAsService(service_manager); | 273 | std::make_shared<Friend>(module, system, "friend:s")->InstallAsService(service_manager); |
| 277 | std::make_shared<Friend>(module, "friend:u")->InstallAsService(service_manager); | 274 | std::make_shared<Friend>(module, system, "friend:u")->InstallAsService(service_manager); |
| 278 | std::make_shared<Friend>(module, "friend:v")->InstallAsService(service_manager); | 275 | std::make_shared<Friend>(module, system, "friend:v")->InstallAsService(service_manager); |
| 279 | } | 276 | } |
| 280 | 277 | ||
| 281 | } // namespace Service::Friend | 278 | } // namespace Service::Friend |
diff --git a/src/core/hle/service/friend/friend.h b/src/core/hle/service/friend/friend.h index 38d05fa8e..24f3fc969 100644 --- a/src/core/hle/service/friend/friend.h +++ b/src/core/hle/service/friend/friend.h | |||
| @@ -6,13 +6,17 @@ | |||
| 6 | 6 | ||
| 7 | #include "core/hle/service/service.h" | 7 | #include "core/hle/service/service.h" |
| 8 | 8 | ||
| 9 | namespace Core { | ||
| 10 | class System; | ||
| 11 | } | ||
| 12 | |||
| 9 | namespace Service::Friend { | 13 | namespace Service::Friend { |
| 10 | 14 | ||
| 11 | class Module final { | 15 | class Module final { |
| 12 | public: | 16 | public: |
| 13 | class Interface : public ServiceFramework<Interface> { | 17 | class Interface : public ServiceFramework<Interface> { |
| 14 | public: | 18 | public: |
| 15 | explicit Interface(std::shared_ptr<Module> module, const char* name); | 19 | explicit Interface(std::shared_ptr<Module> module, Core::System& system, const char* name); |
| 16 | ~Interface() override; | 20 | ~Interface() override; |
| 17 | 21 | ||
| 18 | void CreateFriendService(Kernel::HLERequestContext& ctx); | 22 | void CreateFriendService(Kernel::HLERequestContext& ctx); |
| @@ -20,10 +24,11 @@ public: | |||
| 20 | 24 | ||
| 21 | protected: | 25 | protected: |
| 22 | std::shared_ptr<Module> module; | 26 | std::shared_ptr<Module> module; |
| 27 | Core::System& system; | ||
| 23 | }; | 28 | }; |
| 24 | }; | 29 | }; |
| 25 | 30 | ||
| 26 | /// Registers all Friend services with the specified service manager. | 31 | /// Registers all Friend services with the specified service manager. |
| 27 | void InstallInterfaces(SM::ServiceManager& service_manager); | 32 | void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system); |
| 28 | 33 | ||
| 29 | } // namespace Service::Friend | 34 | } // namespace Service::Friend |
diff --git a/src/core/hle/service/friend/interface.cpp b/src/core/hle/service/friend/interface.cpp index 5b384f733..58155f652 100644 --- a/src/core/hle/service/friend/interface.cpp +++ b/src/core/hle/service/friend/interface.cpp | |||
| @@ -6,8 +6,8 @@ | |||
| 6 | 6 | ||
| 7 | namespace Service::Friend { | 7 | namespace Service::Friend { |
| 8 | 8 | ||
| 9 | Friend::Friend(std::shared_ptr<Module> module, const char* name) | 9 | Friend::Friend(std::shared_ptr<Module> module, Core::System& system, const char* name) |
| 10 | : Interface(std::move(module), name) { | 10 | : Interface(std::move(module), system, name) { |
| 11 | static const FunctionInfo functions[] = { | 11 | static const FunctionInfo functions[] = { |
| 12 | {0, &Friend::CreateFriendService, "CreateFriendService"}, | 12 | {0, &Friend::CreateFriendService, "CreateFriendService"}, |
| 13 | {1, &Friend::CreateNotificationService, "CreateNotificationService"}, | 13 | {1, &Friend::CreateNotificationService, "CreateNotificationService"}, |
diff --git a/src/core/hle/service/friend/interface.h b/src/core/hle/service/friend/interface.h index 1963def39..465a35770 100644 --- a/src/core/hle/service/friend/interface.h +++ b/src/core/hle/service/friend/interface.h | |||
| @@ -10,7 +10,7 @@ namespace Service::Friend { | |||
| 10 | 10 | ||
| 11 | class Friend final : public Module::Interface { | 11 | class Friend final : public Module::Interface { |
| 12 | public: | 12 | public: |
| 13 | explicit Friend(std::shared_ptr<Module> module, const char* name); | 13 | explicit Friend(std::shared_ptr<Module> module, Core::System& system, const char* name); |
| 14 | ~Friend() override; | 14 | ~Friend() override; |
| 15 | }; | 15 | }; |
| 16 | 16 | ||