fix savedatatype offset, remove incomplete createsavedata implimentation
This commit is contained in:
parent
c35d9ba043
commit
92a87e1ba1
5 changed files with 21 additions and 64 deletions
|
@ -1,6 +1,6 @@
|
||||||
namespace Ryujinx.HLE.FileSystem
|
namespace Ryujinx.HLE.FileSystem
|
||||||
{
|
{
|
||||||
enum SaveDataType
|
enum SaveDataType : byte
|
||||||
{
|
{
|
||||||
SystemSaveData,
|
SystemSaveData,
|
||||||
SaveData,
|
SaveData,
|
||||||
|
|
|
@ -10,33 +10,33 @@ namespace Ryujinx.HLE.FileSystem
|
||||||
{
|
{
|
||||||
public static string GetSavePath(Save SaveMetaData, ServiceCtx Context)
|
public static string GetSavePath(Save SaveMetaData, ServiceCtx Context)
|
||||||
{
|
{
|
||||||
string BasePartitionPath = "nand";
|
string BaseSavePath = "nand";
|
||||||
long CurrentTitleId = SaveMetaData.TitleId;
|
long CurrentTitleId = SaveMetaData.TitleId;
|
||||||
|
|
||||||
switch (SaveMetaData.SaveSpaceId)
|
switch (SaveMetaData.SaveSpaceId)
|
||||||
{
|
{
|
||||||
case SaveSpaceId.NandUser:
|
case SaveSpaceId.NandUser:
|
||||||
BasePartitionPath = Path.Combine(BasePartitionPath, "user");
|
BaseSavePath = Path.Combine(BaseSavePath, "user");
|
||||||
break;
|
break;
|
||||||
case SaveSpaceId.NandSystem:
|
case SaveSpaceId.NandSystem:
|
||||||
BasePartitionPath = Path.Combine(BasePartitionPath, "system");
|
BaseSavePath = Path.Combine(BaseSavePath, "system");
|
||||||
break;
|
break;
|
||||||
case SaveSpaceId.SdCard:
|
case SaveSpaceId.SdCard:
|
||||||
BasePartitionPath = Path.Combine("sdmc", "Nintendo");
|
BaseSavePath = Path.Combine("sdmc", "Nintendo");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
BasePartitionPath = Path.Combine(BasePartitionPath, "save");
|
BaseSavePath = Path.Combine(BaseSavePath, "save");
|
||||||
|
|
||||||
if (SaveMetaData.TitleId == 0 && SaveMetaData.SaveDataType == SaveDataType.SaveData)
|
if (SaveMetaData.TitleId == 0 && SaveMetaData.SaveDataType == SaveDataType.SaveData)
|
||||||
{
|
{
|
||||||
CurrentTitleId = Context.Process.MetaData.ACI0.TitleId;
|
CurrentTitleId = Context.Process.MetaData.ACI0.TitleId;
|
||||||
}
|
}
|
||||||
|
|
||||||
string SavePath = Path.Combine(BasePartitionPath,
|
string SavePath = Path.Combine(BaseSavePath,
|
||||||
SaveMetaData.SaveID.ToString("X16"),
|
SaveMetaData.SaveID.ToString("x16"),
|
||||||
SaveMetaData.UserID.ToString(),
|
SaveMetaData.UserID.ToString(),
|
||||||
SaveMetaData.SaveDataType == SaveDataType.SaveData ? CurrentTitleId.ToString("X16") : string.Empty);
|
SaveMetaData.SaveDataType == SaveDataType.SaveData ? CurrentTitleId.ToString("x16") : string.Empty);
|
||||||
|
|
||||||
return SavePath;
|
return SavePath;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
namespace Ryujinx.HLE.FileSystem
|
namespace Ryujinx.HLE.FileSystem
|
||||||
{
|
{
|
||||||
enum SaveSpaceId
|
enum SaveSpaceId : byte
|
||||||
{
|
{
|
||||||
NandSystem,
|
NandSystem,
|
||||||
NandUser,
|
NandUser,
|
||||||
|
|
|
@ -53,7 +53,7 @@ namespace Ryujinx.HLE.FileSystem
|
||||||
|
|
||||||
public string GetNandPath() => MakeDirAndGetFullPath(NandPath);
|
public string GetNandPath() => MakeDirAndGetFullPath(NandPath);
|
||||||
|
|
||||||
public string GetGameSavesPath(Save SaveMetaData, ServiceCtx Context)
|
public string GetGameSavePath(Save SaveMetaData, ServiceCtx Context)
|
||||||
=> MakeDirAndGetFullPath(SaveHelper.GetSavePath(SaveMetaData, Context));
|
=> MakeDirAndGetFullPath(SaveHelper.GetSavePath(SaveMetaData, Context));
|
||||||
|
|
||||||
public string GetSystemPath() => MakeDirAndGetFullPath(SystemPath);
|
public string GetSystemPath() => MakeDirAndGetFullPath(SystemPath);
|
||||||
|
|
|
@ -3,6 +3,8 @@ using Ryujinx.HLE.Logging;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Ryujinx.HLE.FileSystem;
|
using Ryujinx.HLE.FileSystem;
|
||||||
|
|
||||||
|
using Ryujinx.HLE.HOS.SystemState;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.FspSrv
|
namespace Ryujinx.HLE.HOS.Services.FspSrv
|
||||||
{
|
{
|
||||||
class IFileSystemProxy : IpcService
|
class IFileSystemProxy : IpcService
|
||||||
|
@ -17,7 +19,6 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
|
||||||
{
|
{
|
||||||
{ 1, SetCurrentProcess },
|
{ 1, SetCurrentProcess },
|
||||||
{ 18, OpenSdCardFileSystem },
|
{ 18, OpenSdCardFileSystem },
|
||||||
{ 22, CreateSaveDataFileSystem },
|
|
||||||
{ 51, OpenSaveDataFileSystem },
|
{ 51, OpenSaveDataFileSystem },
|
||||||
{ 52, OpenSaveDataFileSystemBySystemSaveDataId },
|
{ 52, OpenSaveDataFileSystemBySystemSaveDataId },
|
||||||
{ 200, OpenDataStorageByCurrentProcess },
|
{ 200, OpenDataStorageByCurrentProcess },
|
||||||
|
@ -38,41 +39,6 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long CreateSaveDataFileSystem(ServiceCtx Context)
|
|
||||||
{
|
|
||||||
long TitleId = Context.RequestData.ReadInt64();
|
|
||||||
long UserIdHigh = Context.RequestData.ReadInt64();
|
|
||||||
long UserIdLow = Context.RequestData.ReadInt64();
|
|
||||||
long SaveId = Context.RequestData.ReadInt64();
|
|
||||||
|
|
||||||
SaveDataType Type = (SaveDataType)Context.RequestData.ReadByte();
|
|
||||||
|
|
||||||
Save SaveInfo = new Save()
|
|
||||||
{
|
|
||||||
TitleId = TitleId,
|
|
||||||
UserID = new SystemState.UserId(UserIdLow, UserIdHigh),
|
|
||||||
SaveID = SaveId,
|
|
||||||
SaveDataType = Type
|
|
||||||
};
|
|
||||||
|
|
||||||
switch (SaveInfo.SaveDataType)
|
|
||||||
{
|
|
||||||
case SaveDataType.SaveData:
|
|
||||||
SaveInfo.SaveSpaceId = SaveSpaceId.NandUser;
|
|
||||||
break;
|
|
||||||
case SaveDataType.SystemSaveData:
|
|
||||||
SaveInfo.SaveSpaceId = SaveSpaceId.NandSystem;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
byte[] SaveCreateStruct = Context.RequestData.ReadBytes(0x40);
|
|
||||||
byte[] Input = Context.RequestData.ReadBytes(0x10);
|
|
||||||
|
|
||||||
Context.Device.FileSystem.GetGameSavesPath(SaveInfo, Context);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long OpenSaveDataFileSystem(ServiceCtx Context)
|
public long OpenSaveDataFileSystem(ServiceCtx Context)
|
||||||
{
|
{
|
||||||
LoadSaveDataFileSystem(Context);
|
LoadSaveDataFileSystem(Context);
|
||||||
|
@ -110,29 +76,20 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
|
||||||
|
|
||||||
public void LoadSaveDataFileSystem(ServiceCtx Context)
|
public void LoadSaveDataFileSystem(ServiceCtx Context)
|
||||||
{
|
{
|
||||||
byte id = Context.RequestData.ReadByte();
|
SaveSpaceId SaveSpaceId = (SaveSpaceId)Context.RequestData.ReadInt64();
|
||||||
SaveSpaceId SaveSpaceId = (SaveSpaceId)id;
|
|
||||||
|
|
||||||
int Unknown = Context.RequestData.ReadInt32();
|
|
||||||
|
|
||||||
long TitleId = Context.RequestData.ReadInt64();
|
|
||||||
byte[] UserId = Context.RequestData.ReadBytes(0x10);
|
|
||||||
long SaveId = Context.RequestData.ReadInt64();
|
|
||||||
|
|
||||||
byte type = Context.RequestData.ReadByte();
|
|
||||||
SaveDataType Type = (SaveDataType)type;
|
|
||||||
|
|
||||||
Save SaveInfo = new Save()
|
Save SaveInfo = new Save()
|
||||||
{
|
{
|
||||||
TitleId = TitleId,
|
TitleId = Context.RequestData.ReadInt64(),
|
||||||
UserID = new SystemState.UserId(UserId),
|
UserID = new UserId(Context.RequestData.ReadInt64(),
|
||||||
SaveID = SaveId,
|
Context.RequestData.ReadInt64()),
|
||||||
SaveDataType = Type
|
SaveID = Context.RequestData.ReadInt64(),
|
||||||
|
SaveDataType = (SaveDataType)Context.RequestData.ReadByte()
|
||||||
};
|
};
|
||||||
|
|
||||||
SaveInfo.SaveSpaceId = SaveSpaceId;
|
SaveInfo.SaveSpaceId = SaveSpaceId;
|
||||||
|
|
||||||
MakeObject(Context, new IFileSystem(Context.Device.FileSystem.GetGameSavesPath(SaveInfo, Context)));
|
MakeObject(Context, new IFileSystem(Context.Device.FileSystem.GetGameSavePath(SaveInfo, Context)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue