save common implementation
This commit is contained in:
parent
0b52ee6627
commit
263bb21dbb
6 changed files with 16 additions and 11 deletions
|
@ -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;
|
||||
|
|
|
@ -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))
|
||||
{
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -57,9 +57,10 @@ namespace Ryujinx.HLE.HOS.SystemState
|
|||
|
||||
Profiles = new ConcurrentDictionary<string, UserProfile>();
|
||||
|
||||
UserId DefaultUuid = new UserId("00000000000000000000000000000001");
|
||||
UserId DefaultUuid = new UserId("00000000000000000000000000000001", true);
|
||||
|
||||
AddUser(DefaultUuid, "Player");
|
||||
|
||||
OpenUser(DefaultUuid);
|
||||
}
|
||||
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue