fs_user.cpp 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
  1. // Copyright 2014 Citra Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #include "common/common.h"
  5. #include "common/file_util.h"
  6. #include "common/scope_exit.h"
  7. #include "common/string_util.h"
  8. #include "core/hle/result.h"
  9. #include "core/hle/service/fs/archive.h"
  10. #include "core/hle/service/fs/fs_user.h"
  11. #include "core/settings.h"
  12. ////////////////////////////////////////////////////////////////////////////////////////////////////
  13. // Namespace FS_User
  14. namespace Service {
  15. namespace FS {
  16. static ArchiveHandle MakeArchiveHandle(u32 low_word, u32 high_word) {
  17. return (u64)low_word | ((u64)high_word << 32);
  18. }
  19. static void Initialize(Service::Interface* self) {
  20. u32* cmd_buff = Kernel::GetCommandBuffer();
  21. // TODO(Link Mauve): check the behavior when cmd_buff[1] isn't 32, as per
  22. // http://3dbrew.org/wiki/FS:Initialize#Request
  23. cmd_buff[1] = RESULT_SUCCESS.raw;
  24. LOG_DEBUG(Service_FS, "called");
  25. }
  26. /**
  27. * FS_User::OpenFile service function
  28. * Inputs:
  29. * 1 : Transaction
  30. * 2 : Archive handle lower word
  31. * 3 : Archive handle upper word
  32. * 4 : Low path type
  33. * 5 : Low path size
  34. * 6 : Open flags
  35. * 7 : Attributes
  36. * 8 : (LowPathSize << 14) | 2
  37. * 9 : Low path data pointer
  38. * Outputs:
  39. * 1 : Result of function, 0 on success, otherwise error code
  40. * 3 : File handle
  41. */
  42. static void OpenFile(Service::Interface* self) {
  43. u32* cmd_buff = Kernel::GetCommandBuffer();
  44. ArchiveHandle archive_handle = MakeArchiveHandle(cmd_buff[2], cmd_buff[3]);
  45. auto filename_type = static_cast<FileSys::LowPathType>(cmd_buff[4]);
  46. u32 filename_size = cmd_buff[5];
  47. FileSys::Mode mode; mode.hex = cmd_buff[6];
  48. u32 attributes = cmd_buff[7]; // TODO(Link Mauve): do something with those attributes.
  49. u32 filename_ptr = cmd_buff[9];
  50. FileSys::Path file_path(filename_type, filename_size, filename_ptr);
  51. LOG_DEBUG(Service_FS, "path=%s, mode=%d attrs=%u", file_path.DebugStr().c_str(), mode.hex, attributes);
  52. ResultVal<Handle> handle = OpenFileFromArchive(archive_handle, file_path, mode);
  53. cmd_buff[1] = handle.Code().raw;
  54. if (handle.Succeeded()) {
  55. cmd_buff[3] = *handle;
  56. } else {
  57. cmd_buff[3] = 0;
  58. LOG_ERROR(Service_FS, "failed to get a handle for file %s", file_path.DebugStr().c_str());
  59. }
  60. }
  61. /**
  62. * FS_User::OpenFileDirectly service function
  63. * Inputs:
  64. * 1 : Transaction
  65. * 2 : Archive ID
  66. * 3 : Archive low path type
  67. * 4 : Archive low path size
  68. * 5 : File low path type
  69. * 6 : File low path size
  70. * 7 : Flags
  71. * 8 : Attributes
  72. * 9 : (ArchiveLowPathSize << 14) | 0x802
  73. * 10 : Archive low path
  74. * 11 : (FileLowPathSize << 14) | 2
  75. * 12 : File low path
  76. * Outputs:
  77. * 1 : Result of function, 0 on success, otherwise error code
  78. * 3 : File handle
  79. */
  80. static void OpenFileDirectly(Service::Interface* self) {
  81. u32* cmd_buff = Kernel::GetCommandBuffer();
  82. auto archive_id = static_cast<FS::ArchiveIdCode>(cmd_buff[2]);
  83. auto archivename_type = static_cast<FileSys::LowPathType>(cmd_buff[3]);
  84. u32 archivename_size = cmd_buff[4];
  85. auto filename_type = static_cast<FileSys::LowPathType>(cmd_buff[5]);
  86. u32 filename_size = cmd_buff[6];
  87. FileSys::Mode mode; mode.hex = cmd_buff[7];
  88. u32 attributes = cmd_buff[8]; // TODO(Link Mauve): do something with those attributes.
  89. u32 archivename_ptr = cmd_buff[10];
  90. u32 filename_ptr = cmd_buff[12];
  91. FileSys::Path archive_path(archivename_type, archivename_size, archivename_ptr);
  92. FileSys::Path file_path(filename_type, filename_size, filename_ptr);
  93. LOG_DEBUG(Service_FS, "archive_path=%s file_path=%s, mode=%u attributes=%d",
  94. archive_path.DebugStr().c_str(), file_path.DebugStr().c_str(), mode.hex, attributes);
  95. if (archive_path.GetType() != FileSys::Empty) {
  96. LOG_ERROR(Service_FS, "archive LowPath type other than empty is currently unsupported");
  97. cmd_buff[1] = UnimplementedFunction(ErrorModule::FS).raw;
  98. cmd_buff[3] = 0;
  99. return;
  100. }
  101. ResultVal<ArchiveHandle> archive_handle = OpenArchive(archive_id);
  102. if (archive_handle.Failed()) {
  103. LOG_ERROR(Service_FS, "failed to get a handle for archive");
  104. cmd_buff[1] = archive_handle.Code().raw;
  105. cmd_buff[3] = 0;
  106. return;
  107. }
  108. SCOPE_EXIT({ CloseArchive(*archive_handle); });
  109. ResultVal<Handle> handle = OpenFileFromArchive(*archive_handle, file_path, mode);
  110. cmd_buff[1] = handle.Code().raw;
  111. if (handle.Succeeded()) {
  112. cmd_buff[3] = *handle;
  113. } else {
  114. cmd_buff[3] = 0;
  115. LOG_ERROR(Service_FS, "failed to get a handle for file %s", file_path.DebugStr().c_str());
  116. }
  117. }
  118. /*
  119. * FS_User::DeleteFile service function
  120. * Inputs:
  121. * 2 : Archive handle lower word
  122. * 3 : Archive handle upper word
  123. * 4 : File path string type
  124. * 5 : File path string size
  125. * 7 : File path string data
  126. * Outputs:
  127. * 1 : Result of function, 0 on success, otherwise error code
  128. */
  129. static void DeleteFile(Service::Interface* self) {
  130. u32* cmd_buff = Kernel::GetCommandBuffer();
  131. ArchiveHandle archive_handle = MakeArchiveHandle(cmd_buff[2], cmd_buff[3]);
  132. auto filename_type = static_cast<FileSys::LowPathType>(cmd_buff[4]);
  133. u32 filename_size = cmd_buff[5];
  134. u32 filename_ptr = cmd_buff[7];
  135. FileSys::Path file_path(filename_type, filename_size, filename_ptr);
  136. LOG_DEBUG(Service_FS, "type=%d size=%d data=%s",
  137. filename_type, filename_size, file_path.DebugStr().c_str());
  138. cmd_buff[1] = DeleteFileFromArchive(archive_handle, file_path).raw;
  139. }
  140. /*
  141. * FS_User::RenameFile service function
  142. * Inputs:
  143. * 2 : Source archive handle lower word
  144. * 3 : Source archive handle upper word
  145. * 4 : Source file path type
  146. * 5 : Source file path size
  147. * 6 : Dest archive handle lower word
  148. * 7 : Dest archive handle upper word
  149. * 8 : Dest file path type
  150. * 9 : Dest file path size
  151. * 11: Source file path string data
  152. * 13: Dest file path string
  153. * Outputs:
  154. * 1 : Result of function, 0 on success, otherwise error code
  155. */
  156. static void RenameFile(Service::Interface* self) {
  157. u32* cmd_buff = Kernel::GetCommandBuffer();
  158. ArchiveHandle src_archive_handle = MakeArchiveHandle(cmd_buff[2], cmd_buff[3]);
  159. auto src_filename_type = static_cast<FileSys::LowPathType>(cmd_buff[4]);
  160. u32 src_filename_size = cmd_buff[5];
  161. ArchiveHandle dest_archive_handle = MakeArchiveHandle(cmd_buff[6], cmd_buff[7]);;
  162. auto dest_filename_type = static_cast<FileSys::LowPathType>(cmd_buff[8]);
  163. u32 dest_filename_size = cmd_buff[9];
  164. u32 src_filename_ptr = cmd_buff[11];
  165. u32 dest_filename_ptr = cmd_buff[13];
  166. FileSys::Path src_file_path(src_filename_type, src_filename_size, src_filename_ptr);
  167. FileSys::Path dest_file_path(dest_filename_type, dest_filename_size, dest_filename_ptr);
  168. LOG_DEBUG(Service_FS, "src_type=%d src_size=%d src_data=%s dest_type=%d dest_size=%d dest_data=%s",
  169. src_filename_type, src_filename_size, src_file_path.DebugStr().c_str(),
  170. dest_filename_type, dest_filename_size, dest_file_path.DebugStr().c_str());
  171. cmd_buff[1] = RenameFileBetweenArchives(src_archive_handle, src_file_path, dest_archive_handle, dest_file_path).raw;
  172. }
  173. /*
  174. * FS_User::DeleteDirectory service function
  175. * Inputs:
  176. * 2 : Archive handle lower word
  177. * 3 : Archive handle upper word
  178. * 4 : Directory path string type
  179. * 5 : Directory path string size
  180. * 7 : Directory path string data
  181. * Outputs:
  182. * 1 : Result of function, 0 on success, otherwise error code
  183. */
  184. static void DeleteDirectory(Service::Interface* self) {
  185. u32* cmd_buff = Kernel::GetCommandBuffer();
  186. ArchiveHandle archive_handle = MakeArchiveHandle(cmd_buff[2], cmd_buff[3]);
  187. auto dirname_type = static_cast<FileSys::LowPathType>(cmd_buff[4]);
  188. u32 dirname_size = cmd_buff[5];
  189. u32 dirname_ptr = cmd_buff[7];
  190. FileSys::Path dir_path(dirname_type, dirname_size, dirname_ptr);
  191. LOG_DEBUG(Service_FS, "type=%d size=%d data=%s",
  192. dirname_type, dirname_size, dir_path.DebugStr().c_str());
  193. cmd_buff[1] = DeleteDirectoryFromArchive(archive_handle, dir_path).raw;
  194. }
  195. /*
  196. * FS_User::CreateFile service function
  197. * Inputs:
  198. * 0 : Command header 0x08080202
  199. * 2 : Archive handle lower word
  200. * 3 : Archive handle upper word
  201. * 4 : File path string type
  202. * 5 : File path string size
  203. * 7 : File size (filled with zeroes)
  204. * 10: File path string data
  205. * Outputs:
  206. * 1 : Result of function, 0 on success, otherwise error code
  207. */
  208. static void CreateFile(Service::Interface* self) {
  209. u32* cmd_buff = Kernel::GetCommandBuffer();
  210. ArchiveHandle archive_handle = MakeArchiveHandle(cmd_buff[2], cmd_buff[3]);
  211. auto filename_type = static_cast<FileSys::LowPathType>(cmd_buff[4]);
  212. u32 filename_size = cmd_buff[5];
  213. u32 file_size = cmd_buff[7];
  214. u32 filename_ptr = cmd_buff[10];
  215. FileSys::Path file_path(filename_type, filename_size, filename_ptr);
  216. LOG_DEBUG(Service_FS, "type=%d size=%d data=%s", filename_type, filename_size, file_path.DebugStr().c_str());
  217. cmd_buff[1] = CreateFileInArchive(archive_handle, file_path, file_size).raw;
  218. }
  219. /*
  220. * FS_User::CreateDirectory service function
  221. * Inputs:
  222. * 2 : Archive handle lower word
  223. * 3 : Archive handle upper word
  224. * 4 : Directory path string type
  225. * 5 : Directory path string size
  226. * 8 : Directory path string data
  227. * Outputs:
  228. * 1 : Result of function, 0 on success, otherwise error code
  229. */
  230. static void CreateDirectory(Service::Interface* self) {
  231. u32* cmd_buff = Kernel::GetCommandBuffer();
  232. ArchiveHandle archive_handle = MakeArchiveHandle(cmd_buff[2], cmd_buff[3]);
  233. auto dirname_type = static_cast<FileSys::LowPathType>(cmd_buff[4]);
  234. u32 dirname_size = cmd_buff[5];
  235. u32 dirname_ptr = cmd_buff[8];
  236. FileSys::Path dir_path(dirname_type, dirname_size, dirname_ptr);
  237. LOG_DEBUG(Service_FS, "type=%d size=%d data=%s", dirname_type, dirname_size, dir_path.DebugStr().c_str());
  238. cmd_buff[1] = CreateDirectoryFromArchive(archive_handle, dir_path).raw;
  239. }
  240. /*
  241. * FS_User::RenameDirectory service function
  242. * Inputs:
  243. * 2 : Source archive handle lower word
  244. * 3 : Source archive handle upper word
  245. * 4 : Source dir path type
  246. * 5 : Source dir path size
  247. * 6 : Dest archive handle lower word
  248. * 7 : Dest archive handle upper word
  249. * 8 : Dest dir path type
  250. * 9 : Dest dir path size
  251. * 11: Source dir path string data
  252. * 13: Dest dir path string
  253. * Outputs:
  254. * 1 : Result of function, 0 on success, otherwise error code
  255. */
  256. static void RenameDirectory(Service::Interface* self) {
  257. u32* cmd_buff = Kernel::GetCommandBuffer();
  258. ArchiveHandle src_archive_handle = MakeArchiveHandle(cmd_buff[2], cmd_buff[3]);
  259. auto src_dirname_type = static_cast<FileSys::LowPathType>(cmd_buff[4]);
  260. u32 src_dirname_size = cmd_buff[5];
  261. ArchiveHandle dest_archive_handle = MakeArchiveHandle(cmd_buff[6], cmd_buff[7]);
  262. auto dest_dirname_type = static_cast<FileSys::LowPathType>(cmd_buff[8]);
  263. u32 dest_dirname_size = cmd_buff[9];
  264. u32 src_dirname_ptr = cmd_buff[11];
  265. u32 dest_dirname_ptr = cmd_buff[13];
  266. FileSys::Path src_dir_path(src_dirname_type, src_dirname_size, src_dirname_ptr);
  267. FileSys::Path dest_dir_path(dest_dirname_type, dest_dirname_size, dest_dirname_ptr);
  268. LOG_DEBUG(Service_FS, "src_type=%d src_size=%d src_data=%s dest_type=%d dest_size=%d dest_data=%s",
  269. src_dirname_type, src_dirname_size, src_dir_path.DebugStr().c_str(),
  270. dest_dirname_type, dest_dirname_size, dest_dir_path.DebugStr().c_str());
  271. cmd_buff[1] = RenameDirectoryBetweenArchives(src_archive_handle, src_dir_path, dest_archive_handle, dest_dir_path).raw;
  272. }
  273. /**
  274. * FS_User::OpenDirectory service function
  275. * Inputs:
  276. * 1 : Archive handle low word
  277. * 2 : Archive handle high word
  278. * 3 : Low path type
  279. * 4 : Low path size
  280. * 7 : (LowPathSize << 14) | 2
  281. * 8 : Low path data pointer
  282. * Outputs:
  283. * 1 : Result of function, 0 on success, otherwise error code
  284. * 3 : Directory handle
  285. */
  286. static void OpenDirectory(Service::Interface* self) {
  287. u32* cmd_buff = Kernel::GetCommandBuffer();
  288. ArchiveHandle archive_handle = MakeArchiveHandle(cmd_buff[1], cmd_buff[2]);
  289. auto dirname_type = static_cast<FileSys::LowPathType>(cmd_buff[3]);
  290. u32 dirname_size = cmd_buff[4];
  291. u32 dirname_ptr = cmd_buff[6];
  292. FileSys::Path dir_path(dirname_type, dirname_size, dirname_ptr);
  293. LOG_DEBUG(Service_FS, "type=%d size=%d data=%s", dirname_type, dirname_size, dir_path.DebugStr().c_str());
  294. ResultVal<Handle> handle = OpenDirectoryFromArchive(archive_handle, dir_path);
  295. cmd_buff[1] = handle.Code().raw;
  296. if (handle.Succeeded()) {
  297. cmd_buff[3] = *handle;
  298. } else {
  299. LOG_ERROR(Service_FS, "failed to get a handle for directory");
  300. }
  301. }
  302. /**
  303. * FS_User::OpenArchive service function
  304. * Inputs:
  305. * 1 : Archive ID
  306. * 2 : Archive low path type
  307. * 3 : Archive low path size
  308. * 4 : (LowPathSize << 14) | 2
  309. * 5 : Archive low path
  310. * Outputs:
  311. * 1 : Result of function, 0 on success, otherwise error code
  312. * 2 : Archive handle lower word (unused)
  313. * 3 : Archive handle upper word (same as file handle)
  314. */
  315. static void OpenArchive(Service::Interface* self) {
  316. u32* cmd_buff = Kernel::GetCommandBuffer();
  317. auto archive_id = static_cast<FS::ArchiveIdCode>(cmd_buff[1]);
  318. auto archivename_type = static_cast<FileSys::LowPathType>(cmd_buff[2]);
  319. u32 archivename_size = cmd_buff[3];
  320. u32 archivename_ptr = cmd_buff[5];
  321. FileSys::Path archive_path(archivename_type, archivename_size, archivename_ptr);
  322. LOG_DEBUG(Service_FS, "archive_path=%s", archive_path.DebugStr().c_str());
  323. if (archive_path.GetType() != FileSys::Empty) {
  324. LOG_ERROR(Service_FS, "archive LowPath type other than empty is currently unsupported");
  325. cmd_buff[1] = UnimplementedFunction(ErrorModule::FS).raw;
  326. return;
  327. }
  328. ResultVal<ArchiveHandle> handle = OpenArchive(archive_id);
  329. cmd_buff[1] = handle.Code().raw;
  330. if (handle.Succeeded()) {
  331. cmd_buff[2] = *handle & 0xFFFFFFFF;
  332. cmd_buff[3] = (*handle >> 32) & 0xFFFFFFFF;
  333. } else {
  334. cmd_buff[2] = cmd_buff[3] = 0;
  335. LOG_ERROR(Service_FS, "failed to get a handle for archive");
  336. }
  337. }
  338. /**
  339. * FS_User::CloseArchive service function
  340. * Inputs:
  341. * 0 : 0x080E0080
  342. * 1 : Archive handle low word
  343. * 2 : Archive handle high word
  344. * Outputs:
  345. * 0 : ??? TODO(yuriks): Verify return header
  346. * 1 : Result of function, 0 on success, otherwise error code
  347. */
  348. static void CloseArchive(Service::Interface* self) {
  349. u32* cmd_buff = Kernel::GetCommandBuffer();
  350. ArchiveHandle archive_handle = MakeArchiveHandle(cmd_buff[1], cmd_buff[2]);
  351. cmd_buff[1] = CloseArchive(archive_handle).raw;
  352. }
  353. /*
  354. * FS_User::IsSdmcDetected service function
  355. * Outputs:
  356. * 1 : Result of function, 0 on success, otherwise error code
  357. * 2 : Whether the Sdmc could be detected
  358. */
  359. static void IsSdmcDetected(Service::Interface* self) {
  360. u32* cmd_buff = Kernel::GetCommandBuffer();
  361. cmd_buff[1] = 0;
  362. cmd_buff[2] = Settings::values.use_virtual_sd ? 1 : 0;
  363. LOG_DEBUG(Service_FS, "called");
  364. }
  365. /**
  366. * FS_User::IsSdmcWriteable service function
  367. * Outputs:
  368. * 0 : Command header 0x08180000
  369. * 1 : Result of function, 0 on success, otherwise error code
  370. * 2 : Whether the Sdmc is currently writeable
  371. */
  372. static void IsSdmcWriteable(Service::Interface* self) {
  373. u32* cmd_buff = Kernel::GetCommandBuffer();
  374. cmd_buff[1] = RESULT_SUCCESS.raw;
  375. // If the SD isn't enabled, it can't be writeable...else, stubbed true
  376. cmd_buff[2] = Settings::values.use_virtual_sd ? 1 : 0;
  377. LOG_DEBUG(Service_FS, " (STUBBED)");
  378. }
  379. /**
  380. * FS_User::FormatSaveData service function,
  381. * formats the SaveData specified by the input path.
  382. * Inputs:
  383. * 0 : 0x084C0242
  384. * 1 : Archive ID
  385. * 2 : Archive low path type
  386. * 3 : Archive low path size
  387. * 10 : (LowPathSize << 14) | 2
  388. * 11 : Archive low path
  389. * Outputs:
  390. * 1 : Result of function, 0 on success, otherwise error code
  391. */
  392. static void FormatSaveData(Service::Interface* self) {
  393. // TODO(Subv): Find out what the other inputs and outputs of this function are
  394. u32* cmd_buff = Kernel::GetCommandBuffer();
  395. LOG_DEBUG(Service_FS, "(STUBBED)");
  396. auto archive_id = static_cast<FS::ArchiveIdCode>(cmd_buff[1]);
  397. auto archivename_type = static_cast<FileSys::LowPathType>(cmd_buff[2]);
  398. u32 archivename_size = cmd_buff[3];
  399. u32 archivename_ptr = cmd_buff[11];
  400. FileSys::Path archive_path(archivename_type, archivename_size, archivename_ptr);
  401. LOG_DEBUG(Service_FS, "archive_path=%s", archive_path.DebugStr().c_str());
  402. if (archive_id != FS::ArchiveIdCode::SaveData) {
  403. // TODO(Subv): What should happen if somebody attempts to format a different archive?
  404. LOG_ERROR(Service_FS, "tried to format an archive different than SaveData, %u", cmd_buff[1]);
  405. cmd_buff[1] = UnimplementedFunction(ErrorModule::FS).raw;
  406. return;
  407. }
  408. if (archive_path.GetType() != FileSys::LowPathType::Empty) {
  409. // TODO(Subv): Implement formatting the SaveData of other games
  410. LOG_ERROR(Service_FS, "archive LowPath type other than empty is currently unsupported");
  411. cmd_buff[1] = UnimplementedFunction(ErrorModule::FS).raw;
  412. return;
  413. }
  414. cmd_buff[1] = FormatSaveData().raw;
  415. }
  416. /**
  417. * FS_User::FormatThisUserSaveData service function
  418. * Inputs:
  419. * 0: 0x080F0180
  420. * Outputs:
  421. * 1 : Result of function, 0 on success, otherwise error code
  422. */
  423. static void FormatThisUserSaveData(Service::Interface* self) {
  424. u32* cmd_buff = Kernel::GetCommandBuffer();
  425. LOG_DEBUG(Service_FS, "(STUBBED)");
  426. // TODO(Subv): Find out what the inputs and outputs of this function are
  427. cmd_buff[1] = FormatSaveData().raw;
  428. }
  429. const FSUserInterface::FunctionInfo FunctionTable[] = {
  430. {0x000100C6, nullptr, "Dummy1"},
  431. {0x040100C4, nullptr, "Control"},
  432. {0x08010002, Initialize, "Initialize"},
  433. {0x080201C2, OpenFile, "OpenFile"},
  434. {0x08030204, OpenFileDirectly, "OpenFileDirectly"},
  435. {0x08040142, DeleteFile, "DeleteFile"},
  436. {0x08050244, RenameFile, "RenameFile"},
  437. {0x08060142, DeleteDirectory, "DeleteDirectory"},
  438. {0x08070142, nullptr, "DeleteDirectoryRecursively"},
  439. {0x08080202, CreateFile, "CreateFile"},
  440. {0x08090182, CreateDirectory, "CreateDirectory"},
  441. {0x080A0244, RenameDirectory, "RenameDirectory"},
  442. {0x080B0102, OpenDirectory, "OpenDirectory"},
  443. {0x080C00C2, OpenArchive, "OpenArchive"},
  444. {0x080D0144, nullptr, "ControlArchive"},
  445. {0x080E0080, CloseArchive, "CloseArchive"},
  446. {0x080F0180, FormatThisUserSaveData,"FormatThisUserSaveData"},
  447. {0x08100200, nullptr, "CreateSystemSaveData"},
  448. {0x08110040, nullptr, "DeleteSystemSaveData"},
  449. {0x08120080, nullptr, "GetFreeBytes"},
  450. {0x08130000, nullptr, "GetCardType"},
  451. {0x08140000, nullptr, "GetSdmcArchiveResource"},
  452. {0x08150000, nullptr, "GetNandArchiveResource"},
  453. {0x08160000, nullptr, "GetSdmcFatfsErro"},
  454. {0x08170000, IsSdmcDetected, "IsSdmcDetected"},
  455. {0x08180000, IsSdmcWriteable, "IsSdmcWritable"},
  456. {0x08190042, nullptr, "GetSdmcCid"},
  457. {0x081A0042, nullptr, "GetNandCid"},
  458. {0x081B0000, nullptr, "GetSdmcSpeedInfo"},
  459. {0x081C0000, nullptr, "GetNandSpeedInfo"},
  460. {0x081D0042, nullptr, "GetSdmcLog"},
  461. {0x081E0042, nullptr, "GetNandLog"},
  462. {0x081F0000, nullptr, "ClearSdmcLog"},
  463. {0x08200000, nullptr, "ClearNandLog"},
  464. {0x08210000, nullptr, "CardSlotIsInserted"},
  465. {0x08220000, nullptr, "CardSlotPowerOn"},
  466. {0x08230000, nullptr, "CardSlotPowerOff"},
  467. {0x08240000, nullptr, "CardSlotGetCardIFPowerStatus"},
  468. {0x08250040, nullptr, "CardNorDirectCommand"},
  469. {0x08260080, nullptr, "CardNorDirectCommandWithAddress"},
  470. {0x08270082, nullptr, "CardNorDirectRead"},
  471. {0x082800C2, nullptr, "CardNorDirectReadWithAddress"},
  472. {0x08290082, nullptr, "CardNorDirectWrite"},
  473. {0x082A00C2, nullptr, "CardNorDirectWriteWithAddress"},
  474. {0x082B00C2, nullptr, "CardNorDirectRead_4xIO"},
  475. {0x082C0082, nullptr, "CardNorDirectCpuWriteWithoutVerify"},
  476. {0x082D0040, nullptr, "CardNorDirectSectorEraseWithoutVerify"},
  477. {0x082E0040, nullptr, "GetProductInfo"},
  478. {0x082F0040, nullptr, "GetProgramLaunchInfo"},
  479. {0x08300182, nullptr, "CreateExtSaveData"},
  480. {0x08310180, nullptr, "CreateSharedExtSaveData"},
  481. {0x08320102, nullptr, "ReadExtSaveDataIcon"},
  482. {0x08330082, nullptr, "EnumerateExtSaveData"},
  483. {0x08340082, nullptr, "EnumerateSharedExtSaveData"},
  484. {0x08350080, nullptr, "DeleteExtSaveData"},
  485. {0x08360080, nullptr, "DeleteSharedExtSaveData"},
  486. {0x08370040, nullptr, "SetCardSpiBaudRate"},
  487. {0x08380040, nullptr, "SetCardSpiBusMode"},
  488. {0x08390000, nullptr, "SendInitializeInfoTo9"},
  489. {0x083A0100, nullptr, "GetSpecialContentIndex"},
  490. {0x083B00C2, nullptr, "GetLegacyRomHeader"},
  491. {0x083C00C2, nullptr, "GetLegacyBannerData"},
  492. {0x083D0100, nullptr, "CheckAuthorityToAccessExtSaveData"},
  493. {0x083E00C2, nullptr, "QueryTotalQuotaSize"},
  494. {0x083F00C0, nullptr, "GetExtDataBlockSize"},
  495. {0x08400040, nullptr, "AbnegateAccessRight"},
  496. {0x08410000, nullptr, "DeleteSdmcRoot"},
  497. {0x08420040, nullptr, "DeleteAllExtSaveDataOnNand"},
  498. {0x08430000, nullptr, "InitializeCtrFileSystem"},
  499. {0x08440000, nullptr, "CreateSeed"},
  500. {0x084500C2, nullptr, "GetFormatInfo"},
  501. {0x08460102, nullptr, "GetLegacyRomHeader2"},
  502. {0x08470180, nullptr, "FormatCtrCardUserSaveData"},
  503. {0x08480042, nullptr, "GetSdmcCtrRootPath"},
  504. {0x08490040, nullptr, "GetArchiveResource"},
  505. {0x084A0002, nullptr, "ExportIntegrityVerificationSeed"},
  506. {0x084B0002, nullptr, "ImportIntegrityVerificationSeed"},
  507. {0x084C0242, FormatSaveData, "FormatSaveData"},
  508. {0x084D0102, nullptr, "GetLegacySubBannerData"},
  509. {0x084E0342, nullptr, "UpdateSha256Context"},
  510. {0x084F0102, nullptr, "ReadSpecialFile"},
  511. {0x08500040, nullptr, "GetSpecialFileSize"},
  512. {0x08580000, nullptr, "GetMovableSedHashedKeyYRandomData"},
  513. {0x08610042, nullptr, "InitializeWithSdkVersion"},
  514. {0x08620040, nullptr, "SetPriority"},
  515. {0x08630000, nullptr, "GetPriority"},
  516. };
  517. ////////////////////////////////////////////////////////////////////////////////////////////////////
  518. // Interface class
  519. FSUserInterface::FSUserInterface() {
  520. Register(FunctionTable, ARRAY_SIZE(FunctionTable));
  521. }
  522. FSUserInterface::~FSUserInterface() {
  523. }
  524. } // namespace FS
  525. } // namespace Service