am/gui: Implement Wake-up message (#1750)

* am/gui: Implement Wake-up message.

This implement the ability to send a Wake-up (Resume) message to the guest.
Sometime games needs to Sleep and Wake-up the switch to unlock some ingame features.

* Address gdkchan feedback
This commit is contained in:
Ac_K
2020-12-16 01:41:42 +01:00
committed by GitHub
parent 3332b29f01
commit 808380690c
6 changed files with 45 additions and 26 deletions

View File

@ -46,11 +46,25 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
// ReceiveMessage() -> nn::am::AppletMessage
public ResultCode ReceiveMessage(ServiceCtx context)
{
if (!context.Device.System.AppletState.TryDequeueMessage(out MessageInfo message))
if (!context.Device.System.AppletState.Messages.TryDequeue(out MessageInfo message))
{
return ResultCode.NoMessages;
}
KEvent messageEvent = context.Device.System.AppletState.MessageEvent;
// NOTE: Service checks if current states are different than the stored ones.
// Since we don't support any states for now, it's fine to check if there is still messages available.
if (context.Device.System.AppletState.Messages.IsEmpty)
{
messageEvent.ReadableEvent.Clear();
}
else
{
messageEvent.ReadableEvent.Signal();
}
context.ResponseData.Write((int)message);
return ResultCode.Success;

View File

@ -3,6 +3,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
enum MessageInfo
{
FocusStateChanged = 0xf,
Resume = 0x10,
OperationModeChanged = 0x1e,
PerformanceModeChanged = 0x1f
}