Updated the NsSystemDeliveryInfo struct and added nsGetSystemDeliveryInfo.

This commit is contained in:
yellows8 2019-10-26 23:39:19 -04:00
parent b0980e4c9f
commit b6af00d908
No known key found for this signature in database
GPG Key ID: 0AF90DA3F1E60E43
2 changed files with 26 additions and 7 deletions

View File

@ -104,13 +104,15 @@ typedef struct {
/// SystemDeliveryInfo
typedef struct {
u32 protocol_version; ///< Must be <= to and match a system-setting.
u8 unk_x4[0x8]; ///< Unused by \ref nssuRequestSendSystemUpdate / \ref nssuControlRequestReceiveSystemUpdate, besides HMAC validation.
u32 systemupdate_meta_version; ///< SystemUpdate meta version.
u64 systemupdate_meta_titleid; ///< SystemUpdate meta titleID.
u8 unk_x18; ///< Copied into state by \ref nssuRequestSendSystemUpdate.
u8 unk_x19[0xc7]; ///< Unused by \ref nssuRequestSendSystemUpdate / \ref nssuControlRequestReceiveSystemUpdate, besides HMAC validation.
u8 hmac[0x20]; ///< HMAC-SHA256 over the previous 0xe0-bytes.
u32 system_delivery_protocol_version; ///< Must be <= to and match a system-setting.
u32 application_delivery_protocol_version; ///< Loaded from a system-setting. Unused by \ref nssuRequestSendSystemUpdate / \ref nssuControlRequestReceiveSystemUpdate, besides HMAC validation.
u32 includes_exfat; ///< Whether ExFat is included. Unused by \ref nssuRequestSendSystemUpdate / \ref nssuControlRequestReceiveSystemUpdate, besides HMAC validation.
u32 systemupdate_meta_version; ///< SystemUpdate meta version.
u64 systemupdate_meta_titleid; ///< SystemUpdate meta titleID.
u8 unk_x18; ///< Copied into state by \ref nssuRequestSendSystemUpdate.
u8 unk_x19; ///< Unused by \ref nssuRequestSendSystemUpdate / \ref nssuControlRequestReceiveSystemUpdate, besides HMAC validation.
u8 unk_x1a[0xc6]; ///< Unused by \ref nssuRequestSendSystemUpdate / \ref nssuControlRequestReceiveSystemUpdate, besides HMAC validation.
u8 hmac[0x20]; ///< HMAC-SHA256 over the previous 0xe0-bytes.
} NsSystemDeliveryInfo;
/// Default size for \ref nssuControlSetupCardUpdate / \ref nssuControlSetupCardUpdateViaSystemUpdater. This is the size used by qlaunch for SetupCardUpdate.
@ -174,6 +176,13 @@ Result nsGetTotalSpaceSize(FsStorageId storage_id, u64 *size);
*/
Result nsGetFreeSpaceSize(FsStorageId storage_id, u64 *size);
/**
* @brief Generates a \ref NsSystemDeliveryInfo using the currently installed SystemUpdate meta title.
* @note Only available on [4.0.0+].
* @param[out] info \ref NsSystemDeliveryInfo
*/
Result nsGetSystemDeliveryInfo(NsSystemDeliveryInfo *info);
///@}
///@name ns:vm

View File

@ -216,6 +216,16 @@ Result nsGetFreeSpaceSize(FsStorageId storage_id, u64 *size) {
return _nsCmdInU64OutU64(&g_nsAppManSrv, storage_id, size, 48);
}
Result nsGetSystemDeliveryInfo(NsSystemDeliveryInfo *info) {
if (hosversionBefore(4,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return serviceDispatch(&g_nsAppManSrv, 2000,
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
.buffers = { { info, sizeof(*info) } },
);
}
// ns:vm
NX_GENERATE_SERVICE_GUARD(nsvm);