Changes

Jump to navigation Jump to search
9,500 bytes added ,  02:59, 1 January 2020
m
Added Type values for Application Record Format.
Line 305: Line 305:  
| 0x0
 
| 0x0
 
| 0x8
 
| 0x8
| Title ID
+
| [[NCM_services#ApplicationId|ApplicationId]]
 
|-
 
|-
 
| 0x8
 
| 0x8
 
| 0x1
 
| 0x1
| Type? (Known values: 2=Installing?, 3=Gamecard?, 4=Installed?)
+
| Type? (Known values: 0x2=Installing?, 0x3=Installed / Gamecard inserted, 0x5=Gamecard not inserted, 0xB=Archived)
 
|-
 
|-
 
| 0x9
 
| 0x9
Line 329: Line 329:     
== LaunchApplication ==
 
== LaunchApplication ==
Takes an input u64 titleID, returns an output u64 PID.
+
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output u64 PID.
    
Launches an application title which is registered with NS.
 
Launches an application title which is registered with NS.
    
== GetApplicationContentPath ==
 
== GetApplicationContentPath ==
Takes a 0x16-type output buffer, an u8 [[NCM_services#Title_Types|title type]], and an u64 titleID.
+
Takes a 0x16-type output buffer, an u8 [[NCM_services#ContentMetaType|ContentMetaType]], and an [[NCM_services#ApplicationId|ApplicationId]].
   −
The input titleID is used with the application-title table like various other cmds, anything not in that table can't be used with this.
+
The input [[NCM_services#ApplicationId|ApplicationId]] is used with the application-title table like various other cmds, anything not in that table can't be used with this.
   −
Returns a string path for the specified type of patch content with this titleID, otherwise returns regular-application paths when update-title not installed. Returns an error when the specified type of content doesn't exist for this title. Starts with "@{SdCardContent,UserContent}://" and ends in ".nca".
+
Returns a string path for the specified type of patch content with this [[NCM_services#ApplicationId|ApplicationId]], otherwise returns regular-application paths when update-title not installed. Returns an error when the specified type of content doesn't exist for this title. Starts with "@{SdCardContent,UserContent}://" and ends in ".nca".
    
For gamecard content, the output path is: "@GcSXXXXXXXX:/<NcaId>.nca". NCA-type0 with gamecard returns 0 with an empty output string.
 
For gamecard content, the output path is: "@GcSXXXXXXXX:/<NcaId>.nca". NCA-type0 with gamecard returns 0 with an empty output string.
Line 365: Line 365:     
== GetApplicationControlData ==
 
== GetApplicationControlData ==
Takes an input u8 [[#ApplicationControlSource]], an u64 titleID, and a type-0x6 output buffer. Returns an output u32 for actual_size. Official user-processes use buffer size 0x24000. [[qlaunch]] only uses flag value 0x1 (Storage if not in cache).
+
Takes an input u8 [[#ApplicationControlSource]], an [[NCM_services#ApplicationId|ApplicationId]], and a type-0x6 output buffer. Returns an output u32 for actual_size. Official user-processes use buffer size 0x24000. [[qlaunch]] only uses flag value 0x1 (Storage if not in cache).
    
Loads cached [[control.nacp]] to buf+0 and the cached icon to buf+0x4000. Returns an error if the buffer is too small.
 
Loads cached [[control.nacp]] to buf+0 and the cached icon to buf+0x4000. Returns an error if the buffer is too small.
Line 383: Line 383:  
| 0x2
 
| 0x2
 
| StorageOnly (Returns data from storage without using cache)
 
| StorageOnly (Returns data from storage without using cache)
|-
   
|}
 
|}
    
== ListApplicationContentMetaStatus ==
 
== ListApplicationContentMetaStatus ==
Takes a type-0x6 output buffer containing an array of the below entries, an input s32 index and u64 titleID, returns an output s32 out_entrycount.
+
Takes a type-0x6 output buffer containing an array of the below entries, an input s32 index and [[NCM_services#ApplicationId|ApplicationId]], returns an output s32 out_entrycount.
   −
Returns 0x10-byte entries using the specified titleID starting at the specified index. Can only return game titles. The second entry if any is the update-title usually. When the input entryindex is >= totalentries, this will return 0 with out_entrycount=0.
+
Returns 0x10-byte entries using the specified [[NCM_services#ApplicationId|ApplicationId]] starting at the specified index. Can only return game titles. The second entry if any is the update-title usually. When the input entryindex is >= totalentries, this will return 0 with out_entrycount=0.
    
Entry structure:
 
Entry structure:
Line 400: Line 399:  
| 0x0
 
| 0x0
 
| 0x1
 
| 0x1
| u8 "type". [[Content_Manager_services|Title type]] (String is from web-applet)
+
| [[NCM_services#ContentMetaType|ContentMetaType]] ("type")
 
|-
 
|-
 
| 0x1
 
| 0x1
 
| 0x1
 
| 0x1
| u8 "installedStorage" / [[Filesystem_services|StorageId]] (String is from web-applet)
+
| [[NCM_services#StorageId|StorageId]] ("installedStorage")
 
|-
 
|-
 
| 0x2
 
| 0x2
Line 416: Line 415:  
| 0x4
 
| 0x4
 
| 0x4
 
| 0x4
| u32 Title-version
+
| Version
 
|-
 
|-
 
| 0x8
 
| 0x8
 
| 0x8
 
| 0x8
| u64 titleID
+
| [[NCM_services#ApplicationId|ApplicationId]]
 
|}
 
|}
   Line 627: Line 626:  
|-
 
|-
 
| 102 || ResetToFactorySettingsForRefurbishment
 
| 102 || ResetToFactorySettingsForRefurbishment
 +
|-
 +
| 103 || [9.1.0+] ResetToFactorySettingsWithPlatformRegion
 +
|-
 +
| 104 || [9.1.0+] ResetToFactorySettingsWithPlatformRegionAuthentication
 
|-
 
|-
 
| 200 || CalculateUserSaveDataStatistics
 
| 200 || CalculateUserSaveDataStatistics
Line 828: Line 831:  
| 2000 || [4.0.0+] [[#GetSystemDeliveryInfo]]
 
| 2000 || [4.0.0+] [[#GetSystemDeliveryInfo]]
 
|-
 
|-
| 2001 || [4.0.0+] SelectLatestSystemDeliveryInfo
+
| 2001 || [4.0.0+] [[#SelectLatestSystemDeliveryInfo]]
 
|-
 
|-
 
| 2002 || [4.0.0+] [[#VerifyDeliveryProtocolVersion]]
 
| 2002 || [4.0.0+] [[#VerifyDeliveryProtocolVersion]]
Line 834: Line 837:  
| 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]]
 
|-
 
|-
| 2006 || [4.0.0+] CanDeliverApplication
+
| 2006 || [4.0.0+] [[#CanDeliverApplication]]
 
|-
 
|-
| 2007 || [4.0.0+] ListContentMetaKeyToDeliverApplication
+
| 2007 || [4.0.0+] [[#ListContentMetaKeyToDeliverApplication]]
 
|-
 
|-
| 2008 || [4.0.0+] NeedsSystemUpdateToDeliverApplication
+
| 2008 || [4.0.0+] [[#NeedsSystemUpdateToDeliverApplication]]
 
|-
 
|-
| 2009 || [4.0.0+] EstimateRequiredSize
+
| 2009 || [4.0.0+] [[#EstimateRequiredSize]]
 
|-
 
|-
| 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]]
 
|-
 
|-
| 2016 || [4.0.0+] ListNotCommittedContentMeta
+
| 2016 || [4.0.0+] [[#ListNotCommittedContentMeta]]
 
|-
 
|-
| 2017 || [4.0.0+] RecoverDownloadTask
+
| 2017 || [4.0.0+] [[#RecoverDownloadTask]]
 
|-
 
|-
| 2018 || [5.0.0+] GetApplicationDeliveryInfoHash
+
| 2018 || [5.0.0+] [[#GetApplicationDeliveryInfoHash]]
 
|-
 
|-
 
| 2050 || [6.0.0+] GetApplicationRightsOnClient
 
| 2050 || [6.0.0+] GetApplicationRightsOnClient
Line 944: Line 947:     
==== RequestApplicationUpdateInfo ====
 
==== RequestApplicationUpdateInfo ====
Takes an input u64 titleID (<code>nn::ncm::ApplicationId</code>), returns an output Event handle and an [[#IAsyncValue]].
+
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncValue]].
    
The data that can be read from the [[#IAsyncValue]] is [[#ApplicationUpdateInfo]].
 
The data that can be read from the [[#IAsyncValue]] is [[#ApplicationUpdateInfo]].
Line 953: Line 956:  
This is used by AM cmd [[Applet_Manager_services#LaunchDevMenu|LaunchDevMenu]].
 
This is used by AM cmd [[Applet_Manager_services#LaunchDevMenu|LaunchDevMenu]].
   −
This loads titleIDs from [[System_Settings|system-settings]] <code>ns.applet!devmenu_id</code> and <code>ns.applet!devoverlaydisp_id</code>, which only exists on devunits. An error is thrown if loading these fail.
+
This loads ProgramIds from [[System_Settings|system-settings]] <code>ns.applet!devmenu_id</code> and <code>ns.applet!devoverlaydisp_id</code>, which only exists on devunits. An error is thrown if loading these fail.
   −
[[NCM_services|NCM]] OpenContentMetaDatabase is used with StorageId = NandSystem, then IContentMetaDatabase GetLatestContentMetaKey is used with both of the above titleIDs to verify that the cmd is successful.
+
[[NCM_services#ncm|OpenContentMetaDatabase]] is used with StorageId = NandSystem, then IContentMetaDatabase GetLatestContentMetaKey is used with both of the above ProgramIds to verify that the cmd is successful.
    
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.
Line 969: Line 972:     
==== GetGameCardPlatformRegion ====
 
==== GetGameCardPlatformRegion ====
No input, returns an u8 '''PlatformRegion''' (0x00 = Global, 0x01 = China).
+
No input, returns an u8 '''GameCardPlatformRegion''' (0x00 = Global, 0x01 = China).
    
This calls [[Filesystem_services#IDeviceOperator|fsp-srv IDeviceOperator]] GetGameCardCompatibilityType and returns the result.
 
This calls [[Filesystem_services#IDeviceOperator|fsp-srv IDeviceOperator]] GetGameCardCompatibilityType and returns the result.
Line 982: Line 985:     
==== RequestNoDownloadRightsErrorResolution ====
 
==== RequestNoDownloadRightsErrorResolution ====
Takes an input u64 titleID (<code>nn::ncm::ApplicationId</code>), returns an output Event handle and an [[#IAsyncValue]].
+
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncValue]].
    
The data that can be read from the [[#IAsyncValue]] is [[#NoDownloadRightsErrorResolution]].
 
The data that can be read from the [[#IAsyncValue]] is [[#NoDownloadRightsErrorResolution]].
    
==== RequestResolveNoDownloadRightsError ====
 
==== RequestResolveNoDownloadRightsError ====
Takes an input u64 titleID (<code>nn::ncm::ApplicationId</code>), returns an output Event handle and an [[#IAsyncValue]].
+
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncValue]].
    
The data that can be read from the [[#IAsyncValue]] is [[#NoDownloadRightsErrorResolution]].
 
The data that can be read from the [[#IAsyncValue]] is [[#NoDownloadRightsErrorResolution]].
Line 1,001: Line 1,004:     
This generates a [[#SystemDeliveryInfo]] using the currently installed SystemUpdate meta title.
 
This generates a [[#SystemDeliveryInfo]] using the currently installed SystemUpdate meta title.
 +
 +
==== SelectLatestSystemDeliveryInfo ====
 +
Takes a type-0x15 input buffer containing a [[#SystemDeliveryInfo]], a type-0x5 input buffer containing an array of [[#SystemDeliveryInfo]], a type-0x5 input buffer containing an array of [[#ApplicationDeliveryInfo]], and returns an output s32.
 +
 +
This determines the latest version from the input [[#ApplicationDeliveryInfo]] array, using value 0 if the array is empty. If this value is less than a state field, the state field value is used instead. Then this selects a [[#SystemDeliveryInfo]] with the latest version from the input array, where the minimum version is the previously mentioned value. The version must also be also be at least the version value from the type-0x15 [[#SystemDeliveryInfo]] buffer. This also does various validation, etc. The output s32 is an index in that array for the selected entry, -1 if none found.
    
==== VerifyDeliveryProtocolVersion ====
 
==== VerifyDeliveryProtocolVersion ====
Line 1,008: Line 1,016:     
==== GetApplicationDeliveryInfo ====
 
==== GetApplicationDeliveryInfo ====
Takes a type-0x6 output buffer containing an array of [[#ApplicationDeliveryInfo]], an input u32 bitmask <code>nn::ns::ApplicationDeliveryAttributeTag</code>, an u64 <code>nn::ncm::ApplicationId</code>, and returns an output s32 total_out.
+
Takes a type-0x6 output buffer containing an array of [[#ApplicationDeliveryInfo]], an input u32 bitmask <code>nn::ns::ApplicationDeliveryAttributeTag</code>, an [[NCM_services#ApplicationId|ApplicationId]], and returns an output s32 total_out.
    
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).
   −
=== IApplicationVersionInterface ===
+
==== HasAllContentsToDeliver ====
This is "nn::ns::detail::IApplicationVersionInterface".
+
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.
 +
 
 +
==== CompareApplicationDeliveryInfo ====
 +
Takes two type-0x5 input buffers containing an array of [[#ApplicationDeliveryInfo]], returns an output s32.
 +
 
 +
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: -1 for less than, 0 for equal, and 1 for higher than.
 +
 
 +
==== CanDeliverApplication ====
 +
Takes two type-0x5 input buffers containing an array of [[#ApplicationDeliveryInfo]], returns an output u8 bool.
 +
 
 +
The array-count for the second buffer must be 1 and the array-count for the first buffer must be <=1, otherwise an error is returned. If the array-count for the first buffer is 0, this will return 0 with the output bool set to 0.
 +
 
 +
==== ListContentMetaKeyToDeliverApplication ====
 +
Takes a type-0x6 output buffer containing an array of [[NCM_services#ContentMetaKey|ContentMetaKey]], a type-0x5 input buffer containing an array of [[#ApplicationDeliveryInfo]], a s32, and returns an output s32 total_out.
 +
 
 +
The array-count for ContentMetaKey must be at least 1, and for ApplicationDeliveryInfo it must match 1.
 +
 
 +
This will only return 1 ContentMetaKey entry. This will not output the entry when the input s32 is larger than 0. This also does other validation, etc.
   −
This was added with [4.0.0+].
+
==== NeedsSystemUpdateToDeliverApplication ====
 +
Takes a type-0x15 input buffer containing a [[#SystemDeliveryInfo]], a type-0x5 input buffer containing an array of [[#ApplicationDeliveryInfo]], and returns an output u8 bool.
   −
{| class="wikitable" border="1"
+
The array-count must match 1.
|-
+
 
! Cmd || Name
+
After validation etc, this sets the output bool by comparing system-version fields in the [[#SystemDeliveryInfo]]/[[#ApplicationDeliveryInfo]] and with a state field.
|-
+
 
| 0 || GetLaunchRequiredVersion
+
==== EstimateRequiredSize ====
|-
+
Takes a type-0x5 input buffer containing an array of [[NCM_services#ContentMetaKey|ContentMetaKey]], returns an output s64.
| 1 || UpgradeLaunchRequiredVersion
+
 
|-
+
When the array-count is less than 1, this will return 0 with the s64 set to 0.
| 35 || UpdateVersionList
+
 
|-
+
==== RequestReceiveApplication ====
| 36 || PushLaunchVersion
+
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 [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].
|-
  −
| 37 || ListRequiredVersion
  −
|-
  −
| 800 || RequestVersionList
  −
|-
  −
| 801 || ListVersionList
  −
|-
  −
| 802 || [[#RequestVersionListData]]
  −
|-
  −
| 1000 || PerformAutoUpdate
  −
|}
     −
==== RequestVersionListData ====
+
[[qlaunch]] uses value Any for the StorageId, and value 55556 for the port.
No input, returns an output Event handle and an [[#IAsyncValue]].
     −
The data that can be read from the [[#IAsyncValue]] is [[#VersionListData]].
+
An error is thrown if a state ref-count is zero. An error is thrown if [[NIM_services|nim]] ListApplicationApplyDeltaTask returns a task.
   −
=== IContentManagerInterface ===
+
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 is "nn::ns::detail::IContentManagementInterface".
     −
{| class="wikitable" border="1"
+
This does various setup then creates the [[#IAsyncResult]] + the async thread which handles the [[#IAsyncResult]] operation. Then the thread does:
|-
+
 
! Cmd || Name
+
* Calls a func which does:
|-
+
** Throws an error if a state flag is set.
| 11 || CalculateApplicationOccupiedSize
+
** Uses [[NIM_services|nim]] cmd53, returning the Result on failure.
|-
+
** Uses [[NIM_services|nim]] cmd56, returning the Result on failure. Waits for the IAsyncResult operation from this to finish, then uses the Get cmd to get the output Result.
| 43 || CheckSdCardMountStatus
+
** Handles cleanup and returns.
|-
+
* On success, this loads various data which is then used for saving a SystemPlayReport when a state flag is set.
| 47 || GetTotalSpaceSize
+
** The EventId is "receive_app_contents" with ApplicationId <NS ProgramId>.
|-
+
 
| 48 || GetFreeSpaceSize
+
==== CommitReceiveApplication ====
|-
+
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.
| 600 || CountApplicationContentMeta
+
 
|-
+
==== GetReceiveApplicationProgress ====
| 601 || ListApplicationContentMetaStatus
+
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output [[#ReceiveApplicationProgress]].
|-
  −
| 605 || ListApplicationContentMetaStatusWithRightsCheck
  −
|-
  −
| 607 || IsAnyApplicationRunning
  −
|}
     −
=== IDocumentInterface ===
+
An error is thrown if a state ref-count is zero. An error is thrown if [[NIM_services|nim]] ListApplicationApplyDeltaTask returns a task.
This is "nn::ns::detail::IDocumentInterface".
     −
{| class="wikitable" border="1"
+
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.
|-
+
 
! Cmd || Name
+
==== RequestSendApplication ====
|-
+
Takes a type-0x5 input buffer containing an array of [[NCM_services#ContentMetaKey|ContentMetaKey]], an u16 port, an u32 Ipv4Address, an [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].
| 21 || GetApplicationContentPath
+
 
|-
+
[[qlaunch]] uses value 55556 for the port.
| 23 || ResolveApplicationContentPath
+
 
|-
+
An error is thrown if a state ref-count is zero. An error is thrown if [[NIM_services|nim]] ListApplicationApplyDeltaTask returns a task.
| 92 || [5.0.0+] GetRunningApplicationProgramId
+
 
|}
+
The [[NCM_services#ContentMetaType|ContentMetaType]] must match Patch.
 +
 
 +
This does various setup and selects a ContentMetaKey to use from the input, then creates the [[#IAsyncResult]] + the async thread which handles the [[#IAsyncResult]] operation. Then the thread does:
 +
 
 +
* Calls a func which does:
 +
** Throws an error if a state flag is set.
 +
** Uses [[NIM_services|nim]] cmd60, returning the Result on failure.
 +
** Uses [[NIM_services|nim]] cmd61, 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.
 +
* 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>.
   −
=== IDownloadTaskInterface ===
+
==== GetSendApplicationProgress ====
This is "nn::ns::detail::IDownloadTaskInterface".
+
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output [[#SendApplicationProgress]].
   −
{| class="wikitable" border="1"
+
Same as [[#GetReceiveApplicationProgress]] except this is the Send version, and uses [[NIM_services|nim]] cmd68/cmd63 instead.
|-
+
 
! Cmd || Name
+
==== CompareSystemDeliveryInfo ====
|-
+
Takes two type-0x15 input buffers containing a [[#SystemDeliveryInfo]], returns an output s32.
| 701 || ClearTaskStatusList
+
 
|-
+
This is essentially the same as [[#CompareApplicationDeliveryInfo]], except this compares the [[#SystemDeliveryInfo]] SystemUpdate version.
| 702 || RequestDownloadTaskList
+
 
 +
==== ListNotCommittedContentMeta ====
 +
Takes a type-0x6 output buffer containing an array of [[NCM_services#ContentMetaKey|ContentMetaKey]], a s32, an [[NCM_services#ApplicationId|ApplicationId]], returns an output s32 total_out.
 +
 
 +
==== RecoverDownloadTask ====
 +
Takes a type-0x5 input buffer containing an array of {unknown} and an input u64, no output.
 +
 
 +
==== GetApplicationDeliveryInfoHash ====
 +
Takes a type-0x5 input buffer containing an array of [[#ApplicationDeliveryInfo]], returns an output 0x20-byte SHA256 hash.
 +
 
 +
This extracts data from the input array for hashing with SHA256, with validation being done when handling each entry.
 +
 
 +
=== IApplicationVersionInterface ===
 +
This is "nn::ns::detail::IApplicationVersionInterface".
 +
 
 +
This was added with [4.0.0+].
 +
 
 +
{| class="wikitable" border="1"
 +
|-
 +
! Cmd || Name
 +
|-
 +
| 0 || GetLaunchRequiredVersion
 
|-
 
|-
| 703 || RequestEnsureDownloadTask
+
| 1 || UpgradeLaunchRequiredVersion
 +
|-
 +
| 35 || UpdateVersionList
 +
|-
 +
| 36 || PushLaunchVersion
 +
|-
 +
| 37 || ListRequiredVersion
 +
|-
 +
| 800 || RequestVersionList
 +
|-
 +
| 801 || ListVersionList
 +
|-
 +
| 802 || [[#RequestVersionListData]]
 +
|-
 +
| 1000 || PerformAutoUpdate
 +
|}
 +
 
 +
==== RequestVersionListData ====
 +
No input, returns an output Event handle and an [[#IAsyncValue]].
 +
 
 +
The data that can be read from the [[#IAsyncValue]] is [[#VersionListData]].
 +
 
 +
=== IContentManagerInterface ===
 +
This is "nn::ns::detail::IContentManagementInterface".
 +
 
 +
{| class="wikitable" border="1"
 +
|-
 +
! Cmd || Name
 +
|-
 +
| 11 || CalculateApplicationOccupiedSize
 +
|-
 +
| 43 || CheckSdCardMountStatus
 +
|-
 +
| 47 || GetTotalSpaceSize
 +
|-
 +
| 48 || GetFreeSpaceSize
 +
|-
 +
| 600 || CountApplicationContentMeta
 +
|-
 +
| 601 || ListApplicationContentMetaStatus
 +
|-
 +
| 605 || ListApplicationContentMetaStatusWithRightsCheck
 +
|-
 +
| 607 || IsAnyApplicationRunning
 +
|}
 +
 
 +
=== IDocumentInterface ===
 +
This is "nn::ns::detail::IDocumentInterface".
 +
 
 +
{| class="wikitable" border="1"
 +
|-
 +
! Cmd || Name
 +
|-
 +
| 21 || GetApplicationContentPath
 +
|-
 +
| 23 || ResolveApplicationContentPath
 +
|-
 +
| 92 || [5.0.0+] GetRunningApplicationProgramId
 +
|}
 +
 
 +
=== IDownloadTaskInterface ===
 +
This is "nn::ns::detail::IDownloadTaskInterface".
 +
 
 +
{| class="wikitable" border="1"
 +
|-
 +
! Cmd || Name
 +
|-
 +
| 701 || ClearTaskStatusList
 +
|-
 +
| 702 || RequestDownloadTaskList
 +
|-
 +
| 703 || RequestEnsureDownloadTask
 +
|-
 +
| 704 || ListDownloadTaskStatus
 +
|-
 +
| 705 || [[#RequestDownloadTaskListData]]
 +
|-
 +
| 706 || [4.0.0+] TryCommitCurrentApplicationDownloadTask
 +
|-
 +
| 707 || [4.0.0+] EnableAutoCommit
 +
|-
 +
| 708 || [4.0.0+] DisableAutoCommit
 +
|-
 +
| 709 || [4.0.0+] TriggerDynamicCommitEvent
 +
|}
 +
 
 +
=== IReadOnlyApplicationRecordInterface ===
 +
This is "nn::ns::detail::IReadOnlyApplicationRecordInterface".
 +
 
 +
This was added with [5.0.0+].
 +
 
 +
{| class="wikitable" border="1"
 +
|-
 +
! Cmd || Name || Notes
 +
|-
 +
| 0 || HasApplicationRecord || Same as [[#IApplicationManagerInterface]] cmd 910
 +
|}
 +
 
 +
=== IReadOnlyApplicationControlDataInterface ===
 +
This is "nn::ns::detail::IReadOnlyApplicationControlDataInterface".
 +
 
 +
This was added with [5.1.0+].
 +
 
 +
{| class="wikitable" border="1"
 +
|-
 +
! Cmd || Name || Notes
 +
|-
 +
| 0 || [[#GetApplicationControlData]] || Same as [[#IApplicationManagerInterface]] cmd 400
 +
|-
 +
| 1 || [[#GetApplicationDesiredLanguage]] || Same as [[#IApplicationManagerInterface]] cmd 55
 +
|-
 +
| 2 || ConvertApplicationLanguageToLanguageCode || Same as [[#IApplicationManagerInterface]] cmd 59
 
|-
 
|-
| 704 || ListDownloadTaskStatus
+
| 3 || [[#ConvertLanguageCodeToApplicationLanguage]] || Same as [[#IApplicationManagerInterface]] cmd 60
 
|-
 
|-
| 705 || [[#RequestDownloadTaskListData]]
+
| 4 || [9.0.0+] SelectApplicationDesiredLanguage ||
|-
  −
| 706 || [4.0.0+] TryCommitCurrentApplicationDownloadTask
  −
|-
  −
| 707 || [4.0.0+] EnableAutoCommit
  −
|-
  −
| 708 || [4.0.0+] DisableAutoCommit
  −
|-
  −
| 709 || [4.0.0+] TriggerDynamicCommitEvent
   
|}
 
|}
   −
=== IReadOnlyApplicationRecordInterface ===
+
=== IDynamicRightsInterface ===
This is "nn::ns::detail::IReadOnlyApplicationRecordInterface".
+
This is "nn::ns::detail::IDynamicRightsInterface".
   −
This was added with [5.0.0+].
+
This was added with [6.0.0+].
    
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 1,118: Line 1,263:  
! Cmd || Name || Notes
 
! Cmd || Name || Notes
 
|-
 
|-
| 0 || HasApplicationRecord || Same as [[#IApplicationManagerInterface]] cmd 910
+
| 0 || [[#RequestApplicationRightsOnServer]] ||  
|}
+
|-
 
+
| 1 || RequestAssignRights ||  
=== IReadOnlyApplicationControlDataInterface ===
  −
This is "nn::ns::detail::IReadOnlyApplicationControlDataInterface".
  −
 
  −
This was added with [5.1.0+].
  −
 
  −
{| class="wikitable" border="1"
  −
|-
  −
! Cmd || Name || Notes
  −
|-
  −
| 0 || [[#GetApplicationControlData]] || Same as [[#IApplicationManagerInterface]] cmd 400
  −
|-
  −
| 1 || [[#GetApplicationDesiredLanguage]] || Same as [[#IApplicationManagerInterface]] cmd 55
  −
|-
  −
| 2 || ConvertApplicationLanguageToLanguageCode || Same as [[#IApplicationManagerInterface]] cmd 59
  −
|-
  −
| 3 || [[#ConvertLanguageCodeToApplicationLanguage]] || Same as [[#IApplicationManagerInterface]] cmd 60
  −
|-
  −
| 4 || [9.0.0+] SelectApplicationDesiredLanguage ||
  −
|}
  −
 
  −
=== IDynamicRightsInterface ===
  −
This is "nn::ns::detail::IDynamicRightsInterface".
  −
 
  −
This was added with [6.0.0+].
  −
 
  −
{| class="wikitable" border="1"
  −
|-
  −
! Cmd || Name || Notes
  −
|-
  −
| 0 || [[#RequestApplicationRightsOnServer]] ||  
  −
|-
  −
| 1 || RequestAssignRights ||  
   
|-
 
|-
 
| 4 || DeprecatedRequestAssignRightsToResume ||  
 
| 4 || DeprecatedRequestAssignRightsToResume ||  
Line 1,217: Line 1,330:  
|-
 
|-
 
| 102 || ResetToFactorySettingsForRefurbishment
 
| 102 || ResetToFactorySettingsForRefurbishment
 +
|-
 +
| 103 || [9.1.0+] ResetToFactorySettingsWithPlatformRegion
 +
|-
 +
| 104 || [9.1.0+] ResetToFactorySettingsWithPlatformRegionAuthentication
 
|}
 
|}
   Line 1,253: Line 1,370:     
== UpdateSafeSystemVersionForDebug ==
 
== UpdateSafeSystemVersionForDebug ==
Takes an input u64 '''titleID''' and an u32 '''version'''.
+
Takes an input [[NCM_services#ApplicationId|ApplicationId]] and an u32 '''version'''.
   −
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 [[NCM_services#ApplicationId|ApplicationId]] 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 [[NCM_services#ApplicationId|ApplicationId]] 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".
    
== GetSafeSystemVersion ==
 
== GetSafeSystemVersion ==
No input, returns an output [[NCM_services#ContentMetaKey|ContentMetaKey]] with the cached contents of "ns_ssversion:/entry" (u64 '''titleID''', u32 '''version''' and u32 '''policy''' from <code>vulnerability!needs_update_vulnerability_policy</code>).
+
No input, returns an output [[NCM_services#ContentMetaKey|ContentMetaKey]] with the cached contents of "ns_ssversion:/entry" ([[NCM_services#ApplicationId|ApplicationId]], u32 '''version''' and u32 '''policy''' from <code>vulnerability!needs_update_vulnerability_policy</code>).
    
= ns:su =
 
= ns:su =
Line 1,582: Line 1,699:     
This just uses [[NIM_services|nim]] ListSystemUpdateTask, then when a task is returned uses it with DestroySystemUpdateTask.
 
This just uses [[NIM_services|nim]] ListSystemUpdateTask, then when a task is returned uses it with DestroySystemUpdateTask.
 +
 +
[[qlaunch]] uses this before [[#RequestReceiveSystemUpdate]].
    
=== RequestCheckLatestUpdateIncludesRebootlessUpdate ===
 
=== RequestCheckLatestUpdateIncludesRebootlessUpdate ===
Line 1,689: Line 1,808:     
== LaunchApplicationForDevelop ==
 
== LaunchApplicationForDevelop ==
Takes an input u32 [[Process_Manager_services#LaunchFlags|LaunchFlags]] and u64 titleID, returns an output u64 PID.
+
Takes an input u32 [[Process_Manager_services#LaunchFlags|LaunchFlags]] and [[NCM_services#ApplicationId|ApplicationId]], returns an output u64 PID.
    
Same as LaunchApplicationWithStorageId except the last two params passed to the internal vtable funcptr call are value 0x6, instead of from the command input.
 
Same as LaunchApplicationWithStorageId except the last two params passed to the internal vtable funcptr call are value 0x6, instead of from the command input.
    
== LaunchApplicationWithStorageIdForDevelop ==
 
== LaunchApplicationWithStorageIdForDevelop ==
Takes 2 input u8s, an u32 [[Process_Manager_services#LaunchFlags|LaunchFlags]], and an u64 titleID. Returns an output u64 PID.
+
Takes 2 input u8s, an u32 [[Process_Manager_services#LaunchFlags|LaunchFlags]], and an [[NCM_services#ApplicationId|ApplicationId]]. Returns an output u64 PID.
    
Launches an application title which is registered with NS.
 
Launches an application title which is registered with NS.
Line 1,702: Line 1,821:     
== IsPreomiaForDevelop ==
 
== IsPreomiaForDevelop ==
Takes an u64 titleID. Returns a bool.
+
Takes an u64 [[NCM_services#ProgramId|ProgramId]]. Returns a bool.
    
= VersionListData =
 
= VersionListData =
Line 1,760: Line 1,879:  
! Description
 
! Description
 
|-
 
|-
| 0x0 || 0x4 || Must be <= to and match [[System_Settings|system-setting]] <code>contents_delivery!system_delivery_protocol_version</code>.
+
| 0x0 || 0x4 || SystemDeliveryProtocolVersion. Must be <= to and match [[System_Settings|system-setting]] <code>contents_delivery!system_delivery_protocol_version</code>.
 
|-
 
|-
| 0x4 || 0x4 || Loaded from [[System_Settings|system-setting]] <code>contents_delivery!application_delivery_protocol_version</code>. Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation.
+
| 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 || 0x4 || Whether ExFat is included. Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation.
+
| 0x8 || 0x1 || HasExFat. Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation.
 
|-
 
|-
| 0xC || 0x4 || SystemUpdate Meta version.
+
| 0x9 || 0x3 || Reserved.
 
|-
 
|-
| 0x10 || 0x8 || SystemUpdate Meta Id.
+
| 0xC || 0x4 || SystemUpdateMetaVersion.
 
|-
 
|-
| 0x18 || 0x1 || firmware_variation, used by [[#RequestSendSystemUpdate]].
+
| 0x10 || 0x8 || SystemUpdateMetaId.
 
|-
 
|-
| 0x19 || 0x1 || Unknown. Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation.
+
| 0x18 || 0x1 || FirmwareVariationId. Used by [[#RequestSendSystemUpdate]].
 
|-
 
|-
| 0x1A || 0xC6 || Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation.
+
| 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.
 
| 0xE0 || 0x20 || HMAC-SHA256 over the previous 0xE0-bytes.
Line 1,788: Line 1,911:  
! Description
 
! Description
 
|-
 
|-
| 0x0 || 0x100 || ?
+
| 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]].
 
|}
 
|}
   Line 1,807: Line 1,944:     
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]]

Navigation menu