//the Pascal translation of libctru 1.0.0 headers files for the nintendo 3ds platform // // Copyright (c) 2013, 2015, 2016, 2017 Kenneth Dwayne Lee Bsc. // all rights reserved // {$ifdef 3dsintf} Const FS_OPEN_READ = 1 shl 0; FS_OPEN_WRITE = 1 shl 1; FS_OPEN_CREATE = 1 shl 2; FS_WRITE_FLUSH = 1 shl 0; // FS_WRITE_NOFLUSH = $00000000; FS_WRITE_UPDATE_TIME = 1 shl 8; {/ Attribute flags. } {! Create attributes. } // FS_ATTRIBUTE_NONE = $01000000; FS_ATTRIBUTE_READONLY = 1 shl 24; FS_ATTRIBUTE_ARCHIVE = 1 shl 16; FS_ATTRIBUTE_HIDDEN = 1 shl 8; FS_ATTRIBUTE_DIRECTORY = 1 shl 0; type FS_MediaType = Longint; PFS_MediaType = ^FS_MediaType; Const MEDIATYPE_NAND = 0; MEDIATYPE_SD = 1; MEDIATYPE_GAME_CARD = 2; type FS_ArchiveID = Longint; Const ARCHIVE_ROMFS = $00000003; ARCHIVE_SAVEDATA = $00000004; ARCHIVE_EXTDATA = $00000006; ARCHIVE_SHARED_EXTDATA = $00000007; ARCHIVE_SYSTEM_SAVEDATA = $00000008; ARCHIVE_SDMC = $00000009; ARCHIVE_SDMC_WRITE_ONLY = $0000000A; ARCHIVE_BOSS_EXTDATA = $12345678; ARCHIVE_CARD_SPIFS = $12345679; ARCHIVE_EXTDATA_AND_BOSS_EXTDATA = $1234567B; ARCHIVE_SYSTEM_SAVEDATA2 = $1234567C; ARCHIVE_NAND_RW = $1234567D; ARCHIVE_NAND_RO = $1234567E; ARCHIVE_NAND_RO_WRITE_ACCESS = $1234567F; ARCHIVE_SAVEDATA_AND_CONTENT = $2345678A; ARCHIVE_SAVEDATA_AND_CONTENT2 = $2345678E; ARCHIVE_NAND_CTR_FS = $567890AB; ARCHIVE_TWL_PHOTO = $567890AC; ARCHIVE_NAND_TWL_FS = $567890AE; ARCHIVE_NAND_W_FS = $567890AF; ARCHIVE_GAMECARD_SAVEDATA = $567890B1; ARCHIVE_USER_SAVEDATA = $567890B2; ARCHIVE_DEMO_SAVEDATA = $567890B4; type FS_PathType = Longint; PFS_PathType = ^FS_PathType; Const PATH_INVALID = 0; PATH_EMPTY = 1; PATH_BINARY = 2; PATH_ASCII = 3; PATH_UTF16 = 4; {/ Secure value slot. } {/< SD application. } type FS_SecureValueSlot = Longint; Const SECUREVALUE_SLOT_SD = $1000; {/ Card SPI baud rate. } {/< 512KHz. } {/< 1MHz. } {/< 2MHz. } {/< 4MHz. } {/< 8MHz. } {/< 16MHz. } type FS_CardSpiBaudRate = Longint; Const BAUDRATE_512KHZ = 0; BAUDRATE_1MHZ = 1; BAUDRATE_2MHZ = 2; BAUDRATE_4MHZ = 3; BAUDRATE_8MHZ = 4; BAUDRATE_16MHZ = 5; {/ Card SPI bus mode. } {/< 1-bit. } {/< 4-bit. } type FS_CardSpiBusMode = Longint; Const BUSMODE_1BIT = 0; BUSMODE_4BIT = 1; {/ Card SPI bus mode. } {/< Update. } {/< Manual. } {/< DLP child. } type FS_SpecialContentType = Longint; Const SPECIALCONTENT_UPDATE = 1; SPECIALCONTENT_MANUAL = 2; SPECIALCONTENT_DLP_CHILD = 3; {/< CTR card. } {/< TWL card. } type FS_CardType = Longint; PFS_CardType = ^ FS_CardType; Const CARD_CTR = 0; CARD_TWL = 1; {/ FS control actions. } type FS_Action = Longint; Const FS_ACTION_UNKNOWN = 0; {/ Archive control actions. } {/< Commits save data changes. No inputs/outputs. } {/< Retrieves a file's last-modified timestamp. In: "u16*, UTF-16 Path", Out: "u64, Time Stamp". } type FS_ArchiveAction = Longint; PFS_ArchiveAction = ^FS_ArchiveAction; Const ARCHIVE_ACTION_COMMIT_SAVE_DATA = 0; ARCHIVE_ACTION_GET_TIMESTAMP = 1; {/ Secure save control actions. } {/< Deletes a save's secure value. In: "u64, ((SecureValueSlot << 32) | (TitleUniqueId << 8) | TitleVariation)", Out: "u8, Value Existed" } {/< Formats a save. No inputs/outputs. } type FS_SecureSaveAction = Longint; PFS_SecureSaveAction = ^FS_SecureSaveAction; Const SECURESAVE_ACTION_DELETE = 0; SECURESAVE_ACTION_FORMAT = 1; {/ File control actions. } type FS_FileAction = Longint; PFS_FileAction = ^FS_FileAction; Const FILE_ACTION_UNKNOWN = 0; {/ Directory control actions. } type FS_DirectoryAction = Longint; PFS_DirectoryAction = ^FS_DirectoryAction; Const DIRECTORY_ACTION_UNKNOWN = 0; {/ Directory entry. } {/< UTF-16 directory name. } {/< File name. } {/< File extension. } {/< Valid flag. (Always 1) } {/< Reserved. } {/< Attributes. } {/< File size. } type FS_DirectoryEntry = record name : array[0..261] of u16; shortName : array[0..9] of cchar; shortExt : array[0..3] of cchar; valid : u8; reserved : u8; attributes : u32; fileSize : u64; end; PFS_DirectoryEntry = ^FS_DirectoryEntry; {/ Archive resource information. } {/< Size of each sector, in bytes. } {/< Size of each cluster, in bytes. } {/< Total number of clusters. } {/< Number of free clusters. } FS_ArchiveResource = record sectorSize : u32; clusterSize : u32; totalClusters : u32; freeClusters : u32; end; PFS_ArchiveResource = ^FS_ArchiveResource; FS_ProgramInfo = record programId : u64; flag0 : word; padding : array[0..6] of u8; end; PFS_ProgramInfo = ^FS_ProgramInfo; const bm_FS_ProgramInfo_mediaType = $FF; bp_FS_ProgramInfo_mediaType = 0; function mediaType(var a : FS_ProgramInfo) : FS_MediaType; procedure set_mediaType(var a : FS_ProgramInfo; __mediaType : FS_MediaType); type FS_ProductInfo = record productCode : array[0..15] of cchar; companyCode : array[0..1] of cchar; remasterVersion : u16; end; PFS_ProductInfo = ^FS_ProductInfo; {/ Integrity verification seed. } {/< AES-CBC MAC over a SHA256 hash, which hashes the first 0x110-bytes of the cleartext SEED. } {/< The "nand/private/movable.sed", encrypted with AES-CTR using the above MAC for the counter. } FS_IntegrityVerificationSeed = record aesCbcMac : array[0..15] of u8; movableSed : array[0..287] of u8; end; PFS_IntegrityVerificationSeed = ^FS_IntegrityVerificationSeed; FS_ExtSaveDataInfo = record flag0 : word; unknown : u8; reserved1 : u16; saveId : u64; reserved2 : u32; end; pFS_ExtSaveDataInfo = ^FS_ExtSaveDataInfo; const bm_PACKED_mediaType = $FF; bp_PACKED_mediaType = 0; function mediaType(var a : FS_ExtSaveDataInfo) : FS_MediaType; procedure set_mediaType(var a : FS_ExtSaveDataInfo; __mediaType : FS_MediaType); type FS_SystemSaveDataInfo = record flag0 : word; unknown : u8; reserved : u16; saveId : u32; end; const bm_FS_SystemSaveDataInfo_mediaType = $FF; bp_FS_SystemSaveDataInfo_mediaType = 0; function mediaType(var a : FS_SystemSaveDataInfo) : FS_MediaType; procedure set_mediaType(var a : FS_SystemSaveDataInfo; __mediaType : FS_MediaType); {/ Device move context. } {/< IVs. } {/< Encrypt parameter. } type FS_DeviceMoveContext = record ivs : array[0..15] of u8; encryptParameter : array[0..15] of u8; end; PFS_DeviceMoveContext = ^FS_DeviceMoveContext; FS_Path = record _type : FS_PathType; size : u32; data : pointer; end; FS_Archive = record id : u32; lowPath : FS_Path; handle : u64; end; PFS_Archive = ^FS_Archive; {/ Initializes FS. } function fsInit:s32;cdecl;external; {/ Exits FS. } procedure fsExit;cdecl;external; {* * @brief Sets the FSUSER session to use in the current thread. * @param session The handle of the FSUSER session to use. * @param sdmc When true, SDMC archive commands are redirected to this session too. Otherwise the default session is used. } procedure fsUseSession(session:Handle; sdmc:bool);cdecl;external; {/ Disables the FSUSER session override in the current thread. } procedure fsEndUseSession;cdecl;external; {* * @brief Creates an FS_Path instance. * @param type Type of path. * @param path Path to use. * @return The created FS_Path instance. } (* Const before type ignored *) function fsMakePath(_type:FS_PathType; path:pointer):FS_Path;cdecl;external; {* * @brief Gets the current FS session handle. * @return The current FS session handle. } function fsGetSessionHandle:PHandle;cdecl;external; {* * @brief Performs a control operation on the filesystem. * @param action Action to perform. * @param input Buffer to read input from. * @param inputSize Size of the input. * @param output Buffer to write output to. * @param outputSize Size of the output. } function FSUSER_Control(action:FS_Action; input:pointer; inputSize:u32; output:pointer; outputSize:u32):s32;cdecl;external; {* * @brief Initializes a FSUSER session. * @param session The handle of the FSUSER session to initialize. } function FSUSER_Initialize(session:Handle):s32;cdecl;external; {* * @brief Opens a file. * @param out Pointer to output the file handle to. * @param archive Archive containing the file. * @param path Path of the file. * @param openFlags Flags to open the file with. * @param attributes Attributes of the file. } function FSUSER_OpenFile(Filehandle:PHandle; archive:FS_Archive; path:FS_Path; openFlags:u32; attributes:u32):s32;cdecl;external; {* * @brief Opens a file directly. * @param out Pointer to output the file handle to. * @param archive Archive containing the file. * @param path Path of the file. * @param openFlags Flags to open the file with. * @param attributes Attributes of the file. } function FSUSER_OpenFileDirectly(Filehandle:PHandle; archive:FS_Archive; path:FS_Path; openFlags:u32; attributes:u32):s32;cdecl;external; {* * @brief Deletes a file. * @param archive Archive containing the file. * @param path Path of the file. } function FSUSER_DeleteFile(archive:FS_Archive; path:FS_Path):s32;cdecl;external; {* * @brief Renames a file. * @param srcArchive Archive containing the source file. * @param srcPath Path of the source file. * @param dstArchive Archive containing the destination file. * @param dstPath Path of the destination file. } function FSUSER_RenameFile(srcArchive:FS_Archive; srcPath:FS_Path; dstArchive:FS_Archive; dstPath:FS_Path):s32;cdecl;external; {* * @brief Deletes a directory, failing if it is not empty. * @param archive Archive containing the directory. * @param path Path of the directory. } function FSUSER_DeleteDirectory(archive:FS_Archive; path:FS_Path):s32;cdecl;external; {* * @brief Deletes a directory, also deleting its contents. * @param archive Archive containing the directory. * @param path Path of the directory. } function FSUSER_DeleteDirectoryRecursively(archive:FS_Archive; path:FS_Path):s32;cdecl;external; {* * @brief Creates a file. * @param archive Archive containing the file. * @param path Path of the file. * @param attributes Attributes of the file. * @param fileSize Size of the file. } function FSUSER_CreateFile(archive:FS_Archive; path:FS_Path; attributes:u32; fileSize:u64):s32;cdecl;external; {* * @brief Creates a directory * @param archive Archive containing the directory. * @param path Path of the directory. * @param attributes Attributes of the directory. } function FSUSER_CreateDirectory(archive:FS_Archive; path:FS_Path; attributes:u32):s32;cdecl;external; {* * @brief Renames a directory. * @param srcArchive Archive containing the source directory. * @param srcPath Path of the source directory. * @param dstArchive Archive containing the destination directory. * @param dstPath Path of the destination directory. } function FSUSER_RenameDirectory(srcArchive:FS_Archive; srcPath:FS_Path; dstArchive:FS_Archive; dstPath:FS_Path):s32;cdecl;external; {* * @brief Opens a directory. * @param out Pointer to output the directory handle to. * @param archive Archive containing the directory. * @param path Path of the directory. } function FSUSER_OpenDirectory(DirHandle:PHandle; archive:FS_Archive; path:FS_Path):s32;cdecl;external; {* * @brief Opens an archive. * @param archive Archive to open. } function FSUSER_OpenArchive(archive:PFS_Archive):s32;cdecl;external; {* * @brief Performs a control operation on an archive. * @param archive Archive to control. * @param action Action to perform. * @param input Buffer to read input from. * @param inputSize Size of the input. * @param output Buffer to write output to. * @param outputSize Size of the output. } function FSUSER_ControlArchive(archive:FS_Archive; action:FS_ArchiveAction; input:pointer; inputSize:u32; output:pointer; outputSize:u32):s32;cdecl;external; {* * @brief Closes an archive. * @param archive Archive to close. } function FSUSER_CloseArchive(archive:PFS_Archive):s32;cdecl;external; {* * @brief Gets the number of free bytes within an archive. * @param freeBytes Pointer to output the free bytes to. * @param archive Archive to check. } function FSUSER_GetFreeBytes(freeBytes:Pu64; archive:FS_Archive):s32;cdecl;external; {* * @brief Gets the inserted card type. * @param type Pointer to output the card type to. } function FSUSER_GetCardType(_type:PFS_CardType):s32;cdecl;external; {* * @brief Gets the SDMC archive resource information. * @param archiveResource Pointer to output the archive resource information to. } function FSUSER_GetSdmcArchiveResource(archiveResource:PFS_ArchiveResource):s32;cdecl;external; {* * @brief Gets the NAND archive resource information. * @param archiveResource Pointer to output the archive resource information to. } function FSUSER_GetNandArchiveResource(archiveResource:PFS_ArchiveResource):s32;cdecl;external; {* * @brief Gets the last SDMC fatfs error. * @param error Pointer to output the error to. } function FSUSER_GetSdmcFatfsError(error:Pu32):s32;cdecl;external; {* * @brief Gets whether an SD card is detected. * @param detected Pointer to output the detection status to. } function FSUSER_IsSdmcDetected(detected:Pbool):s32;cdecl;external; {* * @brief Gets whether the SD card is writable. * @param detected Pointer to output the writable status to. } function FSUSER_IsSdmcWritable(writable:boolean):s32;cdecl;external; {* * @brief Gets the SDMC CID. * @param out Pointer to output the CID to. * @param length Length of the CID buffer. (should be 0x10) } function FSUSER_GetSdmcCid(SdmcCid:Pu8; length:u32):s32;cdecl;external; {* * @brief Gets the NAND CID. * @param out Pointer to output the CID to. * @param length Length of the CID buffer. (should be 0x10) } function FSUSER_GetNandCid(NandCid:Pu8; length:u32):s32;cdecl;external; {* * @brief Gets the SDMC speed info. * @param speedInfo Pointer to output the speed info to. } function FSUSER_GetSdmcSpeedInfo(speedInfo:Pu32):s32;cdecl;external; {* * @brief Gets the NAND speed info. * @param speedInfo Pointer to output the speed info to. } function FSUSER_GetNandSpeedInfo(speedInfo:Pu32):s32;cdecl;external; {* * @brief Gets the SDMC log. * @param out Pointer to output the log to. * @param length Length of the log buffer. } function FSUSER_GetSdmcLog(SdmcLog:Pu8; length:u32):s32;cdecl;external; {* * @brief Gets the NAND log. * @param out Pointer to output the log to. * @param length Length of the log buffer. } function FSUSER_GetNandLog(NandLog:Pu8; length:u32):s32;cdecl;external; {/ Clears the SDMC log. } function FSUSER_ClearSdmcLog:s32;cdecl;external; {/ Clears the NAND log. } function FSUSER_ClearNandLog:s32;cdecl;external; {* * @brief Gets whether a card is inserted. * @param inserted Pointer to output the insertion status to. } function FSUSER_CardSlotIsInserted(inserted:Pbool):s32;cdecl;external; {* * @brief Powers on the card slot. * @param status Pointer to output the power status to. } function FSUSER_CardSlotPowerOn(status:Pbool):s32;cdecl;external; {* * @brief Powers off the card slot. * @param status Pointer to output the power status to. } function FSUSER_CardSlotPowerOff(status:Pbool):s32;cdecl;external; {* * @brief Gets the card's power status. * @param status Pointer to output the power status to. } function FSUSER_CardSlotGetCardIFPowerStatus(status:Pbool):s32;cdecl;external; {* * @brief Executes a CARDNOR direct command. * @param commandId ID of the command. } function FSUSER_CardNorDirectCommand(commandId:u8):s32;cdecl;external; {* * @brief Executes a CARDNOR direct command with an address. * @param commandId ID of the command. * @param address Address to provide. } function FSUSER_CardNorDirectCommandWithAddress(commandId:u8; address:u32):s32;cdecl;external; {* * @brief Executes a CARDNOR direct read. * @param commandId ID of the command. * @param size Size of the output buffer. * @param output Output buffer. } function FSUSER_CardNorDirectRead(commandId:u8; size:u32; output:Pu8):s32;cdecl;external; {* * @brief Executes a CARDNOR direct read with an address. * @param commandId ID of the command. * @param address Address to provide. * @param size Size of the output buffer. * @param output Output buffer. } function FSUSER_CardNorDirectReadWithAddress(commandId:u8; address:u32; size:u32; output:Pu8):s32;cdecl;external; {* * @brief Executes a CARDNOR direct write. * @param commandId ID of the command. * @param size Size of the input buffer. * @param output Input buffer. } function FSUSER_CardNorDirectWrite(commandId:u8; size:u32; input:Pu8):s32;cdecl;external; {* * @brief Executes a CARDNOR direct write with an address. * @param commandId ID of the command. * @param address Address to provide. * @param size Size of the input buffer. * @param input Input buffer. } function FSUSER_CardNorDirectWriteWithAddress(commandId:u8; address:u32; size:u32; input:Pu8):s32;cdecl;external; {* * @brief Executes a CARDNOR 4xIO direct read. * @param commandId ID of the command. * @param address Address to provide. * @param size Size of the output buffer. * @param output Output buffer. } function FSUSER_CardNorDirectRead_4xIO(commandId:u8; address:u32; size:u32; output:Pu8):s32;cdecl;external; {* * @brief Executes a CARDNOR direct CPU write without verify. * @param address Address to provide. * @param size Size of the input buffer. * @param output Input buffer. } function FSUSER_CardNorDirectCpuWriteWithoutVerify(address:u32; size:u32; input:Pu8):s32;cdecl;external; {* * @brief Executes a CARDNOR direct sector erase without verify. * @param address Address to provide. } function FSUSER_CardNorDirectSectorEraseWithoutVerify(address:u32):s32;cdecl;external; {* * @brief Gets a process's product info. * @param info Pointer to output the product info to. * @param processId ID of the process. } function FSUSER_GetProductInfo(info:PFS_ProductInfo; processId:u32):s32;cdecl;external; {* * @brief Gets a process's program launch info. * @param info Pointer to output the program launch info to. * @param processId ID of the process. } function FSUSER_GetProgramLaunchInfo(info:PFS_ProgramInfo; processId:u32):s32;cdecl;external; {* * @brief Sets the CARDSPI baud rate. * @param baudRate Baud rate to set. } function FSUSER_SetCardSpiBaudRate(baudRate:FS_CardSpiBaudRate):s32;cdecl;external; {* * @brief Sets the CARDSPI bus mode. * @param baudRate Bus mode to set. } function FSUSER_SetCardSpiBusMode(busMode:FS_CardSpiBusMode):s32;cdecl;external; {/ Sends initialization info to ARM9. } function FSUSER_SendInitializeInfoTo9:s32;cdecl;external; {* * @brief Gets a special content's index. * @param index Pointer to output the index to. * @param mediaType Media type of the special content. * @param programId Program ID owning the special content. * @param type Type of special content. } function FSUSER_GetSpecialContentIndex(index:Pu16; mediaType:FS_MediaType; programId:u64; _type:FS_SpecialContentType):s32;cdecl;external; {* * @brief Gets the legacy ROM header of a program. * @param mediaType Media type of the program. * @param programId ID of the program. * @param header Pointer to output the legacy ROM header to. (size = 0x3B4) } function FSUSER_GetLegacyRomHeader(mediaType:FS_MediaType; programId:u64; header:Pu8):s32;cdecl;external; {* * @brief Gets the legacy banner data of a program. * @param mediaType Media type of the program. * @param programId ID of the program. * @param header Pointer to output the legacy banner data to. (size = 0x23C0) } function FSUSER_GetLegacyBannerData(mediaType:FS_MediaType; programId:u64; banner:Pu8):s32;cdecl;external; {* * @brief Checks a process's authority to access a save data archive. * @param access Pointer to output the access status to. * @param mediaType Media type of the save data. * @param saveId ID of the save data. * @param processId ID of the process to check. } function FSUSER_CheckAuthorityToAccessExtSaveData(access:Pbool; mediaType:FS_MediaType; saveId:u64; processId:u32):s32;cdecl;external; {* * @brief Queries the total quota size of a save data archive. * @param quotaSize Pointer to output the quota size to. * @param directories Number of directories. * @param files Number of files. * @param fileSizeCount Number of file sizes to provide. * @param fileSizes File sizes to provide. } function FSUSER_QueryTotalQuotaSize(quotaSize:Pu64; directories:u32; files:u32; fileSizeCount:u32; fileSizes:Pu64):s32;cdecl;external; {* * @brief Abnegates an access right. * @param accessRight Access right to abnegate. } function FSUSER_AbnegateAccessRight(accessRight:u32):s32;cdecl;external; {/ Deletes the 3DS SDMC root. } function FSUSER_DeleteSdmcRoot:s32;cdecl;external; {/ Deletes all ext save data on the NAND. } function FSUSER_DeleteAllExtSaveDataOnNand:s32;cdecl;external; {/ Initializes the CTR file system. } function FSUSER_InitializeCtrFileSystem:s32;cdecl;external; {/ Creates the FS seed. } function FSUSER_CreateSeed:s32;cdecl;external; {* * @brief Retrieves archive format info. * @param totalSize Pointer to output the total size to. * @param directories Pointer to output the number of directories to. * @param files Pointer to output the number of files to. * @param duplicateData Pointer to output whether to duplicate data to. * @param archiveId ID of the archive. * @param path Path of the archive. } function FSUSER_GetFormatInfo(totalSize:Pu32; directories:Pu32; files:Pu32; duplicateData:Pbool; archiveId:FS_ArchiveID; path:FS_Path):s32;cdecl;external; {* * @brief Gets the legacy ROM header of a program. * @param headerSize Size of the ROM header. * @param mediaType Media type of the program. * @param programId ID of the program. * @param header Pointer to output the legacy ROM header to. } function FSUSER_GetLegacyRomHeader2(headerSize:u32; mediaType:FS_MediaType; programId:u64; header:Pu8):s32;cdecl;external; {* * @brief Gets the CTR SDMC root path. * @param out Pointer to output the root path to. * @param length Length of the output buffer. } function FSUSER_GetSdmcCtrRootPath(CtrRootPath:Pu8; length:u32):s32;cdecl;external; {* * @brief Gets an archive's resource information. * @param archiveResource Pointer to output the archive resource information to. * @param mediaType Media type to check. } function FSUSER_GetArchiveResource(archiveResource:PFS_ArchiveResource; mediaType:FS_MediaType):s32;cdecl;external; {* * @brief Exports the integrity verification seed. * @param seed Pointer to output the seed to. } function FSUSER_ExportIntegrityVerificationSeed(seed:PFS_IntegrityVerificationSeed):s32;cdecl;external; {* * @brief Imports an integrity verification seed. * @param seed Seed to import. } function FSUSER_ImportIntegrityVerificationSeed(seed:PFS_IntegrityVerificationSeed):s32;cdecl;external; {* * @brief Formats save data. * @param archiveId ID of the save data archive. * @param path Path of the save data. * @param blocks Size of the save data in blocks. (512 bytes) * @param directories Number of directories. * @param files Number of files. * @param directoryBuckets Directory hash tree bucket count. * @param fileBuckets File hash tree bucket count. * @param duplicateData Whether to store an internal duplicate of the data. } function FSUSER_FormatSaveData(archiveId:FS_ArchiveID; path:FS_Path; blocks:u32; directories:u32; files:u32; directoryBuckets:u32; fileBuckets:u32; duplicateData:bool):s32;cdecl;external; {* * @brief Gets the legacy sub banner data of a program. * @param bannerSize Size of the banner. * @param mediaType Media type of the program. * @param programId ID of the program. * @param header Pointer to output the legacy sub banner data to. } function FSUSER_GetLegacySubBannerData(bannerSize:u32; mediaType:FS_MediaType; programId:u64; banner:Pu8):s32;cdecl;external; {* * @brief Reads from a special file. * @param bytesRead Pointer to output the number of bytes read to. * @param fileOffset Offset of the file. * @param size Size of the buffer. * @param data Buffer to read to. } function FSUSER_ReadSpecialFile(bytesRead:Pu32; fileOffset:u64; size:u32; data:Pu8):s32;cdecl;external; {* * @brief Gets the size of a special file. * @param fileSize Pointer to output the size to. } function FSUSER_GetSpecialFileSize(fileSize:Pu64):s32;cdecl;external; {* * @brief Creates ext save data. * @param info Info of the save data. * @param directories Number of directories. * @param files Number of files. * @param sizeLimit Size limit of the save data. * @param smdhSize Size of the save data's SMDH data. * @param smdh SMDH data. } function FSUSER_CreateExtSaveData(info:FS_ExtSaveDataInfo; directories:u32; files:u32; sizeLimit:u64; smdhSize:u32; smdh:Pu8):s32;cdecl;external; {* * @brief Deletes ext save data. * @param info Info of the save data. } function FSUSER_DeleteExtSaveData(info:FS_ExtSaveDataInfo):s32;cdecl;external; {* * @brief Reads the SMDH icon of ext save data. * @param bytesRead Pointer to output the number of bytes read to. * @param info Info of the save data. * @param smdhSize Size of the save data SMDH. * @param smdh Pointer to output SMDH data to. } function FSUSER_ReadExtSaveDataIcon(bytesRead:Pu32; info:FS_ExtSaveDataInfo; smdhSize:u32; smdh:Pu8):s32;cdecl;external; {* * @brief Gets an ext data archive's block information. * @param totalBlocks Pointer to output the total blocks to. * @param freeBlocks Pointer to output the free blocks to. * @param blockSize Pointer to output the block size to. * @param info Info of the save data. } function FSUSER_GetExtDataBlockSize(totalBlocks:Pu64; freeBlocks:Pu64; blockSize:Pu32; info:FS_ExtSaveDataInfo):s32;cdecl;external; {* * @brief Enumerates ext save data. * @param idsWritten Pointer to output the number of IDs written to. * @param idsSize Size of the IDs buffer. * @param mediaType Media type to enumerate over. * @param idSize Size of each ID element. * @param shared Whether to enumerate shared ext save data. * @param ids Pointer to output IDs to. } function FSUSER_EnumerateExtSaveData(idsWritten:Pu32; idsSize:u32; mediaType:FS_MediaType; idSize:u32; shared:bool; ids:Pu8):s32;cdecl;external; {* * @brief Creates system save data. * @param info Info of the save data. * @param totalSize Total size of the save data. * @param blockSize Block size of the save data. (usually 0x1000) * @param directories Number of directories. * @param files Number of files. * @param directoryBuckets Directory hash tree bucket count. * @param fileBuckets File hash tree bucket count. * @param duplicateData Whether to store an internal duplicate of the data. } function FSUSER_CreateSystemSaveData(info:FS_SystemSaveDataInfo; totalSize:u32; blockSize:u32; directories:u32; files:u32; directoryBuckets:u32; fileBuckets:u32; duplicateData:bool):s32;cdecl;external; {* * @brief Deletes system save data. * @param info Info of the save data. } function FSUSER_DeleteSystemSaveData(info:FS_SystemSaveDataInfo):s32;cdecl;external; {* * @brief Initiates a device move as the source device. * @param context Pointer to output the context to. } function FSUSER_StartDeviceMoveAsSource(context:PFS_DeviceMoveContext):s32;cdecl;external; {* * @brief Initiates a device move as the destination device. * @param context Context to use. * @param clear Whether to clear the device's data first. } function FSUSER_StartDeviceMoveAsDestination(context:FS_DeviceMoveContext; clear:bool):s32;cdecl;external; {* * @brief Sets an archive's priority. * @param archive Archive to use. * @param priority Priority to set. } function FSUSER_SetArchivePriority(archive:FS_Archive; priority:u32):s32;cdecl;external; {* * @brief Gets an archive's priority. * @param priority Pointer to output the priority to. * @param archive Archive to use. } function FSUSER_GetArchivePriority(priority:Pu32; archive:FS_Archive):s32;cdecl;external; {* * @brief Configures CTRCARD latency emulation. * @param latency Latency to apply, in milliseconds. * @param emulateEndurance Whether to emulate card endurance. } function FSUSER_SetCtrCardLatencyParameter(latency:u64; emulateEndurance:bool):s32;cdecl;external; {* * @brief Toggles cleaning up invalid save data. * @param Whether to enable cleaning up invalid save data. } function FSUSER_SwitchCleanupInvalidSaveData(enable:bool):s32;cdecl;external; {* * @brief Enumerates system save data. * @param idsWritten Pointer to output the number of IDs written to. * @param idsSize Size of the IDs buffer. * @param ids Pointer to output IDs to. } function FSUSER_EnumerateSystemSaveData(idsWritten:Pu32; idsSize:u32; ids:Pu64):s32;cdecl;external; {* * @brief Initializes a FSUSER session with an SDK version. * @param session The handle of the FSUSER session to initialize. * @param version SDK version to initialize with. } function FSUSER_InitializeWithSdkVersion(session:Handle; version:u32):s32;cdecl;external; {* * @brief Sets the file system priority. * @param priority Priority to set. } function FSUSER_SetPriority(priority:u32):s32;cdecl;external; {* * @brief Gets the file system priority. * @param priority Pointer to output the priority to. } function FSUSER_GetPriority(priority:Pu32):s32;cdecl;external; {* * @brief Sets the save data secure value. * @param value Secure value to set. * @param slot Slot of the secure value. * @param titleUniqueId Unique ID of the title. (default = 0) * @param titleVariation Variation of the title. (default = 0) } function FSUSER_SetSaveDataSecureValue(value:u64; slot:FS_SecureValueSlot; titleUniqueId:u32; titleVariation:u8):s32;cdecl;external; {* * @brief Gets the save data secure value. * @param exists Pointer to output whether the secure value exists to. * @param value Pointer to output the secure value to. * @param slot Slot of the secure value. * @param titleUniqueId Unique ID of the title. (default = 0) * @param titleVariation Variation of the title. (default = 0) } function FSUSER_GetSaveDataSecureValue(exists:Pbool; value:Pu64; slot:FS_SecureValueSlot; titleUniqueId:u32; titleVariation:u8):s32;cdecl;external; {* * @brief Performs a control operation on a secure save. * @param action Action to perform. * @param input Buffer to read input from. * @param inputSize Size of the input. * @param output Buffer to write output to. * @param outputSize Size of the output. } function FSUSER_ControlSecureSave(action:FS_SecureSaveAction; input:pointer; inputSize:u32; output:pointer; outputSize:u32):s32;cdecl;external; {* * @brief Gets the media type of the current application. * @param mediaType Pointer to output the media type to. } function FSUSER_GetMediaType(mediaType:PFS_MediaType):s32;cdecl;external; {* * @brief Performs a control operation on a file. * @param handle Handle of the file. * @param action Action to perform. * @param input Buffer to read input from. * @param inputSize Size of the input. * @param output Buffer to write output to. * @param outputSize Size of the output. } function FSFILE_Control(handle:Handle; action:FS_FileAction; input:pointer; inputSize:u32; output:pointer; outputSize:u32):s32;cdecl;external; {* * @brief Opens a handle to a sub-section of a file. * @param handle Handle of the file. * @param subFile Pointer to output the sub-file to. * @param offset Offset of the sub-section. * @param size Size of the sub-section. } function FSFILE_OpenSubFile(handle:Handle; subFile:PHandle; offset:u64; size:u64):s32;cdecl;external; {* * @brief Reads from a file. * @param handle Handle of the file. * @param bytesRead Pointer to output the number of bytes read to. * @param offset Offset to read from. * @param buffer Buffer to read to. * @param size Size of the buffer. } function FSFILE_Read(handle:Handle; bytesRead:Pu32; offset:u64; buffer:pointer; size:u32):s32;cdecl;external; {* * @brief Writes to a file. * @param handle Handle of the file. * @param bytesWritten Pointer to output the number of bytes written to. * @param offset Offset to write to. * @param buffer Buffer to write from. * @param size Size of the buffer. * @param flags Flags to use when writing. } (* Const before type ignored *) function FSFILE_Write(handle:Handle; bytesWritten:Pu32; offset:u64; buffer:pointer; size:u32; flags:u32):s32;cdecl;external; {* * @brief Gets the size of a file. * @param handle Handle of the file. * @param size Pointer to output the size to. } function FSFILE_GetSize(handle:Handle; size:Pu64):s32;cdecl;external; {* * @brief Sets the size of a file. * @param handle Handle of the file. * @param size Size to set. } function FSFILE_SetSize(handle:Handle; size:u64):s32;cdecl;external; {* * @brief Gets the attributes of a file. * @param handle Handle of the file. * @param attributes Pointer to output the attributes to. } function FSFILE_GetAttributes(handle:Handle; attributes:Pu32):s32;cdecl;external; {* * @brief Sets the attributes of a file. * @param handle Handle of the file. * @param attributes Attributes to set. } function FSFILE_SetAttributes(handle:Handle; attributes:u32):s32;cdecl;external; {* * @brief Closes a file. * @param handle Handle of the file. } function FSFILE_Close(handle:Handle):s32;cdecl;external; {* * @brief Flushes a file's contents. * @param handle Handle of the file. } function FSFILE_Flush(handle:Handle):s32;cdecl;external; {* * @brief Sets a file's priority. * @param handle Handle of the file. * @param priority Priority to set. } function FSFILE_SetPriority(handle:Handle; priority:u32):s32;cdecl;external; {* * @brief Gets a file's priority. * @param handle Handle of the file. * @param priority Pointer to output the priority to. } function FSFILE_GetPriority(handle:Handle; priority:Pu32):s32;cdecl;external; {* * @brief Opens a duplicate handle to a file. * @param handle Handle of the file. * @param linkFile Pointer to output the link handle to. } function FSFILE_OpenLinkFile(handle:Handle; linkFile:PHandle):s32;cdecl;external; {* * @brief Performs a control operation on a directory. * @param handle Handle of the directory. * @param action Action to perform. * @param input Buffer to read input from. * @param inputSize Size of the input. * @param output Buffer to write output to. * @param outputSize Size of the output. } function FSDIR_Control(handle:Handle; action:FS_DirectoryAction; input:pointer; inputSize:u32; output:pointer; outputSize:u32):s32;cdecl;external; {* * @brief Reads one or more directory entries. * @param handle Handle of the directory. * @param entriesRead Pointer to output the number of entries read to. * @param entryCount Number of entries to read. * @param entryOut Pointer to output directory entries to. } function FSDIR_Read(handle:Handle; entriesRead:Pu32; entryCount:u32; entries:PFS_DirectoryEntry):s32;cdecl;external; {* * @brief Closes a directory. * @param handle Handle of the directory. } function FSDIR_Close(handle:Handle):s32;cdecl;external; {* * @brief Sets a directory's priority. * @param handle Handle of the directory. * @param priority Priority to set. } function FSDIR_SetPriority(handle:Handle; priority:u32):s32;cdecl;external; {* * @brief Gets a directory's priority. * @param handle Handle of the directory. * @param priority Pointer to output the priority to. } function FSDIR_GetPriority(handle:Handle; priority:Pu32):s32;cdecl;external; {$endif 3dsintf} {$ifdef 3dsimpl} function mediaType(var a : FS_ProgramInfo) : FS_MediaType; begin mediaType:=(a.flag0 and bm_FS_ProgramInfo_mediaType) shr bp_FS_ProgramInfo_mediaType; end; procedure set_mediaType(var a : FS_ProgramInfo; __mediaType : FS_MediaType); begin a.flag0:=a.flag0 or ((__mediaType shl bp_FS_ProgramInfo_mediaType) and bm_FS_ProgramInfo_mediaType); end; function mediaType(var a : FS_ExtSaveDataInfo) : FS_MediaType; begin mediaType:=(a.flag0 and bm_PACKED_mediaType) shr bp_PACKED_mediaType; end; procedure set_mediaType(var a : FS_ExtSaveDataInfo; __mediaType : FS_MediaType); begin a.flag0:=a.flag0 or ((__mediaType shl bp_PACKED_mediaType) and bm_PACKED_mediaType); end; function mediaType(var a : FS_SystemSaveDataInfo) : FS_MediaType; begin mediaType:=(a.flag0 and bm_FS_SystemSaveDataInfo_mediaType) shr bp_FS_SystemSaveDataInfo_mediaType; end; procedure set_mediaType(var a : FS_SystemSaveDataInfo; __mediaType : FS_MediaType); begin a.flag0:=a.flag0 or ((__mediaType shl bp_FS_SystemSaveDataInfo_mediaType) and bm_FS_SystemSaveDataInfo_mediaType); end; {$endif 3dsimpl}