Skip to content

Commit

Permalink
fs: add GetContentStorageInfoIndex
Browse files Browse the repository at this point in the history
  • Loading branch information
SciresM authored and fincs committed Nov 24, 2024
1 parent 163fddd commit 73d79d4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 2 additions & 0 deletions nx/include/switch/services/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,8 @@ Result fsGetRightsIdByPath(const char* path, FsRightsId* out_rights_id);
/// Retrieves the rights id and key generation corresponding to the content path. Only available on [3.0.0+], attr is ignored before [16.0.0].
Result fsGetRightsIdAndKeyGenerationByPath(const char* path, FsContentAttributes attr, u8* out_key_generation, FsRightsId* out_rights_id);

Result fsGetContentStorageInfoIndex(s32 *out); ///< [19.0.0+]

Result fsDisableAutoSaveDataCreation(void);

Result fsSetGlobalAccessLogMode(u32 mode);
Expand Down
13 changes: 9 additions & 4 deletions nx/source/services/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,13 @@ Result fsGetAndClearErrorInfo(FsFileSystemProxyErrorInfo *out) {
return _fsObjectDispatchOut(&g_fsSrv, 800, *out);
}

Result fsGetContentStorageInfoIndex(s32 *out) {
if (hosversionBefore(19,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);

return _fsCmdNoInOutU32(&g_fsSrv, (u32 *)out, 820);
}

Result fsDisableAutoSaveDataCreation(void) {
return _fsCmdNoIO(&g_fsSrv, 1003);
}
Expand Down Expand Up @@ -1239,7 +1246,8 @@ Result fsDeviceOperatorGetGameCardDeviceCertificate(FsDeviceOperator* d, const F
s64 buffer_size;
} in = { *handle, size };

s64 os;
// Assume old gamecard certificate size on pre-19.0.0
s64 os = 0x200;
Result rc;

if (hosversionAtLeast(19,0,0)) {
Expand All @@ -1250,9 +1258,6 @@ Result fsDeviceOperatorGetGameCardDeviceCertificate(FsDeviceOperator* d, const F
rc = _fsObjectDispatchIn(&d->s, 206, in,
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
.buffers = { { dst, dst_size } });

// Assume old gamecard certificate size on pre-19.0.0
os = 0x200;
}

if (R_SUCCEEDED(rc))
Expand Down

0 comments on commit 73d79d4

Please sign in to comment.