yuzu-emu
/
yuzu
Archived
1
0
Fork 0

Addressed issues

This commit is contained in:
David Marcec 2019-06-28 15:29:38 +10:00
parent 192f1f7ebe
commit c2146c4eef
2 changed files with 13 additions and 13 deletions

View File

@ -1,4 +1,4 @@
// Copyright 2018 yuzu emulator team // Copyright 2019 yuzu emulator team
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
@ -9,4 +9,5 @@
namespace Service::Friend { namespace Service::Friend {
constexpr ResultCode ERR_NO_NOTIFICATIONS{ErrorModule::Account, 15}; constexpr ResultCode ERR_NO_NOTIFICATIONS{ErrorModule::Account, 15};
} }

View File

@ -135,15 +135,13 @@ private:
IPC::ResponseBuilder rb{ctx, 2, 1}; IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
if (is_event_created) { if (!is_event_created) {
rb.PushCopyObjects(notification_event.readable);
} else {
auto& kernel = Core::System::GetInstance().Kernel(); auto& kernel = Core::System::GetInstance().Kernel();
notification_event = Kernel::WritableEvent::CreateEventPair( notification_event = Kernel::WritableEvent::CreateEventPair(
kernel, Kernel::ResetType::Manual, "INotificationService:NotifyEvent"); kernel, Kernel::ResetType::Manual, "INotificationService:NotifyEvent");
is_event_created = true; is_event_created = true;
rb.PushCopyObjects(notification_event.readable);
} }
rb.PushCopyObjects(notification_event.readable);
} }
void Clear(Kernel::HLERequestContext& ctx) { void Clear(Kernel::HLERequestContext& ctx) {
@ -151,8 +149,7 @@ private:
while (!notifications.empty()) { while (!notifications.empty()) {
notifications.pop(); notifications.pop();
} }
states.has_received_friend_request = false; std::memset(&states, 0, sizeof(States));
states.has_updated_friends = false;
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
@ -167,9 +164,8 @@ private:
rb.Push(ERR_NO_NOTIFICATIONS); rb.Push(ERR_NO_NOTIFICATIONS);
return; return;
} }
IPC::ResponseBuilder rb{ctx, 6};
auto notification = notifications.front(); const auto notification = notifications.front();
notifications.pop(); notifications.pop();
switch (notification.notification_type) { switch (notification.notification_type) {
@ -185,11 +181,13 @@ private:
static_cast<u32>(notification.notification_type)); static_cast<u32>(notification.notification_type));
break; break;
} }
IPC::ResponseBuilder rb{ctx, 6};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushRaw<SizedNotificationInfo>(notification); rb.PushRaw<SizedNotificationInfo>(notification);
} }
enum class NotificationTypes : u32_le { enum class NotificationTypes : u32 {
HasUpdatedFriendsList = 0x65, HasUpdatedFriendsList = 0x65,
HasReceivedFriendRequest = 0x1 HasReceivedFriendRequest = 0x1
}; };
@ -208,10 +206,10 @@ private:
bool has_received_friend_request; bool has_received_friend_request;
}; };
Common::UUID uuid{}; Common::UUID uuid;
bool is_event_created = false; bool is_event_created = false;
Kernel::EventPair notification_event; Kernel::EventPair notification_event;
std::queue<SizedNotificationInfo> notifications{}; std::queue<SizedNotificationInfo> notifications;
States states{}; States states{};
}; };
@ -226,10 +224,11 @@ void Module::Interface::CreateNotificationService(Kernel::HLERequestContext& ctx
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
auto uuid = rp.PopRaw<Common::UUID>(); auto uuid = rp.PopRaw<Common::UUID>();
LOG_DEBUG(Service_ACC, "called, uuid={}", uuid.Format());
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<INotificationService>(uuid); rb.PushIpcInterface<INotificationService>(uuid);
LOG_DEBUG(Service_ACC, "called");
} }
Module::Interface::Interface(std::shared_ptr<Module> module, const char* name) Module::Interface::Interface(std::shared_ptr<Module> module, const char* name)