2018-09-08 22:04:26 +00:00
|
|
|
|
using Ryujinx.HLE.HOS;
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
|
|
using static Ryujinx.HLE.FileSystem.VirtualFileSystem;
|
|
|
|
|
|
|
|
|
|
namespace Ryujinx.HLE.FileSystem
|
|
|
|
|
{
|
|
|
|
|
static class SaveHelper
|
|
|
|
|
{
|
2018-12-05 00:52:39 +00:00
|
|
|
|
public static string GetSavePath(SaveInfo SaveMetaData, ServiceCtx Context)
|
2018-09-08 22:04:26 +00:00
|
|
|
|
{
|
2018-12-05 00:52:39 +00:00
|
|
|
|
string BaseSavePath = NandPath;
|
|
|
|
|
long CurrentTitleId = SaveMetaData.TitleId;
|
2018-09-08 22:04:26 +00:00
|
|
|
|
|
2018-12-05 00:52:39 +00:00
|
|
|
|
switch (SaveMetaData.SaveSpaceId)
|
2018-09-08 22:04:26 +00:00
|
|
|
|
{
|
|
|
|
|
case SaveSpaceId.NandUser:
|
2018-12-05 00:52:39 +00:00
|
|
|
|
BaseSavePath = UserNandPath;
|
2018-09-08 22:04:26 +00:00
|
|
|
|
break;
|
|
|
|
|
case SaveSpaceId.NandSystem:
|
2018-12-05 00:52:39 +00:00
|
|
|
|
BaseSavePath = SystemNandPath;
|
2018-09-08 22:04:26 +00:00
|
|
|
|
break;
|
|
|
|
|
case SaveSpaceId.SdCard:
|
2018-12-05 00:52:39 +00:00
|
|
|
|
BaseSavePath = Path.Combine(SdCardPath, "Nintendo");
|
2018-09-08 22:04:26 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2018-12-05 00:52:39 +00:00
|
|
|
|
BaseSavePath = Path.Combine(BaseSavePath, "save");
|
2018-09-08 22:04:26 +00:00
|
|
|
|
|
2018-12-05 00:52:39 +00:00
|
|
|
|
if (SaveMetaData.TitleId == 0 && SaveMetaData.SaveDataType == SaveDataType.SaveData)
|
2018-09-08 22:04:26 +00:00
|
|
|
|
{
|
2018-12-05 00:52:39 +00:00
|
|
|
|
CurrentTitleId = Context.Process.TitleId;
|
2018-09-08 22:04:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-12-05 00:52:39 +00:00
|
|
|
|
string SaveAccount = SaveMetaData.UserId.IsZero() ? "savecommon" : SaveMetaData.UserId.ToString();
|
2018-10-07 13:13:46 +00:00
|
|
|
|
|
2018-12-05 00:52:39 +00:00
|
|
|
|
string SavePath = Path.Combine(BaseSavePath,
|
|
|
|
|
SaveMetaData.SaveId.ToString("x16"),
|
|
|
|
|
SaveAccount,
|
|
|
|
|
SaveMetaData.SaveDataType == SaveDataType.SaveData ? CurrentTitleId.ToString("x16") : string.Empty);
|
2018-09-08 22:04:26 +00:00
|
|
|
|
|
2018-12-05 00:52:39 +00:00
|
|
|
|
return SavePath;
|
2018-09-08 22:04:26 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|