Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fs: add fsOpenGameCardDetectionEventNotifier and fsOpenGameCardStorage.
  • Loading branch information
ITotalJustice committed Aug 16, 2025
commit 47e445e08804d9f0e700e27c69b2289e838101cc
8 changes: 8 additions & 0 deletions nx/include/switch/services/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down
16 changes: 16 additions & 0 deletions nx/source/services/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
Expand Down