1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-11-14 09:36:42 +00:00
Ryujinx/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystemProxy.cs
emmauss caa181edf2 Save Common implementation (#434)
* save common implementation

* remove zero userid check

* Renamed UserId to UInt128

* fix index in hex conversion
2018-10-07 15:13:46 +02:00

94 lines
No EOL
2.8 KiB
C#

using Ryujinx.HLE.FileSystem;
using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.Utilities;
using System.Collections.Generic;
namespace Ryujinx.HLE.HOS.Services.FspSrv
{
class IFileSystemProxy : IpcService
{
private Dictionary<int, ServiceProcessRequest> m_Commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
public IFileSystemProxy()
{
m_Commands = new Dictionary<int, ServiceProcessRequest>()
{
{ 1, SetCurrentProcess },
{ 18, OpenSdCardFileSystem },
{ 51, OpenSaveDataFileSystem },
{ 52, OpenSaveDataFileSystemBySystemSaveDataId },
{ 200, OpenDataStorageByCurrentProcess },
{ 203, OpenPatchDataStorageByCurrentProcess },
{ 1005, GetGlobalAccessLogMode }
};
}
public long SetCurrentProcess(ServiceCtx Context)
{
return 0;
}
public long OpenSdCardFileSystem(ServiceCtx Context)
{
MakeObject(Context, new IFileSystem(Context.Device.FileSystem.GetSdCardPath()));
return 0;
}
public long OpenSaveDataFileSystem(ServiceCtx Context)
{
LoadSaveDataFileSystem(Context);
return 0;
}
public long OpenSaveDataFileSystemBySystemSaveDataId(ServiceCtx Context)
{
LoadSaveDataFileSystem(Context);
return 0;
}
public long OpenDataStorageByCurrentProcess(ServiceCtx Context)
{
MakeObject(Context, new IStorage(Context.Device.FileSystem.RomFs));
return 0;
}
public long OpenPatchDataStorageByCurrentProcess(ServiceCtx Context)
{
MakeObject(Context, new IStorage(Context.Device.FileSystem.RomFs));
return 0;
}
public long GetGlobalAccessLogMode(ServiceCtx Context)
{
Context.ResponseData.Write(0);
return 0;
}
public void LoadSaveDataFileSystem(ServiceCtx Context)
{
SaveSpaceId SaveSpaceId = (SaveSpaceId)Context.RequestData.ReadInt64();
long TitleId = Context.RequestData.ReadInt64();
UInt128 UserId = new UInt128(
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)));
}
}
}