aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.HLE/HOS/Services/Account/Acc/IAsyncNetworkServiceLicenseKindContext.cs
blob: 1fa5cf2a168db5f291f4ced9e0ef565c5c153c3f (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
using Ryujinx.HLE.HOS.Services.Account.Acc.AsyncContext;

namespace Ryujinx.HLE.HOS.Services.Account.Acc
{
    class IAsyncNetworkServiceLicenseKindContext : IAsyncContext
    {
        private NetworkServiceLicenseKind? _serviceLicenseKind;

        public IAsyncNetworkServiceLicenseKindContext(AsyncExecution asyncExecution, NetworkServiceLicenseKind? serviceLicenseKind) : base(asyncExecution)
        {
            _serviceLicenseKind = serviceLicenseKind;
        }

        [CommandCmif(100)]
        // GetNetworkServiceLicenseKind() -> nn::account::NetworkServiceLicenseKind
        public ResultCode GetNetworkServiceLicenseKind(ServiceCtx context)
        {
            if (!AsyncExecution.IsInitialized)
            {
                return ResultCode.AsyncExecutionNotInitialized;
            }

            if (!AsyncExecution.SystemEvent.ReadableEvent.IsSignaled())
            {
                return ResultCode.Unknown41;
            }

            if (!_serviceLicenseKind.HasValue)
            {
                return ResultCode.MissingNetworkServiceLicenseKind;
            }

            context.ResponseData.Write((uint)_serviceLicenseKind.Value);

            return ResultCode.Success;
        }
    }
}