summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2019-01-05 03:42:12 +0100
committerGitHub <noreply@github.com>2019-01-05 03:42:12 +0100
commit1c7696e0d94f651d1e7867f469d495f7c9e5e3ab (patch)
treed581965d6f2d8b2c5d5cf35743f12235012c04eb
parentMerge pull request #1984 from ogniK5377/remove-pulse (diff)
parentProper no message handling for AM::PopMessage (diff)
downloadyuzu-1c7696e0d94f651d1e7867f469d495f7c9e5e3ab.tar
yuzu-1c7696e0d94f651d1e7867f469d495f7c9e5e3ab.tar.gz
yuzu-1c7696e0d94f651d1e7867f469d495f7c9e5e3ab.tar.bz2
yuzu-1c7696e0d94f651d1e7867f469d495f7c9e5e3ab.tar.lz
yuzu-1c7696e0d94f651d1e7867f469d495f7c9e5e3ab.tar.xz
yuzu-1c7696e0d94f651d1e7867f469d495f7c9e5e3ab.tar.zst
yuzu-1c7696e0d94f651d1e7867f469d495f7c9e5e3ab.zip
-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 @@
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 {
@@ -460,9 +461,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) {