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