Make changes as requested by @fincs

This commit is contained in:
piepie62 2020-04-30 15:18:22 -04:00
parent 8a68d99f0a
commit 06c1624f4c
4 changed files with 195 additions and 757 deletions

View File

@ -135,7 +135,7 @@ typedef enum
{
ARCHIVE_ACTION_COMMIT_SAVE_DATA = 0, ///< Commits save data changes. No inputs/outputs.
ARCHIVE_ACTION_GET_TIMESTAMP = 1, ///< Retrieves a file's last-modified timestamp. In: "u16*, UTF-16 Path", Out: "u64, Time Stamp".
ARCHIVE_ACTION_UNKNOWN = 0x789D, //< Unknown action; calls FSPXI command 0x56. In: "FS_Path instance", Out: "u32[4], Unknown"
ARCHIVE_ACTION_UNKNOWN = 0x789D, //< Unknown action; calls FSPXI command 0x56. In: "FS_Path instance", Out: "u32[4], Unknown"
} FS_ArchiveAction;
/// Secure save control actions.
@ -538,7 +538,7 @@ Result FSUSER_CardNorDirectCommandWithAddress(u8 commandId, u32 address);
* @param size Size of the output buffer.
* @param output Output buffer.
*/
Result FSUSER_CardNorDirectRead(u8 commandId, u32 size, u8* output);
Result FSUSER_CardNorDirectRead(u8 commandId, u32 size, void* output);
/**
* @brief Executes a CARDNOR direct read with an address.
@ -547,7 +547,7 @@ Result FSUSER_CardNorDirectRead(u8 commandId, u32 size, u8* output);
* @param size Size of the output buffer.
* @param output Output buffer.
*/
Result FSUSER_CardNorDirectReadWithAddress(u8 commandId, u32 address, u32 size, u8* output);
Result FSUSER_CardNorDirectReadWithAddress(u8 commandId, u32 address, u32 size, void* output);
/**
* @brief Executes a CARDNOR direct write.
@ -555,7 +555,7 @@ Result FSUSER_CardNorDirectReadWithAddress(u8 commandId, u32 address, u32 size,
* @param size Size of the input buffer.
* @param output Input buffer.
*/
Result FSUSER_CardNorDirectWrite(u8 commandId, u32 size, u8* input);
Result FSUSER_CardNorDirectWrite(u8 commandId, u32 size, const void* input);
/**
* @brief Executes a CARDNOR direct write with an address.
@ -564,7 +564,7 @@ Result FSUSER_CardNorDirectWrite(u8 commandId, u32 size, u8* input);
* @param size Size of the input buffer.
* @param input Input buffer.
*/
Result FSUSER_CardNorDirectWriteWithAddress(u8 commandId, u32 address, u32 size, u8* input);
Result FSUSER_CardNorDirectWriteWithAddress(u8 commandId, u32 address, u32 size, const void* input);
/**
* @brief Executes a CARDNOR 4xIO direct read.
@ -573,7 +573,7 @@ Result FSUSER_CardNorDirectWriteWithAddress(u8 commandId, u32 address, u32 size,
* @param size Size of the output buffer.
* @param output Output buffer.
*/
Result FSUSER_CardNorDirectRead_4xIO(u8 commandId, u32 address, u32 size, u8* output);
Result FSUSER_CardNorDirectRead_4xIO(u8 commandId, u32 address, u32 size, void* output);
/**
* @brief Executes a CARDNOR direct CPU write without verify.
@ -581,7 +581,7 @@ Result FSUSER_CardNorDirectRead_4xIO(u8 commandId, u32 address, u32 size, u8* ou
* @param size Size of the input buffer.
* @param output Input buffer.
*/
Result FSUSER_CardNorDirectCpuWriteWithoutVerify(u32 address, u32 size, u8* input);
Result FSUSER_CardNorDirectCpuWriteWithoutVerify(u32 address, u32 size, const void* input);
/**
* @brief Executes a CARDNOR direct sector erase without verify.
@ -633,7 +633,7 @@ Result FSUSER_GetSpecialContentIndex(u16* index, FS_MediaType mediaType, u64 pro
* @param programId ID of the program.
* @param header Pointer to output the legacy ROM header to. (size = 0x3B4)
*/
Result FSUSER_GetLegacyRomHeader(FS_MediaType mediaType, u64 programId, u8* header);
Result FSUSER_GetLegacyRomHeader(FS_MediaType mediaType, u64 programId, void* header);
/**
* @brief Gets the legacy banner data of a program.
@ -641,7 +641,7 @@ Result FSUSER_GetLegacyRomHeader(FS_MediaType mediaType, u64 programId, u8* head
* @param programId ID of the program.
* @param header Pointer to output the legacy banner data to. (size = 0x23C0)
*/
Result FSUSER_GetLegacyBannerData(FS_MediaType mediaType, u64 programId, u8* banner);
Result FSUSER_GetLegacyBannerData(FS_MediaType mediaType, u64 programId, void* banner);
/**
* @brief Checks a process's authority to access a save data archive.
@ -698,7 +698,7 @@ Result FSUSER_GetFormatInfo(u32* totalSize, u32* directories, u32* files, bool*
* @param programId ID of the program.
* @param header Pointer to output the legacy ROM header to.
*/
Result FSUSER_GetLegacyRomHeader2(u32 headerSize, FS_MediaType mediaType, u64 programId, u8* header);
Result FSUSER_GetLegacyRomHeader2(u32 headerSize, FS_MediaType mediaType, u64 programId, void* header);
/**
* @brief Gets the CTR SDMC root path.
@ -746,7 +746,7 @@ Result FSUSER_FormatSaveData(FS_ArchiveID archiveId, FS_Path path, u32 blocks, u
* @param programId ID of the program.
* @param header Pointer to output the legacy sub banner data to.
*/
Result FSUSER_GetLegacySubBannerData(u32 bannerSize, FS_MediaType mediaType, u64 programId, u8* banner);
Result FSUSER_GetLegacySubBannerData(u32 bannerSize, FS_MediaType mediaType, u64 programId, void* banner);
/**
* @brief Hashes the given data and outputs a SHA256 hash.
@ -763,7 +763,7 @@ Result FSUSER_UpdateSha256Context(const void* data, u32 inputSize, u8* hash);
* @param size Size of the buffer.
* @param data Buffer to read to.
*/
Result FSUSER_ReadSpecialFile(u32* bytesRead, u64 fileOffset, u32 size, u8* data);
Result FSUSER_ReadSpecialFile(u32* bytesRead, u64 fileOffset, u32 size, void* data);
/**
* @brief Gets the size of a special file.

View File

@ -11,48 +11,6 @@ typedef u64 FSPXI_Archive;
typedef u64 FSPXI_File;
typedef u64 FSPXI_Directory;
#define DEFINE_SERVICE_METHOD(servname, funcname, ...) Result servname ## _ ## funcname(__VA_ARGS__)
#define DEFINE_PXIFS_SERVICE_METHOD(funcname, ...) DEFINE_SERVICE_METHOD(PXIFS0, funcname, __VA_ARGS__); \
DEFINE_SERVICE_METHOD(PXIFS1, funcname, __VA_ARGS__); \
DEFINE_SERVICE_METHOD(PXIFSR, funcname, __VA_ARGS__); \
DEFINE_SERVICE_METHOD(PXIFSB, funcname, __VA_ARGS__)
/**
* @brief Initializes PxiFS0.
* @param servhandle Optional service session handle to use for PxiFS0, if zero srvGetServiceHandle() will be used.
*/
Result pxifs0Init(Handle servhandle);
/// Exits PxiFS0.
void pxifs0Exit(void);
/**
* @brief Initializes PxiFS1.
* @param servhandle Optional service session handle to use for PxiFS1, if zero srvGetServiceHandle() will be used.
*/
Result pxifs1Init(Handle servhandle);
/// Exits PxiFS1.
void pxifs1Exit(void);
/**
* @brief Initializes PxiFSR.
* @param servhandle Optional service session handle to use for PxiFSR, if zero srvGetServiceHandle() will be used.
*/
Result pxifsRInit(Handle servhandle);
/// Exits PxiFSR.
void pxifsRExit(void);
/**
* @brief Initializes PxiFSB.
* @param servhandle Optional service session handle to use for PxiFSB, if zero srvGetServiceHandle() will be used.
*/
Result pxifsBInit(Handle servhandle);
/// Exits PxiFSB.
void pxifsBExit(void);
/**
* @brief Opens a file.
* @param out Pointer to output the file handle to.
@ -61,14 +19,14 @@ void pxifsBExit(void);
* @param flags Flags to open the file with.
* @param attributes Attributes of the file.
*/
DEFINE_PXIFS_SERVICE_METHOD(OpenFile, FSPXI_File* out, FSPXI_Archive archive, FS_Path path, u32 flags, u32 attributes);
Result FSPXI_OpenFile(Handle serviceHandle, FSPXI_File* out, FSPXI_Archive archive, FS_Path path, u32 flags, u32 attributes);
/**
* @brief Deletes a file.
* @param archive Archive containing the file.
* @param path Path of the file.
*/
DEFINE_PXIFS_SERVICE_METHOD(DeleteFile, FSPXI_Archive archive, FS_Path path);
Result FSPXI_DeleteFile(Handle serviceHandle, FSPXI_Archive archive, FS_Path path);
/**
* @brief Renames a file.
@ -77,14 +35,14 @@ DEFINE_PXIFS_SERVICE_METHOD(DeleteFile, FSPXI_Archive archive, FS_Path path);
* @param dstArchive Archive containing the destination file.
* @param dstPath Path of the destination file.
*/
DEFINE_PXIFS_SERVICE_METHOD(RenameFile, FSPXI_Archive srcArchive, FS_Path srcPath, FSPXI_Archive dstArchive, FS_Path dstPath);
Result FSPXI_RenameFile(Handle serviceHandle, FSPXI_Archive srcArchive, FS_Path srcPath, FSPXI_Archive dstArchive, FS_Path dstPath);
/**
* @brief Deletes a directory.
* @param archive Archive containing the directory.
* @param path Path of the directory.
*/
DEFINE_PXIFS_SERVICE_METHOD(DeleteDirectory, FSPXI_Archive archive, FS_Path path);
Result FSPXI_DeleteDirectory(Handle serviceHandle, FSPXI_Archive archive, FS_Path path);
/**
* @brief Creates a file.
@ -93,7 +51,7 @@ DEFINE_PXIFS_SERVICE_METHOD(DeleteDirectory, FSPXI_Archive archive, FS_Path path
* @param attributes Attributes of the file.
* @param size Size of the file.
*/
DEFINE_PXIFS_SERVICE_METHOD(CreateFile, FSPXI_Archive archive, FS_Path path, u32 attributes, u64 fileSize);
Result FSPXI_CreateFile(Handle serviceHandle, FSPXI_Archive archive, FS_Path path, u32 attributes, u64 fileSize);
/**
* @brief Creates a directory.
@ -101,7 +59,7 @@ DEFINE_PXIFS_SERVICE_METHOD(CreateFile, FSPXI_Archive archive, FS_Path path, u32
* @param path Path of the directory.
* @param attributes Attributes of the directory.
*/
DEFINE_PXIFS_SERVICE_METHOD(CreateDirectory, FSPXI_Archive archive, FS_Path path, u32 attributes);
Result FSPXI_CreateDirectory(Handle serviceHandle, FSPXI_Archive archive, FS_Path path, u32 attributes);
/**
* @brief Renames a directory.
@ -110,7 +68,7 @@ DEFINE_PXIFS_SERVICE_METHOD(CreateDirectory, FSPXI_Archive archive, FS_Path path
* @param dstArchive Archive containing the destination directory.
* @param dstPath Path of the destination directory.
*/
DEFINE_PXIFS_SERVICE_METHOD(RenameDirectory, FSPXI_Archive srcArchive, FS_Path srcPath, FSPXI_Archive dstArchive, FS_Path dstPath);
Result FSPXI_RenameDirectory(Handle serviceHandle, FSPXI_Archive srcArchive, FS_Path srcPath, FSPXI_Archive dstArchive, FS_Path dstPath);
/**
* @brief Opens a directory.
@ -118,7 +76,7 @@ DEFINE_PXIFS_SERVICE_METHOD(RenameDirectory, FSPXI_Archive srcArchive, FS_Path s
* @param archive Archive containing the directory.
* @param path Path of the directory.
*/
DEFINE_PXIFS_SERVICE_METHOD(OpenDirectory, FSPXI_Directory* out, FSPXI_Archive archive, FS_Path path);
Result FSPXI_OpenDirectory(Handle serviceHandle, FSPXI_Directory* out, FSPXI_Archive archive, FS_Path path);
/**
* @brief Reads from a file.
@ -128,7 +86,7 @@ DEFINE_PXIFS_SERVICE_METHOD(OpenDirectory, FSPXI_Directory* out, FSPXI_Archive a
* @param buffer Buffer to read to.
* @param size Size of the buffer.
*/
DEFINE_PXIFS_SERVICE_METHOD(ReadFile, FSPXI_File file, u32* bytesRead, u64 offset, void* buffer, u32 size);
Result FSPXI_ReadFile(Handle serviceHandle, FSPXI_File file, u32* bytesRead, u64 offset, void* buffer, u32 size);
/**
* @brief Calculate SHA256 of a file.
@ -136,7 +94,7 @@ DEFINE_PXIFS_SERVICE_METHOD(ReadFile, FSPXI_File file, u32* bytesRead, u64 offse
* @param buffer Buffer to output the hash to.
* @param size Size of the buffer.
*/
DEFINE_PXIFS_SERVICE_METHOD(CalculateFileHashSHA256, FSPXI_File file, u32* buffer, u32 size);
Result FSPXI_CalculateFileHashSHA256(Handle serviceHandle, FSPXI_File file, u32* buffer, u32 size);
/**
* @brief Writes to a file.
@ -147,7 +105,7 @@ DEFINE_PXIFS_SERVICE_METHOD(CalculateFileHashSHA256, FSPXI_File file, u32* buffe
* @param size Size of the buffer.
* @param flags Flags to use when writing.
*/
DEFINE_PXIFS_SERVICE_METHOD(WriteFile, FSPXI_File file, u32* bytesWritten, u64 offset, const void* buffer, u32 size, u32 flags);
Result FSPXI_WriteFile(Handle serviceHandle, FSPXI_File file, u32* bytesWritten, u64 offset, const void* buffer, u32 size, u32 flags);
/**
* @brief Calculates the MAC used in a DISA/DIFF header?
@ -157,27 +115,27 @@ DEFINE_PXIFS_SERVICE_METHOD(WriteFile, FSPXI_File file, u32* bytesWritten, u64 o
* @param outBuffer Buffer to write MAC to.
* @param outSize Size of outBuffer.
*/
DEFINE_PXIFS_SERVICE_METHOD(CalcSavegameMAC, FSPXI_File file, void* inBuffer, u32 inSize, void* outBuffer, u32 outSize);
Result FSPXI_CalcSavegameMAC(Handle serviceHandle, FSPXI_File file, const void* inBuffer, u32 inSize, void* outBuffer, u32 outSize);
/**
* @brief Get size of a file
* @param file File to get the size of.
* @param size Pointer to output size to.
*/
DEFINE_PXIFS_SERVICE_METHOD(GetFileSize, FSPXI_File file, u64* size);
Result FSPXI_GetFileSize(Handle serviceHandle, FSPXI_File file, u64* size);
/**
* @brief Set size of a file
* @param file File to set the size of
* @param size Size to set the file to
*/
DEFINE_PXIFS_SERVICE_METHOD(SetFileSize, FSPXI_File file, u64 size);
Result FSPXI_SetFileSize(Handle serviceHandle, FSPXI_File file, u64 size);
/**
* @brief Close a file
* @param file File to close
*/
DEFINE_PXIFS_SERVICE_METHOD(CloseFile, FSPXI_File file);
Result FSPXI_CloseFile(Handle serviceHandle, FSPXI_File file);
/**
* @brief Reads one or more directory entries.
@ -186,13 +144,13 @@ DEFINE_PXIFS_SERVICE_METHOD(CloseFile, FSPXI_File file);
* @param entryCount Number of entries to read.
* @param entryOut Pointer to output directory entries to.
*/
DEFINE_PXIFS_SERVICE_METHOD(ReadDirectory, FSPXI_Directory directory, u32* entriesRead, u32 entryCount, FS_DirectoryEntry* entries);
Result FSPXI_ReadDirectory(Handle serviceHandle, FSPXI_Directory directory, u32* entriesRead, u32 entryCount, FS_DirectoryEntry* entries);
/**
* @brief Close a directory
* @param directory Directory to close.
*/
DEFINE_PXIFS_SERVICE_METHOD(CloseDirectory, FSPXI_Directory directory);
Result FSPXI_CloseDirectory(Handle serviceHandle, FSPXI_Directory directory);
/**
* @brief Opens an archive.
@ -200,17 +158,17 @@ DEFINE_PXIFS_SERVICE_METHOD(CloseDirectory, FSPXI_Directory directory);
* @param id ID of the archive.
* @param path Path of the archive.
*/
DEFINE_PXIFS_SERVICE_METHOD(OpenArchive, FSPXI_Archive* archive, FS_ArchiveID archiveID, FS_Path path);
Result FSPXI_OpenArchive(Handle serviceHandle, FSPXI_Archive* archive, FS_ArchiveID archiveID, FS_Path path);
/**
* @brief Unknown 0x13
*/
DEFINE_PXIFS_SERVICE_METHOD(0x13, FSPXI_Archive archive, u8* out, FS_Path path);
Result FSPXI_Unknown0x13(Handle serviceHandle, FSPXI_Archive archive, u8* out, FS_Path path);
/**
* @brief Unknown 0x14
*/
DEFINE_PXIFS_SERVICE_METHOD(0x14, FSPXI_Archive archive, u32* out, FS_Path path);
Result FSPXI_Unknown0x14(Handle serviceHandle, FSPXI_Archive archive, u32* out, FS_Path path);
/**
* @brief Commits an archive's save data.
@ -218,139 +176,139 @@ DEFINE_PXIFS_SERVICE_METHOD(0x14, FSPXI_Archive archive, u32* out, FS_Path path)
* @param id Archive action sent by FSUSER_ControlArchive. Must not be 0 or 0x789D
* @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.
*/
DEFINE_PXIFS_SERVICE_METHOD(CommitSaveData, FSPXI_Archive archive, u32 id);
Result FSPXI_CommitSaveData(Handle serviceHandle, FSPXI_Archive archive, u32 id);
/**
* @brief Close an archive
* @param archive Archive to close.
*/
DEFINE_PXIFS_SERVICE_METHOD(CloseArchive, FSPXI_Archive archive);
Result FSPXI_CloseArchive(Handle serviceHandle, FSPXI_Archive archive);
/**
* @brief Unknown 0x17. Appears to be an "is archive handle valid" command?
* @param archive Archive handle to check validity of.
* @param out Pointer to output validity to.
*/
DEFINE_PXIFS_SERVICE_METHOD(0x17, FSPXI_Archive archive, bool* out);
Result FSPXI_Unknown0x17(Handle serviceHandle, FSPXI_Archive archive, bool* out);
/**
* @brief Gets the inserted card type.
* @param out Pointer to output the card type to.
*/
DEFINE_PXIFS_SERVICE_METHOD(GetCardType, FS_CardType* out);
Result FSPXI_GetCardType(Handle serviceHandle, FS_CardType* out);
/**
* @brief Gets the SDMC archive resource information.
* @param out Pointer to output the archive resource information to.
*/
DEFINE_PXIFS_SERVICE_METHOD(GetSdmcArchiveResource, FS_ArchiveResource* out);
Result FSPXI_GetSdmcArchiveResource(Handle serviceHandle, FS_ArchiveResource* out);
/**
* @brief Gets the NAND archive resource information.
* @param out Pointer to output the archive resource information to.
*/
DEFINE_PXIFS_SERVICE_METHOD(GetNandArchiveResource, FS_ArchiveResource* out);
Result FSPXI_GetNandArchiveResource(Handle serviceHandle, FS_ArchiveResource* out);
/**
* @brief Gets the error code from the SDMC FatFS driver
* @param out Pointer to output the error code to
*/
DEFINE_PXIFS_SERVICE_METHOD(GetSdmcFatFsError, u32* out);
Result FSPXI_GetSdmcFatFsError(Handle serviceHandle, u32* out);
/**
* @brief Gets whether PXIFS0 detects the SD
* @param out Pointer to output the detection status to
*/
DEFINE_PXIFS_SERVICE_METHOD(IsSdmcDetected, bool* out);
Result FSPXI_IsSdmcDetected(Handle serviceHandle, bool* out);
/**
* @brief Gets whether PXIFS0 can write to the SD
* @param out Pointer to output the writable status to
*/
DEFINE_PXIFS_SERVICE_METHOD(IsSdmcWritable, bool* out);
Result FSPXI_IsSdmcWritable(Handle serviceHandle, bool* out);
/**
* @brief Gets the SDMC CID
* @param out Buffer to output the CID to.
* @param size Size of buffer.
*/
DEFINE_PXIFS_SERVICE_METHOD(GetSdmcCid, void* out, u32 size);
Result FSPXI_GetSdmcCid(Handle serviceHandle, void* out, u32 size);
/**
* @brief Gets the NAND CID
* @param out Buffer to output the CID to.
* @param size Size of buffer.
*/
DEFINE_PXIFS_SERVICE_METHOD(GetNandCid, void* out, u32 size);
Result FSPXI_GetNandCid(Handle serviceHandle, void* out, u32 size);
/**
* @brief Gets the SDMC speed info
* @param out Buffer to output the speed info to.
*/
DEFINE_PXIFS_SERVICE_METHOD(GetSdmcSpeedInfo, u32* out);
Result FSPXI_GetSdmcSpeedInfo(Handle serviceHandle, u32* out);
/**
* @brief Gets the NAND speed info
* @param out Buffer to output the speed info to.
*/
DEFINE_PXIFS_SERVICE_METHOD(GetNandSpeedInfo, u32* out);
Result FSPXI_GetNandSpeedInfo(Handle serviceHandle, u32* out);
/**
* @brief Gets the SDMC log
* @param out Buffer to output the log to.
* @param size Size of buffer.
*/
DEFINE_PXIFS_SERVICE_METHOD(GetSdmcLog, void* out, u32 size);
Result FSPXI_GetSdmcLog(Handle serviceHandle, void* out, u32 size);
/**
* @brief Gets the NAND log
* @param out Buffer to output the log to.
* @param size Size of buffer.
*/
DEFINE_PXIFS_SERVICE_METHOD(GetNandLog, void* out, u32 size);
Result FSPXI_GetNandLog(Handle serviceHandle, void* out, u32 size);
/// Clears the SDMC log
DEFINE_PXIFS_SERVICE_METHOD(ClearSdmcLog, void);
Result FSPXI_ClearSdmcLog(Handle serviceHandle);
/// Clears the NAND log
DEFINE_PXIFS_SERVICE_METHOD(ClearNandLog, void);
Result FSPXI_ClearNandLog(Handle serviceHandle);
/**
* @brief Gets whether a card is inserted.
* @param inserted Pointer to output the insertion status to.
*/
DEFINE_PXIFS_SERVICE_METHOD(CardSlotIsInserted, bool* inserted);
Result FSPXI_CardSlotIsInserted(Handle serviceHandle, bool* inserted);
/**
* @brief Powers on the card slot.
* @param status Pointer to output the power status to.
*/
DEFINE_PXIFS_SERVICE_METHOD(CardSlotPowerOn, bool* status);
Result FSPXI_CardSlotPowerOn(Handle serviceHandle, bool* status);
/**
* @brief Powers off the card slot.
* @param status Pointer to output the power status to.
*/
DEFINE_PXIFS_SERVICE_METHOD(CardSlotPowerOff, bool* status);
Result FSPXI_CardSlotPowerOff(Handle serviceHandle, bool* status);
/**
* @brief Gets the card's power status.
* @param status Pointer to output the power status to.
*/
DEFINE_PXIFS_SERVICE_METHOD(CardSlotGetCardIFPowerStatus, bool* status);
Result FSPXI_CardSlotGetCardIFPowerStatus(Handle serviceHandle, bool* status);
/**
* @brief Executes a CARDNOR direct command.
* @param commandId ID of the command.
*/
DEFINE_PXIFS_SERVICE_METHOD(CardNorDirectCommand, u8 commandId);
Result FSPXI_CardNorDirectCommand(Handle serviceHandle, u8 commandId);
/**
* @brief Executes a CARDNOR direct command with an address.
* @param commandId ID of the command.
* @param address Address to provide.
*/
DEFINE_PXIFS_SERVICE_METHOD(CardNorDirectCommandWithAddress, u8 commandId, u32 address);
Result FSPXI_CardNorDirectCommandWithAddress(Handle serviceHandle, u8 commandId, u32 address);
/**
* @brief Executes a CARDNOR direct read.
@ -358,7 +316,7 @@ DEFINE_PXIFS_SERVICE_METHOD(CardNorDirectCommandWithAddress, u8 commandId, u32 a
* @param size Size of the output buffer.
* @param output Output buffer.
*/
DEFINE_PXIFS_SERVICE_METHOD(CardNorDirectRead, u8 commandId, u32 size, u8* output);
Result FSPXI_CardNorDirectRead(Handle serviceHandle, u8 commandId, u32 size, void* output);
/**
* @brief Executes a CARDNOR direct read with an address.
@ -367,7 +325,7 @@ DEFINE_PXIFS_SERVICE_METHOD(CardNorDirectRead, u8 commandId, u32 size, u8* outpu
* @param size Size of the output buffer.
* @param output Output buffer.
*/
DEFINE_PXIFS_SERVICE_METHOD(CardNorDirectReadWithAddress, u8 commandId, u32 address, u32 size, u8* output);
Result FSPXI_CardNorDirectReadWithAddress(Handle serviceHandle, u8 commandId, u32 address, u32 size, void* output);
/**
* @brief Executes a CARDNOR direct write.
@ -376,7 +334,7 @@ DEFINE_PXIFS_SERVICE_METHOD(CardNorDirectReadWithAddress, u8 commandId, u32 addr
* @param output Input buffer.
* @remark Stubbed in latest firmware, since ?.?.?
*/
DEFINE_PXIFS_SERVICE_METHOD(CardNorDirectWrite, u8 commandId, u32 size, u8* input);
Result FSPXI_CardNorDirectWrite(Handle serviceHandle, u8 commandId, u32 size, const void* input);
/**
* @brief Executes a CARDNOR direct write with an address.
@ -385,7 +343,7 @@ DEFINE_PXIFS_SERVICE_METHOD(CardNorDirectWrite, u8 commandId, u32 size, u8* inpu
* @param size Size of the input buffer.
* @param input Input buffer.
*/
DEFINE_PXIFS_SERVICE_METHOD(CardNorDirectWriteWithAddress, u8 commandId, u32 address, u32 size, u8* input);
Result FSPXI_CardNorDirectWriteWithAddress(Handle serviceHandle, u8 commandId, u32 address, u32 size, const void* input);
/**
* @brief Executes a CARDNOR 4xIO direct read.
@ -394,7 +352,7 @@ DEFINE_PXIFS_SERVICE_METHOD(CardNorDirectWriteWithAddress, u8 commandId, u32 add
* @param size Size of the output buffer.
* @param output Output buffer.
*/
DEFINE_PXIFS_SERVICE_METHOD(CardNorDirectRead_4xIO, u8 commandId, u32 address, u32 size, u8* output);
Result FSPXI_CardNorDirectRead_4xIO(Handle serviceHandle, u8 commandId, u32 address, u32 size, void* output);
/**
* @brief Executes a CARDNOR direct CPU write without verify.
@ -402,50 +360,50 @@ DEFINE_PXIFS_SERVICE_METHOD(CardNorDirectRead_4xIO, u8 commandId, u32 address, u
* @param size Size of the input buffer.
* @param output Input buffer.
*/
DEFINE_PXIFS_SERVICE_METHOD(CardNorDirectCpuWriteWithoutVerify, u32 address, u32 size, u8* input);
Result FSPXI_CardNorDirectCpuWriteWithoutVerify(Handle serviceHandle, u32 address, u32 size, const void* input);
/**
* @brief Executes a CARDNOR direct sector erase without verify.
* @param address Address to provide.
*/
DEFINE_PXIFS_SERVICE_METHOD(CardNorDirectSectorEraseWithoutVerify, u32 address);
Result FSPXI_CardNorDirectSectorEraseWithoutVerify(Handle serviceHandle, u32 address);
/**
* @brief Gets an NCCH's product info
* @param info Pointer to output the product info to.
* @param archive Open NCCH content archive
*/
DEFINE_PXIFS_SERVICE_METHOD(GetProductInfo, FS_ProductInfo* info, FSPXI_Archive archive);
Result FSPXI_GetProductInfo(Handle serviceHandle, FS_ProductInfo* info, FSPXI_Archive archive);
/**
* @brief Sets the CARDSPI baud rate.
* @param baudRate Baud rate to set.
*/
DEFINE_PXIFS_SERVICE_METHOD(SetCardSpiBaudrate, FS_CardSpiBaudRate baudRate);
Result FSPXI_SetCardSpiBaudrate(Handle serviceHandle, FS_CardSpiBaudRate baudRate);
/**
* @brief Sets the CARDSPI bus mode.
* @param busMode Bus mode to set.
*/
DEFINE_PXIFS_SERVICE_METHOD(SetCardSpiBusMode, FS_CardSpiBusMode busMode);
Result FSPXI_SetCardSpiBusMode(Handle serviceHandle, FS_CardSpiBusMode busMode);
/**
* @brief Sends initialization info to ARM9
* @param unk FS sends *(0x1FF81086)
*/
DEFINE_PXIFS_SERVICE_METHOD(SendInitializeInfoTo9, u8 unk);
Result FSPXI_SendInitializeInfoTo9(Handle serviceHandle, u8 unk);
/**
* @brief Creates ext save data.
* @param info Info of the save data.
*/
DEFINE_PXIFS_SERVICE_METHOD(CreateExtSaveData, FS_ExtSaveDataInfo info);
Result FSPXI_CreateExtSaveData(Handle serviceHandle, FS_ExtSaveDataInfo info);
/**
* @brief Deletes ext save data.
* @param info Info of the save data.
*/
DEFINE_PXIFS_SERVICE_METHOD(DeleteExtSaveData, FS_ExtSaveDataInfo info);
Result FSPXI_DeleteExtSaveData(Handle serviceHandle, FS_ExtSaveDataInfo info);
/**
* @brief Enumerates ext save data.
@ -456,7 +414,7 @@ DEFINE_PXIFS_SERVICE_METHOD(DeleteExtSaveData, FS_ExtSaveDataInfo info);
* @param shared Whether to enumerate shared ext save data.
* @param ids Pointer to output IDs to.
*/
DEFINE_PXIFS_SERVICE_METHOD(EnumerateExtSaveData, u32* idsWritten, u32 idsSize, FS_MediaType mediaType, u32 idSize, bool shared, u8* ids);
Result FSPXI_EnumerateExtSaveData(Handle serviceHandle, u32* idsWritten, u32 idsSize, FS_MediaType mediaType, u32 idSize, bool shared, u8* ids);
/**
* @brief Gets a special content's index.
@ -465,7 +423,7 @@ DEFINE_PXIFS_SERVICE_METHOD(EnumerateExtSaveData, u32* idsWritten, u32 idsSize,
* @param programId Program ID owning the special content.
* @param type Type of special content.
*/
DEFINE_PXIFS_SERVICE_METHOD(GetSpecialContentIndex, u16* index, FS_MediaType mediaType, u64 programId, FS_SpecialContentType type);
Result FSPXI_GetSpecialContentIndex(Handle serviceHandle, u16* index, FS_MediaType mediaType, u64 programId, FS_SpecialContentType type);
/**
* @brief Gets the legacy ROM header of a program.
@ -473,7 +431,7 @@ DEFINE_PXIFS_SERVICE_METHOD(GetSpecialContentIndex, u16* index, FS_MediaType med
* @param programId ID of the program.
* @param header Pointer to output the legacy ROM header to. (size = 0x3B4)
*/
DEFINE_PXIFS_SERVICE_METHOD(GetLegacyRomHeader, FS_MediaType mediaType, u64 programId, u8* header);
Result FSPXI_GetLegacyRomHeader(Handle serviceHandle, FS_MediaType mediaType, u64 programId, u8* header);
/**
* @brief Gets the legacy banner data of a program.
@ -482,51 +440,51 @@ DEFINE_PXIFS_SERVICE_METHOD(GetLegacyRomHeader, FS_MediaType mediaType, u64 prog
* @param banner Pointer to output the legacy banner data to. (size = 0x23C0)
* @param unk Unknown. Always 1?
*/
DEFINE_PXIFS_SERVICE_METHOD(GetLegacyBannerData, FS_MediaType mediaType, u64 programId, u8* banner, u32 unk);
Result FSPXI_GetLegacyBannerData(Handle serviceHandle, FS_MediaType mediaType, u64 programId, u8* banner, u8 unk);
/**
* Unknown command 3D
* @param unk Unknown. Transaction?
*/
DEFINE_PXIFS_SERVICE_METHOD(0x3D, u32 unk);
Result FSPXI_Unknown0x3D(Handle serviceHandle, u32 unk);
/// Deletes the 3DS SDMC root.
DEFINE_PXIFS_SERVICE_METHOD(DeleteSdmcRoot, void);
Result FSPXI_DeleteSdmcRoot(Handle serviceHandle);
/// Deletes all ext save data on the NAND.
DEFINE_PXIFS_SERVICE_METHOD(DeleteAllExtSaveDataOnNand, void);
Result FSPXI_DeleteAllExtSaveDataOnNand(Handle serviceHandle);
/// Initializes the CTR file system.
DEFINE_PXIFS_SERVICE_METHOD(InitializeCtrFilesystem, void);
Result FSPXI_InitializeCtrFilesystem(Handle serviceHandle);
/// Creates the FS seed.
DEFINE_PXIFS_SERVICE_METHOD(CreateSeed, void);
Result FSPXI_CreateSeed(Handle serviceHandle);
/**
* @brief Gets the CTR SDMC root path.
* @param out Pointer to output the root path to.
* @param length Length of the output buffer.
* @param length Length of the output buffer in bytes.
*/
DEFINE_PXIFS_SERVICE_METHOD(GetSdmcCtrRootPath, u8* out, u32 length);
Result FSPXI_GetSdmcCtrRootPath(Handle serviceHandle, u16* out, u32 length);
/**
* @brief Gets an archive's resource information.
* @param archiveResource Pointer to output the archive resource information to.
* @param mediaType System media type to check.
*/
DEFINE_PXIFS_SERVICE_METHOD(GetArchiveResource, FS_ArchiveResource* archiveResource, FS_SystemMediaType mediaType);
Result FSPXI_GetArchiveResource(Handle serviceHandle, FS_ArchiveResource* archiveResource, FS_SystemMediaType mediaType);
/**
* @brief Exports the integrity verification seed.
* @param seed Pointer to output the seed to.
*/
DEFINE_PXIFS_SERVICE_METHOD(ExportIntegrityVerificationSeed, FS_IntegrityVerificationSeed* seed);
Result FSPXI_ExportIntegrityVerificationSeed(Handle serviceHandle, FS_IntegrityVerificationSeed* seed);
/**
* @brief Imports an integrity verification seed.
* @param seed Seed to import.
*/
DEFINE_PXIFS_SERVICE_METHOD(ImportIntegrityVerificationSeed, FS_IntegrityVerificationSeed* seed);
Result FSPXI_ImportIntegrityVerificationSeed(Handle serviceHandle, const FS_IntegrityVerificationSeed* seed);
/**
* @brief Gets the legacy sub banner data of a program.
@ -535,10 +493,10 @@ DEFINE_PXIFS_SERVICE_METHOD(ImportIntegrityVerificationSeed, FS_IntegrityVerific
* @param programId ID of the program.
* @param header Pointer to output the legacy sub banner data to.
*/
DEFINE_PXIFS_SERVICE_METHOD(GetLegacySubBannerData, u32 bannerSize, FS_MediaType mediaType, u64 programId, u8* banner);
Result FSPXI_GetLegacySubBannerData(Handle serviceHandle, u32 bannerSize, FS_MediaType mediaType, u64 programId, u8* banner);
/// Unknown command 47
DEFINE_PXIFS_SERVICE_METHOD(0x47, void* buf, u32 size);
Result FSPXI_Unknown0x47(Handle serviceHandle, void* buf, u32 size);
/**
* @brief Gets the last modified time of a file in an archive.
@ -547,7 +505,7 @@ DEFINE_PXIFS_SERVICE_METHOD(0x47, void* buf, u32 size);
* @param path The UTF-16 path of the file.
* @param size The size of the path.
*/
DEFINE_PXIFS_SERVICE_METHOD(GetFileLastModified, FSPXI_Archive archive, u64* out, u16* path, u32 size);
Result FSPXI_GetFileLastModified(Handle serviceHandle, FSPXI_Archive archive, u64* out, const u16* path, u32 size);
/**
* @brief Reads from a special file.
@ -556,26 +514,26 @@ DEFINE_PXIFS_SERVICE_METHOD(GetFileLastModified, FSPXI_Archive archive, u64* out
* @param size Size of the buffer.
* @param data Buffer to read to.
*/
DEFINE_PXIFS_SERVICE_METHOD(ReadSpecialFile, u32* bytesRead, u64 fileOffset, u32 size, u8* data);
Result FSPXI_ReadSpecialFile(Handle serviceHandle, u32* bytesRead, u64 fileOffset, u32 size, u8* data);
/**
* @brief Gets the size of a special file.
* @param fileSize Pointer to output the size to.
*/
DEFINE_PXIFS_SERVICE_METHOD(GetSpecialFileSize, u64* fileSize);
Result FSPXI_GetSpecialFileSize(Handle serviceHandle, u64* fileSize);
/**
* @brief Initiates a device move as the source device.
* @param context Pointer to output the context to.
*/
DEFINE_PXIFS_SERVICE_METHOD(StartDeviceMoveAsSource, FS_DeviceMoveContext* context);
Result FSPXI_StartDeviceMoveAsSource(Handle serviceHandle, FS_DeviceMoveContext* context);
/**
* @brief Initiates a device move as the destination device.
* @param context Context to use.
* @param clear Whether to clear the device's data first.
*/
DEFINE_PXIFS_SERVICE_METHOD(StartDeviceMoveAsDestination, FS_DeviceMoveContext context, bool clear);
Result FSPXI_StartDeviceMoveAsDestination(Handle serviceHandle, FS_DeviceMoveContext context, bool clear);
/**
* @brief Reads data and stores SHA256 hashes of blocks
@ -586,9 +544,9 @@ DEFINE_PXIFS_SERVICE_METHOD(StartDeviceMoveAsDestination, FS_DeviceMoveContext c
* @param readBufferSize Size of readBuffer.
* @param hashtable Pointer to store SHA256 hashes in.
* @param hashtableSize Size of hashtable.
* @param unk Unknown. Always 0x00001000?
* @param unk Unknown. Always 0x00001000? Possibly block size?
*/
DEFINE_PXIFS_SERVICE_METHOD(ReadFileSHA256, FSPXI_File file, u32* bytesRead, u64 offset, void* readBuffer, u32 readBufferSize, void* hashtable, u32 hashtableSize, u32 unk);
Result FSPXI_ReadFileSHA256(Handle serviceHandle, FSPXI_File file, u32* bytesRead, u64 offset, void* readBuffer, u32 readBufferSize, void* hashtable, u32 hashtableSize, u32 unk);
/**
* @brief Assumedly writes data and stores SHA256 hashes of blocks
@ -600,24 +558,24 @@ DEFINE_PXIFS_SERVICE_METHOD(ReadFileSHA256, FSPXI_File file, u32* bytesRead, u64
* @param hashtable Pointer to store SHA256 hashes in.
* @param hashtableSize Size of hashtable
* @param unk1 Unknown. Might match with ReadFileSHA256's unknown?
* @param unk2 Unknown.
* @param unk2 Unknown. Might match with ReadFileSHA256's unknown?
*/
DEFINE_PXIFS_SERVICE_METHOD(WriteFileSHA256, FSPXI_File file, u32* bytesWritten, u64 offset, void* writeBuffer, u32 writeBufferSize, void* hashtable, u32 hashtableSize, u32 unk1, u32 unk2);
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);
/// Unknown command 4F
DEFINE_PXIFS_SERVICE_METHOD(0x4F, u64 unk);
Result FSPXI_Unknown0x4F(Handle serviceHandle, u64 unk);
/**
* @brief Sets the file system priority.
* @param priority Priority to set.
*/
DEFINE_PXIFS_SERVICE_METHOD(SetPriority, u32 priority);
Result FSPXI_SetPriority(Handle serviceHandle, u32 priority);
/**
* @brief Toggles cleaning up invalid save data.
* @param enable Whether to enable cleaning up invalid save data.
*/
DEFINE_PXIFS_SERVICE_METHOD(SwitchCleanupInvalidSaveData, bool enable);
Result FSPXI_SwitchCleanupInvalidSaveData(Handle serviceHandle, bool enable);
/**
* @brief Enumerates system save data.
@ -625,7 +583,7 @@ DEFINE_PXIFS_SERVICE_METHOD(SwitchCleanupInvalidSaveData, bool enable);
* @param idsSize Size of the IDs buffer.
* @param ids Pointer to output IDs to.
*/
DEFINE_PXIFS_SERVICE_METHOD(EnumerateSystemSaveData, u32* idsWritten, u32 idsSize, u32* ids);
Result FSPXI_EnumerateSystemSaveData(Handle serviceHandle, u32* idsWritten, u32 idsSize, u32* ids);
/**
* @brief Reads the NAND report.
@ -633,13 +591,13 @@ DEFINE_PXIFS_SERVICE_METHOD(EnumerateSystemSaveData, u32* idsWritten, u32 idsSiz
* @param buffer Buffer to write the report to.
* @param size Size of buffer
*/
DEFINE_PXIFS_SERVICE_METHOD(ReadNandReport, void* buffer, u32 size, u32 unk);
Result FSPXI_ReadNandReport(Handle serviceHandle, void* buffer, u32 size, u32 unk);
/**
* @brief Unknown command 0x56
* @remark Called by FSUSER_ControlArchive with ArchiveAction 0x789D
*/
DEFINE_PXIFS_SERVICE_METHOD(0x56, u32 (*out)[4], FS_Archive archive, FS_Path path);
Result FSPXI_Unknown0x56(Handle serviceHandle, u32 (*out)[4], FS_Archive archive, FS_Path path);
#undef DEFINE_PXIFS_SERVICE_METHOD
#undef DEFINE_SERVICE_METHOD

