From a1661294713fef979e3c1d942093c40b6b9a2c4b Mon Sep 17 00:00:00 2001 From: Adubbz Date: Fri, 12 Jul 2019 17:36:53 +1000 Subject: [PATCH] Added fsDeleteSaveDataFileSystemBySaveDataSpaceId --- nx/include/switch/services/fs.h | 1 + nx/source/services/fs.c | 36 +++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/nx/include/switch/services/fs.h b/nx/include/switch/services/fs.h index 344eba5f..bbf5118f 100644 --- a/nx/include/switch/services/fs.h +++ b/nx/include/switch/services/fs.h @@ -239,6 +239,7 @@ Result fsOpenBisStorage(FsStorage* out, FsBisStorageId partitionId); Result fsOpenBisFileSystem(FsFileSystem* out, FsBisStorageId partitionId, const char* string); Result fsCreateSaveDataFileSystemBySystemSaveDataId(const FsSave* save, const FsSaveCreate* create); +Result fsDeleteSaveDataFileSystemBySaveDataSpaceId(FsSaveDataSpaceId saveDataSpaceId, u64 saveID); Result fsIsExFatSupported(bool* out); diff --git a/nx/source/services/fs.c b/nx/source/services/fs.c index 57b670ca..1eb9495d 100644 --- a/nx/source/services/fs.c +++ b/nx/source/services/fs.c @@ -186,6 +186,42 @@ Result fsCreateSaveDataFileSystemBySystemSaveDataId(const FsSave* save, const Fs return rc; } +Result fsDeleteSaveDataFileSystemBySaveDataSpaceId(FsSaveDataSpaceId saveDataSpaceId, u64 saveID) { + IpcCommand c; + ipcInitialize(&c); + + struct { + u64 magic; + u64 cmd_id; + FsSaveDataSpaceId saveDataSpaceId; + u64 saveID; + } PACKED *raw; + + raw = serviceIpcPrepareHeader(&g_fsSrv, &c, sizeof(*raw)); + + raw->magic = SFCI_MAGIC; + raw->cmd_id = 25; + raw->saveDataSpaceId = saveDataSpaceId; + raw->saveID = saveID; + + Result rc = serviceIpcDispatch(&g_fsSrv); + + if (R_SUCCEEDED(rc)) { + IpcParsedCommand r; + struct { + u64 magic; + u64 result; + } *resp; + + serviceIpcParse(&g_fsSrv, &r, sizeof(*resp)); + resp = r.Raw; + + rc = resp->result; + } + + return rc; +} + Result fsMountSdcard(FsFileSystem* out) { IpcCommand c; ipcInitialize(&c);