NS services: Difference between revisions

No edit summary
(3 intermediate revisions by the same user not shown)
Line 834: Line 834:
| 2003 || [4.0.0+] [[#GetApplicationDeliveryInfo]]
| 2003 || [4.0.0+] [[#GetApplicationDeliveryInfo]]
|-
|-
| 2004 || [4.0.0+] HasAllContentsToDeliver
| 2004 || [4.0.0+] [[#HasAllContentsToDeliver]]
|-
|-
| 2005 || [4.0.0+] CompareApplicationDeliveryInfo
| 2005 || [4.0.0+] CompareApplicationDeliveryInfo
Line 848: Line 848:
| 2010 || [4.0.0+] [[#RequestReceiveApplication]]
| 2010 || [4.0.0+] [[#RequestReceiveApplication]]
|-
|-
| 2011 || [4.0.0+] CommitReceiveApplication
| 2011 || [4.0.0+] [[#CommitReceiveApplication]]
|-
|-
| 2012 || [4.0.0+] GetReceiveApplicationProgress
| 2012 || [4.0.0+] [[#GetReceiveApplicationProgress]]
|-
|-
| 2013 || [4.0.0+] [[#RequestSendApplication]]
| 2013 || [4.0.0+] [[#RequestSendApplication]]
|-
|-
| 2014 || [4.0.0+] GetSendApplicationProgress
| 2014 || [4.0.0+] [[#GetSendApplicationProgress]]
|-
|-
| 2015 || [4.0.0+] CompareSystemDeliveryInfo
| 2015 || [4.0.0+] CompareSystemDeliveryInfo
Line 1,011: Line 1,011:


An error is thrown if any bit is set in ApplicationDeliveryAttributeTag besides bit1. The output array-count must be at least 1: only 1 entry will be written to this array (hence on success total_out will also only be 1 on success).
An error is thrown if any bit is set in ApplicationDeliveryAttributeTag besides bit1. The output array-count must be at least 1: only 1 entry will be written to this array (hence on success total_out will also only be 1 on success).
==== HasAllContentsToDeliver ====
Takes a type-0x5 input buffer containing an array of [[#ApplicationDeliveryInfo]], returns an output u8 bool.
The array-count must match 1. After validating the [[#ApplicationDeliveryInfo]], the output bool is set to u32 [[#ApplicationDeliveryInfo]]+0x1C & 0x10000002 != 0x2, then this returns 0.


==== RequestReceiveApplication ====
==== RequestReceiveApplication ====
Takes a type-0x5 input buffer containing an array of [[NCM_services#ContentMetaKey|ContentMetaKey]], an u8 [[Filesystem_services#StorageId|StorageId]], an u16 port, an u32 Ipv4Address, an u64 <code>nn::ncm::ApplicationId</code>, returns an output Event handle and an [[#IAsyncResult]].
Takes a type-0x5 input buffer containing an array of [[NCM_services#ContentMetaKey|ContentMetaKey]], an u8 [[Filesystem_services#StorageId|StorageId]], an u16 port, an u32 Ipv4Address, an u64 <code>nn::ncm::ApplicationId</code>, returns an output Event handle and an [[#IAsyncResult]].


An error is thrown if [[NIM_services|nim]] ListApplicationApplyDeltaTask returns a task.
An error is thrown if a state flag is not set. An error is thrown if [[NIM_services|nim]] ListApplicationApplyDeltaTask returns a task.


This loops through the input [[NCM_services#ContentMetaKey|ContentMetaKey]] array, throwing an error if the [[NCM_services#ContentMetaType|ContentMetaType]] doesn't match Patch. The input array is copied into state which is used later by the thread for [[NIM_services|nim]] cmd53, max entries is 0x12.
This loops through the input [[NCM_services#ContentMetaKey|ContentMetaKey]] array, throwing an error if the [[NCM_services#ContentMetaType|ContentMetaType]] doesn't match Patch. The input array is copied into state which is used later by the thread for [[NIM_services|nim]] cmd53, max entries is 0x12.
Line 1,028: Line 1,033:
* On success, this loads various data which is then used for saving a SystemPlayReport when a state flag is set.
* On success, this loads various data which is then used for saving a SystemPlayReport when a state flag is set.
** The EventId is "receive_app_contents" with ApplicationId <NS ProgramId>.
** The EventId is "receive_app_contents" with ApplicationId <NS ProgramId>.
==== CommitReceiveApplication ====
Takes an input u64 <code>nn::ncm::ApplicationId</code>, no output.
==== GetReceiveApplicationProgress ====
Takes an input u64 <code>nn::ncm::ApplicationId</code>, returns an output [[#ReceiveApplicationProgress]].
An error is thrown if a state flag is not set. An error is thrown if [[NIM_services|nim]] ListApplicationApplyDeltaTask returns a task.
Uses [[NIM_services|nim]] cmd67, throwing an error if no task is returned. Then [[NIM_services|nim]] cmd57 is used, returning the error from there on failure. Lastly, this writes the 0x10-bytes from output+8 from the latter cmd to the output [[#ReceiveApplicationProgress]], and returns 0.


==== RequestSendApplication ====
==== RequestSendApplication ====
Takes a type-0x5 input buffer containing an array of [[NCM_services#ContentMetaKey|ContentMetaKey]], an u16 port, an u32 Ipv4Address, an u64 <code>nn::ncm::ApplicationId</code>, returns an output Event handle and an [[#IAsyncResult]].
Takes a type-0x5 input buffer containing an array of [[NCM_services#ContentMetaKey|ContentMetaKey]], an u16 port, an u32 Ipv4Address, an u64 <code>nn::ncm::ApplicationId</code>, returns an output Event handle and an [[#IAsyncResult]].


An error is thrown if [[NIM_services|nim]] ListApplicationApplyDeltaTask returns a task.
An error is thrown if a state flag is not set. An error is thrown if [[NIM_services|nim]] ListApplicationApplyDeltaTask returns a task.


The [[NCM_services#ContentMetaType|ContentMetaType]] must match Patch.
The [[NCM_services#ContentMetaType|ContentMetaType]] must match Patch.
Line 1,045: Line 1,060:
* On success, this loads various data which is then used for saving a SystemPlayReport when a state flag is set.
* On success, this loads various data which is then used for saving a SystemPlayReport when a state flag is set.
** The EventId is "send_app_contents" with ApplicationId <NS ProgramId>.
** The EventId is "send_app_contents" with ApplicationId <NS ProgramId>.
==== GetSendApplicationProgress ====
Takes an input u64 <code>nn::ncm::ApplicationId</code>, returns an output [[#SendApplicationProgress]].
Same as [[#GetReceiveApplicationProgress]] except this is the Send version, and uses [[NIM_services|nim]] cmd68/cmd63 instead.


=== IApplicationVersionInterface ===
=== IApplicationVersionInterface ===
Line 1,808: Line 1,828:
| 0x19 || 0x1 || Unknown. Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation.
| 0x19 || 0x1 || Unknown. Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation.
|-
|-
| 0x1A || 0xC6 || Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation.
| 0x1A || 0x1 || Unknown.
|-
| 0x1B || 0xC5 || Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation.
|-
|-
| 0xE0 || 0x20 || HMAC-SHA256 over the previous 0xE0-bytes.
| 0xE0 || 0x20 || HMAC-SHA256 over the previous 0xE0-bytes.
Line 1,822: Line 1,844:
! Description
! Description
|-
|-
| 0x0 || 0x100 || ?
| 0x0 || 0xE0 || ?
|-
| 0xE0 || 0x20 || HMAC-SHA256 over the previous 0xE0-bytes. Uses a different key than [[#SystemDeliveryInfo]].
|}
|}


Line 1,841: Line 1,865:


This is "nn::ns::LatestSystemUpdate". This is an u8.
This is "nn::ns::LatestSystemUpdate". This is an u8.
= ReceiveApplicationProgress =
This is "nn::ns::ReceiveApplicationProgress". This is a 0x10-byte struct.
= SendApplicationProgress =
This is "nn::ns::SendApplicationProgress". This is a 0x10-byte struct.


[[Category:Services]]
[[Category:Services]]