View File

@ -731,7 +731,7 @@ Result FSUSER_CardNorDirectCommandWithAddress(u8 commandId, u32 address)
return cmdbuf[1];
}
Result FSUSER_CardNorDirectRead(u8 commandId, u32 size, u8* output)
Result FSUSER_CardNorDirectRead(u8 commandId, u32 size, void* output)
{
u32 *cmdbuf = getThreadCommandBuffer();
@ -747,7 +747,7 @@ Result FSUSER_CardNorDirectRead(u8 commandId, u32 size, u8* output)
return cmdbuf[1];
}
Result FSUSER_CardNorDirectReadWithAddress(u8 commandId, u32 address, u32 size, u8* output)
Result FSUSER_CardNorDirectReadWithAddress(u8 commandId, u32 address, u32 size, void* output)
{
u32 *cmdbuf = getThreadCommandBuffer();
@ -764,7 +764,7 @@ Result FSUSER_CardNorDirectReadWithAddress(u8 commandId, u32 address, u32 size,
return cmdbuf[1];
}
Result FSUSER_CardNorDirectWrite(u8 commandId, u32 size, u8* input)
Result FSUSER_CardNorDirectWrite(u8 commandId, u32 size, const void* input)
{
u32 *cmdbuf = getThreadCommandBuffer();
@ -780,7 +780,7 @@ Result FSUSER_CardNorDirectWrite(u8 commandId, u32 size, u8* input)
return cmdbuf[1];
}
Result FSUSER_CardNorDirectWriteWithAddress(u8 commandId, u32 address, u32 size, u8* input)
Result FSUSER_CardNorDirectWriteWithAddress(u8 commandId, u32 address, u32 size, const void* input)
{
u32 *cmdbuf = getThreadCommandBuffer();
@ -797,7 +797,7 @@ Result FSUSER_CardNorDirectWriteWithAddress(u8 commandId, u32 address, u32 size,
return cmdbuf[1];
}
Result FSUSER_CardNorDirectRead_4xIO(u8 commandId, u32 address, u32 size, u8* output)
Result FSUSER_CardNorDirectRead_4xIO(u8 commandId, u32 address, u32 size, void* output)
{
u32 *cmdbuf = getThreadCommandBuffer();
@ -814,7 +814,7 @@ Result FSUSER_CardNorDirectRead_4xIO(u8 commandId, u32 address, u32 size, u8* ou
return cmdbuf[1];
}
Result FSUSER_CardNorDirectCpuWriteWithoutVerify(u32 address, u32 size, u8* input)
Result FSUSER_CardNorDirectCpuWriteWithoutVerify(u32 address, u32 size, const void* input)
{
u32 *cmdbuf = getThreadCommandBuffer();
@ -929,7 +929,7 @@ Result FSUSER_GetSpecialContentIndex(u16* index, FS_MediaType mediaType, u64 pro
return cmdbuf[1];
}
Result FSUSER_GetLegacyRomHeader(FS_MediaType mediaType, u64 programId, u8* header)
Result FSUSER_GetLegacyRomHeader(FS_MediaType mediaType, u64 programId, void* header)
{
u32 *cmdbuf = getThreadCommandBuffer();
@ -946,7 +946,7 @@ Result FSUSER_GetLegacyRomHeader(FS_MediaType mediaType, u64 programId, u8* head
return cmdbuf[1];
}
Result FSUSER_GetLegacyBannerData(FS_MediaType mediaType, u64 programId, u8* banner)
Result FSUSER_GetLegacyBannerData(FS_MediaType mediaType, u64 programId, void* banner)
{
u32 *cmdbuf = getThreadCommandBuffer();
@ -1084,7 +1084,7 @@ Result FSUSER_GetFormatInfo(u32* totalSize, u32* directories, u32* files, bool*
return cmdbuf[1];
}
Result FSUSER_GetLegacyRomHeader2(u32 headerSize, FS_MediaType mediaType, u64 programId, u8* header)
Result FSUSER_GetLegacyRomHeader2(u32 headerSize, FS_MediaType mediaType, u64 programId, void* header)
{
u32 *cmdbuf = getThreadCommandBuffer();
@ -1183,7 +1183,7 @@ Result FSUSER_FormatSaveData(FS_ArchiveID archiveId, FS_Path path, u32 blocks, u
return cmdbuf[1];
}
Result FSUSER_GetLegacySubBannerData(u32 bannerSize, FS_MediaType mediaType, u64 programId, u8* banner)
Result FSUSER_GetLegacySubBannerData(u32 bannerSize, FS_MediaType mediaType, u64 programId, void* banner)
{
u32 *cmdbuf = getThreadCommandBuffer();
@ -1246,7 +1246,7 @@ Result FSUSER_UpdateSha256Context(const void* data, u32 inputSize, u8* hash)
return cmdbuf[1];
}
Result FSUSER_ReadSpecialFile(u32* bytesRead, u64 fileOffset, u32 size, u8* data)
Result FSUSER_ReadSpecialFile(u32* bytesRead, u64 fileOffset, u32 size, void* data)
{
u32 *cmdbuf = getThreadCommandBuffer();

File diff suppressed because it is too large Load Diff