From c2146c4eefdb67e64a9cb572d52391dfbb5b0f80 Mon Sep 17 00:00:00 2001 From: David Marcec Date: Fri, 28 Jun 2019 15:29:38 +1000 Subject: Addressed issues --- src/core/hle/service/friend/errors.h | 3 ++- src/core/hle/service/friend/friend.cpp | 23 +++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'src/core/hle/service/friend') diff --git a/src/core/hle/service/friend/errors.h b/src/core/hle/service/friend/errors.h index 72d96b555..b8314eb3f 100644 --- a/src/core/hle/service/friend/errors.h +++ b/src/core/hle/service/friend/errors.h @@ -1,4 +1,4 @@ -// Copyright 2018 yuzu emulator team +// Copyright 2019 yuzu emulator team // Licensed under GPLv2 or any later version // Refer to the license.txt file included. @@ -9,4 +9,5 @@ namespace Service::Friend { constexpr ResultCode ERR_NO_NOTIFICATIONS{ErrorModule::Account, 15}; + } diff --git a/src/core/hle/service/friend/friend.cpp b/src/core/hle/service/friend/friend.cpp index 296babc7c..dec541f2e 100644 --- a/src/core/hle/service/friend/friend.cpp +++ b/src/core/hle/service/friend/friend.cpp @@ -135,15 +135,13 @@ private: IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(RESULT_SUCCESS); - if (is_event_created) { - rb.PushCopyObjects(notification_event.readable); - } else { + 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); } + rb.PushCopyObjects(notification_event.readable); } void Clear(Kernel::HLERequestContext& ctx) { @@ -151,8 +149,7 @@ private: while (!notifications.empty()) { notifications.pop(); } - states.has_received_friend_request = false; - states.has_updated_friends = false; + std::memset(&states, 0, sizeof(States)); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); @@ -167,9 +164,8 @@ private: rb.Push(ERR_NO_NOTIFICATIONS); return; } - IPC::ResponseBuilder rb{ctx, 6}; - auto notification = notifications.front(); + const auto notification = notifications.front(); notifications.pop(); switch (notification.notification_type) { @@ -185,11 +181,13 @@ private: static_cast(notification.notification_type)); break; } + + IPC::ResponseBuilder rb{ctx, 6}; rb.Push(RESULT_SUCCESS); rb.PushRaw(notification); } - enum class NotificationTypes : u32_le { + enum class NotificationTypes : u32 { HasUpdatedFriendsList = 0x65, HasReceivedFriendRequest = 0x1 }; @@ -208,10 +206,10 @@ private: bool has_received_friend_request; }; - Common::UUID uuid{}; + Common::UUID uuid; bool is_event_created = false; Kernel::EventPair notification_event; - std::queue notifications{}; + std::queue notifications; States states{}; }; @@ -226,10 +224,11 @@ void Module::Interface::CreateNotificationService(Kernel::HLERequestContext& ctx IPC::RequestParser rp{ctx}; auto uuid = rp.PopRaw(); + LOG_DEBUG(Service_ACC, "called, uuid={}", uuid.Format()); + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface(uuid); - LOG_DEBUG(Service_ACC, "called"); } Module::Interface::Interface(std::shared_ptr module, const char* name) -- cgit v1.2.3