From 42c5d2b113f6a77b60b5fa6df7d731bb17f6f6f7 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Tue, 29 Oct 2024 16:20:27 -0700 Subject: [PATCH] fs: add GetContentStorageInfoIndex --- nx/include/switch/services/fs.h | 2 ++ nx/source/services/fs.c | 13 +++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/nx/include/switch/services/fs.h b/nx/include/switch/services/fs.h index 0b2d2688..387cccfd 100644 --- a/nx/include/switch/services/fs.h +++ b/nx/include/switch/services/fs.h @@ -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); diff --git a/nx/source/services/fs.c b/nx/source/services/fs.c index cd5b2248..d1715d26 100644 --- a/nx/source/services/fs.c +++ b/nx/source/services/fs.c @@ -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); } @@ -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)) { @@ -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))