NS services: Difference between revisions

Line 2,710: Line 2,710:
[[qlaunch]] uses value 55556 for the port. IP is normally a local-WLAN address, however this can be any address. port/addr are little-endian.
[[qlaunch]] uses value 55556 for the port. IP is normally a local-WLAN address, however this can be any address. port/addr are little-endian.


[[NIM_services|NIM]] will use the input addr/port with [[Sockets_services|bind()]]. During [[Sockets_services|accept()]] handling the addr from there must match the input addr. Hence, addr must be the client addr. [[NIM_services|NIM]] will also eventually verify that the system is not Internet-connected.
See [[NIM_services|nim]] regarding the input addr/port usage, etc.


This validates the [[#SystemDeliveryInfo]] and generates a [[NCM_services#ContentMetaKey|ContentMetaKey]] from that, and creates the [[#IAsyncResult]] + the async thread which handles the [[#IAsyncResult]] operation. Then the thread does:
This validates the [[#SystemDeliveryInfo]] and generates a [[NCM_services#ContentMetaKey|ContentMetaKey]] from that, and creates the [[#IAsyncResult]] + the async thread which handles the [[#IAsyncResult]] operation. Then the thread does:
* Calls a func which does:
* Calls a func which does:
** Uses [[NIM_services|nim]] cmd76, returning the Result on failure.
** Uses [[NIM_services|nim]] CreateLocalCommunicationSendSystemUpdateTask, returning the Result on failure.
** Uses [[NIM_services|nim]] cmd77, returning the Result on failure. Waits for the IAsyncResult operation from this to finish, then uses the Get cmd to get the output Result.
** Uses [[NIM_services|nim]] RequestLocalCommunicationSendSystemUpdateTaskRun, returning the Result on failure. Waits for the IAsyncResult operation from this to finish, then uses the Get cmd to get the output Result.
** Handles cleanup and returns.
** Handles cleanup and returns.
* Unlike [[#RequestReceiveSystemUpdate]], this doesn't save a SystemPlayReport.
* Unlike [[#RequestReceiveSystemUpdate]], this doesn't save a SystemPlayReport.
Line 2,722: Line 2,722:
No input, returns an output [[#SystemUpdateProgress]].
No input, returns an output [[#SystemUpdateProgress]].


Same as [[#GetReceiveProgress]] except this uses nim cmd81 and cmd78.
Same as [[#GetReceiveProgress]] except this uses nim ListLocalCommunicationSendSystemUpdateTask and GetLocalCommunicationSendSystemUpdateTaskInfo.


== ISystemUpdateControl ==
== ISystemUpdateControl ==
Line 2,824: Line 2,824:
*** "DestinationExFatStatus"
*** "DestinationExFatStatus"
*** "Rebootless"
*** "Rebootless"
* Since FIRM will be installed later, the two flags in [[Flash_Filesystem#System_Update_Control]] are set to 1.
* Since BootImagePackage 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. After installing each FIRM, the associated flag in [[Flash_Filesystem#System_Update_Control]] is set to 0.
* Installs BootImagePackage. After installing each BootImagePackage, 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.
* 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.


Line 2,882: Line 2,882:
No input, returns an output u8 bool.
No input, returns an output u8 bool.


Same as [[#HasDownloaded]] except this uses [[NIM_services|nim]] cmd71 and cmd73.
Same as [[#HasDownloaded]] except this uses [[NIM_services|nim]] ListLocalCommunicationReceiveSystemUpdateTask and GetLocalCommunicationReceiveSystemUpdateTaskInfo.


=== RequestReceiveSystemUpdate ===
=== RequestReceiveSystemUpdate ===
Line 2,889: Line 2,889:
[[qlaunch]] uses the same value for the port as [[#RequestSendSystemUpdate]] (see [[#RequestSendSystemUpdate]] for addr as well).
[[qlaunch]] uses the same value for the port as [[#RequestSendSystemUpdate]] (see [[#RequestSendSystemUpdate]] for addr as well).


[[NIM_services|NIM]] will use the input addr/port with [[Sockets_services|connect()]].
See [[NIM_services|nim]] regarding the input addr/port usage, etc.


This validates the [[#SystemDeliveryInfo]] and generates a [[NCM_services#ContentMetaKey|ContentMetaKey]] from that, and creates the [[#IAsyncResult]] + the async thread which handles the [[#IAsyncResult]] operation. Then the thread does:
This validates the [[#SystemDeliveryInfo]] and generates a [[NCM_services#ContentMetaKey|ContentMetaKey]] from that, and creates the [[#IAsyncResult]] + the async thread which handles the [[#IAsyncResult]] operation. Then the thread does:
Line 2,896: Line 2,896:
** Throws an error if [[NIM_services#ListSystemUpdateTask|ListSystemUpdateTask]] returns any task.
** Throws an error if [[NIM_services#ListSystemUpdateTask|ListSystemUpdateTask]] returns any task.
** Checks whether a sysupdate is actually required using the previously generated [[NCM_services#ContentMetaKey|ContentMetaKey]], throwing an error if not.
** Checks whether a sysupdate is actually required using the previously generated [[NCM_services#ContentMetaKey|ContentMetaKey]], throwing an error if not.
** Uses [[NIM_services|nim]] cmd69, returning the Result on failure.
** Uses [[NIM_services|nim]] CreateLocalCommunicationReceiveSystemUpdateTask, returning the Result on failure.
** Uses [[NIM_services|nim]] cmd72, returning the Result on failure. Waits for the IAsyncResult operation from this to finish, then uses the Get cmd to get the output Result.
** Uses [[NIM_services|nim]] RequestLocalCommunicationReceiveSystemUpdateTaskRun, returning the Result on failure. Waits for the IAsyncResult operation from this to finish, then uses the Get cmd to get the output Result.
** Handles cleanup and returns.
** Handles cleanup and returns.
* On success, this loads various data which is then used for saving a SystemPlayReport when the cached [[System_Settings|system-setting]] "systemreport!enabled" is set.
* On success, this loads various data which is then used for saving a SystemPlayReport when the cached [[System_Settings|system-setting]] "systemreport!enabled" is set.
Line 2,918: Line 2,918:
No input, returns an output [[#SystemUpdateProgress]].
No input, returns an output [[#SystemUpdateProgress]].


Same as [[#GetDownloadProgress]] except this uses [[NIM_services|nim]] cmd71 and cmd73.
Same as [[#GetDownloadProgress]] except this uses [[NIM_services|nim]] ListLocalCommunicationReceiveSystemUpdateTask and GetLocalCommunicationReceiveSystemUpdateTaskInfo.


=== ApplyReceivedUpdate ===
=== ApplyReceivedUpdate ===