diff --git a/Ryujinx.HLE/FileSystem/SaveHelper.cs b/Ryujinx.HLE/FileSystem/SaveHelper.cs index 67f010169c..6ef6bf0fc8 100644 --- a/Ryujinx.HLE/FileSystem/SaveHelper.cs +++ b/Ryujinx.HLE/FileSystem/SaveHelper.cs @@ -1,5 +1,6 @@ using Ryujinx.HLE.HOS; using System.IO; +using System.Linq; using static Ryujinx.HLE.FileSystem.VirtualFileSystem; @@ -35,9 +36,12 @@ namespace Ryujinx.HLE.FileSystem } } + string SaveAccount = SaveMetaData.UserId.ToString().All("0".Contains) ? + "savecommon" : SaveMetaData.UserId.ToString(); + string SavePath = Path.Combine(BaseSavePath, SaveMetaData.SaveId.ToString("x16"), - SaveMetaData.UserId.ToString(), + SaveAccount, SaveMetaData.SaveDataType == SaveDataType.SaveData ? CurrentTitleId.ToString("x16") : string.Empty); return SavePath; diff --git a/Ryujinx.HLE/HOS/Services/Acc/IAccountService.cs b/Ryujinx.HLE/HOS/Services/Acc/IAccountService.cs index 8fd7bfeafd..0fd02659ce 100644 --- a/Ryujinx.HLE/HOS/Services/Acc/IAccountService.cs +++ b/Ryujinx.HLE/HOS/Services/Acc/IAccountService.cs @@ -39,7 +39,7 @@ namespace Ryujinx.HLE.HOS.Services.Acc { UserId Uuid = new UserId( Context.RequestData.ReadInt64(), - Context.RequestData.ReadInt64()); + Context.RequestData.ReadInt64(), false); Context.ResponseData.Write(Context.Device.System.State.TryGetUser(Uuid, out _) ? 1 : 0); @@ -94,7 +94,7 @@ namespace Ryujinx.HLE.HOS.Services.Acc { UserId Uuid = new UserId( Context.RequestData.ReadInt64(), - Context.RequestData.ReadInt64()); + Context.RequestData.ReadInt64(), false); if (!Context.Device.System.State.TryGetUser(Uuid, out UserProfile Profile)) { diff --git a/Ryujinx.HLE/HOS/Services/Friend/IFriendService.cs b/Ryujinx.HLE/HOS/Services/Friend/IFriendService.cs index d476f5d027..3ba8306aee 100644 --- a/Ryujinx.HLE/HOS/Services/Friend/IFriendService.cs +++ b/Ryujinx.HLE/HOS/Services/Friend/IFriendService.cs @@ -63,7 +63,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend { UserId Uuid = new UserId( Context.RequestData.ReadInt64(), - Context.RequestData.ReadInt64()); + Context.RequestData.ReadInt64(), false); if (Context.Device.System.State.TryGetUser(Uuid, out UserProfile Profile)) { @@ -81,7 +81,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend { UserId Uuid = new UserId( Context.RequestData.ReadInt64(), - Context.RequestData.ReadInt64()); + Context.RequestData.ReadInt64(), false); long Unknown0 = Context.RequestData.ReadInt64(); diff --git a/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystemProxy.cs b/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystemProxy.cs index 937ea6d6bf..e6738b8f04 100644 --- a/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystemProxy.cs +++ b/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystemProxy.cs @@ -80,7 +80,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv UserId UserId = new UserId( Context.RequestData.ReadInt64(), - Context.RequestData.ReadInt64()); + Context.RequestData.ReadInt64(), false); long SaveId = Context.RequestData.ReadInt64(); diff --git a/Ryujinx.HLE/HOS/SystemState/SystemStateMgr.cs b/Ryujinx.HLE/HOS/SystemState/SystemStateMgr.cs index 2a3c8288b2..71c211968b 100644 --- a/Ryujinx.HLE/HOS/SystemState/SystemStateMgr.cs +++ b/Ryujinx.HLE/HOS/SystemState/SystemStateMgr.cs @@ -57,9 +57,10 @@ namespace Ryujinx.HLE.HOS.SystemState Profiles = new ConcurrentDictionary(); - UserId DefaultUuid = new UserId("00000000000000000000000000000001"); + UserId DefaultUuid = new UserId("00000000000000000000000000000001", true); AddUser(DefaultUuid, "Player"); + OpenUser(DefaultUuid); } diff --git a/Ryujinx.HLE/HOS/SystemState/UserId.cs b/Ryujinx.HLE/HOS/SystemState/UserId.cs index 1e7c53dd00..b1b1bfed01 100644 --- a/Ryujinx.HLE/HOS/SystemState/UserId.cs +++ b/Ryujinx.HLE/HOS/SystemState/UserId.cs @@ -11,9 +11,9 @@ namespace Ryujinx.HLE.HOS.SystemState public byte[] Bytes { get; private set; } - public UserId(long Low, long High) + public UserId(long Low, long High, bool Verify) { - if ((Low | High) == 0) + if ((Low | High) == 0 && Verify) { throw new ArgumentException("Zero is not a valid user id!"); } @@ -43,14 +43,14 @@ namespace Ryujinx.HLE.HOS.SystemState this.Bytes = Bytes; } - public UserId(string UserIdHex) + public UserId(string UserIdHex, bool Verify) { if (UserIdHex == null || UserIdHex.Length != 32 || !UserIdHex.All("0123456789abcdefABCDEF".Contains)) { throw new ArgumentException("Invalid user id!", nameof(UserIdHex)); } - if (UserIdHex == "00000000000000000000000000000000") + if (UserIdHex == "00000000000000000000000000000000" && Verify) { throw new ArgumentException("Zero is not a valid user id!", nameof(UserIdHex)); }