1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-11-11 03:06:38 +00:00
Ryujinx/Ryujinx.HLE/HOS/SystemState/AppletStateMgr.cs
Ac_K aca1c37d4b
am: Add all known AppletMessage (#2378)
This PR add all known AppletMessage values for accuracy, nothing more.
`MessageInfo` is renamed to the right `AppletMessage` name.
2021-06-21 13:41:37 -03:00

39 lines
No EOL
1.1 KiB
C#

using Ryujinx.HLE.HOS.Kernel.Threading;
using Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.SystemAppletProxy;
using System.Collections.Concurrent;
namespace Ryujinx.HLE.HOS.SystemState
{
class AppletStateMgr
{
public ConcurrentQueue<AppletMessage> Messages { get; }
public FocusState FocusState { get; private set; }
public KEvent MessageEvent { get; }
public IdDictionary AppletResourceUserIds { get; }
public AppletStateMgr(Horizon system)
{
Messages = new ConcurrentQueue<AppletMessage>();
MessageEvent = new KEvent(system.KernelContext);
AppletResourceUserIds = new IdDictionary();
}
public void SetFocus(bool isFocused)
{
FocusState = isFocused ? FocusState.InFocus : FocusState.OutOfFocus;
Messages.Enqueue(AppletMessage.FocusStateChanged);
if (isFocused)
{
Messages.Enqueue(AppletMessage.ChangeIntoForeground);
}
MessageEvent.ReadableEvent.Signal();
}
}
}