diff --git a/nx/include/switch/services/ns.h b/nx/include/switch/services/ns.h index 9f6e7a381..6903c8dee 100644 --- a/nx/include/switch/services/ns.h +++ b/nx/include/switch/services/ns.h @@ -771,6 +771,18 @@ Result nsIsAnyApplicationEntityInstalled(u64 application_id, bool *out); */ Result nsCleanupUnavailableAddOnContents(u64 application_id, AccountUid uid); +/** + * @brief EstimateSizeToMove + * @note Only available on [10.0.0+]. + * @param[in] storage_ids Array of u8 \ref NcmStorageId. + * @param[in] count Size of the storage_ids array in entries. + * @param[in] storage_id storage_id \ref NcmStorageId + * @param[in] flags Flags + * @param[in] application_id ApplicationId. + * @param[out] Out Output value. + */ +Result nsEstimateSizeToMove(u8 *storage_ids, s32 count, NcmStorageId storage_id, u32 flags, u64 application_id, s64 *out); + /** * @brief FormatSdCard * @note Only available on [2.0.0+]. diff --git a/nx/source/services/ns.c b/nx/source/services/ns.c index d57ac199a..e63cdd7c4 100644 --- a/nx/source/services/ns.c +++ b/nx/source/services/ns.c @@ -1309,6 +1309,29 @@ Result nsCleanupUnavailableAddOnContents(u64 application_id, AccountUid uid) { return rc; } +Result nsEstimateSizeToMove(u8 *storage_ids, s32 count, NcmStorageId storage_id, u32 flags, u64 application_id, s64 *out) { + if (hosversionBefore(10,0,0)) + return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); + + Service srv={0}; + Result rc = nsGetApplicationManagerInterface(&srv); + + const struct { + u8 storage_id; + u8 pad[3]; + u32 flags; + u64 application_id; + } in = { storage_id, {0}, flags, application_id }; + + if (R_SUCCEEDED(rc)) rc = serviceDispatchInOut(&srv, 1311, in, *out, + .buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_In }, + .buffers = { { storage_ids, count*sizeof(u8) } }, + ); + + serviceClose(&srv); + return rc; +} + Result nsFormatSdCard(void) { if (hosversionBefore(2,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);