Implements proper save path (#386)

* initial save path implementation

* fix savedatatype offset, remove incomplete createsavedata implimentation

* address nits

* fix crash if npdm is not found

* made saveinfo readonly, other stuff

* remove context param from saveinfo contructor

* fix style

* remove whitespace
This commit is contained in:
emmauss 2018-09-09 01:04:26 +03:00 committed by gdkchan
parent 3227218114
commit fc77b089a6
8 changed files with 145 additions and 19 deletions

View file

@ -1,5 +1,6 @@
using Ryujinx.HLE.FileSystem;
using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.Logging;
using Ryujinx.HLE.HOS.SystemState;
using System.Collections.Generic;
namespace Ryujinx.HLE.HOS.Services.FspSrv
@ -14,13 +15,13 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
{
m_Commands = new Dictionary<int, ServiceProcessRequest>()
{
{ 1, SetCurrentProcess },
{ 18, OpenSdCardFileSystem },
{ 22, CreateSaveDataFileSystem },
{ 51, OpenSaveDataFileSystem },
{ 200, OpenDataStorageByCurrentProcess },
{ 203, OpenPatchDataStorageByCurrentProcess },
{ 1005, GetGlobalAccessLogMode }
{ 1, SetCurrentProcess },
{ 18, OpenSdCardFileSystem },
{ 51, OpenSaveDataFileSystem },
{ 52, OpenSaveDataFileSystemBySystemSaveDataId },
{ 200, OpenDataStorageByCurrentProcess },
{ 203, OpenPatchDataStorageByCurrentProcess },
{ 1005, GetGlobalAccessLogMode }
};
}
@ -36,16 +37,16 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
return 0;
}
public long CreateSaveDataFileSystem(ServiceCtx Context)
public long OpenSaveDataFileSystem(ServiceCtx Context)
{
Context.Device.Log.PrintStub(LogClass.ServiceFs, "Stubbed.");
LoadSaveDataFileSystem(Context);
return 0;
}
public long OpenSaveDataFileSystem(ServiceCtx Context)
public long OpenSaveDataFileSystemBySystemSaveDataId(ServiceCtx Context)
{
MakeObject(Context, new IFileSystem(Context.Device.FileSystem.GetGameSavesPath()));
LoadSaveDataFileSystem(Context);
return 0;
}
@ -70,5 +71,24 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
return 0;
}
public void LoadSaveDataFileSystem(ServiceCtx Context)
{
SaveSpaceId SaveSpaceId = (SaveSpaceId)Context.RequestData.ReadInt64();
long TitleId = Context.RequestData.ReadInt64();
UserId UserId = new UserId(
Context.RequestData.ReadInt64(),
Context.RequestData.ReadInt64());
long SaveId = Context.RequestData.ReadInt64();
SaveDataType SaveDataType = (SaveDataType)Context.RequestData.ReadByte();
SaveInfo SaveInfo = new SaveInfo(TitleId, SaveId, SaveDataType, UserId, SaveSpaceId);
MakeObject(Context, new IFileSystem(Context.Device.FileSystem.GetGameSavePath(SaveInfo, Context)));
}
}
}