2021-01-02 22:34:28 +00:00
|
|
|
|
using Ryujinx.Common;
|
|
|
|
|
using Ryujinx.Common.Logging;
|
|
|
|
|
using Ryujinx.HLE.HOS.Services.Account.Acc.AccountService;
|
|
|
|
|
|
|
|
|
|
namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
2019-09-19 00:45:11 +00:00
|
|
|
|
{
|
2021-01-02 22:34:28 +00:00
|
|
|
|
[Service("acc:su", AccountServiceFlag.Administrator)] // Max Sessions: 8
|
2019-09-19 00:45:11 +00:00
|
|
|
|
class IAccountServiceForAdministrator : IpcService
|
|
|
|
|
{
|
2021-01-02 22:34:28 +00:00
|
|
|
|
private ApplicationServiceServer _applicationServiceServer;
|
|
|
|
|
|
|
|
|
|
public IAccountServiceForAdministrator(ServiceCtx context, AccountServiceFlag serviceFlag)
|
|
|
|
|
{
|
|
|
|
|
_applicationServiceServer = new ApplicationServiceServer(serviceFlag);
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-14 23:00:34 +00:00
|
|
|
|
[CommandCmif(0)]
|
2021-01-02 22:34:28 +00:00
|
|
|
|
// GetUserCount() -> i32
|
|
|
|
|
public ResultCode GetUserCount(ServiceCtx context)
|
|
|
|
|
{
|
|
|
|
|
return _applicationServiceServer.GetUserCountImpl(context);
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-14 23:00:34 +00:00
|
|
|
|
[CommandCmif(1)]
|
2021-01-02 22:34:28 +00:00
|
|
|
|
// GetUserExistence(nn::account::Uid) -> bool
|
|
|
|
|
public ResultCode GetUserExistence(ServiceCtx context)
|
|
|
|
|
{
|
|
|
|
|
return _applicationServiceServer.GetUserExistenceImpl(context);
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-14 23:00:34 +00:00
|
|
|
|
[CommandCmif(2)]
|
2021-01-02 22:34:28 +00:00
|
|
|
|
// ListAllUsers() -> array<nn::account::Uid, 0xa>
|
|
|
|
|
public ResultCode ListAllUsers(ServiceCtx context)
|
|
|
|
|
{
|
|
|
|
|
return _applicationServiceServer.ListAllUsers(context);
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-14 23:00:34 +00:00
|
|
|
|
[CommandCmif(3)]
|
2021-01-02 22:34:28 +00:00
|
|
|
|
// ListOpenUsers() -> array<nn::account::Uid, 0xa>
|
|
|
|
|
public ResultCode ListOpenUsers(ServiceCtx context)
|
|
|
|
|
{
|
|
|
|
|
return _applicationServiceServer.ListOpenUsers(context);
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-14 23:00:34 +00:00
|
|
|
|
[CommandCmif(4)]
|
2021-01-02 22:34:28 +00:00
|
|
|
|
// GetLastOpenedUser() -> nn::account::Uid
|
|
|
|
|
public ResultCode GetLastOpenedUser(ServiceCtx context)
|
|
|
|
|
{
|
|
|
|
|
return _applicationServiceServer.GetLastOpenedUser(context);
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-14 23:00:34 +00:00
|
|
|
|
[CommandCmif(5)]
|
2021-01-02 22:34:28 +00:00
|
|
|
|
// GetProfile(nn::account::Uid) -> object<nn::account::profile::IProfile>
|
|
|
|
|
public ResultCode GetProfile(ServiceCtx context)
|
|
|
|
|
{
|
|
|
|
|
ResultCode resultCode = _applicationServiceServer.GetProfile(context, out IProfile iProfile);
|
|
|
|
|
|
|
|
|
|
if (resultCode == ResultCode.Success)
|
|
|
|
|
{
|
|
|
|
|
MakeObject(context, iProfile);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return resultCode;
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-14 23:00:34 +00:00
|
|
|
|
[CommandCmif(50)]
|
2021-01-02 22:34:28 +00:00
|
|
|
|
// IsUserRegistrationRequestPermitted(pid) -> bool
|
|
|
|
|
public ResultCode IsUserRegistrationRequestPermitted(ServiceCtx context)
|
|
|
|
|
{
|
|
|
|
|
// NOTE: pid is unused.
|
|
|
|
|
|
|
|
|
|
return _applicationServiceServer.IsUserRegistrationRequestPermitted(context);
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-14 23:00:34 +00:00
|
|
|
|
[CommandCmif(51)]
|
2021-01-02 22:34:28 +00:00
|
|
|
|
// TrySelectUserWithoutInteraction(bool) -> nn::account::Uid
|
|
|
|
|
public ResultCode TrySelectUserWithoutInteraction(ServiceCtx context)
|
|
|
|
|
{
|
|
|
|
|
return _applicationServiceServer.TrySelectUserWithoutInteraction(context);
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-14 23:00:34 +00:00
|
|
|
|
[CommandCmif(102)]
|
2021-01-02 22:34:28 +00:00
|
|
|
|
// GetBaasAccountManagerForSystemService(nn::account::Uid) -> object<nn::account::baas::IManagerForApplication>
|
|
|
|
|
public ResultCode GetBaasAccountManagerForSystemService(ServiceCtx context)
|
|
|
|
|
{
|
|
|
|
|
ResultCode resultCode = _applicationServiceServer.CheckUserId(context, out UserId userId);
|
|
|
|
|
|
|
|
|
|
if (resultCode != ResultCode.Success)
|
|
|
|
|
{
|
|
|
|
|
return resultCode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MakeObject(context, new IManagerForSystemService(userId));
|
|
|
|
|
|
|
|
|
|
// Doesn't occur in our case.
|
|
|
|
|
// return ResultCode.NullObject;
|
|
|
|
|
|
|
|
|
|
return ResultCode.Success;
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-14 23:00:34 +00:00
|
|
|
|
[CommandCmif(140)] // 6.0.0+
|
2021-01-02 22:34:28 +00:00
|
|
|
|
// ListQualifiedUsers() -> array<nn::account::Uid, 0xa>
|
|
|
|
|
public ResultCode ListQualifiedUsers(ServiceCtx context)
|
|
|
|
|
{
|
|
|
|
|
return _applicationServiceServer.ListQualifiedUsers(context);
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-14 23:00:34 +00:00
|
|
|
|
[CommandCmif(205)]
|
2021-01-02 22:34:28 +00:00
|
|
|
|
// GetProfileEditor(nn::account::Uid) -> object<nn::account::profile::IProfileEditor>
|
|
|
|
|
public ResultCode GetProfileEditor(ServiceCtx context)
|
|
|
|
|
{
|
|
|
|
|
UserId userId = context.RequestData.ReadStruct<UserId>();
|
|
|
|
|
|
2021-04-13 01:16:43 +00:00
|
|
|
|
if (!context.Device.System.AccountManager.TryGetUser(userId, out UserProfile userProfile))
|
2021-01-02 22:34:28 +00:00
|
|
|
|
{
|
|
|
|
|
Logger.Warning?.Print(LogClass.ServiceAcc, $"User 0x{userId} not found!");
|
|
|
|
|
|
|
|
|
|
return ResultCode.UserNotFound;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MakeObject(context, new IProfileEditor(userProfile));
|
|
|
|
|
|
|
|
|
|
// Doesn't occur in our case.
|
|
|
|
|
// return ResultCode.NullObject;
|
|
|
|
|
|
|
|
|
|
return ResultCode.Success;
|
|
|
|
|
}
|
2019-09-19 00:45:11 +00:00
|
|
|
|
}
|
|
|
|
|
}
|