mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-22 04:52:39 +02:00
fs: Added fsCreateSaveDataFileSystem(), fsDeleteSaveDataFileSystem() and fsDeleteSaveDataFileSystemBySaveDataAttribute(). #518
This commit is contained in:
parent
ccec5bd36c
commit
41fc8bb17c
@ -88,6 +88,13 @@ typedef struct {
|
|||||||
u8 unused[0x190]; ///< Uninitialized.
|
u8 unused[0x190]; ///< Uninitialized.
|
||||||
} FsSaveDataExtraData;
|
} FsSaveDataExtraData;
|
||||||
|
|
||||||
|
/// SaveDataMetaInfo
|
||||||
|
typedef struct {
|
||||||
|
u32 size;
|
||||||
|
u8 type; ///< \ref FsSaveDataMetaType
|
||||||
|
u8 reserved[0x0B];
|
||||||
|
} FsSaveDataMetaInfo;
|
||||||
|
|
||||||
/// SaveDataCreationInfo
|
/// SaveDataCreationInfo
|
||||||
typedef struct {
|
typedef struct {
|
||||||
s64 save_data_size; ///< Size of the save data.
|
s64 save_data_size; ///< Size of the save data.
|
||||||
@ -219,6 +226,13 @@ typedef enum {
|
|||||||
FsSaveDataFlags_NeedsSecureDelete = BIT(3),
|
FsSaveDataFlags_NeedsSecureDelete = BIT(3),
|
||||||
} FsSaveDataFlags;
|
} FsSaveDataFlags;
|
||||||
|
|
||||||
|
/// SaveDataMetaType
|
||||||
|
typedef enum {
|
||||||
|
FsSaveDataMetaType_None = 0,
|
||||||
|
FsSaveDataMetaType_Thumbnail = 1,
|
||||||
|
FsSaveDataMetaType_ExtensionContext = 2,
|
||||||
|
} FsSaveDataMetaType;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
FsGameCardAttribute_AutoBootFlag = BIT(0), ///< Causes the cartridge to automatically start on bootup
|
FsGameCardAttribute_AutoBootFlag = BIT(0), ///< Causes the cartridge to automatically start on bootup
|
||||||
FsGameCardAttribute_HistoryEraseFlag = BIT(1), ///< Causes NS to throw an error on attempt to load the cartridge
|
FsGameCardAttribute_HistoryEraseFlag = BIT(1), ///< Causes NS to throw an error on attempt to load the cartridge
|
||||||
@ -323,8 +337,11 @@ Result fsOpenBisStorage(FsStorage* out, FsBisPartitionId partitionId);
|
|||||||
/// Do not call this directly, see fs_dev.h.
|
/// Do not call this directly, see fs_dev.h.
|
||||||
Result fsOpenSdCardFileSystem(FsFileSystem* out);
|
Result fsOpenSdCardFileSystem(FsFileSystem* out);
|
||||||
|
|
||||||
|
Result fsDeleteSaveDataFileSystem(u64 application_id);
|
||||||
|
Result fsCreateSaveDataFileSystem(const FsSaveDataAttribute* attr, const FsSaveDataCreationInfo* creation_info, const FsSaveDataMetaInfo* meta);
|
||||||
Result fsCreateSaveDataFileSystemBySystemSaveDataId(const FsSaveDataAttribute* attr, const FsSaveDataCreationInfo* creation_info);
|
Result fsCreateSaveDataFileSystemBySystemSaveDataId(const FsSaveDataAttribute* attr, const FsSaveDataCreationInfo* creation_info);
|
||||||
Result fsDeleteSaveDataFileSystemBySaveDataSpaceId(FsSaveDataSpaceId save_data_space_id, u64 saveID); ///< [2.0.0+]
|
Result fsDeleteSaveDataFileSystemBySaveDataSpaceId(FsSaveDataSpaceId save_data_space_id, u64 saveID); ///< [2.0.0+]
|
||||||
|
Result fsDeleteSaveDataFileSystemBySaveDataAttribute(FsSaveDataSpaceId save_data_space_id, const FsSaveDataAttribute* attr); ///< [4.0.0+]
|
||||||
|
|
||||||
Result fsIsExFatSupported(bool* out);
|
Result fsIsExFatSupported(bool* out);
|
||||||
|
|
||||||
|
@ -224,6 +224,20 @@ Result fsOpenSdCardFileSystem(FsFileSystem* out) {
|
|||||||
return _fsCmdGetSession(&g_fsSrv, &out->s, 18);
|
return _fsCmdGetSession(&g_fsSrv, &out->s, 18);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result fsDeleteSaveDataFileSystem(u64 application_id) {
|
||||||
|
return _fsObjectDispatchIn(&g_fsSrv, 21, application_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
Result fsCreateSaveDataFileSystem(const FsSaveDataAttribute* attr, const FsSaveDataCreationInfo* creation_info, const FsSaveDataMetaInfo* meta) {
|
||||||
|
const struct {
|
||||||
|
FsSaveDataAttribute attr;
|
||||||
|
FsSaveDataCreationInfo creation_info;
|
||||||
|
FsSaveDataMetaInfo meta;
|
||||||
|
} in = { *attr, *creation_info, *meta };
|
||||||
|
|
||||||
|
return _fsObjectDispatchIn(&g_fsSrv, 22, in);
|
||||||
|
}
|
||||||
|
|
||||||
Result fsCreateSaveDataFileSystemBySystemSaveDataId(const FsSaveDataAttribute* attr, const FsSaveDataCreationInfo* creation_info) {
|
Result fsCreateSaveDataFileSystemBySystemSaveDataId(const FsSaveDataAttribute* attr, const FsSaveDataCreationInfo* creation_info) {
|
||||||
const struct {
|
const struct {
|
||||||
FsSaveDataAttribute attr;
|
FsSaveDataAttribute attr;
|
||||||
@ -245,6 +259,18 @@ Result fsDeleteSaveDataFileSystemBySaveDataSpaceId(FsSaveDataSpaceId save_data_s
|
|||||||
return _fsObjectDispatchIn(&g_fsSrv, 25, in);
|
return _fsObjectDispatchIn(&g_fsSrv, 25, in);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result fsDeleteSaveDataFileSystemBySaveDataAttribute(FsSaveDataSpaceId save_data_space_id, const FsSaveDataAttribute* attr) {
|
||||||
|
if (hosversionBefore(4,0,0))
|
||||||
|
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||||
|
|
||||||
|
const struct {
|
||||||
|
u8 save_data_space_id;
|
||||||
|
FsSaveDataAttribute attr;
|
||||||
|
} in = { (u8)save_data_space_id, *attr };
|
||||||
|
|
||||||
|
return _fsObjectDispatchIn(&g_fsSrv, 28, in);
|
||||||
|
}
|
||||||
|
|
||||||
Result fsIsExFatSupported(bool* out) {
|
Result fsIsExFatSupported(bool* out) {
|
||||||
if (hosversionBefore(2,0,0)) {
|
if (hosversionBefore(2,0,0)) {
|
||||||
*out = false;
|
*out = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user