blob: c9af0727f0f6fa70197d6fbbd1641bada8baad68 (
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.Services.Account.Acc.AsyncContext;
using Ryujinx.Horizon.Common;
using System;
namespace Ryujinx.HLE.HOS.Services.Account.Acc
{
class IAsyncContext : IpcService
{
protected AsyncExecution AsyncExecution;
public IAsyncContext(AsyncExecution asyncExecution)
{
AsyncExecution = asyncExecution;
}
[CommandCmif(0)]
// GetSystemEvent() -> handle<copy>
public ResultCode GetSystemEvent(ServiceCtx context)
{
if (context.Process.HandleTable.GenerateHandle(AsyncExecution.SystemEvent.ReadableEvent, out int _systemEventHandle) != Result.Success)
{
throw new InvalidOperationException("Out of handles!");
}
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_systemEventHandle);
return ResultCode.Success;
}
[CommandCmif(1)]
// Cancel()
public ResultCode Cancel(ServiceCtx context)
{
if (!AsyncExecution.IsInitialized)
{
return ResultCode.AsyncExecutionNotInitialized;
}
if (AsyncExecution.IsRunning)
{
AsyncExecution.Cancel();
}
return ResultCode.Success;
}
[CommandCmif(2)]
// HasDone() -> b8
public ResultCode HasDone(ServiceCtx context)
{
if (!AsyncExecution.IsInitialized)
{
return ResultCode.AsyncExecutionNotInitialized;
}
context.ResponseData.Write(AsyncExecution.SystemEvent.ReadableEvent.IsSignaled());
return ResultCode.Success;
}
[CommandCmif(3)]
// GetResult()
public ResultCode GetResult(ServiceCtx context)
{
if (!AsyncExecution.IsInitialized)
{
return ResultCode.AsyncExecutionNotInitialized;
}
if (!AsyncExecution.SystemEvent.ReadableEvent.IsSignaled())
{
return ResultCode.Unknown41;
}
return ResultCode.Success;
}
}
}
|