From fc77b089a6ab600ac6f954cb193d26239008975f Mon Sep 17 00:00:00 2001 From: emmauss Date: Sun, 9 Sep 2018 01:04:26 +0300 Subject: 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 --- Ryujinx.HLE/HOS/Horizon.cs | 2 +- .../HOS/Services/FspSrv/IFileSystemProxy.cs | 44 ++++++++++++++++------ 2 files changed, 33 insertions(+), 13 deletions(-) (limited to 'Ryujinx.HLE/HOS') diff --git a/Ryujinx.HLE/HOS/Horizon.cs b/Ryujinx.HLE/HOS/Horizon.cs index 92a87661..2e216cdf 100644 --- a/Ryujinx.HLE/HOS/Horizon.cs +++ b/Ryujinx.HLE/HOS/Horizon.cs @@ -109,7 +109,7 @@ namespace Ryujinx.HLE.HOS } } - if (!MainProcess.MetaData.Is64Bits) + if (!(MainProcess.MetaData?.Is64Bits ?? true)) { throw new NotImplementedException("32-bit titles are unsupported!"); } diff --git a/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystemProxy.cs b/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystemProxy.cs index 14edcc75..937ea6d6 100644 --- a/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystemProxy.cs +++ b/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystemProxy.cs @@ -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() { - { 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))); + } } } \ No newline at end of file -- cgit v1.2.3