IAsyncNetworkServiceLicenseKindContext.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using Ryujinx.HLE.HOS.Services.Account.Acc.AsyncContext;
  2. namespace Ryujinx.HLE.HOS.Services.Account.Acc
  3. {
  4. class IAsyncNetworkServiceLicenseKindContext : IAsyncContext
  5. {
  6. private NetworkServiceLicenseKind? _serviceLicenseKind;
  7. public IAsyncNetworkServiceLicenseKindContext(AsyncExecution asyncExecution, NetworkServiceLicenseKind? serviceLicenseKind) : base(asyncExecution)
  8. {
  9. _serviceLicenseKind = serviceLicenseKind;
  10. }
  11. [CommandHipc(100)]
  12. // GetNetworkServiceLicenseKind() -> nn::account::NetworkServiceLicenseKind
  13. public ResultCode GetNetworkServiceLicenseKind(ServiceCtx context)
  14. {
  15. if (!AsyncExecution.IsInitialized)
  16. {
  17. return ResultCode.AsyncExecutionNotInitialized;
  18. }
  19. if (!AsyncExecution.SystemEvent.ReadableEvent.IsSignaled())
  20. {
  21. return ResultCode.Unknown41;
  22. }
  23. if (!_serviceLicenseKind.HasValue)
  24. {
  25. return ResultCode.MissingNetworkServiceLicenseKind;
  26. }
  27. context.ResponseData.Write((uint)_serviceLicenseKind.Value);
  28. return ResultCode.Success;
  29. }
  30. }
  31. }