address nits
This commit is contained in:
parent
92a87e1ba1
commit
5a39e6a847
5 changed files with 25 additions and 37 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Ryujinx.HLE.FileSystem
|
||||
{
|
||||
struct Save
|
||||
struct SaveInfo
|
||||
{
|
||||
public long TitleId { get; set; }
|
||||
public long SaveID { get; set; }
|
||||
|
|
|
@ -1,28 +1,27 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Ryujinx.HLE.HOS;
|
||||
using System.IO;
|
||||
using Ryujinx.HLE.HOS;
|
||||
|
||||
using static Ryujinx.HLE.FileSystem.VirtualFileSystem;
|
||||
|
||||
namespace Ryujinx.HLE.FileSystem
|
||||
{
|
||||
static class SaveHelper
|
||||
{
|
||||
public static string GetSavePath(Save SaveMetaData, ServiceCtx Context)
|
||||
public static string GetSavePath(SaveInfo SaveMetaData, ServiceCtx Context)
|
||||
{
|
||||
string BaseSavePath = "nand";
|
||||
string BaseSavePath = NandPath;
|
||||
long CurrentTitleId = SaveMetaData.TitleId;
|
||||
|
||||
switch (SaveMetaData.SaveSpaceId)
|
||||
{
|
||||
case SaveSpaceId.NandUser:
|
||||
BaseSavePath = Path.Combine(BaseSavePath, "user");
|
||||
BaseSavePath = UserNandPath;
|
||||
break;
|
||||
case SaveSpaceId.NandSystem:
|
||||
BaseSavePath = Path.Combine(BaseSavePath, "system");
|
||||
BaseSavePath = SystemNandPath;
|
||||
break;
|
||||
case SaveSpaceId.SdCard:
|
||||
BaseSavePath = Path.Combine("sdmc", "Nintendo");
|
||||
BaseSavePath = Path.Combine(SdCardPath, "Nintendo");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -30,7 +29,10 @@ namespace Ryujinx.HLE.FileSystem
|
|||
|
||||
if (SaveMetaData.TitleId == 0 && SaveMetaData.SaveDataType == SaveDataType.SaveData)
|
||||
{
|
||||
CurrentTitleId = Context.Process.MetaData.ACI0.TitleId;
|
||||
if (Context.Process.MetaData != null)
|
||||
{
|
||||
CurrentTitleId = (long)Context.Process.MetaData?.ACI0.TitleId;
|
||||
}
|
||||
}
|
||||
|
||||
string SavePath = Path.Combine(BaseSavePath,
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
using Ryujinx.HLE.HOS;
|
||||
using System;
|
||||
using System.IO;
|
||||
using Ryujinx.HLE.HOS;
|
||||
|
||||
namespace Ryujinx.HLE.FileSystem
|
||||
{
|
||||
class VirtualFileSystem : IDisposable
|
||||
{
|
||||
private const string BasePath = "RyuFs";
|
||||
private const string NandPath = "nand";
|
||||
private const string SdCardPath = "sdmc";
|
||||
private const string SystemPath = "system";
|
||||
public const string BasePath = "RyuFs";
|
||||
public const string NandPath = "nand";
|
||||
public const string SdCardPath = "sdmc";
|
||||
public const string SystemPath = "system";
|
||||
public const string SystemNandPath = "nand/system";
|
||||
public const string UserNandPath = "nand/user";
|
||||
|
||||
public Stream RomFs { get; private set; }
|
||||
|
||||
|
@ -53,8 +55,8 @@ namespace Ryujinx.HLE.FileSystem
|
|||
|
||||
public string GetNandPath() => MakeDirAndGetFullPath(NandPath);
|
||||
|
||||
public string GetGameSavePath(Save SaveMetaData, ServiceCtx Context)
|
||||
=> MakeDirAndGetFullPath(SaveHelper.GetSavePath(SaveMetaData, Context));
|
||||
public string GetGameSavePath(SaveInfo Save, ServiceCtx Context)
|
||||
=> MakeDirAndGetFullPath(SaveHelper.GetSavePath(Save, Context));
|
||||
|
||||
public string GetSystemPath() => MakeDirAndGetFullPath(SystemPath);
|
||||
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
using Ryujinx.HLE.HOS.Ipc;
|
||||
using Ryujinx.HLE.Logging;
|
||||
using System.Collections.Generic;
|
||||
using Ryujinx.HLE.FileSystem;
|
||||
|
||||
using Ryujinx.HLE.HOS.Ipc;
|
||||
using Ryujinx.HLE.HOS.SystemState;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Services.FspSrv
|
||||
{
|
||||
|
@ -78,7 +76,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
|
|||
{
|
||||
SaveSpaceId SaveSpaceId = (SaveSpaceId)Context.RequestData.ReadInt64();
|
||||
|
||||
Save SaveInfo = new Save()
|
||||
SaveInfo SaveInfo = new SaveInfo()
|
||||
{
|
||||
TitleId = Context.RequestData.ReadInt64(),
|
||||
UserID = new UserId(Context.RequestData.ReadInt64(),
|
||||
|
|
|
@ -43,20 +43,6 @@ namespace Ryujinx.HLE.HOS.SystemState
|
|||
this.Bytes = Bytes;
|
||||
}
|
||||
|
||||
public UserId(byte[] UserIdBytes)
|
||||
{
|
||||
Bytes = UserIdBytes;
|
||||
|
||||
UserIdHex = string.Empty;
|
||||
|
||||
foreach (byte Byte in Bytes)
|
||||
{
|
||||
UserIdHex += Byte.ToString("X2");
|
||||
}
|
||||
|
||||
this.Bytes = Bytes;
|
||||
}
|
||||
|
||||
public UserId(string UserIdHex)
|
||||
{
|
||||
if (UserIdHex == null || UserIdHex.Length != 32 || !UserIdHex.All("0123456789abcdefABCDEF".Contains))
|
||||
|
|
Loading…
Add table
Reference in a new issue