1
0
mirror of https://github.com/switchbrew/libnx.git synced 2025-07-29 05:12:13 +02:00

ns: Added nsEstimateSizeToMove.

This commit is contained in:
yellows8 2023-10-20 18:53:41 -04:00
parent 4ff1c52869
commit 94cfa2be1c
No known key found for this signature in database
GPG Key ID: 0AF90DA3F1E60E43
2 changed files with 35 additions and 0 deletions
nx
include/switch/services
source/services

View File

@ -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+].

View File

@ -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);