libctru  v2.4.1
fspxi.h
Go to the documentation of this file.
1 /**
2  * @file fspxi.h
3  * @brief Service interface for PxiFS services. This is normally not accessible to userland apps. https://3dbrew.org/wiki/Filesystem_services_PXI
4  */
5 #pragma once
6 
7 #include <3ds/services/fs.h>
8 #include <3ds/types.h>
9 
10 typedef u64 FSPXI_Archive;
11 typedef u64 FSPXI_File;
12 typedef u64 FSPXI_Directory;
13 
14 /**
15  * @brief Opens a file.
16  * @param out Pointer to output the file handle to.
17  * @param archive Archive containing the file.
18  * @param path Path of the file.
19  * @param flags Flags to open the file with.
20  * @param attributes Attributes of the file.
21  */
22 Result FSPXI_OpenFile(Handle serviceHandle, FSPXI_File* out, FSPXI_Archive archive, FS_Path path, u32 flags, u32 attributes);
23 
24 /**
25  * @brief Deletes a file.
26  * @param archive Archive containing the file.
27  * @param path Path of the file.
28  */
29 Result FSPXI_DeleteFile(Handle serviceHandle, FSPXI_Archive archive, FS_Path path);
30 
31 /**
32  * @brief Renames a file.
33  * @param srcArchive Archive containing the source file.
34  * @param srcPath Path of the source file.
35  * @param dstArchive Archive containing the destination file.
36  * @param dstPath Path of the destination file.
37  */
38 Result FSPXI_RenameFile(Handle serviceHandle, FSPXI_Archive srcArchive, FS_Path srcPath, FSPXI_Archive dstArchive, FS_Path dstPath);
39 
40 /**
41  * @brief Deletes a directory.
42  * @param archive Archive containing the directory.
43  * @param path Path of the directory.
44  */
45 Result FSPXI_DeleteDirectory(Handle serviceHandle, FSPXI_Archive archive, FS_Path path);
46 
47 /**
48  * @brief Creates a file.
49  * @param archive Archive to create the file in.
50  * @param path Path of the file.
51  * @param attributes Attributes of the file.
52  * @param size Size of the file.
53  */
54 Result FSPXI_CreateFile(Handle serviceHandle, FSPXI_Archive archive, FS_Path path, u32 attributes, u64 fileSize);
55 
56 /**
57  * @brief Creates a directory.
58  * @param archive Archive to create the directory in.
59  * @param path Path of the directory.
60  * @param attributes Attributes of the directory.
61  */
62 Result FSPXI_CreateDirectory(Handle serviceHandle, FSPXI_Archive archive, FS_Path path, u32 attributes);
63 
64 /**
65  * @brief Renames a directory.
66  * @param srcArchive Archive containing the source directory.
67  * @param srcPath Path of the source directory.
68  * @param dstArchive Archive containing the destination directory.
69  * @param dstPath Path of the destination directory.
70  */
71 Result FSPXI_RenameDirectory(Handle serviceHandle, FSPXI_Archive srcArchive, FS_Path srcPath, FSPXI_Archive dstArchive, FS_Path dstPath);
72 
73 /**
74  * @brief Opens a directory.
75  * @param out Pointer to output the directory handle to.
76  * @param archive Archive containing the directory.
77  * @param path Path of the directory.
78  */
79 Result FSPXI_OpenDirectory(Handle serviceHandle, FSPXI_Directory* out, FSPXI_Archive archive, FS_Path path);
80 
81 /**
82  * @brief Reads from a file.
83  * @param file File to read from.
84  * @param bytesRead Pointer to output the number of read bytes to.
85  * @param offset Offset to read from.
86  * @param buffer Buffer to read to.
87  * @param size Size of the buffer.
88  */
89 Result FSPXI_ReadFile(Handle serviceHandle, FSPXI_File file, u32* bytesRead, u64 offset, void* buffer, u32 size);
90 
91 /**
92  * @brief Calculate SHA256 of a file.
93  * @param file File to calculate the hash of.
94  * @param buffer Buffer to output the hash to.
95  * @param size Size of the buffer.
96  */
97 Result FSPXI_CalculateFileHashSHA256(Handle serviceHandle, FSPXI_File file, void* buffer, u32 size);
98 
99 /**
100  * @brief Writes to a file.
101  * @param file File to write to.
102  * @param bytesWritten Pointer to output the number of bytes written to.
103  * @param offset Offset to write to.
104  * @param buffer Buffer to write from.
105  * @param size Size of the buffer.
106  * @param flags Flags to use when writing.
107  */
108 Result FSPXI_WriteFile(Handle serviceHandle, FSPXI_File file, u32* bytesWritten, u64 offset, const void* buffer, u32 size, u32 flags);
109 
110 /**
111  * @brief Calculates the MAC used in a DISA/DIFF header?
112  * @param file Unsure
113  * @param inBuffer 0x100-byte DISA/DIFF input buffer.
114  * @param inSize Size of inBuffer.
115  * @param outBuffer Buffer to write MAC to.
116  * @param outSize Size of outBuffer.
117  */
118 Result FSPXI_CalcSavegameMAC(Handle serviceHandle, FSPXI_File file, const void* inBuffer, u32 inSize, void* outBuffer, u32 outSize);
119 
120 /**
121  * @brief Get size of a file
122  * @param file File to get the size of.
123  * @param size Pointer to output size to.
124  */
125 Result FSPXI_GetFileSize(Handle serviceHandle, FSPXI_File file, u64* size);
126 
127 /**
128  * @brief Set size of a file
129  * @param file File to set the size of
130  * @param size Size to set the file to
131  */
132 Result FSPXI_SetFileSize(Handle serviceHandle, FSPXI_File file, u64 size);
133 
134 /**
135  * @brief Close a file
136  * @param file File to close
137  */
138 Result FSPXI_CloseFile(Handle serviceHandle, FSPXI_File file);
139 
140 /**
141  * @brief Reads one or more directory entries.
142  * @param directory Directory to read from.
143  * @param entriesRead Pointer to output the number of entries read to.
144  * @param entryCount Number of entries to read.
145  * @param entryOut Pointer to output directory entries to.
146  */
147 Result FSPXI_ReadDirectory(Handle serviceHandle, FSPXI_Directory directory, u32* entriesRead, u32 entryCount, FS_DirectoryEntry* entries);
148 
149 /**
150  * @brief Close a directory
151  * @param directory Directory to close.
152  */
153 Result FSPXI_CloseDirectory(Handle serviceHandle, FSPXI_Directory directory);
154 
155 /**
156  * @brief Opens an archive.
157  * @param archive Pointer to output the opened archive to.
158  * @param id ID of the archive.
159  * @param path Path of the archive.
160  */
161 Result FSPXI_OpenArchive(Handle serviceHandle, FSPXI_Archive* archive, FS_ArchiveID archiveID, FS_Path path);
162 
163 /**
164  * @brief Checks if the archive contains a file at path.
165  * @param archive Archive to check.
166  * @param out Pointer to output existence to.
167  * @param path Path to check for file
168  */
169 Result FSPXI_HasFile(Handle serviceHandle, FSPXI_Archive archive, bool* out, FS_Path path);
170 
171 /**
172  * @brief Checks if the archive contains a directory at path.
173  * @param archive Archive to check.
174  * @param out Pointer to output existence to.
175  * @param path Path to check for directory
176  */
177 Result FSPXI_HasDirectory(Handle serviceHandle, FSPXI_Archive archive, bool* out, FS_Path path);
178 
179 /**
180  * @brief Commits an archive's save data.
181  * @param archive Archive to commit.
182  * @param id Archive action sent by FSUSER_ControlArchive. Must not be 0 or 0x789D
183  * @remark Unsure why id is sent. This appears to be the default action for FSUSER_ControlArchive, with every action other than 0 and 0x789D being sent to this command.
184  */
185 Result FSPXI_CommitSaveData(Handle serviceHandle, FSPXI_Archive archive, u32 id);
186 
187 /**
188  * @brief Close an archive
189  * @param archive Archive to close.
190  */
191 Result FSPXI_CloseArchive(Handle serviceHandle, FSPXI_Archive archive);
192 
193 /**
194  * @brief Unknown 0x17. Appears to be an "is archive handle valid" command?
195  * @param archive Archive handle to check validity of.
196  * @param out Pointer to output validity to.
197  */
198 Result FSPXI_Unknown0x17(Handle serviceHandle, FSPXI_Archive archive, bool* out);
199 
200 /**
201  * @brief Gets the inserted card type.
202  * @param out Pointer to output the card type to.
203  */
205 
206 /**
207  * @brief Gets the SDMC archive resource information.
208  * @param out Pointer to output the archive resource information to.
209  */
211 
212 /**
213  * @brief Gets the NAND archive resource information.
214  * @param out Pointer to output the archive resource information to.
215  */
217 
218 /**
219  * @brief Gets the error code from the SDMC FatFS driver
220  * @param out Pointer to output the error code to
221  */
223 
224 /**
225  * @brief Gets whether PXIFS0 detects the SD
226  * @param out Pointer to output the detection status to
227  */
228 Result FSPXI_IsSdmcDetected(Handle serviceHandle, bool* out);
229 
230 /**
231  * @brief Gets whether PXIFS0 can write to the SD
232  * @param out Pointer to output the writable status to
233  */
234 Result FSPXI_IsSdmcWritable(Handle serviceHandle, bool* out);
235 
236 /**
237  * @brief Gets the SDMC CID
238  * @param out Buffer to output the CID to.
239  * @param size Size of buffer.
240  */
241 Result FSPXI_GetSdmcCid(Handle serviceHandle, void* out, u32 size);
242 
243 /**
244  * @brief Gets the NAND CID
245  * @param out Buffer to output the CID to.
246  * @param size Size of buffer.
247  */
248 Result FSPXI_GetNandCid(Handle serviceHandle, void* out, u32 size);
249 
250 /**
251  * @brief Gets the SDMC speed info
252  * @param out Buffer to output the speed info to.
253  */
255 
256 /**
257  * @brief Gets the NAND speed info
258  * @param out Buffer to output the speed info to.
259  */
261 
262 /**
263  * @brief Gets the SDMC log
264  * @param out Buffer to output the log to.
265  * @param size Size of buffer.
266  */
267 Result FSPXI_GetSdmcLog(Handle serviceHandle, void* out, u32 size);
268 
269 /**
270  * @brief Gets the NAND log
271  * @param out Buffer to output the log to.
272  * @param size Size of buffer.
273  */
274 Result FSPXI_GetNandLog(Handle serviceHandle, void* out, u32 size);
275 
276 /// Clears the SDMC log
278 
279 /// Clears the NAND log
281 
282 /**
283  * @brief Gets whether a card is inserted.
284  * @param inserted Pointer to output the insertion status to.
285  */
286 Result FSPXI_CardSlotIsInserted(Handle serviceHandle, bool* inserted);
287 
288 /**
289  * @brief Powers on the card slot.
290  * @param status Pointer to output the power status to.
291  */
292 Result FSPXI_CardSlotPowerOn(Handle serviceHandle, bool* status);
293 
294 /**
295  * @brief Powers off the card slot.
296  * @param status Pointer to output the power status to.
297  */
298 Result FSPXI_CardSlotPowerOff(Handle serviceHandle, bool* status);
299 
300 /**
301  * @brief Gets the card's power status.
302  * @param status Pointer to output the power status to.
303  */
304 Result FSPXI_CardSlotGetCardIFPowerStatus(Handle serviceHandle, bool* status);
305 
306 /**
307  * @brief Executes a CARDNOR direct command.
308  * @param commandId ID of the command.
309  */
310 Result FSPXI_CardNorDirectCommand(Handle serviceHandle, u8 commandId);
311 
312 /**
313  * @brief Executes a CARDNOR direct command with an address.
314  * @param commandId ID of the command.
315  * @param address Address to provide.
316  */
317 Result FSPXI_CardNorDirectCommandWithAddress(Handle serviceHandle, u8 commandId, u32 address);
318 
319 /**
320  * @brief Executes a CARDNOR direct read.
321  * @param commandId ID of the command.
322  * @param size Size of the output buffer.
323  * @param output Output buffer.
324  */
325 Result FSPXI_CardNorDirectRead(Handle serviceHandle, u8 commandId, u32 size, void* output);
326 
327 /**
328  * @brief Executes a CARDNOR direct read with an address.
329  * @param commandId ID of the command.
330  * @param address Address to provide.
331  * @param size Size of the output buffer.
332  * @param output Output buffer.
333  */
334 Result FSPXI_CardNorDirectReadWithAddress(Handle serviceHandle, u8 commandId, u32 address, u32 size, void* output);
335 
336 /**
337  * @brief Executes a CARDNOR direct write.
338  * @param commandId ID of the command.
339  * @param size Size of the input buffer.
340  * @param output Input buffer.
341  * @remark Stubbed in latest firmware, since ?.?.?
342  */
343 Result FSPXI_CardNorDirectWrite(Handle serviceHandle, u8 commandId, u32 size, const void* input);
344 
345 /**
346  * @brief Executes a CARDNOR direct write with an address.
347  * @param commandId ID of the command.
348  * @param address Address to provide.
349  * @param size Size of the input buffer.
350  * @param input Input buffer.
351  */
352 Result FSPXI_CardNorDirectWriteWithAddress(Handle serviceHandle, u8 commandId, u32 address, u32 size, const void* input);
353 
354 /**
355  * @brief Executes a CARDNOR 4xIO direct read.
356  * @param commandId ID of the command.
357  * @param address Address to provide.
358  * @param size Size of the output buffer.
359  * @param output Output buffer.
360  */
361 Result FSPXI_CardNorDirectRead_4xIO(Handle serviceHandle, u8 commandId, u32 address, u32 size, void* output);
362 
363 /**
364  * @brief Executes a CARDNOR direct CPU write without verify.
365  * @param address Address to provide.
366  * @param size Size of the input buffer.
367  * @param output Input buffer.
368  */
369 Result FSPXI_CardNorDirectCpuWriteWithoutVerify(Handle serviceHandle, u32 address, u32 size, const void* input);
370 
371 /**
372  * @brief Executes a CARDNOR direct sector erase without verify.
373  * @param address Address to provide.
374  */
376 
377 /**
378  * @brief Gets an NCCH's product info
379  * @param info Pointer to output the product info to.
380  * @param archive Open NCCH content archive
381  */
382 Result FSPXI_GetProductInfo(Handle serviceHandle, FS_ProductInfo* info, FSPXI_Archive archive);
383 
384 /**
385  * @brief Sets the CARDSPI baud rate.
386  * @param baudRate Baud rate to set.
387  */
389 
390 /**
391  * @brief Sets the CARDSPI bus mode.
392  * @param busMode Bus mode to set.
393  */
395 
396 /**
397  * @brief Sends initialization info to ARM9
398  * @param unk FS sends *(0x1FF81086)
399  */
401 
402 /**
403  * @brief Creates ext save data.
404  * @param info Info of the save data.
405  */
407 
408 /**
409  * @brief Deletes ext save data.
410  * @param info Info of the save data.
411  */
413 
414 /**
415  * @brief Enumerates ext save data.
416  * @param idsWritten Pointer to output the number of IDs written to.
417  * @param idsSize Size of the IDs buffer.
418  * @param mediaType Media type to enumerate over.
419  * @param idSize Size of each ID element.
420  * @param shared Whether to enumerate shared ext save data.
421  * @param ids Pointer to output IDs to.
422  */
423 Result FSPXI_EnumerateExtSaveData(Handle serviceHandle, u32* idsWritten, u32 idsSize, FS_MediaType mediaType, u32 idSize, bool shared, u8* ids);
424 
425 /**
426  * @brief Gets a special content's index.
427  * @param index Pointer to output the index to.
428  * @param mediaType Media type of the special content.
429  * @param programId Program ID owning the special content.
430  * @param type Type of special content.
431  */
432 Result FSPXI_GetSpecialContentIndex(Handle serviceHandle, u16* index, FS_MediaType mediaType, u64 programId, FS_SpecialContentType type);
433 
434 /**
435  * @brief Gets the legacy ROM header of a program.
436  * @param mediaType Media type of the program.
437  * @param programId ID of the program.
438  * @param header Pointer to output the legacy ROM header to. (size = 0x3B4)
439  */
440 Result FSPXI_GetLegacyRomHeader(Handle serviceHandle, FS_MediaType mediaType, u64 programId, void* header);
441 
442 /**
443  * @brief Gets the legacy banner data of a program.
444  * @param mediaType Media type of the program.
445  * @param programId ID of the program.
446  * @param banner Pointer to output the legacy banner data to. (size = 0x23C0)
447  * @param unk Unknown. Always 1?
448  */
449 Result FSPXI_GetLegacyBannerData(Handle serviceHandle, FS_MediaType mediaType, u64 programId, void* banner, u8 unk);
450 
451 /**
452  * @brief Formats the CARDNOR device.
453  * @param unk Unknown. Transaction?
454  */
456 
457 /// Deletes the 3DS SDMC root.
459 
460 /// Deletes all ext save data on the NAND.
462 
463 /// Initializes the CTR file system.
465 
466 /// Creates the FS seed.
468 
469 /**
470  * @brief Gets the CTR SDMC root path.
471  * @param out Pointer to output the root path to.
472  * @param length Length of the output buffer in bytes.
473  */
474 Result FSPXI_GetSdmcCtrRootPath(Handle serviceHandle, u16* out, u32 length);
475 
476 /**
477  * @brief Gets an archive's resource information.
478  * @param archiveResource Pointer to output the archive resource information to.
479  * @param mediaType System media type to check.
480  */
481 Result FSPXI_GetArchiveResource(Handle serviceHandle, FS_ArchiveResource* archiveResource, FS_SystemMediaType mediaType);
482 
483 /**
484  * @brief Exports the integrity verification seed.
485  * @param seed Pointer to output the seed to.
486  */
488 
489 /**
490  * @brief Imports an integrity verification seed.
491  * @param seed Seed to import.
492  */
494 
495 /**
496  * @brief Gets the legacy sub banner data of a program.
497  * @param bannerSize Size of the banner.
498  * @param mediaType Media type of the program.
499  * @param programId ID of the program.
500  * @param header Pointer to output the legacy sub banner data to.
501  */
502 Result FSPXI_GetLegacySubBannerData(Handle serviceHandle, u32 bannerSize, FS_MediaType mediaType, u64 programId, void* banner);
503 
504 /**
505  * @brief Generates random bytes. Uses same code as PSPXI_GenerateRandomBytes
506  * @param buf Buffer to output random bytes to.
507  * @param size Size of buffer.
508  */
509 Result FSPXI_GenerateRandomBytes(Handle serviceHandle, void* buffer, u32 size);
510 
511 /**
512  * @brief Gets the last modified time of a file in an archive.
513  * @param archive The archive that contains the file.
514  * @param out The pointer to write the timestamp to.
515  * @param path The UTF-16 path of the file.
516  * @param size The size of the path.
517  */
518 Result FSPXI_GetFileLastModified(Handle serviceHandle, FSPXI_Archive archive, u64* out, const u16* path, u32 size);
519 
520 /**
521  * @brief Reads from a special file.
522  * @param bytesRead Pointer to output the number of bytes read to.
523  * @param fileOffset Offset of the file.
524  * @param size Size of the buffer.
525  * @param data Buffer to read to.
526  */
527 Result FSPXI_ReadSpecialFile(Handle serviceHandle, u32* bytesRead, u64 fileOffset, u32 size, void* data);
528 
529 /**
530  * @brief Gets the size of a special file.
531  * @param fileSize Pointer to output the size to.
532  */
533 Result FSPXI_GetSpecialFileSize(Handle serviceHandle, u64* fileSize);
534 
535 /**
536  * @brief Initiates a device move as the source device.
537  * @param context Pointer to output the context to.
538  */
540 
541 /**
542  * @brief Initiates a device move as the destination device.
543  * @param context Context to use.
544  * @param clear Whether to clear the device's data first.
545  */
547 
548 /**
549  * @brief Reads data and stores SHA256 hashes of blocks
550  * @param file File to read from.
551  * @param bytesRead Pointer to output the number of read bytes to.
552  * @param offset Offset to read from.
553  * @param readBuffer Pointer to store read data in.
554  * @param readBufferSize Size of readBuffer.
555  * @param hashtable Pointer to store SHA256 hashes in.
556  * @param hashtableSize Size of hashtable.
557  * @param unk Unknown. Always 0x00001000? Possibly block size?
558  */
559 Result FSPXI_ReadFileSHA256(Handle serviceHandle, FSPXI_File file, u32* bytesRead, u64 offset, void* readBuffer, u32 readBufferSize, void* hashtable, u32 hashtableSize, u32 unk);
560 
561 /**
562  * @brief Assumedly writes data and stores SHA256 hashes of blocks
563  * @param file File to write to.
564  * @param bytesWritten Pointer to output the number of written bytes to.
565  * @param offset Offset to write to.
566  * @param writeBuffer Buffer to write from.
567  * @param writeBufferSize Size of writeBuffer.
568  * @param hashtable Pointer to store SHA256 hashes in.
569  * @param hashtableSize Size of hashtable
570  * @param unk1 Unknown. Might match with ReadFileSHA256's unknown?
571  * @param unk2 Unknown. Might match with ReadFileSHA256's unknown?
572  */
573 Result FSPXI_WriteFileSHA256(Handle serviceHandle, FSPXI_File file, u32* bytesWritten, u64 offset, const void* writeBuffer, u32 writeBufferSize, void* hashtable, u32 hashtableSize, u32 unk1, u32 unk2);
574 
575 /**
576  * @brief Configures CTRCARD latency emulation.
577  * @param latency Latency to apply.
578  */
580 
581 /**
582  * @brief Sets the file system priority.
583  * @param priority Priority to set.
584  */
585 Result FSPXI_SetPriority(Handle serviceHandle, u32 priority);
586 
587 /**
588  * @brief Toggles cleaning up invalid save data.
589  * @param enable Whether to enable cleaning up invalid save data.
590  */
592 
593 /**
594  * @brief Enumerates system save data.
595  * @param idsWritten Pointer to output the number of IDs written to.
596  * @param idsSize Size of the IDs buffer.
597  * @param ids Pointer to output IDs to.
598  */
599 Result FSPXI_EnumerateSystemSaveData(Handle serviceHandle, u32* idsWritten, u32 idsSize, u32* ids);
600 
601 /**
602  * @brief Reads the NAND report.
603  * @param unk Unknown
604  * @param buffer Buffer to write the report to.
605  * @param size Size of buffer
606  */
607 Result FSPXI_ReadNandReport(Handle serviceHandle, void* buffer, u32 size, u32 unk);
608 
609 /**
610  * @brief Unknown command 0x56
611  * @remark Called by FSUSER_ControlArchive with ArchiveAction 0x789D
612  */
613 Result FSPXI_Unknown0x56(Handle serviceHandle, u32 out[4], FS_Archive archive, FS_Path path);
Filesystem Services.
FS_ArchiveID
Archive IDs.
Definition: fs.h:52
FS_MediaType
Media types.
Definition: fs.h:35
u64 FS_Archive
Filesystem archive handle, providing access to a filesystem's contents.
Definition: fs.h:247
FS_CardSpiBusMode
Card SPI bus mode.
Definition: fs.h:108
FS_CardType
Definition: fs.h:122
FS_SystemMediaType
System media types.
Definition: fs.h:43
FS_SpecialContentType
Card SPI bus mode.
Definition: fs.h:115
FS_CardSpiBaudRate
Card SPI baud rate.
Definition: fs.h:97
Result FSPXI_WriteFileSHA256(Handle serviceHandle, FSPXI_File file, u32 *bytesWritten, u64 offset, const void *writeBuffer, u32 writeBufferSize, void *hashtable, u32 hashtableSize, u32 unk1, u32 unk2)
Assumedly writes data and stores SHA256 hashes of blocks.
Result FSPXI_CalculateFileHashSHA256(Handle serviceHandle, FSPXI_File file, void *buffer, u32 size)
Calculate SHA256 of a file.
Result FSPXI_DeleteSdmcRoot(Handle serviceHandle)
Deletes the 3DS SDMC root.
Result FSPXI_InitializeCtrFilesystem(Handle serviceHandle)
Initializes the CTR file system.
Result FSPXI_GetNandSpeedInfo(Handle serviceHandle, FS_SdMmcSpeedInfo *out)
Gets the NAND speed info.
Result FSPXI_ClearSdmcLog(Handle serviceHandle)
Clears the SDMC log.
Result FSPXI_CardNorDirectRead_4xIO(Handle serviceHandle, u8 commandId, u32 address, u32 size, void *output)
Executes a CARDNOR 4xIO direct read.
Result FSPXI_IsSdmcWritable(Handle serviceHandle, bool *out)
Gets whether PXIFS0 can write to the SD.
Result FSPXI_DeleteFile(Handle serviceHandle, FSPXI_Archive archive, FS_Path path)
Deletes a file.
Result FSPXI_GetSdmcCtrRootPath(Handle serviceHandle, u16 *out, u32 length)
Gets the CTR SDMC root path.
Result FSPXI_GetLegacySubBannerData(Handle serviceHandle, u32 bannerSize, FS_MediaType mediaType, u64 programId, void *banner)
Gets the legacy sub banner data of a program.
Result FSPXI_OpenFile(Handle serviceHandle, FSPXI_File *out, FSPXI_Archive archive, FS_Path path, u32 flags, u32 attributes)
Opens a file.
Result FSPXI_HasDirectory(Handle serviceHandle, FSPXI_Archive archive, bool *out, FS_Path path)
Checks if the archive contains a directory at path.
Result FSPXI_ReadSpecialFile(Handle serviceHandle, u32 *bytesRead, u64 fileOffset, u32 size, void *data)
Reads from a special file.
Result FSPXI_SendInitializeInfoTo9(Handle serviceHandle, u8 unk)
Sends initialization info to ARM9.
Result FSPXI_CloseDirectory(Handle serviceHandle, FSPXI_Directory directory)
Close a directory.
Result FSPXI_CreateFile(Handle serviceHandle, FSPXI_Archive archive, FS_Path path, u32 attributes, u64 fileSize)
Creates a file.
Result FSPXI_EnumerateSystemSaveData(Handle serviceHandle, u32 *idsWritten, u32 idsSize, u32 *ids)
Enumerates system save data.
Result FSPXI_GetSdmcSpeedInfo(Handle serviceHandle, FS_SdMmcSpeedInfo *out)
Gets the SDMC speed info.
Result FSPXI_CardSlotIsInserted(Handle serviceHandle, bool *inserted)
Gets whether a card is inserted.
Result FSPXI_GetNandLog(Handle serviceHandle, void *out, u32 size)
Gets the NAND log.
Result FSPXI_GetArchiveResource(Handle serviceHandle, FS_ArchiveResource *archiveResource, FS_SystemMediaType mediaType)
Gets an archive's resource information.
Result FSPXI_ReadDirectory(Handle serviceHandle, FSPXI_Directory directory, u32 *entriesRead, u32 entryCount, FS_DirectoryEntry *entries)
Reads one or more directory entries.
Result FSPXI_GetLegacyBannerData(Handle serviceHandle, FS_MediaType mediaType, u64 programId, void *banner, u8 unk)
Gets the legacy banner data of a program.
Result FSPXI_GetNandArchiveResource(Handle serviceHandle, FS_ArchiveResource *out)
Gets the NAND archive resource information.
Result FSPXI_GetSpecialFileSize(Handle serviceHandle, u64 *fileSize)
Gets the size of a special file.
Result FSPXI_CardNorDirectWriteWithAddress(Handle serviceHandle, u8 commandId, u32 address, u32 size, const void *input)
Executes a CARDNOR direct write with an address.
Result FSPXI_CloseArchive(Handle serviceHandle, FSPXI_Archive archive)
Close an archive.
Result FSPXI_FormatCardNorDevice(Handle serviceHandle, u32 unk)
Formats the CARDNOR device.
Result FSPXI_ClearNandLog(Handle serviceHandle)
Clears the NAND log.
Result FSPXI_DeleteDirectory(Handle serviceHandle, FSPXI_Archive archive, FS_Path path)
Deletes a directory.
Result FSPXI_CardSlotPowerOff(Handle serviceHandle, bool *status)
Powers off the card slot.
Result FSPXI_GetNandCid(Handle serviceHandle, void *out, u32 size)
Gets the NAND CID.
Result FSPXI_SetCtrCardLatencyParameter(Handle serviceHandle, u64 latency)
Configures CTRCARD latency emulation.
Result FSPXI_RenameDirectory(Handle serviceHandle, FSPXI_Archive srcArchive, FS_Path srcPath, FSPXI_Archive dstArchive, FS_Path dstPath)
Renames a directory.
Result FSPXI_CloseFile(Handle serviceHandle, FSPXI_File file)
Close a file.
Result FSPXI_DeleteExtSaveData(Handle serviceHandle, FS_ExtSaveDataInfo info)
Deletes ext save data.
Result FSPXI_SetPriority(Handle serviceHandle, u32 priority)
Sets the file system priority.
Result FSPXI_GetCardType(Handle serviceHandle, FS_CardType *out)
Gets the inserted card type.
Result FSPXI_ExportIntegrityVerificationSeed(Handle serviceHandle, FS_IntegrityVerificationSeed *seed)
Exports the integrity verification seed.
Result FSPXI_CreateExtSaveData(Handle serviceHandle, FS_ExtSaveDataInfo info)
Creates ext save data.
Result FSPXI_GetSdmcFatFsError(Handle serviceHandle, u32 *out)
Gets the error code from the SDMC FatFS driver.
Result FSPXI_CreateSeed(Handle serviceHandle)
Creates the FS seed.
Result FSPXI_SetFileSize(Handle serviceHandle, FSPXI_File file, u64 size)
Set size of a file.
Result FSPXI_CreateDirectory(Handle serviceHandle, FSPXI_Archive archive, FS_Path path, u32 attributes)
Creates a directory.
Result FSPXI_WriteFile(Handle serviceHandle, FSPXI_File file, u32 *bytesWritten, u64 offset, const void *buffer, u32 size, u32 flags)
Writes to a file.
Result FSPXI_OpenDirectory(Handle serviceHandle, FSPXI_Directory *out, FSPXI_Archive archive, FS_Path path)
Opens a directory.
Result FSPXI_ReadFile(Handle serviceHandle, FSPXI_File file, u32 *bytesRead, u64 offset, void *buffer, u32 size)
Reads from a file.
Result FSPXI_CardNorDirectSectorEraseWithoutVerify(Handle serviceHandle, u32 address)
Executes a CARDNOR direct sector erase without verify.
Result FSPXI_GetSdmcArchiveResource(Handle serviceHandle, FS_ArchiveResource *out)
Gets the SDMC archive resource information.
Result FSPXI_GetSpecialContentIndex(Handle serviceHandle, u16 *index, FS_MediaType mediaType, u64 programId, FS_SpecialContentType type)
Gets a special content's index.
Result FSPXI_CalcSavegameMAC(Handle serviceHandle, FSPXI_File file, const void *inBuffer, u32 inSize, void *outBuffer, u32 outSize)
Calculates the MAC used in a DISA/DIFF header?
Result FSPXI_CardNorDirectCommand(Handle serviceHandle, u8 commandId)
Executes a CARDNOR direct command.
Result FSPXI_OpenArchive(Handle serviceHandle, FSPXI_Archive *archive, FS_ArchiveID archiveID, FS_Path path)
Opens an archive.
Result FSPXI_IsSdmcDetected(Handle serviceHandle, bool *out)
Gets whether PXIFS0 detects the SD.
Result FSPXI_GetSdmcLog(Handle serviceHandle, void *out, u32 size)
Gets the SDMC log.
Result FSPXI_CardNorDirectReadWithAddress(Handle serviceHandle, u8 commandId, u32 address, u32 size, void *output)
Executes a CARDNOR direct read with an address.
Result FSPXI_StartDeviceMoveAsSource(Handle serviceHandle, FS_DeviceMoveContext *context)
Initiates a device move as the source device.
Result FSPXI_CardSlotPowerOn(Handle serviceHandle, bool *status)
Powers on the card slot.
Result FSPXI_GetProductInfo(Handle serviceHandle, FS_ProductInfo *info, FSPXI_Archive archive)
Gets an NCCH's product info.
Result FSPXI_GetFileSize(Handle serviceHandle, FSPXI_File file, u64 *size)
Get size of a file.
Result FSPXI_CommitSaveData(Handle serviceHandle, FSPXI_Archive archive, u32 id)
Commits an archive's save data.
Result FSPXI_ReadNandReport(Handle serviceHandle, void *buffer, u32 size, u32 unk)
Reads the NAND report.
Result FSPXI_Unknown0x17(Handle serviceHandle, FSPXI_Archive archive, bool *out)
Unknown 0x17.
Result FSPXI_CardNorDirectWrite(Handle serviceHandle, u8 commandId, u32 size, const void *input)
Executes a CARDNOR direct write.
Result FSPXI_SetCardSpiBaudrate(Handle serviceHandle, FS_CardSpiBaudRate baudRate)
Sets the CARDSPI baud rate.
Result FSPXI_ReadFileSHA256(Handle serviceHandle, FSPXI_File file, u32 *bytesRead, u64 offset, void *readBuffer, u32 readBufferSize, void *hashtable, u32 hashtableSize, u32 unk)
Reads data and stores SHA256 hashes of blocks.
Result FSPXI_CardNorDirectRead(Handle serviceHandle, u8 commandId, u32 size, void *output)
Executes a CARDNOR direct read.
Result FSPXI_SetCardSpiBusMode(Handle serviceHandle, FS_CardSpiBusMode busMode)
Sets the CARDSPI bus mode.
Result FSPXI_RenameFile(Handle serviceHandle, FSPXI_Archive srcArchive, FS_Path srcPath, FSPXI_Archive dstArchive, FS_Path dstPath)
Renames a file.
Result FSPXI_EnumerateExtSaveData(Handle serviceHandle, u32 *idsWritten, u32 idsSize, FS_MediaType mediaType, u32 idSize, bool shared, u8 *ids)
Enumerates ext save data.
Result FSPXI_GetFileLastModified(Handle serviceHandle, FSPXI_Archive archive, u64 *out, const u16 *path, u32 size)
Gets the last modified time of a file in an archive.
Result FSPXI_CardSlotGetCardIFPowerStatus(Handle serviceHandle, bool *status)
Gets the card's power status.
Result FSPXI_GenerateRandomBytes(Handle serviceHandle, void *buffer, u32 size)
Generates random bytes.
Result FSPXI_CardNorDirectCpuWriteWithoutVerify(Handle serviceHandle, u32 address, u32 size, const void *input)
Executes a CARDNOR direct CPU write without verify.
Result FSPXI_CardNorDirectCommandWithAddress(Handle serviceHandle, u8 commandId, u32 address)
Executes a CARDNOR direct command with an address.
Result FSPXI_GetSdmcCid(Handle serviceHandle, void *out, u32 size)
Gets the SDMC CID.
Result FSPXI_HasFile(Handle serviceHandle, FSPXI_Archive archive, bool *out, FS_Path path)
Checks if the archive contains a file at path.
Result FSPXI_StartDeviceMoveAsDestination(Handle serviceHandle, FS_DeviceMoveContext context, bool clear)
Initiates a device move as the destination device.
Result FSPXI_DeleteAllExtSaveDataOnNand(Handle serviceHandle)
Deletes all ext save data on the NAND.
Result FSPXI_ImportIntegrityVerificationSeed(Handle serviceHandle, const FS_IntegrityVerificationSeed *seed)
Imports an integrity verification seed.
Result FSPXI_Unknown0x56(Handle serviceHandle, u32 out[4], FS_Archive archive, FS_Path path)
Unknown command 0x56.
Result FSPXI_SwitchCleanupInvalidSaveData(Handle serviceHandle, bool enable)
Toggles cleaning up invalid save data.
Result FSPXI_GetLegacyRomHeader(Handle serviceHandle, FS_MediaType mediaType, u64 programId, void *header)
Gets the legacy ROM header of a program.
Archive resource information.
Definition: fs.h:174
Device move context.
Definition: fs.h:225
Directory entry.
Definition: fs.h:162
Ext save data information.
Definition: fs.h:206
Integrity verification seed.
Definition: fs.h:199
Filesystem path data, detailing the specific target of an operation.
Definition: fs.h:232
Product information.
Definition: fs.h:191
SDMC/NAND speed information.
Definition: fs.h:240
Various system types.
uint64_t u64
64-bit unsigned integer
Definition: types.h:24
uint8_t u8
would be nice if newlib had this already
Definition: types.h:21
u32 Handle
Resource handle.
Definition: types.h:41
s32 Result
Function result.
Definition: types.h:42
uint16_t u16
16-bit unsigned integer
Definition: types.h:22
uint32_t u32
32-bit unsigned integer
Definition: types.h:23