1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-11-30 21:02:02 +00:00
Ryujinx/Ryujinx.HLE/FileSystem/SaveHelper.cs

46 lines
1.5 KiB
C#
Raw Normal View History

using Ryujinx.HLE.HOS;
using System.IO;
using static Ryujinx.HLE.FileSystem.VirtualFileSystem;
namespace Ryujinx.HLE.FileSystem
{
static class SaveHelper
{
2018-12-01 20:01:59 +00:00
public static string GetSavePath(SaveInfo saveMetaData, ServiceCtx context)
{
2018-12-01 20:01:59 +00:00
string baseSavePath = NandPath;
long currentTitleId = saveMetaData.TitleId;
2018-12-01 20:01:59 +00:00
switch (saveMetaData.SaveSpaceId)
{
case SaveSpaceId.NandUser:
2018-12-01 20:01:59 +00:00
baseSavePath = UserNandPath;
break;
case SaveSpaceId.NandSystem:
2018-12-01 20:01:59 +00:00
baseSavePath = SystemNandPath;
break;
case SaveSpaceId.SdCard:
2018-12-01 20:01:59 +00:00
baseSavePath = Path.Combine(SdCardPath, "Nintendo");
break;
}
2018-12-01 20:01:59 +00:00
baseSavePath = Path.Combine(baseSavePath, "save");
2018-12-01 20:01:59 +00:00
if (saveMetaData.TitleId == 0 && saveMetaData.SaveDataType == SaveDataType.SaveData)
{
2018-12-01 20:01:59 +00:00
currentTitleId = context.Process.TitleId;
}
2018-12-01 20:01:59 +00:00
string saveAccount = saveMetaData.UserId.IsZero() ? "savecommon" : saveMetaData.UserId.ToString();
2018-12-01 20:01:59 +00:00
string savePath = Path.Combine(baseSavePath,
saveMetaData.SaveId.ToString("x16"),
saveAccount,
saveMetaData.SaveDataType == SaveDataType.SaveData ? currentTitleId.ToString("x16") : string.Empty);
2018-12-01 20:01:59 +00:00
return savePath;
}
}
}