diff options
| -rw-r--r-- | src/core/hle/service/friend/friend.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/core/hle/service/friend/friend.cpp b/src/core/hle/service/friend/friend.cpp index 68c9240ae..3c36f4085 100644 --- a/src/core/hle/service/friend/friend.cpp +++ b/src/core/hle/service/friend/friend.cpp | |||
| @@ -17,10 +17,11 @@ namespace Service::Friend { | |||
| 17 | 17 | ||
| 18 | class IFriendService final : public ServiceFramework<IFriendService> { | 18 | class IFriendService final : public ServiceFramework<IFriendService> { |
| 19 | public: | 19 | public: |
| 20 | explicit IFriendService(Core::System& system_) : ServiceFramework{system_, "IFriendService"} { | 20 | explicit IFriendService(Core::System& system_) |
| 21 | : ServiceFramework{system_, "IFriendService"}, service_context{system, "IFriendService"} { | ||
| 21 | // clang-format off | 22 | // clang-format off |
| 22 | static const FunctionInfo functions[] = { | 23 | static const FunctionInfo functions[] = { |
| 23 | {0, nullptr, "GetCompletionEvent"}, | 24 | {0, &IFriendService::GetCompletionEvent, "GetCompletionEvent"}, |
| 24 | {1, nullptr, "Cancel"}, | 25 | {1, nullptr, "Cancel"}, |
| 25 | {10100, nullptr, "GetFriendListIds"}, | 26 | {10100, nullptr, "GetFriendListIds"}, |
| 26 | {10101, &IFriendService::GetFriendList, "GetFriendList"}, | 27 | {10101, &IFriendService::GetFriendList, "GetFriendList"}, |
| @@ -109,6 +110,12 @@ public: | |||
| 109 | // clang-format on | 110 | // clang-format on |
| 110 | 111 | ||
| 111 | RegisterHandlers(functions); | 112 | RegisterHandlers(functions); |
| 113 | |||
| 114 | completion_event = service_context.CreateEvent("IFriendService:CompletionEvent"); | ||
| 115 | } | ||
| 116 | |||
| 117 | ~IFriendService() override { | ||
| 118 | service_context.CloseEvent(completion_event); | ||
| 112 | } | 119 | } |
| 113 | 120 | ||
| 114 | private: | 121 | private: |
| @@ -129,6 +136,14 @@ private: | |||
| 129 | }; | 136 | }; |
| 130 | static_assert(sizeof(SizedFriendFilter) == 0x10, "SizedFriendFilter is an invalid size"); | 137 | static_assert(sizeof(SizedFriendFilter) == 0x10, "SizedFriendFilter is an invalid size"); |
| 131 | 138 | ||
| 139 | void GetCompletionEvent(Kernel::HLERequestContext& ctx) { | ||
| 140 | LOG_DEBUG(Service_Friend, "called"); | ||
| 141 | |||
| 142 | IPC::ResponseBuilder rb{ctx, 2, 1}; | ||
| 143 | rb.Push(ResultSuccess); | ||
| 144 | rb.PushCopyObjects(completion_event->GetReadableEvent()); | ||
| 145 | } | ||
| 146 | |||
| 132 | void GetBlockedUserListIds(Kernel::HLERequestContext& ctx) { | 147 | void GetBlockedUserListIds(Kernel::HLERequestContext& ctx) { |
| 133 | // This is safe to stub, as there should be no adverse consequences from reporting no | 148 | // This is safe to stub, as there should be no adverse consequences from reporting no |
| 134 | // blocked users. | 149 | // blocked users. |
| @@ -179,6 +194,10 @@ private: | |||
| 179 | rb.Push<u32>(0); // Friend count | 194 | rb.Push<u32>(0); // Friend count |
| 180 | // TODO(ogniK): Return a buffer of u64s which are the "NetworkServiceAccountId" | 195 | // TODO(ogniK): Return a buffer of u64s which are the "NetworkServiceAccountId" |
| 181 | } | 196 | } |
| 197 | |||
| 198 | KernelHelpers::ServiceContext service_context; | ||
| 199 | |||
| 200 | Kernel::KEvent* completion_event; | ||
| 182 | }; | 201 | }; |
| 183 | 202 | ||
| 184 | class INotificationService final : public ServiceFramework<INotificationService> { | 203 | class INotificationService final : public ServiceFramework<INotificationService> { |