diff --git a/nx/include/switch/services/fs.h b/nx/include/switch/services/fs.h index 8d143ff9..b114941f 100644 --- a/nx/include/switch/services/fs.h +++ b/nx/include/switch/services/fs.h @@ -166,6 +166,8 @@ Service* fsGetServiceSession(void); Result fsOpenBisStorage(FsStorage* out, u32 PartitionId); Result fsOpenBisFileSystem(FsFileSystem* out, u32 PartitionId, const char* string); +Result fsIsExFatSupported(bool* out); + /// Do not call this directly, see fs_dev.h. Result fsMountSdcard(FsFileSystem* out); diff --git a/nx/source/services/fs.c b/nx/source/services/fs.c index 8619c4f9..909c8e80 100644 --- a/nx/source/services/fs.c +++ b/nx/source/services/fs.c @@ -425,6 +425,49 @@ Result fsOpenSdCardDetectionEventNotifier(FsEventNotifier* out) { return rc; } +Result fsIsExFatSupported(bool* out) +{ + if (!kernelAbove200()) { + *out = false; + return 0; + } + + IpcCommand c; + ipcInitialize(&c); + + struct { + u64 magic; + u64 cmd_id; + } *raw; + + raw = serviceIpcPrepareHeader(&g_fsSrv, &c, sizeof(*raw)); + + raw->magic = SFCI_MAGIC; + raw->cmd_id = 27; + + Result rc = serviceIpcDispatch(&g_fsSrv); + + if (R_SUCCEEDED(rc)) { + IpcParsedCommand r; + struct { + u64 magic; + u64 result; + u8 exfat; + } *resp; + + serviceIpcParse(&g_fsSrv, &r, sizeof(*resp)); + resp = r.Raw; + + rc = resp->result; + + if (R_SUCCEEDED(rc)) { + *out = resp->exfat; + } + } + + return rc; +} + // Wrapper(s) for fsMountSaveData. Result fsMount_SaveData(FsFileSystem* out, u64 titleID, u128 userID) { FsSave save;