2018-12-18 00:33:36 -05:00
|
|
|
using Ryujinx.HLE.HOS.Kernel.Threading;
|
2019-09-18 20:45:11 -04:00
|
|
|
using Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.SystemAppletProxy;
|
2018-03-19 14:58:46 -04:00
|
|
|
using System.Collections.Concurrent;
|
|
|
|
|
2018-08-16 19:47:36 -04:00
|
|
|
namespace Ryujinx.HLE.HOS.SystemState
|
2018-03-19 14:58:46 -04:00
|
|
|
{
|
2018-09-18 19:36:43 -04:00
|
|
|
class AppletStateMgr
|
2018-03-19 14:58:46 -04:00
|
|
|
{
|
2020-12-15 19:41:42 -05:00
|
|
|
public ConcurrentQueue<MessageInfo> Messages { get; }
|
2018-03-19 14:58:46 -04:00
|
|
|
|
|
|
|
public FocusState FocusState { get; private set; }
|
|
|
|
|
2020-12-01 18:23:43 -05:00
|
|
|
public KEvent MessageEvent { get; }
|
|
|
|
|
|
|
|
public IdDictionary AppletResourceUserIds { get; }
|
2018-03-19 14:58:46 -04:00
|
|
|
|
2018-12-06 06:16:24 -05:00
|
|
|
public AppletStateMgr(Horizon system)
|
2018-03-19 14:58:46 -04:00
|
|
|
{
|
2020-12-15 19:41:42 -05:00
|
|
|
Messages = new ConcurrentQueue<MessageInfo>();
|
2020-05-03 23:41:29 -04:00
|
|
|
MessageEvent = new KEvent(system.KernelContext);
|
2020-12-01 18:23:43 -05:00
|
|
|
|
|
|
|
AppletResourceUserIds = new IdDictionary();
|
2018-03-19 14:58:46 -04:00
|
|
|
}
|
|
|
|
|
2018-12-06 06:16:24 -05:00
|
|
|
public void SetFocus(bool isFocused)
|
2018-03-19 14:58:46 -04:00
|
|
|
{
|
2020-12-15 19:41:42 -05:00
|
|
|
FocusState = isFocused ? FocusState.InFocus : FocusState.OutOfFocus;
|
2018-03-19 14:58:46 -04:00
|
|
|
|
2020-12-15 19:41:42 -05:00
|
|
|
Messages.Enqueue(MessageInfo.FocusStateChanged);
|
2018-09-23 14:11:46 -04:00
|
|
|
MessageEvent.ReadableEvent.Signal();
|
2018-03-19 14:58:46 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|