aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE
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
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')
-rw-r--r--Ryujinx.HLE/HOS/Applets/PlayerSelect/PlayerSelectApplet.cs2
-rw-r--r--Ryujinx.HLE/HOS/ApplicationLoader.cs2
-rw-r--r--Ryujinx.HLE/HOS/Horizon.cs5
-rw-r--r--Ryujinx.HLE/HOS/Services/Account/Acc/AccountManager.cs (renamed from Ryujinx.HLE/HOS/Services/Account/Acc/AccountService/AccountUtils.cs)20
-rw-r--r--Ryujinx.HLE/HOS/Services/Account/Acc/AccountService/ProfileServer.cs29
-rw-r--r--Ryujinx.HLE/HOS/Services/Account/Acc/ApplicationServiceServer.cs24
-rw-r--r--Ryujinx.HLE/HOS/Services/Account/Acc/DefaultUserImage.jpg (renamed from Ryujinx.HLE/RyujinxProfileImage.jpg)bin52969 -> 52969 bytes
-rw-r--r--Ryujinx.HLE/HOS/Services/Account/Acc/IAccountServiceForAdministrator.cs2
-rw-r--r--Ryujinx.HLE/HOS/Services/Account/Acc/Types/UserProfile.cs17
-rw-r--r--Ryujinx.HLE/HOS/Services/Account/ResultCode.cs24
-rw-r--r--Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs2
-rw-r--r--Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/IFriendService.cs4
-rw-r--r--Ryujinx.HLE/HOS/Services/Mii/Helper.cs5
-rw-r--r--Ryujinx.HLE/HOS/Services/Sdb/Pdm/QueryService/QueryPlayStatisticsManager.cs2
-rw-r--r--Ryujinx.HLE/HOS/SystemState/SystemStateMgr.cs10
-rw-r--r--Ryujinx.HLE/Ryujinx.HLE.csproj4
-rw-r--r--Ryujinx.HLE/Switch.cs4
17 files changed, 79 insertions, 77 deletions
diff --git a/Ryujinx.HLE/HOS/Applets/PlayerSelect/PlayerSelectApplet.cs b/Ryujinx.HLE/HOS/Applets/PlayerSelect/PlayerSelectApplet.cs
index 418f5c10..9cfe0253 100644
--- a/Ryujinx.HLE/HOS/Applets/PlayerSelect/PlayerSelectApplet.cs
+++ b/Ryujinx.HLE/HOS/Applets/PlayerSelect/PlayerSelectApplet.cs
@@ -40,7 +40,7 @@ namespace Ryujinx.HLE.HOS.Applets
private byte[] BuildResponse()
{
- UserProfile currentUser = _system.State.Account.LastOpenedUser;
+ UserProfile currentUser = _system.AccountManager.LastOpenedUser;
using (MemoryStream stream = new MemoryStream())
using (BinaryWriter writer = new BinaryWriter(stream))
diff --git a/Ryujinx.HLE/HOS/ApplicationLoader.cs b/Ryujinx.HLE/HOS/ApplicationLoader.cs
index 21d94311..40e3f646 100644
--- a/Ryujinx.HLE/HOS/ApplicationLoader.cs
+++ b/Ryujinx.HLE/HOS/ApplicationLoader.cs
@@ -648,7 +648,7 @@ namespace Ryujinx.HLE.HOS
{
Logger.Info?.Print(LogClass.Application, "Ensuring required savedata exists.");
- Uid user = _device.System.State.Account.LastOpenedUser.UserId.ToLibHacUid();
+ Uid user = _device.System.AccountManager.LastOpenedUser.UserId.ToLibHacUid();
ref ApplicationControlProperty control = ref ControlData.Value;
diff --git a/Ryujinx.HLE/HOS/Horizon.cs b/Ryujinx.HLE/HOS/Horizon.cs
index 80f097f4..f7fcad2a 100644
--- a/Ryujinx.HLE/HOS/Horizon.cs
+++ b/Ryujinx.HLE/HOS/Horizon.cs
@@ -18,6 +18,7 @@ using Ryujinx.HLE.HOS.Kernel.Memory;
using Ryujinx.HLE.HOS.Kernel.Process;
using Ryujinx.HLE.HOS.Kernel.Threading;
using Ryujinx.HLE.HOS.Services;
+using Ryujinx.HLE.HOS.Services.Account.Acc;
using Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.SystemAppletProxy;
using Ryujinx.HLE.HOS.Services.Apm;
using Ryujinx.HLE.HOS.Services.Arp;
@@ -86,6 +87,7 @@ namespace Ryujinx.HLE.HOS
internal KSharedMemory IirsSharedMem { get; private set; }
internal SharedFontManager Font { get; private set; }
+ internal AccountManager AccountManager { get; private set; }
internal ContentManager ContentManager { get; private set; }
internal CaptureManager CaptureManager { get; private set; }
@@ -110,7 +112,7 @@ namespace Ryujinx.HLE.HOS
internal LibHac.Horizon LibHacHorizonServer { get; private set; }
internal HorizonClient LibHacHorizonClient { get; private set; }
- public Horizon(Switch device, ContentManager contentManager, MemoryConfiguration memoryConfiguration)
+ public Horizon(Switch device, ContentManager contentManager, AccountManager accountManager, MemoryConfiguration memoryConfiguration)
{
KernelContext = new KernelContext(
device,
@@ -165,6 +167,7 @@ namespace Ryujinx.HLE.HOS
DisplayResolutionChangeEvent = new KEvent(KernelContext);
+ AccountManager = accountManager;
ContentManager = contentManager;
CaptureManager = new CaptureManager(device);
diff --git a/Ryujinx.HLE/HOS/Services/Account/Acc/AccountService/AccountUtils.cs b/Ryujinx.HLE/HOS/Services/Account/Acc/AccountManager.cs
index 8b7f1e54..d36ea931 100644
--- a/Ryujinx.HLE/HOS/Services/Account/Acc/AccountService/AccountUtils.cs
+++ b/Ryujinx.HLE/HOS/Services/Account/Acc/AccountManager.cs
@@ -1,23 +1,31 @@
-using System.Collections.Concurrent;
+using Ryujinx.Common;
+using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
namespace Ryujinx.HLE.HOS.Services.Account.Acc
{
- public class AccountUtils
+ public class AccountManager
{
private ConcurrentDictionary<string, UserProfile> _profiles;
- internal UserProfile LastOpenedUser { get; private set; }
+ public UserProfile LastOpenedUser { get; private set; }
- public AccountUtils()
+ public AccountManager()
{
_profiles = new ConcurrentDictionary<string, UserProfile>();
+
+ UserId defaultUserId = new UserId("00000000000000010000000000000000");
+ byte[] defaultUserImage = EmbeddedResources.Read("Ryujinx.HLE/HOS/Services/Account/Acc/DefaultUserImage.jpg");
+
+ AddUser(defaultUserId, "Player", defaultUserImage);
+
+ OpenUser(defaultUserId);
}
- public void AddUser(UserId userId, string name)
+ public void AddUser(UserId userId, string name, byte[] image)
{
- UserProfile profile = new UserProfile(userId, name);
+ UserProfile profile = new UserProfile(userId, name, image);
_profiles.AddOrUpdate(userId.ToString(), profile, (key, old) => profile);
}
diff --git a/Ryujinx.HLE/HOS/Services/Account/Acc/AccountService/ProfileServer.cs b/Ryujinx.HLE/HOS/Services/Account/Acc/AccountService/ProfileServer.cs
index c6e0508f..18534393 100644
--- a/Ryujinx.HLE/HOS/Services/Account/Acc/AccountService/ProfileServer.cs
+++ b/Ryujinx.HLE/HOS/Services/Account/Acc/AccountService/ProfileServer.cs
@@ -1,8 +1,6 @@
using Ryujinx.Common.Logging;
using Ryujinx.Cpu;
using Ryujinx.HLE.Utilities;
-using System.IO;
-using System.Reflection;
using System.Text;
namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService
@@ -10,12 +8,10 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService
class ProfileServer
{
private UserProfile _profile;
- private Stream _profilePictureStream;
public ProfileServer(UserProfile profile)
{
- _profile = profile;
- _profilePictureStream = Assembly.GetCallingAssembly().GetManifestResourceStream("Ryujinx.HLE.RyujinxProfileImage.jpg");
+ _profile = profile;
}
public ResultCode Get(ServiceCtx context)
@@ -54,7 +50,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService
public ResultCode GetImageSize(ServiceCtx context)
{
- context.ResponseData.Write(_profilePictureStream.Length);
+ context.ResponseData.Write(_profile.Image.Length);
return ResultCode.Success;
}
@@ -64,13 +60,14 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService
long bufferPosition = context.Request.ReceiveBuff[0].Position;
long bufferLen = context.Request.ReceiveBuff[0].Size;
- byte[] profilePictureData = new byte[bufferLen];
+ if (_profile.Image.Length > bufferLen)
+ {
+ return ResultCode.InvalidBufferSize;
+ }
- _profilePictureStream.Read(profilePictureData, 0, profilePictureData.Length);
+ context.Memory.Write((ulong)bufferPosition, _profile.Image);
- context.Memory.Write((ulong)bufferPosition, profilePictureData);
-
- context.ResponseData.Write(_profilePictureStream.Length);
+ context.ResponseData.Write(_profile.Image.Length);
return ResultCode.Success;
}
@@ -100,16 +97,16 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService
context.Memory.Read((ulong)userDataPosition, userData);
- long profilePicturePosition = context.Request.SendBuff[0].Position;
- long profilePictureSize = context.Request.SendBuff[0].Size;
+ long profileImagePosition = context.Request.SendBuff[0].Position;
+ long profileImageSize = context.Request.SendBuff[0].Size;
- byte[] profilePictureData = new byte[profilePictureSize];
+ byte[] profileImageData = new byte[profileImageSize];
- context.Memory.Read((ulong)profilePicturePosition, profilePictureData);
+ context.Memory.Read((ulong)profileImagePosition, profileImageData);
// TODO: Read the nn::account::profile::ProfileBase and store everything in the savedata.
- Logger.Stub?.PrintStub(LogClass.ServiceAcc, new { userDataSize, profilePictureSize });
+ Logger.Stub?.PrintStub(LogClass.ServiceAcc, new { userDataSize, profileImageSize });
return ResultCode.Success;
}
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)
diff --git a/Ryujinx.HLE/RyujinxProfileImage.jpg b/Ryujinx.HLE/HOS/Services/Account/Acc/DefaultUserImage.jpg
index 55e4c43c..55e4c43c 100644
--- a/Ryujinx.HLE/RyujinxProfileImage.jpg
+++ b/Ryujinx.HLE/HOS/Services/Account/Acc/DefaultUserImage.jpg
Binary files differ
diff --git a/Ryujinx.HLE/HOS/Services/Account/Acc/IAccountServiceForAdministrator.cs b/Ryujinx.HLE/HOS/Services/Account/Acc/IAccountServiceForAdministrator.cs
index 90091b08..55119077 100644
--- a/Ryujinx.HLE/HOS/Services/Account/Acc/IAccountServiceForAdministrator.cs
+++ b/Ryujinx.HLE/HOS/Services/Account/Acc/IAccountServiceForAdministrator.cs
@@ -111,7 +111,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
{
UserId userId = context.RequestData.ReadStruct<UserId>();
- 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!");
diff --git a/Ryujinx.HLE/HOS/Services/Account/Acc/Types/UserProfile.cs b/Ryujinx.HLE/HOS/Services/Account/Acc/Types/UserProfile.cs
index 6758f7bb..a57796c9 100644
--- a/Ryujinx.HLE/HOS/Services/Account/Acc/Types/UserProfile.cs
+++ b/Ryujinx.HLE/HOS/Services/Account/Acc/Types/UserProfile.cs
@@ -1,26 +1,29 @@
-using Ryujinx.HLE.Utilities;
-using System;
+using System;
namespace Ryujinx.HLE.HOS.Services.Account.Acc
{
- class UserProfile
+ public class UserProfile
{
private static readonly DateTime Epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
- public UserId UserId { get; private set; }
+ public UserId UserId { get; }
- public string Name { get; private set; }
+ public string Name { get; }
+
+ public byte[] Image { get; }
public long LastModifiedTimestamp { get; private set; }
- public AccountState AccountState { get; set; }
+ public AccountState AccountState { get; set; }
public AccountState OnlinePlayState { get; set; }
- public UserProfile(UserId userId, string name)
+ public UserProfile(UserId userId, string name, byte[] image)
{
UserId = userId;
Name = name;
+ Image = image;
+
LastModifiedTimestamp = 0;
AccountState = AccountState.Closed;
diff --git a/Ryujinx.HLE/HOS/Services/Account/ResultCode.cs b/Ryujinx.HLE/HOS/Services/Account/ResultCode.cs
index f25b2acb..7c23a8b6 100644
--- a/Ryujinx.HLE/HOS/Services/Account/ResultCode.cs
+++ b/Ryujinx.HLE/HOS/Services/Account/ResultCode.cs
@@ -7,17 +7,17 @@ namespace Ryujinx.HLE.HOS.Services.Account
Success = 0,
- NullArgument = (20 << ErrorCodeShift) | ModuleId,
- InvalidArgument = (22 << ErrorCodeShift) | ModuleId,
- NullInputBuffer = (30 << ErrorCodeShift) | ModuleId,
- InvalidInputBufferSize = (31 << ErrorCodeShift) | ModuleId,
- InvalidInputBuffer = (32 << ErrorCodeShift) | ModuleId,
- AsyncExecutionNotInitialized = (40 << ErrorCodeShift) | ModuleId,
- Unknown41 = (41 << ErrorCodeShift) | ModuleId,
- InternetRequestDenied = (59 << ErrorCodeShift) | ModuleId,
- UserNotFound = (100 << ErrorCodeShift) | ModuleId,
- NullObject = (302 << ErrorCodeShift) | ModuleId,
- Unknown341 = (341 << ErrorCodeShift) | ModuleId,
- InvalidIdTokenCacheBufferSize = (451 << ErrorCodeShift) | ModuleId
+ NullArgument = (20 << ErrorCodeShift) | ModuleId,
+ InvalidArgument = (22 << ErrorCodeShift) | ModuleId,
+ NullInputBuffer = (30 << ErrorCodeShift) | ModuleId,
+ InvalidBufferSize = (31 << ErrorCodeShift) | ModuleId,
+ InvalidBuffer = (32 << ErrorCodeShift) | ModuleId,
+ AsyncExecutionNotInitialized = (40 << ErrorCodeShift) | ModuleId,
+ Unknown41 = (41 << ErrorCodeShift) | ModuleId,
+ InternetRequestDenied = (59 << ErrorCodeShift) | ModuleId,
+ UserNotFound = (100 << ErrorCodeShift) | ModuleId,
+ NullObject = (302 << ErrorCodeShift) | ModuleId,
+ Unknown341 = (341 << ErrorCodeShift) | ModuleId,
+ InvalidIdTokenCacheBufferSize = (451 << ErrorCodeShift) | ModuleId
}
}
diff --git a/Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs b/Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs
index fc11441f..257f1cb0 100644
--- a/Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs
+++ b/Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs
@@ -58,7 +58,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati
break;
case LaunchParameterKind.PreselectedUser:
// Only the first 0x18 bytes of the Data seems to be actually used.
- storageData = StorageHelper.MakeLaunchParams(context.Device.System.State.Account.LastOpenedUser);
+ storageData = StorageHelper.MakeLaunchParams(context.Device.System.AccountManager.LastOpenedUser);
break;
case LaunchParameterKind.Unknown:
throw new NotImplementedException("Unknown LaunchParameterKind.");
diff --git a/Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/IFriendService.cs b/Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/IFriendService.cs
index 71502cda..461fde17 100644
--- a/Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/IFriendService.cs
+++ b/Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/IFriendService.cs
@@ -150,7 +150,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend.ServiceCreator
return ResultCode.InvalidArgument;
}
- if (context.Device.System.State.Account.TryGetUser(userId, out UserProfile profile))
+ if (context.Device.System.AccountManager.TryGetUser(userId, out UserProfile profile))
{
profile.OnlinePlayState = AccountState.Open;
}
@@ -171,7 +171,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend.ServiceCreator
return ResultCode.InvalidArgument;
}
- if (context.Device.System.State.Account.TryGetUser(userId, out UserProfile profile))
+ if (context.Device.System.AccountManager.TryGetUser(userId, out UserProfile profile))
{
profile.OnlinePlayState = AccountState.Closed;
}
diff --git a/Ryujinx.HLE/HOS/Services/Mii/Helper.cs b/Ryujinx.HLE/HOS/Services/Mii/Helper.cs
index 7e3f4068..ea469ac9 100644
--- a/Ryujinx.HLE/HOS/Services/Mii/Helper.cs
+++ b/Ryujinx.HLE/HOS/Services/Mii/Helper.cs
@@ -1,5 +1,4 @@
-using Ryujinx.HLE.HOS.SystemState;
-using Ryujinx.HLE.Utilities;
+using Ryujinx.HLE.Utilities;
using System;
using System.Buffers.Binary;
@@ -32,7 +31,7 @@ namespace Ryujinx.HLE.HOS.Services.Mii
public static UInt128 GetDeviceId()
{
// FIXME: call set:sys GetMiiAuthorId
- return SystemStateMgr.DefaultUserId.ToUInt128();
+ return new UInt128(0, 1);
}
public static ReadOnlySpan<byte> Ver3FacelineColorTable => new byte[] { 0, 1, 2, 3, 4, 5 };
diff --git a/Ryujinx.HLE/HOS/Services/Sdb/Pdm/QueryService/QueryPlayStatisticsManager.cs b/Ryujinx.HLE/HOS/Services/Sdb/Pdm/QueryService/QueryPlayStatisticsManager.cs
index 317decad..aaaf26e4 100644
--- a/Ryujinx.HLE/HOS/Services/Sdb/Pdm/QueryService/QueryPlayStatisticsManager.cs
+++ b/Ryujinx.HLE/HOS/Services/Sdb/Pdm/QueryService/QueryPlayStatisticsManager.cs
@@ -25,7 +25,7 @@ namespace Ryujinx.HLE.HOS.Services.Sdb.Pdm.QueryService
if (byUserId)
{
- if (!context.Device.System.State.Account.TryGetUser(userId, out _))
+ if (!context.Device.System.AccountManager.TryGetUser(userId, out _))
{
return ResultCode.UserNotFound;
}
diff --git a/Ryujinx.HLE/HOS/SystemState/SystemStateMgr.cs b/Ryujinx.HLE/HOS/SystemState/SystemStateMgr.cs
index 0fe73ebb..9c63853c 100644
--- a/Ryujinx.HLE/HOS/SystemState/SystemStateMgr.cs
+++ b/Ryujinx.HLE/HOS/SystemState/SystemStateMgr.cs
@@ -1,12 +1,9 @@
-using Ryujinx.HLE.HOS.Services.Account.Acc;
using System;
namespace Ryujinx.HLE.HOS.SystemState
{
public class SystemStateMgr
{
- public static readonly UserId DefaultUserId = new UserId("00000000000000010000000000000000");
-
internal static string[] LanguageCodes = new string[]
{
"ja",
@@ -46,15 +43,8 @@ namespace Ryujinx.HLE.HOS.SystemState
public bool InstallContents { get; set; }
- public AccountUtils Account { get; private set; }
-
public SystemStateMgr()
{
- Account = new AccountUtils();
-
- Account.AddUser(DefaultUserId, "Player");
- Account.OpenUser(DefaultUserId);
-
// TODO: Let user specify.
DesiredKeyboardLayout = (long)KeyboardLayout.Default;
}
diff --git a/Ryujinx.HLE/Ryujinx.HLE.csproj b/Ryujinx.HLE/Ryujinx.HLE.csproj
index c9f30280..022dc42d 100644
--- a/Ryujinx.HLE/Ryujinx.HLE.csproj
+++ b/Ryujinx.HLE/Ryujinx.HLE.csproj
@@ -32,12 +32,12 @@
<ItemGroup>
<None Remove="Homebrew.npdm" />
- <None Remove="RyujinxProfileImage.jpg" />
+ <None Remove="HOS\Services\Account\Acc\DefaultUserImage.jpg" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Homebrew.npdm" />
- <EmbeddedResource Include="RyujinxProfileImage.jpg" />
+ <EmbeddedResource Include="HOS\Services\Account\Acc\DefaultUserImage.jpg" />
</ItemGroup>
</Project>
diff --git a/Ryujinx.HLE/Switch.cs b/Ryujinx.HLE/Switch.cs
index 6770b25e..a36c006d 100644
--- a/Ryujinx.HLE/Switch.cs
+++ b/Ryujinx.HLE/Switch.cs
@@ -13,6 +13,7 @@ using Ryujinx.HLE.FileSystem;
using Ryujinx.HLE.FileSystem.Content;
using Ryujinx.HLE.HOS;
using Ryujinx.HLE.HOS.Services;
+using Ryujinx.HLE.HOS.Services.Account.Acc;
using Ryujinx.HLE.HOS.Services.Apm;
using Ryujinx.HLE.HOS.Services.Hid;
using Ryujinx.HLE.HOS.Services.Nv.NvDrvServices;
@@ -57,6 +58,7 @@ namespace Ryujinx.HLE
public Switch(
VirtualFileSystem fileSystem,
ContentManager contentManager,
+ AccountManager accountManager,
UserChannelPersistence userChannelPersistence,
IRenderer renderer,
IHardwareDeviceDriver audioDeviceDriver,
@@ -112,7 +114,7 @@ namespace Ryujinx.HLE
FileSystem = fileSystem;
- System = new Horizon(this, contentManager, memoryConfiguration);
+ System = new Horizon(this, contentManager, accountManager, memoryConfiguration);
System.InitializeServices();
Statistics = new PerformanceStatistics();