archive.h
Go to the documentation of this file.
/**
* @file archive.h
* @brief FS_Archive driver
*/
#pragma once
#include <sys/types.h>
#include <3ds/types.h>
#include <3ds/services/fs.h>
#define ARCHIVE_DIRITER_MAGIC 0x68637261 /* "arch" */
/*! Open directory struct */
typedef struct
{
u32 magic; /*! "arch" */
Handle fd; /*! CTRU handle */
ssize_t index; /*! Current entry index */
size_t size; /*! Current batch size */
FS_DirectoryEntry entry_data[32]; /*! Temporary storage for reading entries */
} archive_dir_t;
/// Mounts the SD
Result archiveMountSdmc(void);
/// Mounts and opens an archive as deviceName
/// Returns either an archive open error code, or -1 for generic failure
Result archiveMount(FS_ArchiveID archiveID, FS_Path archivePath, const char *deviceName);
/// Uses FSUSER_ControlArchive with control action ARCHIVE_ACTION_COMMIT_SAVE_DATA on the opened archive. Not done automatically at unmount.
/// Returns -1 if the specified device is not found
Result archiveCommitSaveData(const char *deviceName);
/// Unmounts the specified device, closing its archive in the process
/// Returns -1 if the specified device was not found
Result archiveUnmount(const char *deviceName);
/// Unmounts all devices and cleans up any resources used by the driver
Result archiveUnmountAll(void);
/// Get a file's mtime
Result archive_getmtime(const char *name, u64 *mtime);
archiveUnmount
Result archiveUnmount(const char *deviceName)
Unmounts the specified device, closing its archive in the process Returns -1 if the specified device ...
archiveMountSdmc
Result archiveMountSdmc(void)
Mounts the SD.
archiveCommitSaveData
Result archiveCommitSaveData(const char *deviceName)
Uses FSUSER_ControlArchive with control action ARCHIVE_ACTION_COMMIT_SAVE_DATA on the opened archive.
archiveMount
Result archiveMount(FS_ArchiveID archiveID, FS_Path archivePath, const char *deviceName)
Mounts and opens an archive as deviceName Returns either an archive open error code,...
archive_getmtime
Result archive_getmtime(const char *name, u64 *mtime)
Get a file's mtime.
archiveUnmountAll
Result archiveUnmountAll(void)
Unmounts all devices and cleans up any resources used by the driver.
fs.h
Filesystem Services.
FS_ArchiveID
FS_ArchiveID
Archive IDs.
Definition: fs.h:52
FS_DirectoryEntry
Directory entry.
Definition: fs.h:162
FS_Path
Filesystem path data, detailing the specific target of an operation.
Definition: fs.h:232
archive_dir_t
Open directory struct.
Definition: archive.h:16
archive_dir_t::size
size_t size
Current entry index.
Definition: archive.h:20
archive_dir_t::index
ssize_t index
CTRU handle.
Definition: archive.h:19
archive_dir_t::fd
Handle fd
"arch"
Definition: archive.h:18
types.h
Various system types.
u64
uint64_t u64
64-bit unsigned integer
Definition: types.h:24
Handle
u32 Handle
Resource handle.
Definition: types.h:41
Result
s32 Result
Function result.
Definition: types.h:42
u32
uint32_t u32
32-bit unsigned integer
Definition: types.h:23