diff options
Diffstat (limited to 'src/core/hle/service/am')
-rw-r--r-- | src/core/hle/service/am/am.cpp | 11 | ||||
-rw-r--r-- | src/core/hle/service/am/applets/applets.cpp | 2 | ||||
-rw-r--r-- | src/core/hle/service/am/applets/applets.h | 2 |
3 files changed, 12 insertions, 3 deletions
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index c851e5420..d1cbe0e44 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -39,6 +39,7 @@ namespace Service::AM { constexpr ResultCode ERR_NO_DATA_IN_CHANNEL{ErrorModule::AM, 0x2}; +constexpr ResultCode ERR_NO_MESSAGES{ErrorModule::AM, 0x3}; constexpr ResultCode ERR_SIZE_OUT_OF_BOUNDS{ErrorModule::AM, 0x1F7}; enum class AppletId : u32 { @@ -462,9 +463,17 @@ void ICommonStateGetter::GetEventHandle(Kernel::HLERequestContext& ctx) { void ICommonStateGetter::ReceiveMessage(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); + const auto message = msg_queue->PopMessage(); IPC::ResponseBuilder rb{ctx, 3}; + + if (message == AppletMessageQueue::AppletMessage::NoMessage) { + LOG_ERROR(Service_AM, "Message queue is empty"); + rb.Push(ERR_NO_MESSAGES); + rb.PushEnum<AppletMessageQueue::AppletMessage>(message); + return; + } rb.Push(RESULT_SUCCESS); - rb.PushEnum<AppletMessageQueue::AppletMessage>(msg_queue->PopMessage()); + rb.PushEnum<AppletMessageQueue::AppletMessage>(message); } void ICommonStateGetter::GetCurrentFocusState(Kernel::HLERequestContext& ctx) { diff --git a/src/core/hle/service/am/applets/applets.cpp b/src/core/hle/service/am/applets/applets.cpp index 7698ca819..a6064c63f 100644 --- a/src/core/hle/service/am/applets/applets.cpp +++ b/src/core/hle/service/am/applets/applets.cpp @@ -6,7 +6,7 @@ #include "common/assert.h" #include "core/core.h" #include "core/hle/kernel/readable_event.h" -#include "core/hle/kernel/server_port.h" +#include "core/hle/kernel/server_session.h" #include "core/hle/kernel/writable_event.h" #include "core/hle/service/am/am.h" #include "core/hle/service/am/applets/applets.h" diff --git a/src/core/hle/service/am/applets/applets.h b/src/core/hle/service/am/applets/applets.h index b0a8913c3..37424c379 100644 --- a/src/core/hle/service/am/applets/applets.h +++ b/src/core/hle/service/am/applets/applets.h @@ -7,7 +7,7 @@ #include <memory> #include <queue> #include "common/swap.h" -#include "core/hle/kernel/kernel.h" +#include "core/hle/kernel/object.h" #include "core/hle/kernel/writable_event.h" union ResultCode; |