1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-11-24 19:32:05 +00:00
Ryujinx/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystemProxy.cs

94 lines
2.8 KiB
C#
Raw Normal View History

using Ryujinx.HLE.FileSystem;
using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.SystemState;
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();
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)));
}
}
}