Fix ListOpenContextStoredUsers and stub LoadOpenContext (#3718)

* Fix ListOpenContextStoredUsers and stub LoadOpenContext

* Remove nonsensical comment
This commit is contained in:
gdkchan 2022-09-27 21:24:52 -03:00 committed by GitHub
parent 814f75142e
commit 1fd5cf2b4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 15 deletions

View file

@ -22,7 +22,8 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
// outside of the AccountManager. // outside of the AccountManager.
private readonly HorizonClient _horizonClient; private readonly HorizonClient _horizonClient;
private ConcurrentDictionary<string, UserProfile> _profiles; private readonly ConcurrentDictionary<string, UserProfile> _profiles;
private UserProfile[] _storedOpenedUsers;
public UserProfile LastOpenedUser { get; private set; } public UserProfile LastOpenedUser { get; private set; }
@ -31,6 +32,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
_horizonClient = horizonClient; _horizonClient = horizonClient;
_profiles = new ConcurrentDictionary<string, UserProfile>(); _profiles = new ConcurrentDictionary<string, UserProfile>();
_storedOpenedUsers = Array.Empty<UserProfile>();
_accountSaveDataManager = new AccountSaveDataManager(_profiles); _accountSaveDataManager = new AccountSaveDataManager(_profiles);
@ -221,6 +223,16 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
return _profiles.Values.Where(x => x.AccountState == AccountState.Open); return _profiles.Values.Where(x => x.AccountState == AccountState.Open);
} }
internal IEnumerable<UserProfile> GetStoredOpenedUsers()
{
return _storedOpenedUsers;
}
internal void StoreOpenedUsers()
{
_storedOpenedUsers = _profiles.Values.Where(x => x.AccountState == AccountState.Open).ToArray();
}
internal UserProfile GetFirst() internal UserProfile GetFirst()
{ {
return _profiles.First().Value; return _profiles.First().Value;

View file

@ -162,7 +162,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService
public ResultCode StoreOpenContext(ServiceCtx context) public ResultCode StoreOpenContext(ServiceCtx context)
{ {
Logger.Stub?.PrintStub(LogClass.ServiceAcc); context.Device.System.AccountManager.StoreOpenedUsers();
return ResultCode.Success; return ResultCode.Success;
} }

View file

@ -201,6 +201,11 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
return ResultCode.Success; return ResultCode.Success;
} }
public ResultCode ListOpenContextStoredUsers(ServiceCtx context)
{
return WriteUserList(context, context.Device.System.AccountManager.GetStoredOpenedUsers());
}
public ResultCode ListQualifiedUsers(ServiceCtx context) public ResultCode ListQualifiedUsers(ServiceCtx context)
{ {
// TODO: Determine how users are "qualified". We assume all users are "qualified" for now. // TODO: Determine how users are "qualified". We assume all users are "qualified" for now.

View file

@ -1,5 +1,4 @@
using Ryujinx.Common.Logging; using Ryujinx.Common.Logging;
using Ryujinx.Cpu;
using Ryujinx.HLE.HOS.Services.Account.Acc.AccountService; using Ryujinx.HLE.HOS.Services.Account.Acc.AccountService;
using Ryujinx.HLE.HOS.Services.Arp; using Ryujinx.HLE.HOS.Services.Arp;
@ -139,20 +138,21 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
return _applicationServiceServer.ClearSaveDataThumbnail(context); return _applicationServiceServer.ClearSaveDataThumbnail(context);
} }
[CommandHipc(130)] // 5.0.0+
// LoadOpenContext(nn::account::Uid)
public ResultCode LoadOpenContext(ServiceCtx context)
{
Logger.Stub?.PrintStub(LogClass.ServiceAcc);
return ResultCode.Success;
}
[CommandHipc(60)] // 5.0.0-5.1.0
[CommandHipc(131)] // 6.0.0+ [CommandHipc(131)] // 6.0.0+
// ListOpenContextStoredUsers() -> array<nn::account::Uid, 0xa> // ListOpenContextStoredUsers() -> array<nn::account::Uid, 0xa>
public ResultCode ListOpenContextStoredUsers(ServiceCtx context) public ResultCode ListOpenContextStoredUsers(ServiceCtx context)
{ {
ulong outputPosition = context.Request.RecvListBuff[0].Position; return _applicationServiceServer.ListOpenContextStoredUsers(context);
ulong outputSize = context.Request.RecvListBuff[0].Size;
MemoryHelper.FillWithZeros(context.Memory, outputPosition, (int)outputSize);
// TODO: This seems to write stored userids of the OpenContext in the buffer. We needs to determine them.
Logger.Stub?.PrintStub(LogClass.ServiceAcc);
return ResultCode.Success;
} }
[CommandHipc(141)] // 6.0.0+ [CommandHipc(141)] // 6.0.0+