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
|
|
|
|
|
{
|
|
|
|
|
public static string GetSavePath(SaveInfo SaveMetaData, ServiceCtx Context)
|
|
|
|
|
{
|
|
|
|
|
string BaseSavePath = NandPath;
|
|
|
|
|
long CurrentTitleId = SaveMetaData.TitleId;
|
|
|
|
|
|
|
|
|
|
switch (SaveMetaData.SaveSpaceId)
|
|
|
|
|
{
|
|
|
|
|
case SaveSpaceId.NandUser:
|
|
|
|
|
BaseSavePath = UserNandPath;
|
|
|
|
|
break;
|
|
|
|
|
case SaveSpaceId.NandSystem:
|
|
|
|
|
BaseSavePath = SystemNandPath;
|
|
|
|
|
break;
|
|
|
|
|
case SaveSpaceId.SdCard:
|
|
|
|
|
BaseSavePath = Path.Combine(SdCardPath, "Nintendo");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BaseSavePath = Path.Combine(BaseSavePath, "save");
|
|
|
|
|
|
|
|
|
|
if (SaveMetaData.TitleId == 0 && SaveMetaData.SaveDataType == SaveDataType.SaveData)
|
|
|
|
|
{
|
2018-11-28 23:18:09 +01:00
|
|
|
|
CurrentTitleId = Context.Process.TitleId;
|
2018-09-09 00:04:26 +02:00
|
|
|
|
}
|
|
|
|
|
|
2018-10-07 15:13:46 +02:00
|
|
|
|
string SaveAccount = SaveMetaData.UserId.IsZero() ? "savecommon" : SaveMetaData.UserId.ToString();
|
|
|
|
|
|
2018-09-09 00:04:26 +02:00
|
|
|
|
string SavePath = Path.Combine(BaseSavePath,
|
|
|
|
|
SaveMetaData.SaveId.ToString("x16"),
|
2018-10-07 15:13:46 +02:00
|
|
|
|
SaveAccount,
|
2018-09-09 00:04:26 +02:00
|
|
|
|
SaveMetaData.SaveDataType == SaveDataType.SaveData ? CurrentTitleId.ToString("x16") : string.Empty);
|
|
|
|
|
|
|
|
|
|
return SavePath;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|