NS services: Difference between revisions
No edit summary |
No edit summary |
||
Line 1,574: | Line 1,574: | ||
==== CreateApplicationResource ==== | ==== CreateApplicationResource ==== | ||
Returns an [[#IApplicationResource]]. | Takes an input [[#ApplicationResourceType]]. Returns an [[#IApplicationResource]]. | ||
==== GetApplicationResource ==== | ==== GetApplicationResource ==== | ||
Returns an [[#IApplicationResource]]. | Takes an input u64 ProcessId and an input [[#ApplicationResourceType]]. Returns an [[#IApplicationResource]]. | ||
==== RegisterDeviceLockKey ==== | ==== RegisterDeviceLockKey ==== | ||
Line 3,414: | Line 3,414: | ||
= ApplicationUpdateInfo = | = ApplicationUpdateInfo = | ||
This is "nn::ns::ApplicationUpdateInfo". | This is "nn::ns::ApplicationUpdateInfo". This is an u8. | ||
{| class="wikitable" border="1" | |||
|- | |||
! Value | |||
! Description | |||
|- | |||
| 0 || UpToDate | |||
|- | |||
| 1 || Updatable | |||
|} | |||
[[qlaunch]] just checks whether this is 0. | |||
= ApplicationOccupiedSize = | = ApplicationOccupiedSize = | ||
This is "nn::ns::ApplicationOccupiedSize". This is a 0x80-byte struct. | This is "nn::ns::ApplicationOccupiedSize". This is a 0x80-byte struct. | ||
= | {| class="wikitable" border="1" | ||
|- | |||
! Offset | |||
! Size | |||
! Description | |||
|- | |||
| 0x0 || 0x20 * 4 || Array of [[#ApplicationOccupiedSizeEntity]] | |||
|} | |||
= | = ApplicationOccupiedSizeEntity = | ||
This is "nn::ns:: | This is "nn::ns::ApplicationOccupiedSizeEntity". This is a 0x20-byte struct. | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 3,435: | Line 3,449: | ||
! Description | ! Description | ||
|- | |- | ||
| 0x0 || | | 0x0 || 0x1 || [[NCM_services#StorageId|StorageId]] | ||
|- | |- | ||
| | | 0x1 || 0x7 || Reserved | ||
|- | |- | ||
| | | 0x8 || 0x8 || AppSize | ||
|- | |- | ||
| | | 0x10 || 0x8 || PatchSize | ||
|- | |- | ||
| | | 0x18 || 0x8 || AocSize | ||
|} | |||
= ProgressForDeleteUserSaveDataAll = | |||
This is "nn::ns::detail::ProgressForDeleteUserSaveDataAll". This is a 0x28-byte struct. | |||
{| class="wikitable" border="1" | |||
|- | |- | ||
| | ! Offset | ||
! Size | |||
! Description | |||
|- | |||
| 0x0 || 0x8 || StartedAt | |||
|- | |||
| 0x8 || 0x4 || Count | |||
|- | |||
| 0xC || 0x4 || Reserved | |||
|- | |||
| 0x10 || 0x8 || SizeInBytes | |||
|- | |- | ||
| | | 0x18 || 0x1 || IsSystem | ||
|- | |- | ||
| | | 0x19 || 0x7 || Reserved | ||
|- | |- | ||
| | | 0x20 || 0x8 || ApplicationId | ||
|} | |} | ||
= | = ApplicationViewDeprecated = | ||
This is "nn::ns:: | This is "nn::ns::ApplicationViewDeprecated". This is a 0x40-byte struct. | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 3,465: | Line 3,495: | ||
| 0x0 || 0x8 || [[NCM_services#ApplicationId|ApplicationId]] | | 0x0 || 0x8 || [[NCM_services#ApplicationId|ApplicationId]] | ||
|- | |- | ||
| 0x8 || 0x4 || | | 0x8 || 0x4 || Version | ||
|- | |||
| 0xC || 0x4 || [[#ApplicationViewFlag|Flag]] | |||
|- | |- | ||
| | | 0x10 || 0x18 || [[#ApplicationDownloadProgress|Progress]] | ||
|- | |- | ||
| | | 0x28 || 0x18 || [[#ApplicationApplyDeltaProgress|ApplyProgress]] | ||
|} | |} | ||
This is converted from [[#ApplicationView]] by [[#GetApplicationViewDeprecated]] on newer system-versions as follows: | |||
This is | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 3,481: | Line 3,512: | ||
! Description | ! Description | ||
|- | |- | ||
| 0x0 || | | 0x0 || 0x20 || Same as [[#ApplicationView]] +0x0. | ||
|- | |||
| 0x20 || 0x4 || Same as [[#ApplicationView]] +0x20. | |||
|- | |||
| 0x24 || 0x2 || Same as [[#ApplicationView]] +0x24. | |||
|- | |- | ||
| | | 0x26 || 0x2 || Cleared to 0. | ||
|} | |- | ||
| 0x28 || 0x10 || Same as [[#ApplicationView]] +0x30. | |||
= | |- | ||
This is a | | 0x38 || 0x4 || Same as [[#ApplicationView]] +0x40. | ||
|- | |||
| 0x3C || 0x1 || Same as [[#ApplicationView]] +0x44. | |||
|- | |||
| 0x3D || 0x2 || Cleared to 0. | |||
|- | |||
| 0x3F || 0x1 || Cleared to 0. | |||
|} | |||
= ApplicationViewFlag = | |||
This is "nn::ns::ApplicationViewFlag". This is a 32-bit flag. | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! | ! Bit | ||
! Description | ! Description | ||
|- | |- | ||
| | | 0 | ||
| | |||
|- | |||
| 1 | |||
| | |||
|- | |- | ||
| | | 2 | ||
| | |||
|- | |- | ||
| | | 3 | ||
| | |||
|- | |- | ||
| | | 4 | ||
| | |||
|- | |- | ||
| | | 5 | ||
| | |||
|- | |- | ||
| | | 6 | ||
| | |||
|- | |- | ||
| 7 | |||
| | |||
|- | |- | ||
| | | 8 | ||
| | |||
|- | |- | ||
| | | 9 | ||
| | |||
|- | |- | ||
| | | 10 | ||
| | |||
|- | |||
| 11 | |||
| | |||
|- | |||
| 12 | |||
| | |||
|- | |||
| 13 | |||
| | |||
|- | |||
| 14 | |||
| | |||
|- | |||
| 15 | |||
| | |||
|- | |||
| 16 | |||
| | |||
|- | |||
| 17 | |||
| | |||
|} | |} | ||
This is "nn::ns:: | = ApplicationDownloadProgress = | ||
This is "nn::ns::ApplicationDownloadProgress". This is a 0x18-byte struct. | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
Line 3,537: | Line 3,603: | ||
! Description | ! Description | ||
|- | |- | ||
| 0x0 || 0x8 || | | 0x0 || 0x8 || Downloaded | ||
|- | |||
| 0x8 || 0x8 || Total | |||
|- | |||
| 0x10 || 0x4 || LastResult | |||
|- | |- | ||
| | | 0x14 || 0x1 || [[#ApplicationDownloadState|State]] | ||
|- | |||
| 0x15 || 0x3 || Reserved | |||
|} | |} | ||
= ApplicationApplyDeltaProgress = | |||
This is "nn::ns::ApplicationApplyDeltaProgress". This is a 0x18-byte struct. | |||
= | |||
This is "nn::ns:: | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
Line 3,558: | Line 3,623: | ||
! Description | ! Description | ||
|- | |- | ||
| 0x0 || | | 0x0 || 0x8 || Applied | ||
|- | |- | ||
| | | 0x8 || 0x8 || Total | ||
|- | |- | ||
| | | 0x10 || 0x4 || LastResult | ||
|- | |- | ||
| | | 0x14 || 0x1 || [[#ApplicationApplyDeltaState|State]] | ||
|- | |- | ||
| | | 0x15 || 0x3 || Reserved | ||
|} | |||
= ApplicationDownloadState = | |||
This is "nn::ns::ApplicationDownloadState". This is an u8. | |||
{| class="wikitable" border="1" | |||
|- | |- | ||
! Value | |||
! Description | |||
|- | |- | ||
| | | 0 || Runnable | ||
|- | |- | ||
| | | 1 || Suspended | ||
|- | |- | ||
| | | 2 || NotEnoughSpace | ||
|- | |- | ||
| | | 3 || Fatal | ||
|- | |- | ||
| | | 4 || Finished | ||
|} | |} | ||
This is "nn::ns:: | = ApplicationApplyDeltaState = | ||
This is "nn::ns::ApplicationApplyDeltaState". This is an u8. | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! | ! Value | ||
! Description | ! Description | ||
|- | |- | ||
| | | 0 || Applying | ||
|- | |- | ||
| | | 1 || Suspended | ||
|- | |- | ||
| | | 2 || NotEnoughSpace | ||
|- | |- | ||
| | | 3 || Fatal | ||
|- | |- | ||
| | | 4 || NoTask | ||
|- | |- | ||
| | | 5 || WaitApply | ||
|- | |- | ||
| | | 6 || Applied | ||
|} | |} | ||
This is "nn::ns:: | = ApplicationView = | ||
This is "nn::ns::ApplicationView". This is a 0x50-byte struct. | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! | ! Offset | ||
! | ! Size | ||
! Description | |||
|- | |- | ||
| | | 0x0 || 0x8 || [[NCM_services#ApplicationId|ApplicationId]] | ||
|- | |- | ||
| | | 0x8 || 0x4 || ? | ||
|- | |||
| 0xC || 0x4 || Flags | |||
|- | |- | ||
| | | 0x10 || 0x40 || ? | ||
|} | |} | ||
This is | = ApplicationViewWithPromotionInfo = | ||
This is a 0x70-byte struct. | |||
= | {| class="wikitable" border="1" | ||
|- | |||
! Offset | |||
! Size | |||
! Description | |||
|- | |||
| 0x0 || 0x50 || [[#ApplicationView]] | |||
|- | |||
| 0x50 || 0x20 || [[#PromotionInfo]] | |||
|} | |||
= | = PromotionInfo = | ||
This is a 0x20-byte struct. | This is a 0x20-byte struct. | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 3,641: | Line 3,717: | ||
! Description | ! Description | ||
|- | |- | ||
| 0x0 || 0x8 || | | 0x0 || 0x8 || PosixTime start_timestamp. | ||
|- | |- | ||
| 0x8 || | | 0x8 || 0x8 || PosixTime end_timestamp. | ||
|- | |- | ||
| 0x18 || 0x1 || Flags, [[qlaunch]] only uses bit0-bit4 and bit7. | | 0x10 || 0x8 || Remaining time until the promotion ends, in nanoseconds ({end_timestamp - current_time} converted to nanoseconds). | ||
|- | |- | ||
| 0x19 || 0x1 || Flags, [[qlaunch]] only uses bit0. | | 0x18 || 0x4 || Not set, left at zero. | ||
|- | |- | ||
| 0x1A || 0x6 || Unknown | | 0x1C || 0x1 || Flags. Bit0: whether the PromotionInfo is valid (including bit1). Bit1 clear: u64 +0x10 is set. | ||
|} | |- | ||
| 0x1D || 0x3 || Padding | |||
|} | |||
= ApplicationResourceType = | |||
This is "nn::ns::ApplicationResourceType". This is an u8. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Value | |||
! Description | |||
|- | |||
| 0 || ApplicationResource | |||
|- | |||
| 1 || MicroApplicationResource | |||
|} | |||
= NoDownloadRightsErrorResolution = | |||
This is "nn::ns::NoDownloadRightsErrorResolution". | |||
= BackgroundNetworkUpdateState = | |||
This is "nn::ns::BackgroundNetworkUpdateState". This is an u8. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Value | |||
! Description | |||
|- | |||
| 0 || None | |||
|- | |||
| 1 || InProgress | |||
|- | |||
| 2 || Ready | |||
|} | |||
Similar to [[#HasDownloaded]], [[#GetBackgroundNetworkUpdateState]] uses [[NIM_services|nim]] ListSystemUpdateTask and [[NIM_services|nim]] GetSystemUpdateTaskInfo. When ListSystemUpdateTask successfully returns a task and GetSystemUpdateTaskInfo is successful, the output value is set to: <code>1 + *((u8*)(taskinfo+0) == 0x3</code>. Otherwise, value=0. | |||
[[#GetBackgroundNetworkUpdateState]] always returns Result 0, however this will assert if GetSystemUpdateTaskInfo fails with ret!=0x3C89. | |||
= SystemUpdateProgress = | |||
This is "nn::ns::SystemUpdateProgress". This is a 0x10-byte struct. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Size | |||
! Description | |||
|- | |||
| 0x0 || 0x8 || Loaded (this value can be larger than total_size when the async operation is finishing and when total_size is <=0, this current_size field may contain a progress value for when the total_size is not yet determined) | |||
|- | |||
| 0x8 || 0x8 || Total (this field is only valid when >0) | |||
|} | |||
Commands which have this as output will return 0 with the output cleared, when no task is available. | |||
= EulaDataPath = | |||
This is "nn::ns::detail::EulaDataPath". This is a 0x100-byte struct. | |||
This contains a file path. | |||
= SystemDeliveryInfo = | |||
This is "nn::ns::SystemDeliveryInfo". This is a 0x100-byte struct. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Size | |||
! Description | |||
|- | |||
| 0x0 || 0x4 || SystemDeliveryProtocolVersion. Must be <= to and match [[System_Settings|system-setting]] <code>contents_delivery!system_delivery_protocol_version</code>. | |||
|- | |||
| 0x4 || 0x4 || ApplicationDeliveryProtocolVersion. Loaded from [[System_Settings|system-setting]] <code>contents_delivery!application_delivery_protocol_version</code>. Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation. | |||
|- | |||
| 0x8 || 0x1 || HasExFat. Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation. | |||
|- | |||
| 0x9 || 0x3 || Reserved. | |||
|- | |||
| 0xC || 0x4 || SystemUpdateMetaVersion. | |||
|- | |||
| 0x10 || 0x8 || SystemUpdateMetaId. | |||
|- | |||
| 0x18 || 0x1 || FirmwareVariationId. Used by [[#RequestSendSystemUpdate]]. | |||
|- | |||
| 0x19 || 0x1 || UpdatableFirmwareGroupId. Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation. | |||
|- | |||
| 0x1A || 0x1 || PlatformRegion (0x00 = Unknown, 0x01 = Global, 0x02 = China). | |||
|- | |||
| 0x1B || 0xC5 || Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation. | |||
|- | |||
| 0xE0 || 0x20 || HMAC-SHA256 over the previous 0xE0-bytes. | |||
|} | |||
= ApplicationDeliveryInfo = | |||
This is "nn::ns::ApplicationDeliveryInfo". This is a 0x100-byte struct. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Size | |||
! Description | |||
|- | |||
| 0x0 || 0x8 || ? | |||
|- | |||
| 0x8 || 0x8 || ApplicationId. | |||
|- | |||
| 0x10 || 0x4 || ApplicationVersion. | |||
|- | |||
| 0x14 || 0x4 || ? | |||
|- | |||
| 0x18 || 0x4 || RequiredSystemVersion. | |||
|- | |||
| 0x1C || 0x4 || ? | |||
|- | |||
| 0x20 || 0xC0 || ? | |||
|- | |||
| 0xE0 || 0x20 || HMAC-SHA256 over the previous 0xE0-bytes. Uses a different key than [[#SystemDeliveryInfo]]. | |||
|} | |||
= LatestSystemUpdate = | |||
This is "nn::ns::LatestSystemUpdate". This is an u8. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Value | |||
! Description | |||
|- | |||
| 0 || UpToDate | |||
|- | |||
| 1 || Downloaded | |||
|- | |||
| 2 || NeedsDownload | |||
|} | |||
= ReceiveApplicationProgress = | |||
This is "nn::ns::ReceiveApplicationProgress". This is a 0x10-byte struct. | |||
= SendApplicationProgress = | |||
This is "nn::ns::SendApplicationProgress". This is a 0x10-byte struct. | |||
= ApplicationRightsOnClient = | |||
This is a 0x20-byte struct. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Size | |||
! Description | |||
|- | |||
| 0x0 || 0x8 || [[NCM_services#ApplicationId|ApplicationId]] | |||
|- | |||
| 0x8 || 0x10 || [[Account_services#Uid|Uid]] | |||
|- | |||
| 0x18 || 0x1 || Flags, [[qlaunch]] only uses bit0-bit4 and bit7. | |||
|- | |||
| 0x19 || 0x1 || Flags, [[qlaunch]] only uses bit0. | |||
|- | |||
| 0x1A || 0x6 || Unknown | |||
|} | |||
[[qlaunch]] only uses +0x18/+0x19 in this struct. | |||
= DownloadTaskStatus = | |||
This is "nn::ns::DownloadTaskStatus". This is a 0x20-byte struct. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Size | |||
! Description | |||
|- | |||
| 0x0 || 0x10 || Uuid | |||
|- | |||
| 0x10 || 0x8 || [[NCM_services#ApplicationId|ApplicationId]] | |||
|- | |||
| 0x18 || 0x1 || [[#DownloadTaskStatusDetail|Detail]] | |||
|- | |||
| 0x19 || 0x1 || NeedsCleanup | |||
|- | |||
| 0x1A || 0x2 || Reserved | |||
|- | |||
| 0x1C || 0x4 || Result | |||
|} | |||
= DownloadTaskStatusDetail = | |||
This is "nn::ns::DownloadTaskStatusDetail". This is an u8. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Value | |||
! Description | |||
|- | |||
| 0 || Created | |||
|- | |||
| 1 || Added | |||
|- | |||
| 2 || AlreadyExists | |||
|- | |||
| 3 || Failed | |||
|} | |||
= ApplicationLaunchInfo = | |||
This is a 0x40-byte struct. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Size | |||
! Description | |||
|- | |||
| 0x0 || 0x8 || [[NCM_services#ApplicationId|ApplicationId]] | |||
|- | |||
| 0x8 || 0x4 || Application version | |||
|- | |||
| 0xC || 0x4 || [[Process_Manager_services#LaunchFlags|LaunchFlags]], set to hard-coded value 0xB by [[#GetApplicationLaunchInfo]]. | |||
|- | |||
| 0x10 || 0x1 || Application [[NCM_services#StorageId|StorageId]] | |||
|- | |||
| 0x11 || 0x1 || Update [[NCM_services#StorageId|StorageId]] | |||
|- | |||
| 0x12 || 0x2E || | |||
|} | |||
= | = UserData = | ||
This is a 0x80-byte struct. | |||
This is a | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
Line 3,695: | Line 3,968: | ||
|} | |} | ||
This is a | = ProfileBase = | ||
This is a 0x38-byte struct. | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
Line 3,709: | Line 3,982: | ||
|- | |- | ||
|} | |} | ||
= Uid = | = Uid = |