From 3561062bc67cde7423d64237170845a206a441c6 Mon Sep 17 00:00:00 2001 From: Ac_K Date: Sat, 13 Oct 2018 23:16:02 +0000 Subject: [PATCH] Update IAccountService and IManagerForApplication (#454) * Update IAccountService and IManagerForApplication `IAccountService`: - Add symbols. - Fix some mistake. - Add `IsUserRegistrationRequestPermitted` and `TrySelectUserWithoutInteraction`. `IManagerForApplication`: - Add symbols. - Add Uuid args. - Little improvement of `GetAccountId` --- .../HOS/Services/Acc/IAccountService.cs | 50 +++++++++++++++++-- .../Services/Acc/IManagerForApplication.cs | 15 ++++-- 2 files changed, 58 insertions(+), 7 deletions(-) diff --git a/Ryujinx.HLE/HOS/Services/Acc/IAccountService.cs b/Ryujinx.HLE/HOS/Services/Acc/IAccountService.cs index 347f2e20c7..08c4c88cd7 100644 --- a/Ryujinx.HLE/HOS/Services/Acc/IAccountService.cs +++ b/Ryujinx.HLE/HOS/Services/Acc/IAccountService.cs @@ -24,11 +24,14 @@ namespace Ryujinx.HLE.HOS.Services.Acc { 3, ListOpenUsers }, { 4, GetLastOpenedUser }, { 5, GetProfile }, + { 50, IsUserRegistrationRequestPermitted }, + { 51, TrySelectUserWithoutInteraction }, { 100, InitializeApplicationInfo }, { 101, GetBaasAccountManagerForApplication } }; } + // GetUserCount() -> i32 public long GetUserCount(ServiceCtx Context) { Context.ResponseData.Write(Context.Device.System.State.GetUserCount()); @@ -36,22 +39,25 @@ namespace Ryujinx.HLE.HOS.Services.Acc return 0; } + // GetUserExistence(nn::account::Uid) -> bool public long GetUserExistence(ServiceCtx Context) { UInt128 Uuid = new UInt128( Context.RequestData.ReadInt64(), Context.RequestData.ReadInt64()); - Context.ResponseData.Write(Context.Device.System.State.TryGetUser(Uuid, out _) ? 1 : 0); + Context.ResponseData.Write(Context.Device.System.State.TryGetUser(Uuid, out _)); return 0; } + // ListAllUsers() -> array public long ListAllUsers(ServiceCtx Context) { return WriteUserList(Context, Context.Device.System.State.GetAllUsers()); } + // ListOpenUsers() -> array public long ListOpenUsers(ServiceCtx Context) { return WriteUserList(Context, Context.Device.System.State.GetOpenUsers()); @@ -78,6 +84,7 @@ namespace Ryujinx.HLE.HOS.Services.Acc return 0; } + // GetLastOpenedUser() -> nn::account::Uid public long GetLastOpenedUser(ServiceCtx Context) { UserProfile LastOpened = Context.Device.System.State.LastOpenUser; @@ -87,6 +94,7 @@ namespace Ryujinx.HLE.HOS.Services.Acc return 0; } + // GetProfile(nn::account::Uid) -> object public long GetProfile(ServiceCtx Context) { UInt128 Uuid = new UInt128( @@ -105,16 +113,50 @@ namespace Ryujinx.HLE.HOS.Services.Acc return 0; } - public long InitializeApplicationInfo(ServiceCtx Context) + // IsUserRegistrationRequestPermitted(u64, pid) -> bool + public long IsUserRegistrationRequestPermitted(ServiceCtx Context) { - Context.Device.Log.PrintStub(LogClass.ServiceAcc, "Stubbed."); + long Unknown = Context.RequestData.ReadInt64(); + + Context.Device.Log.PrintStub(LogClass.ServiceAcc, $"Stubbed. Unknown: {Unknown}"); + + Context.ResponseData.Write(false); return 0; } + // TrySelectUserWithoutInteraction(bool) -> nn::account::Uid + public long TrySelectUserWithoutInteraction(ServiceCtx Context) + { + bool Unknown = Context.RequestData.ReadBoolean(); + + Context.Device.Log.PrintStub(LogClass.ServiceAcc, $"Stubbed. Unknown: {Unknown}"); + + UserProfile Profile = Context.Device.System.State.LastOpenUser; + + Profile.Uuid.Write(Context.ResponseData); + + return 0; + } + + // InitializeApplicationInfo(u64, pid) + public long InitializeApplicationInfo(ServiceCtx Context) + { + long Unknown = Context.RequestData.ReadInt64(); + + Context.Device.Log.PrintStub(LogClass.ServiceAcc, $"Stubbed. Unknown: {Unknown}"); + + return 0; + } + + // GetBaasAccountManagerForApplication(nn::account::Uid) -> object public long GetBaasAccountManagerForApplication(ServiceCtx Context) { - MakeObject(Context, new IManagerForApplication()); + UInt128 Uuid = new UInt128( + Context.RequestData.ReadInt64(), + Context.RequestData.ReadInt64()); + + MakeObject(Context, new IManagerForApplication(Uuid)); return 0; } diff --git a/Ryujinx.HLE/HOS/Services/Acc/IManagerForApplication.cs b/Ryujinx.HLE/HOS/Services/Acc/IManagerForApplication.cs index 813a1b17e5..ed0e6efb69 100644 --- a/Ryujinx.HLE/HOS/Services/Acc/IManagerForApplication.cs +++ b/Ryujinx.HLE/HOS/Services/Acc/IManagerForApplication.cs @@ -1,24 +1,30 @@ using Ryujinx.HLE.HOS.Ipc; using Ryujinx.HLE.Logging; +using Ryujinx.HLE.Utilities; using System.Collections.Generic; namespace Ryujinx.HLE.HOS.Services.Acc { class IManagerForApplication : IpcService { + private UInt128 Uuid; + private Dictionary m_Commands; public override IReadOnlyDictionary Commands => m_Commands; - public IManagerForApplication() + public IManagerForApplication(UInt128 Uuid) { m_Commands = new Dictionary() { { 0, CheckAvailability }, { 1, GetAccountId } }; + + this.Uuid = Uuid; } + // CheckAvailability() public long CheckAvailability(ServiceCtx Context) { Context.Device.Log.PrintStub(LogClass.ServiceAcc, "Stubbed."); @@ -26,11 +32,14 @@ namespace Ryujinx.HLE.HOS.Services.Acc return 0; } + // GetAccountId() -> nn::account::NetworkServiceAccountId public long GetAccountId(ServiceCtx Context) { - Context.Device.Log.PrintStub(LogClass.ServiceAcc, "Stubbed."); + long NetworkServiceAccountId = 0xcafe; - Context.ResponseData.Write(0xcafeL); + Context.Device.Log.PrintStub(LogClass.ServiceAcc, $"Stubbed. NetworkServiceAccountId: {NetworkServiceAccountId}"); + + Context.ResponseData.Write(NetworkServiceAccountId); return 0; }