diff --git a/nx/include/switch/services/fs.h b/nx/include/switch/services/fs.h index 387cccfd..b38563c3 100644 --- a/nx/include/switch/services/fs.h +++ b/nx/include/switch/services/fs.h @@ -261,6 +261,11 @@ typedef enum { FsGameCardPartition_Logo = 3, ///< [4.0.0+] } FsGameCardPartition; +typedef enum { + FsGameCardStoragePartition_Normal = 0, + FsGameCardStoragePartition_Secure = 1, +} FsGameCardStoragePartition; + typedef struct { u32 value; } FsGameCardHandle; @@ -540,8 +545,11 @@ Result fsOpenDataStorageByProgramId(FsStorage *out, u64 program_id); /// <[3.0.0 Result fsOpenDataStorageByDataId(FsStorage* out, u64 dataId, NcmStorageId storageId); Result fsOpenPatchDataStorageByCurrentProcess(FsStorage* out); +Result fsOpenGameCardStorage(FsStorage* out, const FsGameCardHandle* handle, FsGameCardStoragePartition partition); + Result fsOpenDeviceOperator(FsDeviceOperator* out); Result fsOpenSdCardDetectionEventNotifier(FsEventNotifier* out); +Result fsOpenGameCardDetectionEventNotifier(FsEventNotifier* out); Result fsIsSignedSystemPartitionOnSdCardValid(bool *out); diff --git a/nx/source/services/fs.c b/nx/source/services/fs.c index d1715d26..405581bd 100644 --- a/nx/source/services/fs.c +++ b/nx/source/services/fs.c @@ -538,6 +538,18 @@ Result fsOpenPatchDataStorageByCurrentProcess(FsStorage* out) { return _fsCmdGetSession(&g_fsSrv, &out->s, 203); } +Result fsOpenGameCardStorage(FsStorage* out, const FsGameCardHandle* handle, FsGameCardStoragePartition partition) { + const struct { + FsGameCardHandle handle; + u32 partition; + } in = { *handle, (u32)partition }; + + return serviceDispatchIn(&g_fsSrv, 30, in, + .out_num_objects = 1, + .out_objects = &out->s + ); +} + Result fsOpenDeviceOperator(FsDeviceOperator* out) { return _fsCmdGetSession(&g_fsSrv, &out->s, 400); } @@ -546,6 +558,10 @@ Result fsOpenSdCardDetectionEventNotifier(FsEventNotifier* out) { return _fsCmdGetSession(&g_fsSrv, &out->s, 500); } +Result fsOpenGameCardDetectionEventNotifier(FsEventNotifier* out) { + return _fsCmdGetSession(&g_fsSrv, &out->s, 501); +} + Result fsIsSignedSystemPartitionOnSdCardValid(bool *out) { if (!hosversionBetween(4, 8)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);