aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Services/Account/Acc/ApplicationServiceServer.cs
diff options
context:
space:
mode:
authorAc_K <Acoustik666@gmail.com>2021-04-13 03:16:43 +0200
committerGitHub <noreply@github.com>2021-04-13 03:16:43 +0200
commit7344dee47598a26fe72de859c311354f834ca2ed (patch)
treeedf8cf10ffda04e49b2aac4cfc69b3f5fd98d5f3 /Ryujinx.HLE/HOS/Services/Account/Acc/ApplicationServiceServer.cs
parent001005b3d56d4984399b4baf8e4b7348ecdb5062 (diff)
account: Adds AccountManager (#2184)
* 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
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Account/Acc/ApplicationServiceServer.cs')
-rw-r--r--Ryujinx.HLE/HOS/Services/Account/Acc/ApplicationServiceServer.cs24
1 files changed, 12 insertions, 12 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Account/Acc/ApplicationServiceServer.cs b/Ryujinx.HLE/HOS/Services/Account/Acc/ApplicationServiceServer.cs
index 4931866c..29cce5d7 100644
--- a/Ryujinx.HLE/HOS/Services/Account/Acc/ApplicationServiceServer.cs
+++ b/Ryujinx.HLE/HOS/Services/Account/Acc/ApplicationServiceServer.cs
@@ -17,7 +17,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
public ResultCode GetUserCountImpl(ServiceCtx context)
{
- context.ResponseData.Write(context.Device.System.State.Account.GetUserCount());
+ context.ResponseData.Write(context.Device.System.AccountManager.GetUserCount());
return ResultCode.Success;
}
@@ -31,26 +31,26 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
return resultCode;
}
- context.ResponseData.Write(context.Device.System.State.Account.TryGetUser(userId, out _));
+ context.ResponseData.Write(context.Device.System.AccountManager.TryGetUser(userId, out _));
return ResultCode.Success;
}
public ResultCode ListAllUsers(ServiceCtx context)
{
- return WriteUserList(context, context.Device.System.State.Account.GetAllUsers());
+ return WriteUserList(context, context.Device.System.AccountManager.GetAllUsers());
}
public ResultCode ListOpenUsers(ServiceCtx context)
{
- return WriteUserList(context, context.Device.System.State.Account.GetOpenedUsers());
+ return WriteUserList(context, context.Device.System.AccountManager.GetOpenedUsers());
}
private ResultCode WriteUserList(ServiceCtx context, IEnumerable<UserProfile> profiles)
{
if (context.Request.RecvListBuff.Count == 0)
{
- return ResultCode.InvalidInputBuffer;
+ return ResultCode.InvalidBuffer;
}
long outputPosition = context.Request.RecvListBuff[0].Position;
@@ -78,7 +78,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
public ResultCode GetLastOpenedUser(ServiceCtx context)
{
- context.Device.System.State.Account.LastOpenedUser.UserId.Write(context.ResponseData);
+ context.Device.System.AccountManager.LastOpenedUser.UserId.Write(context.ResponseData);
return ResultCode.Success;
}
@@ -94,7 +94,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
return resultCode;
}
- if (!context.Device.System.State.Account.TryGetUser(userId, out UserProfile userProfile))
+ if (!context.Device.System.AccountManager.TryGetUser(userId, out UserProfile userProfile))
{
Logger.Warning?.Print(LogClass.ServiceAcc, $"User 0x{userId} not found!");
@@ -118,7 +118,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
public ResultCode TrySelectUserWithoutInteraction(ServiceCtx context)
{
- if (context.Device.System.State.Account.GetUserCount() != 1)
+ if (context.Device.System.AccountManager.GetUserCount() != 1)
{
// Invalid UserId.
UserId.Null.Write(context.ResponseData);
@@ -137,7 +137,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
}
// NOTE: As we returned an invalid UserId if there is more than one user earlier, now we can return only the first one.
- context.Device.System.State.Account.GetFirst().UserId.Write(context.ResponseData);
+ context.Device.System.AccountManager.GetFirst().UserId.Write(context.ResponseData);
return ResultCode.Success;
}
@@ -153,7 +153,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
if (context.Request.SendBuff.Count == 0)
{
- return ResultCode.InvalidInputBuffer;
+ return ResultCode.InvalidBuffer;
}
long inputPosition = context.Request.SendBuff[0].Position;
@@ -161,7 +161,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
if (inputSize != 0x24000)
{
- return ResultCode.InvalidInputBufferSize;
+ return ResultCode.InvalidBufferSize;
}
byte[] thumbnailBuffer = new byte[inputSize];
@@ -205,7 +205,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
{
// TODO: Determine how users are "qualified". We assume all users are "qualified" for now.
- return WriteUserList(context, context.Device.System.State.Account.GetAllUsers());
+ return WriteUserList(context, context.Device.System.AccountManager.GetAllUsers());
}
public ResultCode CheckUserId(ServiceCtx context, out UserId userId)