mirror of
https://github.com/GreemDev/Ryujinx.git
synced 2024-12-25 16:05:47 +00:00
7344dee475
* account: Adds Account Manager In a way to have Custom User Profiles merged in master faster, this PR adds a `AccountManager` class (based on `AccountUtils` class) and the following changes have been made: - Adds a "default profile values" which were the old hardcoded ones. - The image profile is moved to the Account service folder. - The hardcoded UserId for the savedata is now using the `AccountManager` last opened one. - The DeviceId in Mii service is changed to the right value (checked by REd sys:set call). * Fix csproj * Addresses gdkchan's comments * Fix UserProfile fields * Fix mii GetDeviceId() * Update Ryujinx.HLE.csproj
129 lines
No EOL
4.3 KiB
C#
129 lines
No EOL
4.3 KiB
C#
using Ryujinx.Common;
|
|
using Ryujinx.Common.Logging;
|
|
using Ryujinx.HLE.HOS.Services.Account.Acc.AccountService;
|
|
|
|
namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
|
{
|
|
[Service("acc:su", AccountServiceFlag.Administrator)] // Max Sessions: 8
|
|
class IAccountServiceForAdministrator : IpcService
|
|
{
|
|
private ApplicationServiceServer _applicationServiceServer;
|
|
|
|
public IAccountServiceForAdministrator(ServiceCtx context, AccountServiceFlag serviceFlag)
|
|
{
|
|
_applicationServiceServer = new ApplicationServiceServer(serviceFlag);
|
|
}
|
|
|
|
[Command(0)]
|
|
// GetUserCount() -> i32
|
|
public ResultCode GetUserCount(ServiceCtx context)
|
|
{
|
|
return _applicationServiceServer.GetUserCountImpl(context);
|
|
}
|
|
|
|
[Command(1)]
|
|
// GetUserExistence(nn::account::Uid) -> bool
|
|
public ResultCode GetUserExistence(ServiceCtx context)
|
|
{
|
|
return _applicationServiceServer.GetUserExistenceImpl(context);
|
|
}
|
|
|
|
[Command(2)]
|
|
// ListAllUsers() -> array<nn::account::Uid, 0xa>
|
|
public ResultCode ListAllUsers(ServiceCtx context)
|
|
{
|
|
return _applicationServiceServer.ListAllUsers(context);
|
|
}
|
|
|
|
[Command(3)]
|
|
// ListOpenUsers() -> array<nn::account::Uid, 0xa>
|
|
public ResultCode ListOpenUsers(ServiceCtx context)
|
|
{
|
|
return _applicationServiceServer.ListOpenUsers(context);
|
|
}
|
|
|
|
[Command(4)]
|
|
// GetLastOpenedUser() -> nn::account::Uid
|
|
public ResultCode GetLastOpenedUser(ServiceCtx context)
|
|
{
|
|
return _applicationServiceServer.GetLastOpenedUser(context);
|
|
}
|
|
|
|
[Command(5)]
|
|
// 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;
|
|
}
|
|
|
|
[Command(50)]
|
|
// IsUserRegistrationRequestPermitted(pid) -> bool
|
|
public ResultCode IsUserRegistrationRequestPermitted(ServiceCtx context)
|
|
{
|
|
// NOTE: pid is unused.
|
|
|
|
return _applicationServiceServer.IsUserRegistrationRequestPermitted(context);
|
|
}
|
|
|
|
[Command(51)]
|
|
// TrySelectUserWithoutInteraction(bool) -> nn::account::Uid
|
|
public ResultCode TrySelectUserWithoutInteraction(ServiceCtx context)
|
|
{
|
|
return _applicationServiceServer.TrySelectUserWithoutInteraction(context);
|
|
}
|
|
|
|
[Command(102)]
|
|
// 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;
|
|
}
|
|
|
|
[Command(140)] // 6.0.0+
|
|
// ListQualifiedUsers() -> array<nn::account::Uid, 0xa>
|
|
public ResultCode ListQualifiedUsers(ServiceCtx context)
|
|
{
|
|
return _applicationServiceServer.ListQualifiedUsers(context);
|
|
}
|
|
|
|
[Command(205)]
|
|
// GetProfileEditor(nn::account::Uid) -> object<nn::account::profile::IProfileEditor>
|
|
public ResultCode GetProfileEditor(ServiceCtx context)
|
|
{
|
|
UserId userId = context.RequestData.ReadStruct<UserId>();
|
|
|
|
if (!context.Device.System.AccountManager.TryGetUser(userId, out UserProfile userProfile))
|
|
{
|
|
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;
|
|
}
|
|
}
|
|
} |