IFileSystemProxy.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572
  1. using LibHac;
  2. using LibHac.Fs;
  3. using LibHac.FsSrv;
  4. using LibHac.FsSystem;
  5. using LibHac.FsSystem.NcaUtils;
  6. using LibHac.Ncm;
  7. using Ryujinx.Common;
  8. using Ryujinx.Common.Logging;
  9. using Ryujinx.Cpu;
  10. using Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy;
  11. using System.IO;
  12. using static Ryujinx.HLE.Utilities.StringUtils;
  13. using StorageId = Ryujinx.HLE.FileSystem.StorageId;
  14. namespace Ryujinx.HLE.HOS.Services.Fs
  15. {
  16. [Service("fsp-srv")]
  17. class IFileSystemProxy : IpcService
  18. {
  19. private LibHac.FsSrv.IFileSystemProxy _baseFileSystemProxy;
  20. public IFileSystemProxy(ServiceCtx context)
  21. {
  22. _baseFileSystemProxy = context.Device.FileSystem.FsServer.CreateFileSystemProxyService();
  23. }
  24. [Command(1)]
  25. // Initialize(u64, pid)
  26. public ResultCode Initialize(ServiceCtx context)
  27. {
  28. return ResultCode.Success;
  29. }
  30. [Command(8)]
  31. // OpenFileSystemWithId(nn::fssrv::sf::FileSystemType filesystem_type, nn::ApplicationId tid, buffer<bytes<0x301>, 0x19, 0x301> path)
  32. // -> object<nn::fssrv::sf::IFileSystem> contentFs
  33. public ResultCode OpenFileSystemWithId(ServiceCtx context)
  34. {
  35. FileSystemType fileSystemType = (FileSystemType)context.RequestData.ReadInt32();
  36. long titleId = context.RequestData.ReadInt64();
  37. string switchPath = ReadUtf8String(context);
  38. string fullPath = context.Device.FileSystem.SwitchPathToSystemPath(switchPath);
  39. if (!File.Exists(fullPath))
  40. {
  41. if (fullPath.Contains("."))
  42. {
  43. ResultCode result = FileSystemProxyHelper.OpenFileSystemFromInternalFile(context, fullPath, out FileSystemProxy.IFileSystem fileSystem);
  44. if (result == ResultCode.Success)
  45. {
  46. MakeObject(context, fileSystem);
  47. }
  48. return result;
  49. }
  50. return ResultCode.PathDoesNotExist;
  51. }
  52. FileStream fileStream = new FileStream(fullPath, FileMode.Open, FileAccess.Read);
  53. string extension = Path.GetExtension(fullPath);
  54. if (extension == ".nca")
  55. {
  56. ResultCode result = FileSystemProxyHelper.OpenNcaFs(context, fullPath, fileStream.AsStorage(), out FileSystemProxy.IFileSystem fileSystem);
  57. if (result == ResultCode.Success)
  58. {
  59. MakeObject(context, fileSystem);
  60. }
  61. return result;
  62. }
  63. else if (extension == ".nsp")
  64. {
  65. ResultCode result = FileSystemProxyHelper.OpenNsp(context, fullPath, out FileSystemProxy.IFileSystem fileSystem);
  66. if (result == ResultCode.Success)
  67. {
  68. MakeObject(context, fileSystem);
  69. }
  70. return result;
  71. }
  72. return ResultCode.InvalidInput;
  73. }
  74. [Command(11)]
  75. // OpenBisFileSystem(nn::fssrv::sf::Partition partitionID, buffer<bytes<0x301>, 0x19, 0x301>) -> object<nn::fssrv::sf::IFileSystem> Bis
  76. public ResultCode OpenBisFileSystem(ServiceCtx context)
  77. {
  78. BisPartitionId bisPartitionId = (BisPartitionId)context.RequestData.ReadInt32();
  79. Result rc = FileSystemProxyHelper.ReadFsPath(out FsPath path, context);
  80. if (rc.IsFailure()) return (ResultCode)rc.Value;
  81. rc = _baseFileSystemProxy.OpenBisFileSystem(out LibHac.Fs.Fsa.IFileSystem fileSystem, ref path, bisPartitionId);
  82. if (rc.IsFailure()) return (ResultCode)rc.Value;
  83. MakeObject(context, new FileSystemProxy.IFileSystem(fileSystem));
  84. return ResultCode.Success;
  85. }
  86. [Command(18)]
  87. // OpenSdCardFileSystem() -> object<nn::fssrv::sf::IFileSystem>
  88. public ResultCode OpenSdCardFileSystem(ServiceCtx context)
  89. {
  90. Result rc = _baseFileSystemProxy.OpenSdCardFileSystem(out LibHac.Fs.Fsa.IFileSystem fileSystem);
  91. if (rc.IsFailure()) return (ResultCode)rc.Value;
  92. MakeObject(context, new FileSystemProxy.IFileSystem(fileSystem));
  93. return ResultCode.Success;
  94. }
  95. [Command(21)]
  96. public ResultCode DeleteSaveDataFileSystem(ServiceCtx context)
  97. {
  98. ulong saveDataId = context.RequestData.ReadUInt64();
  99. Result result = _baseFileSystemProxy.DeleteSaveDataFileSystem(saveDataId);
  100. return (ResultCode)result.Value;
  101. }
  102. [Command(22)]
  103. public ResultCode CreateSaveDataFileSystem(ServiceCtx context)
  104. {
  105. SaveDataAttribute attribute = context.RequestData.ReadStruct<SaveDataAttribute>();
  106. SaveDataCreationInfo creationInfo = context.RequestData.ReadStruct<SaveDataCreationInfo>();
  107. SaveMetaCreateInfo metaCreateInfo = context.RequestData.ReadStruct<SaveMetaCreateInfo>();
  108. // TODO: There's currently no program registry for FS to reference.
  109. // Workaround that by setting the application ID and owner ID if they're not already set
  110. if (attribute.ProgramId == ProgramId.InvalidId)
  111. {
  112. attribute.ProgramId = new ProgramId(context.Process.TitleId);
  113. }
  114. if (creationInfo.OwnerId == 0)
  115. {
  116. creationInfo.OwnerId = 0;
  117. }
  118. Logger.Info?.Print(LogClass.ServiceFs, $"Creating save with title ID {attribute.ProgramId.Value:x16}");
  119. Result result = _baseFileSystemProxy.CreateSaveDataFileSystem(ref attribute, ref creationInfo, ref metaCreateInfo);
  120. return (ResultCode)result.Value;
  121. }
  122. [Command(23)]
  123. public ResultCode CreateSaveDataFileSystemBySystemSaveDataId(ServiceCtx context)
  124. {
  125. SaveDataAttribute attribute = context.RequestData.ReadStruct<SaveDataAttribute>();
  126. SaveDataCreationInfo creationInfo = context.RequestData.ReadStruct<SaveDataCreationInfo>();
  127. Result result = _baseFileSystemProxy.CreateSaveDataFileSystemBySystemSaveDataId(ref attribute, ref creationInfo);
  128. return (ResultCode)result.Value;
  129. }
  130. [Command(25)]
  131. public ResultCode DeleteSaveDataFileSystemBySaveDataSpaceId(ServiceCtx context)
  132. {
  133. SaveDataSpaceId spaceId = (SaveDataSpaceId)context.RequestData.ReadInt64();
  134. ulong saveDataId = context.RequestData.ReadUInt64();
  135. Result result = _baseFileSystemProxy.DeleteSaveDataFileSystemBySaveDataSpaceId(spaceId, saveDataId);
  136. return (ResultCode)result.Value;
  137. }
  138. [Command(28)]
  139. public ResultCode DeleteSaveDataFileSystemBySaveDataAttribute(ServiceCtx context)
  140. {
  141. SaveDataSpaceId spaceId = (SaveDataSpaceId)context.RequestData.ReadInt64();
  142. SaveDataAttribute attribute = context.RequestData.ReadStruct<SaveDataAttribute>();
  143. Result result = _baseFileSystemProxy.DeleteSaveDataFileSystemBySaveDataAttribute(spaceId, ref attribute);
  144. return (ResultCode)result.Value;
  145. }
  146. [Command(30)]
  147. // OpenGameCardStorage(u32, u32) -> object<nn::fssrv::sf::IStorage>
  148. public ResultCode OpenGameCardStorage(ServiceCtx context)
  149. {
  150. GameCardHandle handle = new GameCardHandle(context.RequestData.ReadInt32());
  151. GameCardPartitionRaw partitionId = (GameCardPartitionRaw)context.RequestData.ReadInt32();
  152. Result result = _baseFileSystemProxy.OpenGameCardStorage(out LibHac.Fs.IStorage storage, handle, partitionId);
  153. if (result.IsSuccess())
  154. {
  155. MakeObject(context, new FileSystemProxy.IStorage(storage));
  156. }
  157. return (ResultCode)result.Value;
  158. }
  159. [Command(35)]
  160. public ResultCode CreateSaveDataFileSystemWithHashSalt(ServiceCtx context)
  161. {
  162. SaveDataAttribute attribute = context.RequestData.ReadStruct<SaveDataAttribute>();
  163. SaveDataCreationInfo creationInfo = context.RequestData.ReadStruct<SaveDataCreationInfo>();
  164. SaveMetaCreateInfo metaCreateInfo = context.RequestData.ReadStruct<SaveMetaCreateInfo>();
  165. HashSalt hashSalt = context.RequestData.ReadStruct<HashSalt>();
  166. // TODO: There's currently no program registry for FS to reference.
  167. // Workaround that by setting the application ID and owner ID if they're not already set
  168. if (attribute.ProgramId == ProgramId.InvalidId)
  169. {
  170. attribute.ProgramId = new ProgramId(context.Process.TitleId);
  171. }
  172. if (creationInfo.OwnerId == 0)
  173. {
  174. creationInfo.OwnerId = 0;
  175. }
  176. Result result = _baseFileSystemProxy.CreateSaveDataFileSystemWithHashSalt(ref attribute, ref creationInfo, ref metaCreateInfo, ref hashSalt);
  177. return (ResultCode)result.Value;
  178. }
  179. [Command(51)]
  180. // OpenSaveDataFileSystem(u8 save_data_space_id, nn::fssrv::sf::SaveStruct saveStruct) -> object<nn::fssrv::sf::IFileSystem> saveDataFs
  181. public ResultCode OpenSaveDataFileSystem(ServiceCtx context)
  182. {
  183. SaveDataSpaceId spaceId = (SaveDataSpaceId)context.RequestData.ReadInt64();
  184. SaveDataAttribute attribute = context.RequestData.ReadStruct<SaveDataAttribute>();
  185. // TODO: There's currently no program registry for FS to reference.
  186. // Workaround that by setting the application ID if it's not already set
  187. if (attribute.ProgramId == ProgramId.InvalidId)
  188. {
  189. attribute.ProgramId = new ProgramId(context.Process.TitleId);
  190. }
  191. Result result = _baseFileSystemProxy.OpenSaveDataFileSystem(out LibHac.Fs.Fsa.IFileSystem fileSystem, spaceId, ref attribute);
  192. if (result.IsSuccess())
  193. {
  194. MakeObject(context, new FileSystemProxy.IFileSystem(fileSystem));
  195. }
  196. return (ResultCode)result.Value;
  197. }
  198. [Command(52)]
  199. // OpenSaveDataFileSystemBySystemSaveDataId(u8 save_data_space_id, nn::fssrv::sf::SaveStruct saveStruct) -> object<nn::fssrv::sf::IFileSystem> systemSaveDataFs
  200. public ResultCode OpenSaveDataFileSystemBySystemSaveDataId(ServiceCtx context)
  201. {
  202. SaveDataSpaceId spaceId = (SaveDataSpaceId)context.RequestData.ReadInt64();
  203. SaveDataAttribute attribute = context.RequestData.ReadStruct<SaveDataAttribute>();
  204. Result result = _baseFileSystemProxy.OpenSaveDataFileSystemBySystemSaveDataId(out LibHac.Fs.Fsa.IFileSystem fileSystem, spaceId, ref attribute);
  205. if (result.IsSuccess())
  206. {
  207. MakeObject(context, new FileSystemProxy.IFileSystem(fileSystem));
  208. }
  209. return (ResultCode)result.Value;
  210. }
  211. [Command(53)]
  212. // OpenReadOnlySaveDataFileSystem(u8 save_data_space_id, nn::fssrv::sf::SaveStruct save_struct) -> object<nn::fssrv::sf::IFileSystem>
  213. public ResultCode OpenReadOnlySaveDataFileSystem(ServiceCtx context)
  214. {
  215. SaveDataSpaceId spaceId = (SaveDataSpaceId)context.RequestData.ReadInt64();
  216. SaveDataAttribute attribute = context.RequestData.ReadStruct<SaveDataAttribute>();
  217. // TODO: There's currently no program registry for FS to reference.
  218. // Workaround that by setting the application ID if it's not already set
  219. if (attribute.ProgramId == ProgramId.InvalidId)
  220. {
  221. attribute.ProgramId = new ProgramId(context.Process.TitleId);
  222. }
  223. Result result = _baseFileSystemProxy.OpenReadOnlySaveDataFileSystem(out LibHac.Fs.Fsa.IFileSystem fileSystem, spaceId, ref attribute);
  224. if (result.IsSuccess())
  225. {
  226. MakeObject(context, new FileSystemProxy.IFileSystem(fileSystem));
  227. }
  228. return (ResultCode)result.Value;
  229. }
  230. [Command(60)]
  231. public ResultCode OpenSaveDataInfoReader(ServiceCtx context)
  232. {
  233. Result result = _baseFileSystemProxy.OpenSaveDataInfoReader(out ReferenceCountedDisposable<LibHac.FsSrv.ISaveDataInfoReader> infoReader);
  234. if (result.IsSuccess())
  235. {
  236. MakeObject(context, new ISaveDataInfoReader(infoReader));
  237. }
  238. return (ResultCode)result.Value;
  239. }
  240. [Command(61)]
  241. public ResultCode OpenSaveDataInfoReaderBySaveDataSpaceId(ServiceCtx context)
  242. {
  243. SaveDataSpaceId spaceId = (SaveDataSpaceId)context.RequestData.ReadByte();
  244. Result result = _baseFileSystemProxy.OpenSaveDataInfoReaderBySaveDataSpaceId(out ReferenceCountedDisposable<LibHac.FsSrv.ISaveDataInfoReader> infoReader, spaceId);
  245. if (result.IsSuccess())
  246. {
  247. MakeObject(context, new ISaveDataInfoReader(infoReader));
  248. }
  249. return (ResultCode)result.Value;
  250. }
  251. [Command(62)]
  252. public ResultCode OpenSaveDataInfoReaderOnlyCacheStorage(ServiceCtx context)
  253. {
  254. SaveDataFilter filter = new SaveDataFilter();
  255. filter.SetSaveDataType(SaveDataType.Cache);
  256. filter.SetProgramId(new ProgramId(context.Process.TitleId));
  257. // FS would query the User and SdCache space IDs to find where the existing cache is (if any).
  258. // We always have the SD card inserted, so we can always use SdCache for now.
  259. Result result = _baseFileSystemProxy.OpenSaveDataInfoReaderBySaveDataSpaceId(
  260. out ReferenceCountedDisposable<LibHac.FsSrv.ISaveDataInfoReader> infoReader, SaveDataSpaceId.SdCache);
  261. if (result.IsSuccess())
  262. {
  263. MakeObject(context, new ISaveDataInfoReader(infoReader));
  264. }
  265. return (ResultCode)result.Value;
  266. }
  267. [Command(67)]
  268. public ResultCode FindSaveDataWithFilter(ServiceCtx context)
  269. {
  270. SaveDataSpaceId spaceId = (SaveDataSpaceId)context.RequestData.ReadInt64();
  271. SaveDataFilter filter = context.RequestData.ReadStruct<SaveDataFilter>();
  272. long bufferPosition = context.Request.ReceiveBuff[0].Position;
  273. long bufferLen = context.Request.ReceiveBuff[0].Size;
  274. byte[] infoBuffer = new byte[bufferLen];
  275. Result result = _baseFileSystemProxy.FindSaveDataWithFilter(out long count, infoBuffer, spaceId, ref filter);
  276. context.Memory.Write((ulong)bufferPosition, infoBuffer);
  277. context.ResponseData.Write(count);
  278. return (ResultCode)result.Value;
  279. }
  280. [Command(68)]
  281. public ResultCode OpenSaveDataInfoReaderWithFilter(ServiceCtx context)
  282. {
  283. SaveDataSpaceId spaceId = (SaveDataSpaceId)context.RequestData.ReadInt64();
  284. SaveDataFilter filter = context.RequestData.ReadStruct<SaveDataFilter>();
  285. Result result = _baseFileSystemProxy.OpenSaveDataInfoReaderWithFilter(
  286. out ReferenceCountedDisposable<LibHac.FsSrv.ISaveDataInfoReader> infoReader, spaceId, ref filter);
  287. if (result.IsSuccess())
  288. {
  289. MakeObject(context, new ISaveDataInfoReader(infoReader));
  290. }
  291. return (ResultCode)result.Value;
  292. }
  293. [Command(71)]
  294. public ResultCode ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute(ServiceCtx context)
  295. {
  296. Logger.Stub?.PrintStub(LogClass.ServiceFs);
  297. MemoryHelper.FillWithZeros(context.Memory, context.Request.ReceiveBuff[0].Position, (int)context.Request.ReceiveBuff[0].Size);
  298. return ResultCode.Success;
  299. }
  300. [Command(200)]
  301. // OpenDataStorageByCurrentProcess() -> object<nn::fssrv::sf::IStorage> dataStorage
  302. public ResultCode OpenDataStorageByCurrentProcess(ServiceCtx context)
  303. {
  304. MakeObject(context, new FileSystemProxy.IStorage(context.Device.FileSystem.RomFs.AsStorage()));
  305. return 0;
  306. }
  307. [Command(202)]
  308. // OpenDataStorageByDataId(u8 storageId, nn::ApplicationId tid) -> object<nn::fssrv::sf::IStorage> dataStorage
  309. public ResultCode OpenDataStorageByDataId(ServiceCtx context)
  310. {
  311. StorageId storageId = (StorageId)context.RequestData.ReadByte();
  312. byte[] padding = context.RequestData.ReadBytes(7);
  313. long titleId = context.RequestData.ReadInt64();
  314. // We do a mitm here to find if the request is for an AOC.
  315. // This is because AOC can be distributed over multiple containers in the emulator.
  316. if (context.Device.System.ContentManager.GetAocDataStorage((ulong)titleId, out LibHac.Fs.IStorage aocStorage))
  317. {
  318. Logger.Info?.Print(LogClass.Loader, $"Opened AddOnContent Data TitleID={titleId:X16}");
  319. MakeObject(context, new FileSystemProxy.IStorage(aocStorage));
  320. return ResultCode.Success;
  321. }
  322. NcaContentType contentType = NcaContentType.Data;
  323. StorageId installedStorage = context.Device.System.ContentManager.GetInstalledStorage(titleId, contentType, storageId);
  324. if (installedStorage == StorageId.None)
  325. {
  326. contentType = NcaContentType.PublicData;
  327. installedStorage = context.Device.System.ContentManager.GetInstalledStorage(titleId, contentType, storageId);
  328. }
  329. if (installedStorage != StorageId.None)
  330. {
  331. string contentPath = context.Device.System.ContentManager.GetInstalledContentPath(titleId, storageId, contentType);
  332. string installPath = context.Device.FileSystem.SwitchPathToSystemPath(contentPath);
  333. if (!string.IsNullOrWhiteSpace(installPath))
  334. {
  335. string ncaPath = installPath;
  336. if (File.Exists(ncaPath))
  337. {
  338. try
  339. {
  340. LibHac.Fs.IStorage ncaStorage = new LocalStorage(ncaPath, FileAccess.Read, FileMode.Open);
  341. Nca nca = new Nca(context.Device.System.KeySet, ncaStorage);
  342. LibHac.Fs.IStorage romfsStorage = nca.OpenStorage(NcaSectionType.Data, context.Device.System.FsIntegrityCheckLevel);
  343. MakeObject(context, new FileSystemProxy.IStorage(romfsStorage));
  344. }
  345. catch (HorizonResultException ex)
  346. {
  347. return (ResultCode)ex.ResultValue.Value;
  348. }
  349. return ResultCode.Success;
  350. }
  351. else
  352. {
  353. throw new FileNotFoundException($"No Nca found in Path `{ncaPath}`.");
  354. }
  355. }
  356. else
  357. {
  358. throw new DirectoryNotFoundException($"Path for title id {titleId:x16} on Storage {storageId} was not found in Path {installPath}.");
  359. }
  360. }
  361. throw new FileNotFoundException($"System archive with titleid {titleId:x16} was not found on Storage {storageId}. Found in {installedStorage}.");
  362. }
  363. [Command(203)]
  364. // OpenPatchDataStorageByCurrentProcess() -> object<nn::fssrv::sf::IStorage>
  365. public ResultCode OpenPatchDataStorageByCurrentProcess(ServiceCtx context)
  366. {
  367. MakeObject(context, new FileSystemProxy.IStorage(context.Device.FileSystem.RomFs.AsStorage()));
  368. return ResultCode.Success;
  369. }
  370. [Command(400)]
  371. // OpenDataStorageByCurrentProcess() -> object<nn::fssrv::sf::IStorage> dataStorage
  372. public ResultCode OpenDeviceOperator(ServiceCtx context)
  373. {
  374. Result result = _baseFileSystemProxy.OpenDeviceOperator(out LibHac.FsSrv.IDeviceOperator deviceOperator);
  375. if (result.IsSuccess())
  376. {
  377. MakeObject(context, new IDeviceOperator(deviceOperator));
  378. }
  379. return (ResultCode)result.Value;
  380. }
  381. [Command(630)]
  382. // SetSdCardAccessibility(u8)
  383. public ResultCode SetSdCardAccessibility(ServiceCtx context)
  384. {
  385. bool isAccessible = context.RequestData.ReadBoolean();
  386. return (ResultCode)_baseFileSystemProxy.SetSdCardAccessibility(isAccessible).Value;
  387. }
  388. [Command(631)]
  389. // IsSdCardAccessible() -> u8
  390. public ResultCode IsSdCardAccessible(ServiceCtx context)
  391. {
  392. Result result = _baseFileSystemProxy.IsSdCardAccessible(out bool isAccessible);
  393. context.ResponseData.Write(isAccessible);
  394. return (ResultCode)result.Value;
  395. }
  396. [Command(1004)]
  397. // SetGlobalAccessLogMode(u32 mode)
  398. public ResultCode SetGlobalAccessLogMode(ServiceCtx context)
  399. {
  400. int mode = context.RequestData.ReadInt32();
  401. context.Device.System.GlobalAccessLogMode = mode;
  402. return ResultCode.Success;
  403. }
  404. [Command(1005)]
  405. // GetGlobalAccessLogMode() -> u32 logMode
  406. public ResultCode GetGlobalAccessLogMode(ServiceCtx context)
  407. {
  408. int mode = context.Device.System.GlobalAccessLogMode;
  409. context.ResponseData.Write(mode);
  410. return ResultCode.Success;
  411. }
  412. [Command(1006)]
  413. // OutputAccessLogToSdCard(buffer<bytes, 5> log_text)
  414. public ResultCode OutputAccessLogToSdCard(ServiceCtx context)
  415. {
  416. string message = ReadUtf8StringSend(context);
  417. // FS ends each line with a newline. Remove it because Ryujinx logging adds its own newline
  418. Logger.AccessLog?.PrintMsg(LogClass.ServiceFs, message.TrimEnd('\n'));
  419. return ResultCode.Success;
  420. }
  421. [Command(1011)]
  422. public ResultCode GetProgramIndexForAccessLog(ServiceCtx context)
  423. {
  424. int programIndex = 0;
  425. int programCount = 1;
  426. context.ResponseData.Write(programIndex);
  427. context.ResponseData.Write(programCount);
  428. return ResultCode.Success;
  429. }
  430. [Command(1200)] // 6.0.0+
  431. // OpenMultiCommitManager() -> object<nn::fssrv::sf::IMultiCommitManager>
  432. public ResultCode OpenMultiCommitManager(ServiceCtx context)
  433. {
  434. Result result = _baseFileSystemProxy.OpenMultiCommitManager(out LibHac.FsSrv.IMultiCommitManager commitManager);
  435. if (result.IsSuccess())
  436. {
  437. MakeObject(context, new IMultiCommitManager(commitManager));
  438. }
  439. return (ResultCode)result.Value;
  440. }
  441. }
  442. }