Merge pull request #7482 from Morph1984/friend

service: friend: Implement GetCompletionEvent
This commit is contained in:
bunnei 2021-11-30 11:09:22 -08:00 committed by GitHub
commit ff63080cd9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,10 +17,11 @@ namespace Service::Friend {
class IFriendService final : public ServiceFramework<IFriendService> { class IFriendService final : public ServiceFramework<IFriendService> {
public: public:
explicit IFriendService(Core::System& system_) : ServiceFramework{system_, "IFriendService"} { explicit IFriendService(Core::System& system_)
: ServiceFramework{system_, "IFriendService"}, service_context{system, "IFriendService"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "GetCompletionEvent"}, {0, &IFriendService::GetCompletionEvent, "GetCompletionEvent"},
{1, nullptr, "Cancel"}, {1, nullptr, "Cancel"},
{10100, nullptr, "GetFriendListIds"}, {10100, nullptr, "GetFriendListIds"},
{10101, &IFriendService::GetFriendList, "GetFriendList"}, {10101, &IFriendService::GetFriendList, "GetFriendList"},
@ -109,6 +110,12 @@ public:
// clang-format on // clang-format on
RegisterHandlers(functions); RegisterHandlers(functions);
completion_event = service_context.CreateEvent("IFriendService:CompletionEvent");
}
~IFriendService() override {
service_context.CloseEvent(completion_event);
} }
private: private:
@ -129,6 +136,14 @@ private:
}; };
static_assert(sizeof(SizedFriendFilter) == 0x10, "SizedFriendFilter is an invalid size"); static_assert(sizeof(SizedFriendFilter) == 0x10, "SizedFriendFilter is an invalid size");
void GetCompletionEvent(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_Friend, "called");
IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(ResultSuccess);
rb.PushCopyObjects(completion_event->GetReadableEvent());
}
void GetBlockedUserListIds(Kernel::HLERequestContext& ctx) { void GetBlockedUserListIds(Kernel::HLERequestContext& ctx) {
// This is safe to stub, as there should be no adverse consequences from reporting no // This is safe to stub, as there should be no adverse consequences from reporting no
// blocked users. // blocked users.
@ -179,6 +194,10 @@ private:
rb.Push<u32>(0); // Friend count rb.Push<u32>(0); // Friend count
// TODO(ogniK): Return a buffer of u64s which are the "NetworkServiceAccountId" // TODO(ogniK): Return a buffer of u64s which are the "NetworkServiceAccountId"
} }
KernelHelpers::ServiceContext service_context;
Kernel::KEvent* completion_event;
}; };
class INotificationService final : public ServiceFramework<INotificationService> { class INotificationService final : public ServiceFramework<INotificationService> {