From 4264ac8f3306506b8d16cbe74a0679e1b764330e Mon Sep 17 00:00:00 2001 From: Alexis Fargeat Date: Fri, 27 Mar 2020 14:57:37 +0100 Subject: [PATCH] Added IAsyncContext.cs and EnsureIdTokenSync --- .../HOS/Services/Account/Acc/IAsyncContext.cs | 61 +++++++++++++++++++ .../Account/Acc/IManagerForApplication.cs | 12 ++++ 2 files changed, 73 insertions(+) create mode 100644 Ryujinx.HLE/HOS/Services/Account/Acc/IAsyncContext.cs diff --git a/Ryujinx.HLE/HOS/Services/Account/Acc/IAsyncContext.cs b/Ryujinx.HLE/HOS/Services/Account/Acc/IAsyncContext.cs new file mode 100644 index 0000000000..18739701a1 --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Account/Acc/IAsyncContext.cs @@ -0,0 +1,61 @@ +using LibHac; +using Ryujinx.Common.Logging; +using Ryujinx.HLE.HOS.Ipc; +using Ryujinx.HLE.HOS.Kernel.Common; +using Ryujinx.HLE.HOS.Kernel.Threading; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Ryujinx.HLE.HOS.Services.Account.Acc +{ + class IAsyncContext : IpcService + { + private KEvent _event; + public IAsyncContext(ServiceCtx context) + { + _event = new KEvent(context.Device.System); + } + + [Command(0)] + //GetSystemEvent() -> handle + public ResultCode GetSystemEvent(ServiceCtx context) + { + if (context.Process.HandleTable.GenerateHandle(_event.ReadableEvent, out int _handle) != KernelResult.Success) + { + throw new InvalidOperationException("Out of Handles!"); + } + + context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_handle); + + return ResultCode.Success; + } + + [Command(1)] + //Cancel() + public ResultCode Cancel(ServiceCtx context) + { + Logger.PrintStub(LogClass.ServiceAcc); + + return ResultCode.Success; + } + + [Command(2)] + //HasDone() -> b8 + public ResultCode HasDone(ServiceCtx context) + { + context.ResponseData.Write(1); + + return ResultCode.Success; + } + + [Command(3)] + //GetResult() + public ResultCode GetResult(ServiceCtx context) + { + Logger.PrintStub(LogClass.ServiceAcc); + + return ResultCode.Success; + } + } +} diff --git a/Ryujinx.HLE/HOS/Services/Account/Acc/IManagerForApplication.cs b/Ryujinx.HLE/HOS/Services/Account/Acc/IManagerForApplication.cs index 801eae6a9a..734c4d57fe 100644 --- a/Ryujinx.HLE/HOS/Services/Account/Acc/IManagerForApplication.cs +++ b/Ryujinx.HLE/HOS/Services/Account/Acc/IManagerForApplication.cs @@ -1,3 +1,4 @@ +using GLib; using Ryujinx.Common.Logging; using Ryujinx.HLE.HOS.Services.Arp; @@ -36,6 +37,17 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc return ResultCode.Success; } + [Command(2)] + //EnsureIdTokenCacheAsync() -> object + public ResultCode EnsureIdTokenCacheAsync(ServiceCtx context) + { + MakeObject(context, new IAsyncContext(context)); + + return ResultCode.Success; + } + + [Command(3)] + public ResultCode [Command(130)] // GetNintendoAccountUserResourceCacheForApplication() -> (nn::account::NintendoAccountId, buffer, buffer) public ResultCode GetNintendoAccountUserResourceCacheForApplication(ServiceCtx context)