IFileSystemProxy.cs 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. using Ryujinx.HLE.FileSystem;
  2. using Ryujinx.HLE.HOS.Ipc;
  3. using Ryujinx.HLE.Utilities;
  4. using System.Collections.Generic;
  5. namespace Ryujinx.HLE.HOS.Services.FspSrv
  6. {
  7. class IFileSystemProxy : IpcService
  8. {
  9. private Dictionary<int, ServiceProcessRequest> m_Commands;
  10. public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
  11. public IFileSystemProxy()
  12. {
  13. m_Commands = new Dictionary<int, ServiceProcessRequest>()
  14. {
  15. { 1, SetCurrentProcess },
  16. { 18, OpenSdCardFileSystem },
  17. { 51, OpenSaveDataFileSystem },
  18. { 52, OpenSaveDataFileSystemBySystemSaveDataId },
  19. { 200, OpenDataStorageByCurrentProcess },
  20. { 203, OpenPatchDataStorageByCurrentProcess },
  21. { 1005, GetGlobalAccessLogMode }
  22. };
  23. }
  24. public long SetCurrentProcess(ServiceCtx Context)
  25. {
  26. return 0;
  27. }
  28. public long OpenSdCardFileSystem(ServiceCtx Context)
  29. {
  30. MakeObject(Context, new IFileSystem(Context.Device.FileSystem.GetSdCardPath()));
  31. return 0;
  32. }
  33. public long OpenSaveDataFileSystem(ServiceCtx Context)
  34. {
  35. LoadSaveDataFileSystem(Context);
  36. return 0;
  37. }
  38. public long OpenSaveDataFileSystemBySystemSaveDataId(ServiceCtx Context)
  39. {
  40. LoadSaveDataFileSystem(Context);
  41. return 0;
  42. }
  43. public long OpenDataStorageByCurrentProcess(ServiceCtx Context)
  44. {
  45. MakeObject(Context, new IStorage(Context.Device.FileSystem.RomFs));
  46. return 0;
  47. }
  48. public long OpenPatchDataStorageByCurrentProcess(ServiceCtx Context)
  49. {
  50. MakeObject(Context, new IStorage(Context.Device.FileSystem.RomFs));
  51. return 0;
  52. }
  53. public long GetGlobalAccessLogMode(ServiceCtx Context)
  54. {
  55. Context.ResponseData.Write(0);
  56. return 0;
  57. }
  58. public void LoadSaveDataFileSystem(ServiceCtx Context)
  59. {
  60. SaveSpaceId SaveSpaceId = (SaveSpaceId)Context.RequestData.ReadInt64();
  61. long TitleId = Context.RequestData.ReadInt64();
  62. UInt128 UserId = new UInt128(
  63. Context.RequestData.ReadInt64(),
  64. Context.RequestData.ReadInt64());
  65. long SaveId = Context.RequestData.ReadInt64();
  66. SaveDataType SaveDataType = (SaveDataType)Context.RequestData.ReadByte();
  67. SaveInfo SaveInfo = new SaveInfo(TitleId, SaveId, SaveDataType, UserId, SaveSpaceId);
  68. MakeObject(Context, new IFileSystem(Context.Device.FileSystem.GetGameSavePath(SaveInfo, Context)));
  69. }
  70. }
  71. }