NS services: Difference between revisions

(2 intermediate revisions by the same user not shown)
Line 404: Line 404:
| 0x1
| 0x1
| 0x1
| 0x1
| u8 "installedStorage" / [[Filesystem_services|StorageId]] (String is from web-applet)
| u8 "installedStorage" / [[NCM_services#StorageId|StorageId]] (String is from web-applet)
|-
|-
| 0x2
| 0x2
Line 1,027: Line 1,027:
The array-count for both buffers must be 1, otherwise an error is returned.
The array-count for both buffers must be 1, otherwise an error is returned.


Both [[#ApplicationDeliveryInfo]] are validated, then the application-version in the first/second buffer are compared. The output s32 is set to the comparison result: 0 for less than, -1 for equal, and 1 for higher than.
Both [[#ApplicationDeliveryInfo]] are validated, then the application-version in the first/second buffer are compared. The output s32 is set to the comparison result: -1 for less than, 0 for equal, and 1 for higher than.


==== CanDeliverApplication ====
==== CanDeliverApplication ====
Line 1,054: Line 1,054:


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


[[qlaunch]] uses value 6 for the StorageId, and value 55556 for the port.
[[qlaunch]] uses value Any for the StorageId, and value 55556 for the port.


An error is thrown if a state flag is not set. An error is thrown if [[NIM_services|nim]] ListApplicationApplyDeltaTask returns a task.
An error is thrown if a state field 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,078: Line 1,078:
Takes an input u64 <code>nn::ncm::ApplicationId</code>, returns an output [[#ReceiveApplicationProgress]].
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.
An error is thrown if a state field 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.
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.
Line 1,087: Line 1,087:
[[qlaunch]] uses value 55556 for the port.
[[qlaunch]] uses value 55556 for the port.


An error is thrown if a state flag is not set. An error is thrown if [[NIM_services|nim]] ListApplicationApplyDeltaTask returns a task.
An error is thrown if a state field 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,367: Line 1,367:
This command is not available for retail units. On a debug unit, if the [[System_Settings|system setting]] <code>vulnerability!enable_debug</code> is set, this mounts the system savegame [[Flash_Filesystem#System_Savegames|0x8000000000000049]] as "ns_ssversion:/", opens the file "ns_ssversion:/entry" and writes the supplied '''titleID''' and '''version''' in it.
This command is not available for retail units. On a debug unit, if the [[System_Settings|system setting]] <code>vulnerability!enable_debug</code> is set, this mounts the system savegame [[Flash_Filesystem#System_Savegames|0x8000000000000049]] as "ns_ssversion:/", opens the file "ns_ssversion:/entry" and writes the supplied '''titleID''' and '''version''' in it.


Finally, it calls [[NCM_services#ncm|OpenContentMetaDatabase]] with [[Filesystem_services#StorageId|StorageID]] 3, then calls [[NCM_services#IContentMetaDatabase|GetLatestContentMetaKey]] with the supplied '''titleID''' and compares the version field from the returned [[CNMT#Content_Meta_Records|Content Meta Record]] with the supplied '''version'''.
Finally, it calls [[NCM_services#ncm|OpenContentMetaDatabase]] with [[NCM_services#StorageId|StorageId]] 3, then calls [[NCM_services#IContentMetaDatabase|GetLatestContentMetaKey]] with the supplied '''titleID''' and compares the version field from the returned [[CNMT#Content_Meta_Records|Content Meta Record]] with the supplied '''version'''.


If the supplied '''version''' is higher than the one in NCM's database, the value returned by [[NS_Services#NeedsUpdateVulnerability|NeedsUpdateVulnerability]] is set to "true".
If the supplied '''version''' is higher than the one in NCM's database, the value returned by [[NS_Services#NeedsUpdateVulnerability|NeedsUpdateVulnerability]] is set to "true".