summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar David Marcec2019-01-04 13:11:17 +1100
committerGravatar David Marcec2019-01-04 13:11:17 +1100
commitf2536cafe55aa3cd70a201d3befaae0c1695698b (patch)
tree6816d47a7281ea4a613d1ded0be60feba7191004 /src
parentMerge pull request #1724 from FearlessTobi/port-4412 (diff)
downloadyuzu-f2536cafe55aa3cd70a201d3befaae0c1695698b.tar.gz
yuzu-f2536cafe55aa3cd70a201d3befaae0c1695698b.tar.xz
yuzu-f2536cafe55aa3cd70a201d3befaae0c1695698b.zip
Proper no message handling for AM::PopMessage
When we have no messages, we should be returning an error code.
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/am/am.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp
index d13ce4dca..7a5e9d216 100644
--- a/src/core/hle/service/am/am.cpp
+++ b/src/core/hle/service/am/am.cpp
@@ -38,6 +38,7 @@
38namespace Service::AM { 38namespace Service::AM {
39 39
40constexpr ResultCode ERR_NO_DATA_IN_CHANNEL{ErrorModule::AM, 0x2}; 40constexpr ResultCode ERR_NO_DATA_IN_CHANNEL{ErrorModule::AM, 0x2};
41constexpr ResultCode ERR_NO_MESSAGES{ErrorModule::AM, 0x3};
41constexpr ResultCode ERR_SIZE_OUT_OF_BOUNDS{ErrorModule::AM, 0x1F7}; 42constexpr ResultCode ERR_SIZE_OUT_OF_BOUNDS{ErrorModule::AM, 0x1F7};
42 43
43enum class AppletId : u32 { 44enum class AppletId : u32 {
@@ -460,9 +461,17 @@ void ICommonStateGetter::GetEventHandle(Kernel::HLERequestContext& ctx) {
460void ICommonStateGetter::ReceiveMessage(Kernel::HLERequestContext& ctx) { 461void ICommonStateGetter::ReceiveMessage(Kernel::HLERequestContext& ctx) {
461 LOG_DEBUG(Service_AM, "called"); 462 LOG_DEBUG(Service_AM, "called");
462 463
464 const auto message = msg_queue->PopMessage();
463 IPC::ResponseBuilder rb{ctx, 3}; 465 IPC::ResponseBuilder rb{ctx, 3};
466
467 if (message == AppletMessageQueue::AppletMessage::NoMessage) {
468 LOG_ERROR(Service_AM, "Message queue is empty");
469 rb.Push(ERR_NO_MESSAGES);
470 rb.PushEnum<AppletMessageQueue::AppletMessage>(message);
471 return;
472 }
464 rb.Push(RESULT_SUCCESS); 473 rb.Push(RESULT_SUCCESS);
465 rb.PushEnum<AppletMessageQueue::AppletMessage>(msg_queue->PopMessage()); 474 rb.PushEnum<AppletMessageQueue::AppletMessage>(message);
466} 475}
467 476
468void ICommonStateGetter::GetCurrentFocusState(Kernel::HLERequestContext& ctx) { 477void ICommonStateGetter::GetCurrentFocusState(Kernel::HLERequestContext& ctx) {