NS services: Difference between revisions
No edit summary |
|||
(22 intermediate revisions by 2 users not shown) | |||
Line 935: | Line 935: | ||
Then if the above succeeds, the above titles are launched with the above StorageId via [[Process_Manager_services|pmshell]] LaunchProgram, with a 0.5s sleep-thread afterwards on success. | Then if the above succeeds, the above titles are launched with the above StorageId via [[Process_Manager_services|pmshell]] LaunchProgram, with a 0.5s sleep-thread afterwards on success. | ||
=== GetGameCardPlatformRegion === | ==== GetGameCardPlatformRegion ==== | ||
No input, returns an u8 '''PlatformRegion''' (0x00 = Default, 0x01 = China). | No input, returns an u8 '''PlatformRegion''' (0x00 = Default, 0x01 = China). | ||
Line 1,199: | Line 1,199: | ||
! Cmd || Name | ! Cmd || Name | ||
|- | |- | ||
| 0 || GetBackgroundNetworkUpdateState | | 0 || [[#GetBackgroundNetworkUpdateState]] | ||
|- | |- | ||
| 1 || [[# | | 1 || [[#OpenSystemUpdateControl]] | ||
|- | |- | ||
| 2 || NotifyExFatDriverRequired | | 2 || [[#NotifyExFatDriverRequired]] | ||
|- | |- | ||
| 3 || ClearExFatDriverStatusForDebug | | 3 || [[#ClearExFatDriverStatusForDebug]] | ||
|- | |- | ||
| 4 || RequestBackgroundNetworkUpdate | | 4 || [[#RequestBackgroundNetworkUpdate]] | ||
|- | |- | ||
| 5 || NotifyBackgroundNetworkUpdate | | 5 || [[#NotifyBackgroundNetworkUpdate]] | ||
|- | |- | ||
| 6 || NotifyExFatDriverDownloadedForDebug | | 6 || [[#NotifyExFatDriverDownloadedForDebug]] | ||
|- | |- | ||
| 9 || GetSystemUpdateNotificationEventForContentDelivery | | 9 || [[#GetSystemUpdateNotificationEventForContentDelivery]] | ||
|- | |- | ||
| 10 || NotifySystemUpdateForContentDelivery | | 10 || [[#NotifySystemUpdateForContentDelivery]] | ||
|- | |- | ||
| 11 || [3.0.0+] PrepareShutdown | | 11 || [3.0.0+] [[#PrepareShutdown]] | ||
|- | |- | ||
| 12 || [3.0.0-3.0.2] | | 12 || [3.0.0-3.0.2] | ||
Line 1,227: | Line 1,227: | ||
| 15 || [3.0.0-3.0.2] | | 15 || [3.0.0-3.0.2] | ||
|- | |- | ||
| 16 || [4.0.0+] DestroySystemUpdateTask | | 16 || [4.0.0+] [[#DestroySystemUpdateTask]] | ||
|- | |- | ||
| 17 || [4.0.0+] RequestSendSystemUpdate | | 17 || [4.0.0+] [[#RequestSendSystemUpdate]] | ||
|- | |- | ||
| 18 || [4.0.0+] GetSendSystemUpdateProgress | | 18 || [4.0.0+] [[#GetSendSystemUpdateProgress]] | ||
|} | |} | ||
== GetBackgroundNetworkUpdateState == | |||
No input, returns an output [[#BackgroundNetworkUpdateState]]. | |||
== OpenSystemUpdateControl == | |||
No input, returns an [[#ISystemUpdateControl]]. | |||
== NotifyExFatDriverRequired == | |||
No input/output. | |||
== ClearExFatDriverStatusForDebug == | |||
No input/output. | |||
== RequestBackgroundNetworkUpdate == | |||
No input/output. | |||
== NotifyBackgroundNetworkUpdate == | |||
Takes an input [[NCM_services#ContentMetaKey|ContentMetaKey]], no output. | |||
== NotifyExFatDriverDownloadedForDebug == | |||
No input/output. | |||
== GetSystemUpdateNotificationEventForContentDelivery == | |||
No input, returns an output Event handle with EventClearMode=0. | |||
== NotifySystemUpdateForContentDelivery == | |||
No input/output. | |||
== PrepareShutdown == | |||
No input/output. | |||
== DestroySystemUpdateTask == | |||
No input/output. | |||
== RequestSendSystemUpdate == | |||
Takes a type-0x15 input buffer containing a [[#SystemDeliveryInfo]], an u16, an u32, returns an output Event handle and an [[#IAsyncResult]]. | |||
== GetSendSystemUpdateProgress == | |||
No input, returns an output [[#SystemUpdateProgress]]. | |||
== ISystemUpdateControl == | == ISystemUpdateControl == | ||
Line 1,241: | Line 1,280: | ||
| 0 || [[#HasDownloaded]] | | 0 || [[#HasDownloaded]] | ||
|- | |- | ||
| 1 || RequestCheckLatestUpdate | | 1 || [[#RequestCheckLatestUpdate]] | ||
|- | |- | ||
| 2 || RequestDownloadLatestUpdate | | 2 || [[#RequestDownloadLatestUpdate]] | ||
|- | |- | ||
| 3 || [[#GetDownloadProgress]] | | 3 || [[#GetDownloadProgress]] | ||
Line 1,249: | Line 1,288: | ||
| 4 || [[#ApplyDownloadedUpdate]] | | 4 || [[#ApplyDownloadedUpdate]] | ||
|- | |- | ||
| 5 || RequestPrepareCardUpdate | | 5 || [[#RequestPrepareCardUpdate]] | ||
|- | |- | ||
| 6 || GetPrepareCardUpdateProgress | | 6 || [[#GetPrepareCardUpdateProgress]] | ||
|- | |- | ||
| 7 || HasPreparedCardUpdate | | 7 || [[#HasPreparedCardUpdate]] | ||
|- | |- | ||
| 8 || ApplyCardUpdate | | 8 || [[#ApplyCardUpdate]] | ||
|- | |- | ||
| 9 || [[#GetDownloadedEulaDataSize]] | | 9 || [[#GetDownloadedEulaDataSize]] | ||
Line 1,261: | Line 1,300: | ||
| 10 || [[#GetDownloadedEulaData]] | | 10 || [[#GetDownloadedEulaData]] | ||
|- | |- | ||
| 11 || SetupCardUpdate | | 11 || [[#SetupCardUpdate]] | ||
|- | |- | ||
| 12 || GetPreparedCardUpdateEulaDataSize | | 12 || [[#GetPreparedCardUpdateEulaDataSize]] | ||
|- | |- | ||
| 13 || GetPreparedCardUpdateEulaData | | 13 || [[#GetPreparedCardUpdateEulaData]] | ||
|- | |- | ||
| 14 || [4.0.0+] SetupCardUpdateViaSystemUpdater | | 14 || [4.0.0+] [[#SetupCardUpdateViaSystemUpdater]] | ||
|- | |- | ||
| 15 || [4.0.0+] HasReceived | | 15 || [4.0.0+] [[#HasReceived]] | ||
|- | |- | ||
| 16 || [4.0.0+] RequestReceiveSystemUpdate | | 16 || [4.0.0+] [[#RequestReceiveSystemUpdate]] | ||
|- | |- | ||
| 17 || [4.0.0+] GetReceiveProgress | | 17 || [4.0.0+] [[#GetReceiveProgress]] | ||
|- | |- | ||
| 18 || [4.0.0+] ApplyReceivedUpdate | | 18 || [4.0.0+] [[#ApplyReceivedUpdate]] | ||
|- | |- | ||
| 19 || [4.0.0+] GetReceivedEulaDataSize | | 19 || [4.0.0+] [[#GetReceivedEulaDataSize]] | ||
|- | |- | ||
| 20 || [4.0.0+] GetReceivedEulaData | | 20 || [4.0.0+] [[#GetReceivedEulaData]] | ||
|- | |- | ||
| 21 || [4.0.0+] SetupToReceiveSystemUpdate | | 21 || [4.0.0+] [[#SetupToReceiveSystemUpdate]] | ||
|- | |- | ||
| 22 || [6.0.0+] RequestCheckLatestUpdateIncludesRebootlessUpdate | | 22 || [6.0.0+] [[#RequestCheckLatestUpdateIncludesRebootlessUpdate]] | ||
|} | |} | ||
Only 1 ISystemUpdateControl can be open at a time. | |||
On newer sysvers, all pre-4.0.0 Card cmds require [[#SetupCardUpdateViaSystemUpdater]] to be used previously, except for RequestPrepareCardUpdate. | |||
=== HasDownloaded === | === HasDownloaded === | ||
Line 1,294: | Line 1,337: | ||
This always returns 0, however this will assert if GetSystemUpdateTaskInfo fails with ret!=0x3C89. | This always returns 0, however this will assert if GetSystemUpdateTaskInfo fails with ret!=0x3C89. | ||
=== RequestCheckLatestUpdate === | |||
No input, returns an output Event handle and an [[#IAsyncValue]]. | |||
The data that can be read from the [[#IAsyncValue]] is [[#LatestSystemUpdate]]. | |||
=== RequestDownloadLatestUpdate === | |||
No input, returns an output Event handle and an [[#IAsyncResult]]. | |||
=== GetDownloadProgress === | === GetDownloadProgress === | ||
No input, returns | No input, returns an output [[#SystemUpdateProgress]]. | ||
Similar to [[#HasDownloaded]] except instead of a flag, this returns the 0x10-bytes from taskinfo+8. The output struct is cleared when the task(info) isn't available. | Similar to [[#HasDownloaded]] except instead of a flag, this returns the 0x10-bytes from taskinfo+8. The output struct is cleared when the task(info) isn't available. | ||
Line 1,306: | Line 1,357: | ||
* Uses ListSystemUpdateTask again, then [[NIM_services|nim]] IsExFatDriverIncluded. Runs ExFat handling when the output flag is set. | * Uses ListSystemUpdateTask again, then [[NIM_services|nim]] IsExFatDriverIncluded. Runs ExFat handling when the output flag is set. | ||
* The two flags in [[Flash_Filesystem#System_Update_Control]] are set to 1. | * On newer system-versions, this uses [[NIM_services|nim]] GetSystemUpdateTaskInfo then on success uses data from there to save a SystemPlayReport when a state flag is set (by default it's not set). | ||
** The EventId is "systemupdate_dl_throughput" with ApplicationId 0100000000001018. | |||
** The following fields are added to the report, see [[NIM_services#SystemUpdateTaskInfo|nim SystemUpdateTaskInfo]]: "ContentMetaId", "Version", "DownloadSize", and "ThroughputKBps", | |||
* On newer system-versions, this saves another SystemPlayReport when a state flag is set (same flag mentioned above). | |||
** The EventId is "systemupdate_pass" with ApplicationId 0100000000001021. | |||
** This report has the following fields: | |||
*** "Type" | |||
*** "SourceSystemUpdateMetaId" | |||
*** "SourceSystemUpdateMetaVersion" | |||
*** "SourceExFatStatus" | |||
*** "DestinationSystemUpdateMetaId" | |||
*** "DestinationSystemUpdateMetaVersion" | |||
*** "DestinationExFatStatus" | |||
*** "Rebootless" | |||
* Since FIRM will be installed later, the two flags in [[Flash_Filesystem#System_Update_Control]] are set to 1. | |||
* Uses [[NIM_services|nim]] CommitSystemUpdateTask and [[NIM_services|nim]] DestroySystemUpdateTask. | * Uses [[NIM_services|nim]] CommitSystemUpdateTask and [[NIM_services|nim]] DestroySystemUpdateTask. | ||
* Installs FIRM. | * Installs FIRM. After installing each FIRM, the associated flag in [[Flash_Filesystem#System_Update_Control]] is set to 0. | ||
* On newer system versions when an input flag is set, this uses [[Filesystem_services|NotifySystemDataUpdateEvent]], however this doesn't happen with ApplyDownloadedUpdate since that input flag is 0. | |||
=== RequestPrepareCardUpdate === | |||
No input, returns an output Event handle and an [[#IAsyncResult]]. | |||
=== GetPrepareCardUpdateProgress === | |||
No input, returns an output [[#SystemUpdateProgress]]. | |||
=== HasPreparedCardUpdate === | |||
No input, returns an output u8 bool flag. | |||
=== ApplyCardUpdate === | |||
No input/output. | |||
=== GetDownloadedEulaDataSize === | === GetDownloadedEulaDataSize === | ||
Takes a type-0x15 input buffer | Takes a type-0x15 input buffer [[#EulaDataPath]], returns an output u64 '''filesize'''. | ||
Runs code similar to [[#HasDownloaded]], throwing an error if a network sysupdate isn't ready for install. | Runs code similar to [[#HasDownloaded]], throwing an error if a network sysupdate isn't ready for install. | ||
Line 1,317: | Line 1,395: | ||
Uses ListSystemUpdateTask again. Then [[NIM_services|nim]] GetDownloadedSystemDataPath, with the output ContentPath being used to mount the EULA title with FS. | Uses ListSystemUpdateTask again. Then [[NIM_services|nim]] GetDownloadedSystemDataPath, with the output ContentPath being used to mount the EULA title with FS. | ||
Then "<mountname>:/< | Then "<mountname>:/<[[#EulaDataPath]]>" is opened, gets the '''filesize''', then runs cleanup. | ||
=== GetDownloadedEulaData === | === GetDownloadedEulaData === | ||
Takes a type-0x15 input buffer | Takes a type-0x15 input buffer [[#EulaDataPath]] and a type-0x6 output buffer, returns an output u64 '''filesize'''. | ||
Similar to [[#GetDownloadedEulaDataSize]] except this reads the file instead, using the specified output buffer with size=filesize. This will throw an error if the filesize is larger than the buffer size. | Similar to [[#GetDownloadedEulaDataSize]] except this reads the file instead, using the specified output buffer with size=filesize. This will throw an error if the filesize is larger than the buffer size. | ||
=== SetupCardUpdate === | |||
Takes an input u64 size and a TransferMemory handle, no output. | |||
The permissions for the TransferMemory is None. | |||
=== GetPreparedCardUpdateEulaDataSize === | |||
Takes a type-0x15 input buffer [[#EulaDataPath]], returns an output u64 '''filesize'''. | |||
=== GetPreparedCardUpdateEulaData === | |||
Takes a type-0x15 input buffer [[#EulaDataPath]] and a type-0x6 output buffer, returns an output u64 '''filesize'''. | |||
=== SetupCardUpdateViaSystemUpdater === | |||
Takes an input u64 size and a TransferMemory handle, no output. | |||
The permissions for the TransferMemory is None. | |||
Same as SetupCardUpdate, except this doesn't have the code for [[Filesystem_services|GetGameCardHandle/GetGameCardUpdatePartitionInfo]], and uses [[Filesystem_services|OpenRegisteredUpdatePartition]] instead of [[Filesystem_services|OpenGameCardFileSystem]]. This also uses a different is_initialized bool state flag. | |||
=== HasReceived === | |||
No input, returns an output u8 bool. | |||
Same as [[#HasDownloaded]] except this uses [[NIM_services|nim]] cmd71 and cmd73. | |||
=== RequestReceiveSystemUpdate === | |||
Takes a type-0x15 input buffer containing a [[#SystemDeliveryInfo]], an u16, an u32, returns an output Event handle and an [[#IAsyncResult]]. | |||
=== GetReceiveProgress === | |||
No input, returns an output [[#SystemUpdateProgress]]. | |||
Same as [[#GetDownloadProgress]] except this uses [[NIM_services|nim]] cmd71 and cmd73. | |||
=== ApplyReceivedUpdate === | |||
No input/output. | |||
=== GetReceivedEulaDataSize === | |||
Takes a type-0x15 input buffer [[#EulaDataPath]], returns an output u64 '''filesize'''. | |||
=== GetReceivedEulaData === | |||
Takes a type-0x15 input buffer [[#EulaDataPath]] and a type-0x6 output buffer, returns an output u64 '''filesize'''. | |||
=== SetupToReceiveSystemUpdate === | |||
No input/output. | |||
This just uses [[NIM_services|nim]] ListSystemUpdateTask, then when a task is returned uses it with DestroySystemUpdateTask. | |||
=== RequestCheckLatestUpdateIncludesRebootlessUpdate === | |||
No input, returns an output Event handle and an [[#IAsyncValue]]. | |||
== BackgroundNetworkUpdateState == | |||
{| class="wikitable" border="1" | |||
|- | |||
! Value | |||
! Description | |||
|- | |||
| 0 || Unknown. Values >2 are handled the same as this by [[qlaunch]]. | |||
|- | |||
| 1 || Unknown. | |||
|- | |||
| 2 || Unknown. | |||
|} | |||
This is "nn::ns::BackgroundNetworkUpdateState". This is an u8. | |||
== SystemUpdateProgress == | |||
This is "nn::ns::SystemUpdateProgress". This is a 0x10-byte struct. | |||
== 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. | |||
== LatestSystemUpdate == | |||
{| class="wikitable" border="1" | |||
|- | |||
! Value | |||
! Description | |||
|- | |||
| 1 || Unknown. | |||
|- | |||
| 2 || Unknown. | |||
|- | |||
| Other values || Unknown. | |||
|} | |||
This is "nn::ns::LatestSystemUpdate". This is an u8. | |||
= IAsyncValue = | = IAsyncValue = |