blob: a2837e2071e68e049a41b553939a7d897c2369de (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
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 IdDictionary IndirectLayerHandles { get; }
public AppletStateMgr(Horizon system)
{
Messages = new ConcurrentQueue<AppletMessage>();
MessageEvent = new KEvent(system.KernelContext);
AppletResourceUserIds = new IdDictionary();
IndirectLayerHandles = 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();
}
}
}
|