NS services: Difference between revisions

No edit summary
 
(8 intermediate revisions by 2 users not shown)
Line 349: Line 349:


== ListApplicationRecord ==
== ListApplicationRecord ==
Takes a type-0x6 output buffer containing an array of the below record and an s32 entry_offset, returns an output s32 out_entrycount.
Takes a type-0x6 output buffer containing an array of [[#ApplicationRecord]] and an s32 entry_offset, returns an output s32 out_entrycount.


Returns an array of entries with the below format using the specified offset and count.
Returns an array of entries with the below format using the specified offset and count.
=== Application Record Format ===
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0
| 0x8
| [[NCM_services#ApplicationId|ApplicationId]]
|-
| 0x8
| 0x1
| Type? (Known values: 0x2=Installing?, 0x3=Installed / Gamecard inserted, 0x5=Gamecard not inserted, 0xB=Archived)
|-
| 0x9
| 0x1
| Unknown, usually 0x02
|-
| 0xA
| 0x6
| Unknown, usually zeros?
|-
| 0x10
| 0x1
| Unknown, seems to change between reboots and removing/reinserting gamecards
|-
| 0x11
| 0x7
| Unknown, usually zeros?
|}


== LaunchApplication ==
== LaunchApplication ==
Line 429: Line 397:


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.
=== ApplicationControlSource ===
{| class="wikitable" border="1"
|-
! Value
! Description
|-
| 0x0
| CacheOnly (Returns data from cache)
|-
| 0x1
| Storage (Returns data from storage if not present in cache)
|-
| 0x2
| 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 [[NCM_services#ApplicationId|ApplicationId]], returns an output s32 out_entrycount.
Takes a type-0x6 output buffer containing an array of [[#ApplicationContentMetaStatus]], an input s32 index and [[NCM_services#ApplicationId|ApplicationId]], returns an output s32 out_entrycount.


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.
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:
= ns:am2, ns:ec, ns:rid, ns:rt, ns:web, ns:ro, ns:sweb =
{| class="wikitable" border="1"
These are "nn::ns::detail::IServiceGetterInterface".
|-
 
! Offset
! Size
! Description
|-
| 0x0
| 0x1
| [[NCM_services#ContentMetaType|ContentMetaType]] ("type")
|-
| 0x1
| 0x1
| [[NCM_services#StorageId|StorageId]] ("installedStorage")
|-
| 0x2
| 0x1
| Unknown. Non-zero with output from cmd 605, differs for app/update titles.
|-
| 0x3
| 0x1
| Padding
|-
| 0x4
| 0x4
| Version
|-
| 0x8
| 0x8
| [[NCM_services#ApplicationId|ApplicationId]]
|}
 
= ns:am2, ns:ec, ns:rid, ns:rt, ns:web, ns:ro, ns:sweb =
These are "nn::ns::detail::IServiceGetterInterface".
 
These commands check a state field for a command-specific bit and returns an error if not set, this is likely a permissions check for service+command.
These commands check a state field for a command-specific bit and returns an error if not set, this is likely a permissions check for service+command.


Line 767: Line 687:
|-
|-
| 420 || [19.0.0+] CloneApplicationControlDataCacheForDebug
| 420 || [19.0.0+] CloneApplicationControlDataCacheForDebug
|-
| 421 || [20.0.0+]
|-
| 422 || [20.0.0+]
|-
| 423 || [20.0.0+]
|-
| 424 || [20.0.0+]
|-
| 425 || [20.0.0+]
|-
| 426 || [20.0.0+]
|-
| 427 || [20.0.0+]
|-
|-
| 502 || [[#RequestCheckGameCardRegistration]]
| 502 || [[#RequestCheckGameCardRegistration]]
Line 789: Line 723:
|-
|-
| 512 || [19.0.0+] IsGameCardApplicationRunning
| 512 || [19.0.0+] IsGameCardApplicationRunning
|-
| 513 || [20.0.0+]
|-
| 514 || [20.0.0+]
|-
| 515 || [20.0.0+]
|-
|-
| 600 || [[#CountApplicationContentMeta]]
| 600 || [[#CountApplicationContentMeta]]
Line 864: Line 804:
| 916 || [11.0.0+] IsApplicationAutoDeleteDisabled
| 916 || [11.0.0+] IsApplicationAutoDeleteDisabled
|-
|-
| 1000 || [[#RequestVerifyApplicationDeprecated]]
| 917 || [20.0.0+]
|-
|-
| 1001 || CorruptApplicationForDebug
| 918 || [20.0.0+]
|-
|-
| 1002 || [3.0.0-9.2.0] [[#RequestVerifyAddOnContentsRights]]
| 919 || [20.0.0+]
|-
| 920 || [20.0.0+]
|-
| 921 || [20.0.0+]
|-
| 922 || [20.0.0+]
|-
| 923 || [20.0.0+]
|-
| 928 || [20.0.0+]
|-
| 929 || [20.0.0+]
|-
| 930 || [20.0.0+]
|-
| 931 || [20.0.0+]
|-
| 933 || [20.1.0+]
|-
| 1000 || [[#RequestVerifyApplicationDeprecated]]
|-
| 1001 || CorruptApplicationForDebug
|-
| 1002 || [3.0.0-9.2.0] [[#RequestVerifyAddOnContentsRights]]
|-
|-
| 1003 || [5.0.0+] [[#RequestVerifyApplication]]
| 1003 || [5.0.0+] [[#RequestVerifyApplication]]
Line 913: Line 877:
|-
|-
| 1506 || [9.0.0+] GetSdCardStartupStatus
| 1506 || [9.0.0+] GetSdCardStartupStatus
|-
| 1508 || [20.0.0+]
|-
| 1509 || [20.0.0+]
|-
| 1510 || [20.0.0+]
|-
| 1511 || [20.0.0+]
|-
| 1512 || [20.0.0+]
|-
|-
| 1600 || GetSystemSeedForPseudoDeviceId
| 1600 || GetSystemSeedForPseudoDeviceId
Line 929: Line 903:
|-
|-
| 1705 || [11.0.0+] [[#IsPatchAutoDeletableApplication]]
| 1705 || [11.0.0+] [[#IsPatchAutoDeletableApplication]]
|-
| 1706 || [20.0.0+]
|-
|-
| 1800 || IsNotificationSetupCompleted
| 1800 || IsNotificationSetupCompleted
Line 983: Line 959:
|-
|-
| 2018 || [5.0.0+] [[#GetApplicationDeliveryInfoHash]]
| 2018 || [5.0.0+] [[#GetApplicationDeliveryInfoHash]]
|-
| 2019 || [20.0.0+]
|-
|-
| 2050 || [6.0.0+] [[#GetApplicationRightsOnClient]]
| 2050 || [6.0.0+] [[#GetApplicationRightsOnClient]]
|-
|-
| 2051 || [9.0.0+] InvalidateRightsIdCache
| 2051 || [9.0.0+] InvalidateRightsIdCache
|-
| 2052 || [20.0.0+]
|-
| 2053 || [20.0.0+]
|-
|-
| 2100 || [6.0.0+] [[#GetApplicationTerminateResult]]
| 2100 || [6.0.0+] [[#GetApplicationTerminateResult]]
Line 1,019: Line 1,001:
|-
|-
| 2182 || [6.0.0+] SetActiveRightsContextUsingStateToRightsEnvironment
| 2182 || [6.0.0+] SetActiveRightsContextUsingStateToRightsEnvironment
|-
| 2183 || [20.1.0+]
|-
|-
| 2190 || [6.0.0+] [[#GetRightsEnvironmentHandleForApplication]]
| 2190 || [6.0.0+] [[#GetRightsEnvironmentHandleForApplication]]
Line 1,055: Line 1,039:
|-
|-
| 2361 || [19.0.0+] GetMaxApplicationDownloadTaskCount
| 2361 || [19.0.0+] GetMaxApplicationDownloadTaskCount
|-
| 2362 || [20.0.0+]
|-
| 2363 || [20.0.0+]
|-
| 2364 || [20.0.0+]
|-
| 2365 || [20.0.0+]
|-
| 2366 || [20.0.0+]
|-
| 2367 || [20.0.0+]
|-
| 2368 || [20.0.0+]
|-
|-
| 2400 || [8.0.0+] [[#GetPromotionInfo]]
| 2400 || [8.0.0+] [[#GetPromotionInfo]]
Line 1,060: Line 1,058:
| 2401 || [8.0.0+] CountPromotionInfo
| 2401 || [8.0.0+] CountPromotionInfo
|-
|-
| 2402 || [8.0.0+] ListPromotionInfo
| 2402 || [8.0.0+] [[#ListPromotionInfo|ListPromotionInfo]]
|-
|-
| 2403 || [8.0.0+] [[#ImportPromotionJsonForDebug]]
| 2403 || [8.0.0+] [[#ImportPromotionJsonForDebug]]
Line 1,095: Line 1,093:
|-
|-
| 2524 || [19.0.0+]  
| 2524 || [19.0.0+]  
|-
| 2525 || [20.0.0+]
|-
|-
| 2800 || [9.0.0+] GetApplicationIdOfPreomia
| 2800 || [9.0.0+] GetApplicationIdOfPreomia
Line 1,142: Line 1,142:
| 3105 || [18.0.0+] GetApplicationStartupMovie
| 3105 || [18.0.0+] GetApplicationStartupMovie
|-
|-
| 5000 || [18.0.0+]  
| 4000 || [20.0.0+]
|-
| 4004 || [20.0.0+]
|-
| 4006 || [20.0.0+]
|-
| 4007 || [20.0.0+]
|-
|-
| 5001 || [18.0.0+]  
| 4008 || [20.0.0+]
|-
|-
| 9999 || [10.0.0-10.2.0] GetApplicationCertificate
| 4009 || [20.0.0+]
|}
|-
 
| 4010 || [20.0.0+]
[4.0.0+] RequestDownloadAddOnContent now takes an additional 8-bytes of input.
|-
 
| 4011 || [20.0.0+]
==== GetApplicationRecordUpdateSystemEvent ====
|-
No input, returns an output Event handle with EventClearMode=1.
| 4012 || [20.0.0+]
 
|-
==== GetApplicationViewDeprecated ====
| 4013 || [20.0.0+]
Takes a type-0x6 output buffer containing an array of [[#ApplicationViewDeprecated]], a type-0x5 input buffer containing an array of u64 [[NCM_services#ApplicationId|ApplicationIds]], no output.
|-
 
| 4015 || [20.0.0+]
On newer system-versions this is the same as [[#GetApplicationView]], except this converts the output from the func called in the loop from [[#ApplicationView]] to [[#ApplicationViewDeprecated]].
|-
 
| 4017 || [20.0.0+]
==== DeleteApplicationEntity ====
|-
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.
| 4019 || [20.0.0+]
 
|-
==== DeleteApplicationCompletely ====
| 4020 || [20.0.0+]
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.
|-
 
| 4021 || [20.0.0+]
==== DeleteRedundantApplicationEntity ====
|-
No input/output.
| 4022 || [20.0.0+]
 
|-
==== IsApplicationEntityMovable ====
| 4023 || [20.0.0+]
Takes an input u8 [[NCM_services#StorageId|StorageId]], an [[NCM_services#ApplicationId|ApplicationId]], returns an output u8 bool.
|-
 
| 4024 || [20.0.0+]
==== MoveApplicationEntity ====
|-
Takes an input u8 [[NCM_services#StorageId|StorageId]], an [[NCM_services#ApplicationId|ApplicationId]], no output.
| 4025 || [20.0.0+]
 
|-
==== RequestApplicationUpdateInfo ====
| 4026 || [20.0.0+]
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncValue]].
|-
 
| 4027 || [20.0.0+]
The data that can be read from the [[#IAsyncValue]] is [[#ApplicationUpdateInfo]].
|-
 
| 4028 || [20.0.0+]
Before using the cmd, official sw uses [[Network_Interface_services#IsAnyInternetRequestAccepted|IsAnyInternetRequestAccepted]] with the output from [[Network_Interface_services#GetClientId|GetClientId]], throwing an error when the returned bool is false.
|-
 
| 4029 || [20.0.0+]
==== CancelApplicationDownload ====
|-
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.
| 4030 || [20.0.0+]
 
|-
==== ResumeApplicationDownload ====
| 4031 || [20.0.0+]
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.
|-
 
| 4032 || [20.0.0+]
==== CheckApplicationLaunchVersion ====
|-
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.
| 4033 || [20.0.0+]
 
|-
==== CalculateApplicationDownloadRequiredSize ====
| 4034 || [20.0.0+]
Takes an input u8 [[NCM_services#StorageId|StorageId]], an [[NCM_services#ApplicationId|ApplicationId]], returns an output s64.
|-
 
| 4035 || [20.0.0+]
==== CleanupSdCard ====
|-
No input/output.
| 4037 || [20.0.0+]
 
|-
==== GetSdCardMountStatusChangedEvent ====
| 4038 || [20.0.0+]
No input, returns an output Event handle with EventClearMode=0.
|-
 
| 4039 || [20.0.0+]
==== GetGameCardUpdateDetectionEvent ====
|-
No input, returns an output Event handle with EventClearMode=0.
| 4040 || [20.0.0+]
 
|-
==== DisableApplicationAutoDelete ====
| 4041 || [20.0.0+]
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.
|-
 
| 4042 || [20.0.0+]
==== EnableApplicationAutoDelete ====
|-
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.
| 4043 || [20.0.0+]
 
|-
==== SetApplicationTerminateResult ====
| 4044 || [20.0.0+]
Takes an input u32 Result, an [[NCM_services#ApplicationId|ApplicationId]], no output.
|-
| 4045 || [20.0.0+]
|-
| 4046 || [20.0.0+]
|-
| 4049 || [20.0.0+]
|-
| 4050 || [20.0.0+]
|-
| 4051 || [20.0.0+]
|-
| 4052 || [20.0.0+]
|-
| 4053 || [20.0.0+]
|-
| 4054 || [20.0.0+]
|-
| 4055 || [20.0.0+]
|-
| 4056 || [20.0.0+]
|-
| 4057 || [20.0.0+]
|-
| 4058 || [20.0.0+]
|-
| 4059 || [20.0.0+]
|-
| 4060 || [20.0.0+]
|-
| 4061 || [20.0.0+]
|-
| 4062 || [20.0.0+]
|-
| 4063 || [20.0.0+]
|-
| 4064 || [20.0.0+]
|-
| 4065 || [20.0.0+]
|-
| 4066 || [20.0.0+]
|-
| 4067 || [20.0.0+]
|-
| 4068 || [20.0.0+]
|-
| 4069 || [20.0.0+]
|-
| 4070 || [20.0.0+]
|-
| 4071 || [20.0.0+]
|-
| 4072 || [20.0.0+]
|-
| 4073 || [20.0.0+]
|-
| 4074 || [20.0.0+]
|-
| 4075 || [20.0.0+]
|-
| 4076 || [20.0.0+]
|-
| 4077 || [20.0.0+]
|-
| 4078 || [20.0.0+]
|-
| 4079 || [20.0.0+]
|-
| 4080 || [20.0.0+]
|-
| 4081 || [20.0.0+]
|-
| 4083 || [20.0.0+]
|-
| 4084 || [20.0.0+]
|-
| 4085 || [20.0.0+]
|-
| 4086 || [20.0.0+]
|-
| 4087 || [20.0.0+]
|-
| 4088 || [20.0.0+]
|-
| 4089 || [20.0.0+]
|-
| 4090 || [20.0.0+]
|-
| 4091 || [20.0.0+]
|-
| 4092 || [20.0.0+]
|-
| 4093 || [20.0.0+]
|-
| 4094 || [20.0.0+]
|-
| 4095 || [20.0.0+]
|-
| 4096 || [20.0.0+]
|-
| 4097 || [20.0.0+]
|-
| 5000 || [18.0.0+]  
|-
| 5001 || [18.0.0+]  
|-
| 9999 || [10.0.0-10.2.0] GetApplicationCertificate
|}


==== ClearApplicationTerminateResult ====
[4.0.0+] RequestDownloadAddOnContent now takes an additional 8-bytes of input.
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.


==== GetLastSdCardMountUnexpectedResult ====
==== GetApplicationRecordUpdateSystemEvent ====
No input/output.
No input, returns an output Event handle with EventClearMode=1.


==== GetRequestServerStopper ====
==== GetApplicationViewDeprecated ====
No input, returns an output [[#IRequestServerStopper]].
Takes a type-0x6 output buffer containing an array of [[#ApplicationViewDeprecated]], a type-0x5 input buffer containing an array of u64 [[NCM_services#ApplicationId|ApplicationIds]], no output.
 
On newer system-versions this is the same as [[#GetApplicationView]], except this converts the output from the func called in the loop from [[#ApplicationView]] to [[#ApplicationViewDeprecated]].


==== CancelApplicationApplyDelta ====
==== DeleteApplicationEntity ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.


==== ResumeApplicationApplyDelta ====
==== DeleteApplicationCompletely ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.


==== CalculateApplicationApplyDeltaRequiredSize ====
==== DeleteRedundantApplicationEntity ====
Takes an input u8 [[NCM_services#StorageId|StorageId]], an [[NCM_services#ApplicationId|ApplicationId]], returns an output s64.
 
==== ResumeAll ====
No input/output.
No input/output.


==== GetStorageSize ====
==== IsApplicationEntityMovable ====
Takes an input u8 [[NCM_services#StorageId|StorageId]], returns two output s64s.
Takes an input u8 [[NCM_services#StorageId|StorageId]], an [[NCM_services#ApplicationId|ApplicationId]], returns an output u8 bool.


This temporarily mounts the [[Filesystem_services#OpenContentStorageFileSystem|ContentStorage]] specified by the StorageId (must be BuiltInUser or SdCard). The two output s64s are the output from [[Filesystem_services#GetTotalSpaceSize|GetTotalSpaceSize]] and [[Filesystem_services#GetFreeSpaceSize|GetFreeSpaceSize]] with this ContentStorage, with it this being unmounted afterwards.
==== MoveApplicationEntity ====
Takes an input u8 [[NCM_services#StorageId|StorageId]], an [[NCM_services#ApplicationId|ApplicationId]], no output.


==== RequestUpdateApplication2 ====
==== RequestApplicationUpdateInfo ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncValue]].


See [[#RequestApplicationUpdateInfo]] regarding nifm.
The data that can be read from the [[#IAsyncValue]] is [[#ApplicationUpdateInfo]].


==== LaunchApplication ====
Before using the cmd, official sw uses [[Network_Interface_services#IsAnyInternetRequestAccepted|IsAnyInternetRequestAccepted]] with the output from [[Network_Interface_services#GetClientId|GetClientId]], throwing an error when the returned bool is false.
Takes an input u8 ProgramIndex, an input [[#ApplicationLaunchInfo]], returns an output u64.


[18.0.0+] Now takes a total of 0x58 bytes of input.
==== CancelApplicationDownload ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.


[19.0.0+] Now takes a total of 0x88 bytes of input.
==== ResumeApplicationDownload ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.


==== GetApplicationLaunchInfo ====
==== CheckApplicationLaunchVersion ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output [[#ApplicationLaunchInfo]].
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.


[18.0.0+] Now returns a total of 0x50 bytes of output.
==== CalculateApplicationDownloadRequiredSize ====
Takes an input u8 [[NCM_services#StorageId|StorageId]], an [[NCM_services#ApplicationId|ApplicationId]], returns an output s64.


[19.0.0+] Now returns a total of 0x80 bytes of output.
==== CleanupSdCard ====
No input/output.


==== AcquireApplicationLaunchInfo ====
==== GetSdCardMountStatusChangedEvent ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output [[#ApplicationLaunchInfo]].
No input, returns an output Event handle with EventClearMode=0.


This verifies that a state flag is set and that a state field matches the input ApplicationId, throwing an error otherwise. The [[#ApplicationLaunchInfo]] from state is copied to output, then the state flag is cleared.
==== GetGameCardUpdateDetectionEvent ====
No input, returns an output Event handle with EventClearMode=0.


[18.0.0+] Now returns a total of 0x50 bytes of output.
==== DisableApplicationAutoDelete ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.


[19.0.0+] Now returns a total of 0x80 bytes of output.
==== EnableApplicationAutoDelete ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.


==== GetMainApplicationProgramIndexByApplicationLaunchInfo ====
==== SetApplicationTerminateResult ====
[18.0.0+] Now takes a total of 0x50 bytes of input.
Takes an input u32 Result, an [[NCM_services#ApplicationId|ApplicationId]], no output.


[19.0.0+] Now returns a total of 0x80 bytes of output.
==== ClearApplicationTerminateResult ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.


==== LaunchDevMenu ====
==== GetLastSdCardMountUnexpectedResult ====
No input/output.
No input/output.


This is used by AM cmd [[Applet_Manager_services#LaunchDevMenu|LaunchDevMenu]].
==== GetRequestServerStopper ====
No input, returns an output [[#IRequestServerStopper]].


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.
==== CancelApplicationApplyDelta ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.


[[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.
==== ResumeApplicationApplyDelta ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.


Then if the above succeeds, the above titles are launched with the above StorageId via [[Process_Manager_services|pmshell]] LaunchProgram ([10.0.0+] [[PGL_services#LaunchProgram|pgl]] with pgl_launch_flags=0), with a 0.5s sleep-thread afterwards on success. [[Process_Manager_services#LaunchFlags|LaunchFlags]] value 0xB is used here.
==== CalculateApplicationApplyDeltaRequiredSize ====
Takes an input u8 [[NCM_services#StorageId|StorageId]], an [[NCM_services#ApplicationId|ApplicationId]], returns an output s64.


==== DeleteUserSaveDataAll ====
==== ResumeAll ====
Takes an input [[Account_services#Uid|Uid]], returns an output [[#IProgressMonitorForDeleteUserSaveDataAll]].
No input/output.


On success, [[#IProgressMonitorForDeleteUserSaveDataAll]] GetProgress is used with the output being copied into object state.
==== GetStorageSize ====
Takes an input u8 [[NCM_services#StorageId|StorageId]], returns two output s64s.


==== DeleteUserSystemSaveData ====
This temporarily mounts the [[Filesystem_services#OpenContentStorageFileSystem|ContentStorage]] specified by the StorageId (must be BuiltInUser or SdCard). The two output s64s are the output from [[Filesystem_services#GetTotalSpaceSize|GetTotalSpaceSize]] and [[Filesystem_services#GetFreeSpaceSize|GetFreeSpaceSize]] with this ContentStorage, with it this being unmounted afterwards.
Takes an input [[Account_services#Uid|Uid]], an u64 SystemSaveDataId, no output.


==== DeleteSaveData ====
==== RequestUpdateApplication2 ====
Takes an input u8 [[Filesystem_services#SaveDataSpaceId|SaveDataSpaceId]], an u64 SaveDataId, no output.
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].


==== UnregisterNetworkServiceAccount ====
See [[#RequestApplicationUpdateInfo]] regarding nifm.
Takes an input [[Account_services#Uid|Uid]], no output.


==== UnregisterNetworkServiceAccountWithUserSaveDataDeletion ====
==== LaunchApplication ====
Takes an input [[Account_services#Uid|Uid]], no output.
Takes an input u8 ProgramIndex, an input [[#ApplicationLaunchInfo]], returns an output u64.


==== LaunchLibraryApplet ====
[18.0.0+] Now takes a total of 0x58 bytes of input.
Takes an input u64 [[NCM_services#ProgramId|ProgramId]], returns an output u64.


The specified program is launched with StorageId=BuiltInSystem via [[Process_Manager_services|pmshell]] LaunchProgram ([10.0.0+] [[PGL_services#LaunchProgram|pgl]] with pgl_launch_flags=0). [[Process_Manager_services#LaunchFlags|LaunchFlags]] value 0x9 is used here. The output u64 from here is written to the output for this cmd, on success.
[19.0.0+] Now takes a total of 0x88 bytes of input.


This is used by [[Applet_Manager_services|AM]].
==== GetApplicationLaunchInfo ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output [[#ApplicationLaunchInfo]].


==== LaunchSystemApplet ====
[18.0.0+] Now returns a total of 0x50 bytes of output.
No input, returns an output u64.


A state flag must be non-zero, otherwise an error is thrown. When a state field is value 1, a hard-coded ProgramId for MaintenanceMenu is used. Otherwise, the ProgramId is loaded from [[System_Settings|system-setting]] <code>ns.applet!system_applet_id</code>.
[19.0.0+] Now returns a total of 0x80 bytes of output.


The SystemApplet is launched with StorageId=BuiltInSystem via [[Process_Manager_services|pmshell]] LaunchProgram ([10.0.0+] [[PGL_services#LaunchProgram|pgl]] with pgl_launch_flags=0). [[Process_Manager_services#LaunchFlags|LaunchFlags]] value 0x9 is used here. The output u64 from here is written to the output for this cmd, on success.
==== AcquireApplicationLaunchInfo ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output [[#ApplicationLaunchInfo]].


This is used by [[Applet_Manager_services|AM]].
This verifies that a state flag is set and that a state field matches the input ApplicationId, throwing an error otherwise. The [[#ApplicationLaunchInfo]] from state is copied to output, then the state flag is cleared.


==== LaunchOverlayApplet ====
[18.0.0+] Now returns a total of 0x50 bytes of output.
No input, returns an output u64.


A state flag must be non-zero, otherwise an error is thrown. The ProgramId is loaded from [[System_Settings|system-setting]] <code>ns.applet!overlay_applet_id</code>.
[19.0.0+] Now returns a total of 0x80 bytes of output.


The OverlayApplet is launched with StorageId=BuiltInSystem via [[Process_Manager_services|pmshell]] LaunchProgram ([10.0.0+] [[PGL_services#LaunchProgram|pgl]] with pgl_launch_flags=0). [[Process_Manager_services#LaunchFlags|LaunchFlags]] value 0x9 is used here. The output u64 from here is written to the output for this cmd, on success.
==== GetMainApplicationProgramIndexByApplicationLaunchInfo ====
[18.0.0+] Now takes a total of 0x50 bytes of input.


This is used by [[Applet_Manager_services|AM]].
[19.0.0+] Now returns a total of 0x80 bytes of output.


==== RequestDownloadApplicationControlData ====
==== LaunchDevMenu ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].
No input/output.


See [[#RequestApplicationUpdateInfo]] regarding nifm.
This is used by AM cmd [[Applet_Manager_services#LaunchDevMenu|LaunchDevMenu]].


==== GetApplicationControlProperty ====
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.
[18.0.0+] Now takes a total of 0x58 bytes of input.


==== ListApplicationTitle ====
[[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.
Takes an input TransferMemory handle, a type-0x5 input buffer containing an array of u64 [[NCM_services#ApplicationId|ApplicationIds]], an u8 [[#ApplicationControlSource]], an u64 size, returns an output Event handle and an [[#IAsyncValue]].


[[qlaunch]] uses value 0x1 for the u8.
Then if the above succeeds, the above titles are launched with the above StorageId via [[Process_Manager_services|pmshell]] LaunchProgram ([10.0.0+] [[PGL_services#LaunchProgram|pgl]] with pgl_launch_flags=0), with a 0.5s sleep-thread afterwards on success. [[Process_Manager_services#LaunchFlags|LaunchFlags]] value 0xB is used here.


The user-process creates the TransferMemory with permissions=R--.
==== DeleteUserSaveDataAll ====
Takes an input [[Account_services#Uid|Uid]], returns an output [[#IProgressMonitorForDeleteUserSaveDataAll]].


The data available with [[#IAsyncValue]] Get is a s32 for the offset within the TransferMemory where the output data is located, GetSize returns the total byte-size of the data located here. The data located here is the [[NACP_Format|NACP]] title-entry for each specified ApplicationId.
On success, [[#IProgressMonitorForDeleteUserSaveDataAll]] GetProgress is used with the output being copied into object state.


The TransferMemory size must be at least: count*sizeof([[NACP_Format|title-entry]]) + count*sizeof(u64) + count*[[#GetApplicationControlData|0x24000]].
==== DeleteUserSystemSaveData ====
Takes an input [[Account_services#Uid|Uid]], an u64 SystemSaveDataId, no output.


This is essentially an async wrapper for [[#GetApplicationControlData]], with support for multiple ApplicationIds.
==== DeleteSaveData ====
Takes an input u8 [[Filesystem_services#SaveDataSpaceId|SaveDataSpaceId]], an u64 SaveDataId, no output.


==== ListApplicationIcon ====
==== UnregisterNetworkServiceAccount ====
Takes an input TransferMemory handle, a type-0x5 input buffer containing an array of u64 [[NCM_services#ApplicationId|ApplicationIds]], an u8 [[#ApplicationControlSource]], an u64 size, returns an output Event handle and an [[#IAsyncValue]].
Takes an input [[Account_services#Uid|Uid]], no output.


The user-process creates the TransferMemory with permissions=R--.
==== UnregisterNetworkServiceAccountWithUserSaveDataDeletion ====
Takes an input [[Account_services#Uid|Uid]], no output.


The data available with [[#IAsyncValue]] Get is a s32 for the offset within the TransferMemory where the output data is located, GetSize returns the total byte-size of the data located here. This data is: an u64 for total entries, an array of u64s for each icon size, then the icon JPEGs for the specified ApplicationIds.
==== LaunchLibraryApplet ====
Takes an input u64 [[NCM_services#ProgramId|ProgramId]], returns an output u64.


The TransferMemory size must be at least: 0x4 + count*sizeof(u64) + count*[[#GetApplicationControlData|0x20000]] + count*sizeof(u64) + [[#GetApplicationControlData|0x24000]].
The specified program is launched with StorageId=BuiltInSystem via [[Process_Manager_services|pmshell]] LaunchProgram ([10.0.0+] [[PGL_services#LaunchProgram|pgl]] with pgl_launch_flags=0). [[Process_Manager_services#LaunchFlags|LaunchFlags]] value 0x9 is used here. The output u64 from here is written to the output for this cmd, on success.
 
This is used by [[Applet_Manager_services|AM]].


This is essentially an async wrapper for [[#GetApplicationControlData]], with support for multiple ApplicationIds.
==== LaunchSystemApplet ====
No input, returns an output u64.


==== RequestCheckGameCardRegistration ====
A state flag must be non-zero, otherwise an error is thrown. When a state field is value 1, a hard-coded ProgramId for MaintenanceMenu is used. Otherwise, the ProgramId is loaded from [[System_Settings|system-setting]] <code>ns.applet!system_applet_id</code> ([20.0.0+] <code>ns.applet!system_applet_id_gen2</code>).
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].


See [[#RequestApplicationUpdateInfo]] regarding nifm.
The SystemApplet is launched with StorageId=BuiltInSystem via [[Process_Manager_services|pmshell]] LaunchProgram ([10.0.0+] [[PGL_services#LaunchProgram|pgl]] with pgl_launch_flags=0). [[Process_Manager_services#LaunchFlags|LaunchFlags]] value 0x9 is used here. The output u64 from here is written to the output for this cmd, on success.


==== RequestGameCardRegistrationGoldPoint ====
This is used by [[Applet_Manager_services|AM]].
Takes an input [[Account_services#Uid|Uid]], an [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncValue]].


The data that can be read from the [[#IAsyncValue]] is 4-bytes.
==== LaunchOverlayApplet ====
No input, returns an output u64.


See [[#RequestApplicationUpdateInfo]] regarding nifm.
A state flag must be non-zero, otherwise an error is thrown. The ProgramId is loaded from [[System_Settings|system-setting]] <code>ns.applet!overlay_applet_id</code>.


==== RequestRegisterGameCard ====
The OverlayApplet is launched with StorageId=BuiltInSystem via [[Process_Manager_services|pmshell]] LaunchProgram ([10.0.0+] [[PGL_services#LaunchProgram|pgl]] with pgl_launch_flags=0). [[Process_Manager_services#LaunchFlags|LaunchFlags]] value 0x9 is used here. The output u64 from here is written to the output for this cmd, on success.
Takes an input s32, an [[Account_services#Uid|Uid]], an [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].


See [[#RequestApplicationUpdateInfo]] regarding nifm.
This is used by [[Applet_Manager_services|AM]].


==== GetGameCardMountFailureEvent ====
==== RequestDownloadApplicationControlData ====
No input, returns an output Event handle with EventClearMode=0.
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].


==== IsGameCardInserted ====
See [[#RequestApplicationUpdateInfo]] regarding nifm.
No input, returns an output u8 bool.


==== EnsureGameCardAccess ====
==== GetApplicationControlProperty ====
No input/output.
[18.0.0+] Now takes a total of 0x58 bytes of input.


==== GetLastGameCardMountFailureResult ====
==== ListApplicationTitle ====
No input/output.
Takes an input TransferMemory handle, a type-0x5 input buffer containing an array of u64 [[NCM_services#ApplicationId|ApplicationIds]], an u8 [[#ApplicationControlSource]], an u64 size, returns an output Event handle and an [[#IAsyncValue]].


==== ListApplicationIdOnGameCard ====
[[qlaunch]] uses value 0x1 for the u8.
Takes a type-0x6 output buffer containing an array of u64 [[NCM_services#ApplicationId|ApplicationIds]], returns an output s32 for total output entries.


==== GetGameCardPlatformRegion ====
The user-process creates the TransferMemory with permissions=R--.
No input, returns an u8 '''GameCardPlatformRegion''' (0x00 = Global, 0x01 = China).


This calls [[Filesystem_services#IDeviceOperator|fsp-srv IDeviceOperator]] GetGameCardCompatibilityType and returns the result.
The data available with [[#IAsyncValue]] Get is a s32 for the offset within the TransferMemory where the output data is located, GetSize returns the total byte-size of the data located here. The data located here is the [[NACP_Format|NACP]] title-entry for each specified ApplicationId.


==== ListAvailableAddOnContent ====
The TransferMemory size must be at least: count*sizeof([[NACP_Format|title-entry]]) + count*sizeof(u64) + count*[[#GetApplicationControlData|0x24000]].
[10.0.0+] This now takes a total of 0x10-bytes of input instead of a total of 0x18-bytes of input.


[15.0.0+] This now takes a total of 0x8-bytes of input instead of a total of 0x10-bytes of input.
This is essentially an async wrapper for [[#GetApplicationControlData]], with support for multiple ApplicationIds.


==== RequestDownloadTaskListData ====
==== ListApplicationIcon ====
No input, returns an output Event handle and an [[#IAsyncValue]].
Takes an input TransferMemory handle, a type-0x5 input buffer containing an array of u64 [[NCM_services#ApplicationId|ApplicationIds]], an u8 [[#ApplicationControlSource]], an u64 size, returns an output Event handle and an [[#IAsyncValue]].


==== TouchApplication ====
The user-process creates the TransferMemory with permissions=R--.
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.


==== IsApplicationUpdateRequested ====
The data available with [[#IAsyncValue]] Get is a s32 for the offset within the TransferMemory where the output data is located, GetSize returns the total byte-size of the data located here. This data is: an u64 for total entries, an array of u64s for each icon size, then the icon JPEGs for the specified ApplicationIds.
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output u8 bool and an u32.


The output u32 is only valid when the output bool is set.
The TransferMemory size must be at least: 0x4 + count*sizeof(u64) + count*[[#GetApplicationControlData|0x20000]] + count*sizeof(u64) + [[#GetApplicationControlData|0x24000]].


==== WithdrawApplicationUpdateRequest ====
This is essentially an async wrapper for [[#GetApplicationControlData]], with support for multiple ApplicationIds.
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.


==== RequestVerifyApplicationDeprecated ====
==== RequestCheckGameCardRegistration ====
Takes an input TransferMemory handle, an [[NCM_services#ApplicationId|ApplicationId]], an u64 size, returns an output Event handle and an [[#IProgressAsyncResult]].
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].


On newer system-versions this calls the same func as [[#RequestVerifyApplication]], with the u32 value set to 0x7.
See [[#RequestApplicationUpdateInfo]] regarding nifm.


==== RequestVerifyAddOnContentsRights ====
==== RequestGameCardRegistrationGoldPoint ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IProgressAsyncResult]].
Takes an input [[Account_services#Uid|Uid]], an [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncValue]].


==== RequestVerifyApplication ====
The data that can be read from the [[#IAsyncValue]] is 4-bytes.
Takes an input TransferMemory handle, an u32, an [[NCM_services#ApplicationId|ApplicationId]], an u64 size, returns an output Event handle and an [[#IProgressAsyncResult]].


Official sw creates the TransferMemory with an user-specified buffer with permissions=0. [[qlaunch]] uses buffer size 0x100000.
See [[#RequestApplicationUpdateInfo]] regarding nifm.


Official sw has an additional wrapper func which calls the original wrapper func, this uses value 0x7 for the u32. This is the same func used by [[qlaunch]].
==== RequestRegisterGameCard ====
Takes an input s32, an [[Account_services#Uid|Uid]], an [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].


==== IsAnyApplicationEntityInstalled ====
See [[#RequestApplicationUpdateInfo]] regarding nifm.
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output u8 bool.


==== CleanupUnavailableAddOnContents ====
==== GetGameCardMountFailureEvent ====
Takes an input u64 [[NCM_services#ApplicationId|ApplicationId]], an [[Account_services#Uid|Uid]], no output.
No input, returns an output Event handle with EventClearMode=0.


==== RequestMoveApplicationEntity ====
==== IsGameCardInserted ====
Takes an input TransferMemory handle, a type-0x5 input buffer containing an array of [[NCM_services#StorageId|StorageId]], a [[NCM_services#StorageId|StorageId]], an u32 bitfield of "nn::ns::KeepApplicationEntityFlagTag", an [[NCM_services#ApplicationId|ApplicationId]], an u64 tmem_size, returns an output Event handle and an [[#IProgressAsyncResult]].
No input, returns an output u8 bool.


The TransferMemory uses permissions=0.
==== EnsureGameCardAccess ====
No input/output.


==== EstimateSizeToMove ====
==== GetLastGameCardMountFailureResult ====
Takes a type-0x5 input buffer containing an array of [[NCM_services#StorageId|StorageId]], a [[NCM_services#StorageId|StorageId]], an u32 bitfield of "nn::ns::KeepApplicationEntityFlagTag", an [[NCM_services#ApplicationId|ApplicationId]], returns an output s64.
 
This calls a func also used by [[#RequestMoveApplicationEntity]], then calls another func.
 
==== FormatSdCard ====
No input/output.
No input/output.


==== NeedsSystemUpdateToFormatSdCard ====
==== ListApplicationIdOnGameCard ====
No input, returns an output u8 bool.
Takes a type-0x6 output buffer containing an array of u64 [[NCM_services#ApplicationId|ApplicationIds]], returns an output s32 for total output entries.


==== GetLastSdCardFormatUnexpectedResult ====
==== GetGameCardPlatformRegion ====
No input/output.
No input, returns an u8 '''GameCardPlatformRegion''' (0x00 = Global, 0x01 = China).


==== GetApplicationView ====
This calls [[Filesystem_services#IDeviceOperator|fsp-srv IDeviceOperator]] GetGameCardCompatibilityType and returns the result.
Takes a type-0x6 output buffer containing an array of [[#ApplicationView]], a type-0x5 input buffer containing an array of u64 [[NCM_services#ApplicationId|ApplicationIds]], no output.


==== GetApplicationViewDownloadErrorContext ====
==== ListAvailableAddOnContent ====
Takes a type-0x16 output buffer containg an [[Error_Applet#ErrorContext|ErrorContext]], an u64 [[NCM_services#ApplicationId|ApplicationId]], no output.
[10.0.0+] This now takes a total of 0x10-bytes of input instead of a total of 0x18-bytes of input.


==== GetApplicationViewWithPromotionInfo ====
[15.0.0+] This now takes a total of 0x8-bytes of input instead of a total of 0x10-bytes of input.
Takes a type-0x6 output buffer containing an array of [[#ApplicationViewWithPromotionInfo]], a type-0x5 input buffer containing an array of u64 [[NCM_services#ApplicationId|ApplicationIds]], no output.


==== IsPatchAutoDeletableApplication ====
==== RequestDownloadTaskListData ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output bool.
No input, returns an output Event handle and an [[#IAsyncValue]].


Compares the input ApplicationId with the value of [[System_Settings|system-setting]] <code>ns.application!auto_deletable_application_id_on_not_enough_space</code>, with the bool being set to the comparsion result.
==== TouchApplication ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.


==== ListLastNotificationInfo ====
==== IsApplicationUpdateRequested ====
Takes a type-0x6 buffer containing an array with struct entry size 0x90-bytes. Returns 4-bytes of output.
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output u8 bool and an u32.


[19.0.0+] The struct size is now 0x98-bytes.
The output u32 is only valid when the output bool is set.


==== ListNotificationTask ====
==== WithdrawApplicationUpdateRequest ====
Takes a type-0x6 buffer containing an array with struct entry size 0xB0-bytes. Returns 4-bytes of output.
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.


[19.0.0+] The struct size is now 0xB8-bytes.
==== RequestVerifyApplicationDeprecated ====
Takes an input TransferMemory handle, an [[NCM_services#ApplicationId|ApplicationId]], an u64 size, returns an output Event handle and an [[#IProgressAsyncResult]].


==== RequestDownloadApplicationPrepurchasedRights ====
On newer system-versions this calls the same func as [[#RequestVerifyApplication]], with the u32 value set to 0x7.
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].


See [[#RequestApplicationUpdateInfo]] regarding nifm.
==== RequestVerifyAddOnContentsRights ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IProgressAsyncResult]].


==== GetSystemDeliveryInfo ====
==== RequestVerifyApplication ====
Takes a type-0x16 output buffer containing a [[#SystemDeliveryInfo]], no output.
Takes an input TransferMemory handle, an u32, an [[NCM_services#ApplicationId|ApplicationId]], an u64 size, returns an output Event handle and an [[#IProgressAsyncResult]].


This generates a [[#SystemDeliveryInfo]] using the currently installed SystemUpdate meta title.
Official sw creates the TransferMemory with an user-specified buffer with permissions=0. [[qlaunch]] uses buffer size 0x100000.


==== SelectLatestSystemDeliveryInfo ====
Official sw has an additional wrapper func which calls the original wrapper func, this uses value 0x7 for the u32. This is the same func used by [[qlaunch]].
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.
==== IsAnyApplicationEntityInstalled ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output u8 bool.


==== VerifyDeliveryProtocolVersion ====
==== CleanupUnavailableAddOnContents ====
Takes a type-0x15 input buffer containing a [[#SystemDeliveryInfo]], no output.
Takes an input u64 [[NCM_services#ApplicationId|ApplicationId]], an [[Account_services#Uid|Uid]], no output.


This validates the [[#SystemDeliveryInfo]] HMAC and the protocol-version fields. Then the meta version is compared with a state field, an error is returned on match otherwise 0 is returned.
==== RequestMoveApplicationEntity ====
Takes an input TransferMemory handle, a type-0x5 input buffer containing an array of [[NCM_services#StorageId|StorageId]], a [[NCM_services#StorageId|StorageId]], an u32 bitfield of "nn::ns::KeepApplicationEntityFlagTag", an [[NCM_services#ApplicationId|ApplicationId]], an u64 tmem_size, returns an output Event handle and an [[#IProgressAsyncResult]].


==== GetApplicationDeliveryInfo ====
The TransferMemory uses permissions=0.
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).
==== EstimateSizeToMove ====
Takes a type-0x5 input buffer containing an array of [[NCM_services#StorageId|StorageId]], a [[NCM_services#StorageId|StorageId]], an u32 bitfield of "nn::ns::KeepApplicationEntityFlagTag", an [[NCM_services#ApplicationId|ApplicationId]], returns an output s64.


==== HasAllContentsToDeliver ====
This calls a func also used by [[#RequestMoveApplicationEntity]], then calls another func.
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.
==== FormatSdCard ====
No input/output.


==== CompareApplicationDeliveryInfo ====
==== NeedsSystemUpdateToFormatSdCard ====
Takes two type-0x5 input buffers containing an array of [[#ApplicationDeliveryInfo]], returns an output s32.
No input, returns an output u8 bool.


The array-count for both buffers must be 1, otherwise an error is returned.
==== GetLastSdCardFormatUnexpectedResult ====
No input/output.


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.
==== GetApplicationView ====
Takes a type-0x6 output buffer containing an array of [[#ApplicationView]], a type-0x5 input buffer containing an array of u64 [[NCM_services#ApplicationId|ApplicationIds]], no output.


==== CanDeliverApplication ====
==== GetApplicationViewDownloadErrorContext ====
Takes two type-0x5 input buffers containing an array of [[#ApplicationDeliveryInfo]], returns an output u8 bool.
Takes a type-0x16 output buffer containg an [[Error_Applet#ErrorContext|ErrorContext]], an u64 [[NCM_services#ApplicationId|ApplicationId]], no output.


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.
==== GetApplicationViewWithPromotionInfo ====
Takes a type-0x6 output buffer containing an array of [[#ApplicationViewWithPromotionInfo]], a type-0x5 input buffer containing an array of u64 [[NCM_services#ApplicationId|ApplicationIds]], no output.


==== ListContentMetaKeyToDeliverApplication ====
==== IsPatchAutoDeletableApplication ====
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.
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output bool.
 
Compares the input ApplicationId with the value of [[System_Settings|system-setting]] <code>ns.application!auto_deletable_application_id_on_not_enough_space</code>, with the bool being set to the comparsion result.


The array-count for ContentMetaKey must be at least 1, and for ApplicationDeliveryInfo it must match 1.
==== ListLastNotificationInfo ====
Takes a type-0x6 buffer containing an array with struct entry size 0x90-bytes. Returns 4-bytes of output.


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.
[19.0.0+] The struct size is now 0x98-bytes.


==== NeedsSystemUpdateToDeliverApplication ====
==== ListNotificationTask ====
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.
Takes a type-0x6 buffer containing an array with struct entry size 0xB0-bytes. Returns 4-bytes of output.


The array-count must match 1.
[19.0.0+] The struct size is now 0xB8-bytes.


After validation etc, this sets the output bool by comparing system-version fields in the [[#SystemDeliveryInfo]]/[[#ApplicationDeliveryInfo]] and with a state field.
==== RequestDownloadApplicationPrepurchasedRights ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].


==== EstimateRequiredSize ====
See [[#RequestApplicationUpdateInfo]] regarding nifm.
Takes a type-0x5 input buffer containing an array of [[NCM_services#ContentMetaKey|ContentMetaKey]], returns an output s64.


When the array-count is less than 1, this will return 0 with the s64 set to 0.
==== GetSystemDeliveryInfo ====
Takes a type-0x16 output buffer containing a [[#SystemDeliveryInfo]], no output.


==== RequestReceiveApplication ====
This generates a [[#SystemDeliveryInfo]] using the currently installed SystemUpdate meta title.
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]].


[[qlaunch]] uses value Any for the StorageId, and value 55556 for the port.
==== 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.


An error is thrown if a state ref-count is zero. An error is thrown if [[NIM_services|nim]] ListApplicationApplyDeltaTask returns a task.
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.


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.
==== VerifyDeliveryProtocolVersion ====
Takes a type-0x15 input buffer containing a [[#SystemDeliveryInfo]], no output.


This does various setup then creates the [[#IAsyncResult]] + the async thread which handles the [[#IAsyncResult]] operation. Then the thread does:
This validates the [[#SystemDeliveryInfo]] HMAC and the protocol-version fields. Then the meta version is compared with a state field, an error is returned on match otherwise 0 is returned.


* Calls a func which does:
==== GetApplicationDeliveryInfo ====
** Throws an error if a state flag is set.
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.
** 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.
** 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.
** The EventId is "receive_app_contents" with ApplicationId <NS ProgramId>.


==== CommitReceiveApplication ====
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).
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.


==== GetReceiveApplicationProgress ====
==== HasAllContentsToDeliver ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output [[#ReceiveApplicationProgress]].
Takes a type-0x5 input buffer containing an array of [[#ApplicationDeliveryInfo]], returns an output u8 bool.


An error is thrown if a state ref-count is zero. An error is thrown if [[NIM_services|nim]] ListApplicationApplyDeltaTask returns a task.
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.


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.
==== CompareApplicationDeliveryInfo ====
Takes two type-0x5 input buffers containing an array of [[#ApplicationDeliveryInfo]], returns an output s32.


==== RequestSendApplication ====
The array-count for both buffers must be 1, otherwise an error is returned.
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]].


[[qlaunch]] uses value 55556 for the port.
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.


An error is thrown if a state ref-count is zero. An error is thrown if [[NIM_services|nim]] ListApplicationApplyDeltaTask returns a task.
==== CanDeliverApplication ====
Takes two type-0x5 input buffers containing an array of [[#ApplicationDeliveryInfo]], returns an output u8 bool.


The [[NCM_services#ContentMetaType|ContentMetaType]] must match Patch.
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.


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:
==== 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.


* Calls a func which does:
The array-count for ContentMetaKey must be at least 1, and for ApplicationDeliveryInfo it must match 1.
** 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 the cached [[System_Settings|system-setting]] "systemreport!enabled" is set.
** The EventId is "send_app_contents" with ApplicationId <NS ProgramId>.


==== GetSendApplicationProgress ====
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.
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output [[#SendApplicationProgress]].


Same as [[#GetReceiveApplicationProgress]] except this is the Send version, and uses [[NIM_services|nim]] cmd68/cmd63 instead.
==== 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.


==== CompareSystemDeliveryInfo ====
The array-count must match 1.
Takes two type-0x15 input buffers containing a [[#SystemDeliveryInfo]], returns an output s32.


This is essentially the same as [[#CompareApplicationDeliveryInfo]], except this compares the [[#SystemDeliveryInfo]] SystemUpdate version.
After validation etc, this sets the output bool by comparing system-version fields in the [[#SystemDeliveryInfo]]/[[#ApplicationDeliveryInfo]] and with a state field.


==== ListNotCommittedContentMeta ====
==== EstimateRequiredSize ====
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.
Takes a type-0x5 input buffer containing an array of [[NCM_services#ContentMetaKey|ContentMetaKey]], returns an output s64.


==== RecoverDownloadTask ====
When the array-count is less than 1, this will return 0 with the s64 set to 0.
Takes a type-0x5 input buffer containing an array of {unknown} and an input u64, no output.


==== GetApplicationDeliveryInfoHash ====
==== RequestReceiveApplication ====
Takes a type-0x5 input buffer containing an array of [[#ApplicationDeliveryInfo]], returns an output 0x20-byte SHA256 hash.
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]].


This extracts data from the input array for hashing with SHA256, with validation being done when handling each entry.
[[qlaunch]] uses value Any for the StorageId, and value 55556 for the port.


==== GetApplicationRightsOnClient ====
An error is thrown if a state ref-count is zero. An error is thrown if [[NIM_services|nim]] ListApplicationApplyDeltaTask returns a task.
Takes a type-0x6 output buffer containing an array of [[#ApplicationRightsOnClient]], an input u32 flags, an [[NCM_services#ApplicationId|ApplicationId]], an [[Account_services#Uid|Uid]], returns 4-bytes of output for total output entries.


Official sw has at least two wrappers which use this cmd: one with an all-zero Uid, one with an user-specified Uid. With both of these, the passed flags are hard-coded to value 0x3.
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.


For the output array count, [[qlaunch]] uses value 3.
This does various setup then creates the [[#IAsyncResult]] + the async thread which handles the [[#IAsyncResult]] operation. Then the thread does:


==== GetApplicationTerminateResult ====
* Calls a func which does:
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output u32 Result.
** Throws an error if a state flag is set.
** 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.
** 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.
** The EventId is "receive_app_contents" with ApplicationId <NS ProgramId>.


==== GetRightsEnvironmentHandleForApplication ====
==== CommitReceiveApplication ====
No input, returns a total of 8-bytes of output.
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.


[9.0.0+] Now takes a total of 8-bytes of input, returns a total of 8-bytes of output.
==== GetReceiveApplicationProgress ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output [[#ReceiveApplicationProgress]].


==== RequestNoDownloadRightsErrorResolution ====
An error is thrown if a state ref-count is zero. An error is thrown if [[NIM_services|nim]] ListApplicationApplyDeltaTask returns a task.
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]].
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.


See [[#RequestApplicationUpdateInfo]] regarding nifm.
==== 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]].


==== RequestResolveNoDownloadRightsError ====
[[qlaunch]] uses value 55556 for the port.
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]].
An error is thrown if a state ref-count is zero. An error is thrown if [[NIM_services|nim]] ListApplicationApplyDeltaTask returns a task.


See [[#RequestApplicationUpdateInfo]] regarding nifm.
The [[NCM_services#ContentMetaType|ContentMetaType]] must match Patch.


==== GetPromotionInfo ====
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:
Takes a type-0x6 output buffer containing an array of [[#PromotionInfo]], a type-0x5 input buffer containing an array of u64 [[NCM_services#ApplicationId|ApplicationIds]], a type-0x5 input buffer containing an array of [[Account_services#Uid|Uids]], no output.


Official sw uses hard-coded value 1 for the count with each of these arrays.
* 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 the cached [[System_Settings|system-setting]] "systemreport!enabled" is set.
** The EventId is "send_app_contents" with ApplicationId <NS ProgramId>.


==== ImportPromotionJsonForDebug ====
==== GetSendApplicationProgress ====
Takes a type-0x5 input buffer, no output.
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output [[#SendApplicationProgress]].


The output from [[Settings_services#GetDebugModeFlag]] must be 1, otherwise an error is returned.
Same as [[#GetReceiveApplicationProgress]] except this is the Send version, and uses [[NIM_services|nim]] cmd68/cmd63 instead.


==== ClearPromotionInfoForDebug ====
==== CompareSystemDeliveryInfo ====
No input/output.
Takes two type-0x15 input buffers containing a [[#SystemDeliveryInfo]], returns an output s32.


The output from [[Settings_services#GetDebugModeFlag]] must be 1, otherwise an error is returned.
This is essentially the same as [[#CompareApplicationDeliveryInfo]], except this compares the [[#SystemDeliveryInfo]] SystemUpdate version.


This just clears 0xC-bytes in state.
==== 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.


==== CreateApplicationResource ====
==== RecoverDownloadTask ====
Takes an input [[#ApplicationResourceType]]. Returns an [[#IApplicationResource]].
Takes a type-0x5 input buffer containing an array of {unknown} and an input u64, no output.


==== GetApplicationResource ====
==== GetApplicationDeliveryInfoHash ====
Takes an input u64 ProcessId and an input [[#ApplicationResourceType]]. Returns an [[#IApplicationResource]].
Takes a type-0x5 input buffer containing an array of [[#ApplicationDeliveryInfo]], returns an output 0x20-byte SHA256 hash.


==== LaunchMicroApplication ====
This extracts data from the input array for hashing with SHA256, with validation being done when handling each entry.
[18.0.0+] Now takes a total of 0x50 bytes of input.


[19.0.0+] Now takes a total of 0x80 bytes of input.
==== GetApplicationRightsOnClient ====
Takes a type-0x6 output buffer containing an array of [[#ApplicationRightsOnClient]], an input u32 flags, an [[NCM_services#ApplicationId|ApplicationId]], an [[Account_services#Uid|Uid]], returns 4-bytes of output for total output entries.


==== CreateApplicationInstance ====
Official sw has at least two wrappers which use this cmd: one with an all-zero Uid, one with an user-specified Uid. With both of these, the passed flags are hard-coded to value 0x3.
[18.0.0+] Now takes a total of 0x50 bytes of input.


[19.0.0+] Now takes a total of 0x80 bytes of input.
For the output array count, [[qlaunch]] uses value 3.


==== RegisterDeviceLockKey ====
==== GetApplicationTerminateResult ====
Takes a type-0x5 input buffer containing an InArray of u8, no output.
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output u32 Result.


User-processes expose this with two funcs: one which uses an user-specified u8 array directly, while the other uses [[HID_services#NpadButtonSet|NpadButton]].
==== GetRightsEnvironmentHandleForApplication ====
No input, returns a total of 8-bytes of output.


This does SHA256 hashing, etc.
[9.0.0+] Now takes a total of 8-bytes of input, returns a total of 8-bytes of output.


==== UnregisterDeviceLockKey ====
==== RequestNoDownloadRightsErrorResolution ====
No input/output.
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncValue]].


Runs code identical to [[#RegisterDeviceLockKey]], except the passed buffer/size are 0.
The data that can be read from the [[#IAsyncValue]] is [[#NoDownloadRightsErrorResolution]].


==== VerifyDeviceLockKey ====
See [[#RequestApplicationUpdateInfo]] regarding nifm.
Takes a type-0x5 input buffer containing an InArray of u8, no output.


User-processes expose this with two funcs: one which uses an user-specified u8 array directly, while the other uses [[HID_services#NpadButtonSet|NpadButton]].
==== RequestResolveNoDownloadRightsError ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncValue]].


This runs hashing similar to [[#RegisterDeviceLockKey]], with the calculated hash being verified with the one from state.
The data that can be read from the [[#IAsyncValue]] is [[#NoDownloadRightsErrorResolution]].


==== HideApplicationIcon ====
See [[#RequestApplicationUpdateInfo]] regarding nifm.
No input/output.


==== ShowApplicationIcon ====
==== GetPromotionInfo ====
No input/output.
Takes a type-0x6 output buffer containing an array of [[#PromotionInfo]], a type-0x5 input buffer containing an array of u64 [[NCM_services#ApplicationId|ApplicationIds]], a type-0x5 input buffer containing an array of [[Account_services#Uid|Uids]], no output.


==== HideApplicationTitle ====
Official sw uses hard-coded value 1 for the count with each of these arrays.
No input/output.


==== ShowApplicationTitle ====
==== ListPromotionInfo ====
No input/output.
[20.0.0+] The struct size for the output buffer array is now 0x28-bytes instead of 0x20-bytes.


==== EnableGameCard ====
==== ImportPromotionJsonForDebug ====
No input/output.
Takes a type-0x5 input buffer, no output.


==== DisableGameCard ====
The output from [[Settings_services#GetDebugModeFlag]] must be 1, otherwise an error is returned.
No input/output.


==== EnableLocalContentShare ====
==== ClearPromotionInfoForDebug ====
No input/output.
No input/output.


==== DisableLocalContentShare ====
The output from [[Settings_services#GetDebugModeFlag]] must be 1, otherwise an error is returned.
No input/output.


==== IsApplicationIconHidden ====
This just clears 0xC-bytes in state.
No input, returns an output bool.


==== IsApplicationTitleHidden ====
==== CreateApplicationResource ====
No input, returns an output bool.
Takes an input [[#ApplicationResourceType]]. Returns an [[#IApplicationResource]].


==== IsGameCardEnabled ====
==== GetApplicationResource ====
No input, returns an output bool.
Takes an input u64 ProcessId and an input [[#ApplicationResourceType]]. Returns an [[#IApplicationResource]].


==== IsLocalContentShareEnabled ====
==== LaunchMicroApplication ====
No input, returns an output bool.
[18.0.0+] Now takes a total of 0x50 bytes of input.


Various Deliver cmds now load the same flag used by this cmd (IsLocalContentShareEnabled), with an error being returned when it's not enabled.
[19.0.0+] Now takes a total of 0x80 bytes of input.


=== IGameCardStopper ===
==== CreateApplicationInstance ====
This is "nn::ns::detail::IGameCardStopper".
[18.0.0+] Now takes a total of 0x50 bytes of input.


This interface has no commands.
[19.0.0+] Now takes a total of 0x80 bytes of input.


=== IRequestServerStopper ===
==== RegisterDeviceLockKey ====
This is "nn::ns::detail::IRequestServerStopper".
Takes a type-0x5 input buffer containing an InArray of u8, no output.


This interface has no commands.
User-processes expose this with two funcs: one which uses an user-specified u8 array directly, while the other uses [[HID_services#NpadButtonSet|NpadButton]].


=== IProgressMonitorForDeleteUserSaveDataAll ===
This does SHA256 hashing, etc.
This is "nn::ns::detail::IProgressMonitorForDeleteUserSaveDataAll".


{| class="wikitable" border="1"
==== UnregisterDeviceLockKey ====
|-
No input/output.
! Cmd || Name
|-
| 0 || GetSystemEvent
|-
| 1 || IsFinished
|-
| 2 || GetResult
|-
| 10 || GetProgress
|}


When closing the object, official sw uses IsFinished first, asserting when the output bool is false.
Runs code identical to [[#RegisterDeviceLockKey]], except the passed buffer/size are 0.


* GetSystemEvent: No input, returns an output Event handle. [[qlaunch]] doesn't use this.
==== VerifyDeviceLockKey ====
Takes a type-0x5 input buffer containing an InArray of u8, no output.


* IsFinished: No input, returns an output u8 bool.
User-processes expose this with two funcs: one which uses an user-specified u8 array directly, while the other uses [[HID_services#NpadButtonSet|NpadButton]].


* GetResult: No input/output.
This runs hashing similar to [[#RegisterDeviceLockKey]], with the calculated hash being verified with the one from state.


* GetProgress: No input, returns an output [[#ProgressForDeleteUserSaveDataAll]]. Official sw writes this struct directly to object state.
==== HideApplicationIcon ====
No input/output.


=== IProgressAsyncResult ===
==== ShowApplicationIcon ====
This is "nn::ns::detail::IProgressAsyncResult".
No input/output.


{| class="wikitable" border="1"
==== HideApplicationTitle ====
|-
No input/output.
! Cmd || Name
|-
| 0 || Get
|-
| 1 || Cancel
|-
| 2 || GetProgress
|-
| 3 || GetDetailResult
|-
| 4 || [4.0.0+] GetErrorContext
|}


=== IApplicationVersionInterface ===
==== ShowApplicationTitle ====
This is "nn::ns::detail::IApplicationVersionInterface".
No input/output.


This was added with [4.0.0+].
==== EnableGameCard ====
No input/output.
 
==== DisableGameCard ====
No input/output.
 
==== EnableLocalContentShare ====
No input/output.
 
==== DisableLocalContentShare ====
No input/output.
 
==== IsApplicationIconHidden ====
No input, returns an output bool.
 
==== IsApplicationTitleHidden ====
No input, returns an output bool.
 
==== IsGameCardEnabled ====
No input, returns an output bool.
 
==== IsLocalContentShareEnabled ====
No input, returns an output bool.
 
Various Deliver cmds now load the same flag used by this cmd (IsLocalContentShareEnabled), with an error being returned when it's not enabled.
 
=== IGameCardStopper ===
This is "nn::ns::detail::IGameCardStopper".
 
This interface has no commands.
 
=== IRequestServerStopper ===
This is "nn::ns::detail::IRequestServerStopper".
 
This interface has no commands.
 
=== IProgressMonitorForDeleteUserSaveDataAll ===
This is "nn::ns::detail::IProgressMonitorForDeleteUserSaveDataAll".


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 1,787: Line 1,918:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 || GetLaunchRequiredVersion
| 0 || GetSystemEvent
|-
|-
| 1 || UpgradeLaunchRequiredVersion
| 1 || IsFinished
|-
|-
| 35 || UpdateVersionList
| 2 || GetResult
|-
|-
| 36 || PushLaunchVersion
| 10 || GetProgress
|-
| 37 || ListRequiredVersion
|-
| 800 || RequestVersionList
|-
| 801 || ListVersionList
|-
| 802 || [[#RequestVersionListData]]
|-
| 900 || [12.0.0+] ImportAutoUpdatePolicyJsonForDebug
|-
| 901 || [12.0.0+] ListDefaultAutoUpdatePolicy
|-
| 902 || [12.0.0+] ListAutoUpdatePolicyForSpecificApplication
|-
| 1000 || PerformAutoUpdate
|-
| 1001 || [11.0.0+] ListAutoUpdateSchedule
|}
|}


==== RequestVersionListData ====
When closing the object, official sw uses IsFinished first, asserting when the output bool is false.
No input, returns an output Event handle and an [[#IAsyncValue]].
 
* GetSystemEvent: No input, returns an output Event handle. [[qlaunch]] doesn't use this.
 
* IsFinished: No input, returns an output u8 bool.
 
* GetResult: No input/output.


The data that can be read from the [[#IAsyncValue]] is [[#VersionListData]].
* GetProgress: No input, returns an output [[#ProgressForDeleteUserSaveDataAll]]. Official sw writes this struct directly to object state.


=== IContentManagementInterface ===
=== IProgressAsyncResult ===
This is "nn::ns::detail::IContentManagementInterface".
This is "nn::ns::detail::IProgressAsyncResult".


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 1,826: Line 1,944:
! Cmd || Name
! Cmd || Name
|-
|-
| 11 || [[#CalculateApplicationOccupiedSize]]
| 0 || Get
|-
|-
| 43 || [[#CheckSdCardMountStatus]]
| 1 || Cancel
|-
|-
| 47 || [[#GetTotalSpaceSize]]
| 2 || GetProgress
|-
|-
| 48 || [[#GetFreeSpaceSize]]
| 3 || GetDetailResult
|-
|-
| 600 || [[#CountApplicationContentMeta]]
| 4 || [4.0.0+] GetErrorContext
|-
| 601 || [[#ListApplicationContentMetaStatus]]
|-
| 605 || [[#ListApplicationContentMetaStatusWithRightsCheck]]
|-
| 607 || [[#IsAnyApplicationRunning]]
|}
|}


==== CalculateApplicationOccupiedSize ====
=== IApplicationVersionInterface ===
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output [[#ApplicationOccupiedSize]].
This is "nn::ns::detail::IApplicationVersionInterface".


==== CheckSdCardMountStatus ====
This was added with [4.0.0+].
No input/output.
 
==== CountApplicationContentMeta ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output s32.
 
==== ListApplicationContentMetaStatusWithRightsCheck ====
Same input/output as [[#ListApplicationContentMetaStatus]].
 
==== IsAnyApplicationRunning ====
No input, returns an output u8 bool.
 
=== IDocumentInterface ===
This is "nn::ns::detail::IDocumentInterface".


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 1,865: Line 1,964:
! Cmd || Name
! Cmd || Name
|-
|-
| 21 || GetApplicationContentPath
| 0 || GetLaunchRequiredVersion
|-
| 1 || UpgradeLaunchRequiredVersion
|-
|-
| 23 || ResolveApplicationContentPath
| 35 || UpdateVersionList
|-
|-
| 92 || [5.0.0+] GetRunningApplicationProgramId
| 36 || PushLaunchVersion
|-
|-
| 2524 || [19.0.0+]  
| 37 || ListRequiredVersion
|-
| 800 || RequestVersionList
|-
| 801 || ListVersionList
|-
| 802 || [[#RequestVersionListData]]
|-
| 900 || [12.0.0+] ImportAutoUpdatePolicyJsonForDebug
|-
| 901 || [12.0.0+] ListDefaultAutoUpdatePolicy
|-
| 902 || [12.0.0+] ListAutoUpdatePolicyForSpecificApplication
|-
| 1000 || PerformAutoUpdate
|-
| 1001 || [11.0.0+] ListAutoUpdateSchedule
|}
|}


=== IDownloadTaskInterface ===
==== RequestVersionListData ====
This is "nn::ns::detail::IDownloadTaskInterface".
No input, returns an output Event handle and an [[#IAsyncValue]].
 
The data that can be read from the [[#IAsyncValue]] is [[#VersionListData]].
 
=== IContentManagementInterface ===
This is "nn::ns::detail::IContentManagementInterface".


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 1,881: Line 2,003:
! Cmd || Name
! Cmd || Name
|-
|-
| 701 || [[#ClearTaskStatusList]]
| 11 || [[#CalculateApplicationOccupiedSize]]
|-
|-
| 702 || [[#RequestDownloadTaskList]]
| 43 || [[#CheckSdCardMountStatus]]
|-
|-
| 703 || [[#RequestEnsureDownloadTask]]
| 47 || [[#GetTotalSpaceSize]]
|-
|-
| 704 || [[#ListDownloadTaskStatus]]
| 48 || [[#GetFreeSpaceSize]]
|-
|-
| 705 || [[#RequestDownloadTaskListData]]
| 58 || [20.1.0+]
|-
|-
| 706 || [4.0.0+] [[#TryCommitCurrentApplicationDownloadTask]]
| 71 || [20.1.0+]
|-
|-
| 707 || [4.0.0+] [[#EnableAutoCommit]]
| 600 || [[#CountApplicationContentMeta]]
|-
|-
| 708 || [4.0.0+] [[#DisableAutoCommit]]
| 601 || [[#ListApplicationContentMetaStatus]]
|-
|-
| 709 || [4.0.0+] [[#TriggerDynamicCommitEvent]]
| 605 || [[#ListApplicationContentMetaStatusWithRightsCheck]]
|-
| 607 || [[#IsAnyApplicationRunning]]
|}
|}


==== ClearTaskStatusList ====
==== CalculateApplicationOccupiedSize ====
No input/output.
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output [[#ApplicationOccupiedSize]].


==== RequestDownloadTaskList ====
==== CheckSdCardMountStatus ====
No input/output.
No input/output.


==== RequestEnsureDownloadTask ====
==== CountApplicationContentMeta ====
No input, returns an output Event handle and an [[#IAsyncResult]].
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output s32.


==== ListDownloadTaskStatus ====
==== ListApplicationContentMetaStatusWithRightsCheck ====
Takes a type-0x6 output buffer containing an array of [[#DownloadTaskStatus]], returns an output s32 total_out.
Same input/output as [[#ListApplicationContentMetaStatus]].


A maximum of 0x100 tasks can be stored in state.
==== IsAnyApplicationRunning ====
No input, returns an output u8 bool.


==== TryCommitCurrentApplicationDownloadTask ====
=== IDocumentInterface ===
No input/output.
This is "nn::ns::detail::IDocumentInterface".
 
==== EnableAutoCommit ====
No input/output.
 
==== DisableAutoCommit ====
No input/output.
 
==== TriggerDynamicCommitEvent ====
No input/output.
 
=== IReadOnlyApplicationRecordInterface ===
This is "nn::ns::detail::IReadOnlyApplicationRecordInterface".
 
This was added with [5.0.0+].


{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Cmd || Name || Notes
! Cmd || Name
|-
| 21 || GetApplicationContentPath
|-
|-
| 0 || HasApplicationRecord || Same as [[#IApplicationManagerInterface]] cmd 910
| 23 || ResolveApplicationContentPath
|-
|-
| 1 || [10.0.0+] NotifyApplicationFailure ||
| 92 || [5.0.0+] GetRunningApplicationProgramId
|-
|-
| 2 || [10.0.0+] IsDataCorruptedResult ||
| 2524 || [19.0.0+]  
|}
|}


=== IReadOnlyApplicationControlDataInterface ===
=== IDownloadTaskInterface ===
This is "nn::ns::detail::IReadOnlyApplicationControlDataInterface".
This is "nn::ns::detail::IDownloadTaskInterface".
 
This was added with [5.1.0+].


{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Cmd || Name || Notes
! Cmd || Name
|-
| 701 || [[#ClearTaskStatusList]]
|-
| 702 || [[#RequestDownloadTaskList]]
|-
| 703 || [[#RequestEnsureDownloadTask]]
|-
|-
| 0 || [[#GetApplicationControlData]] || Same as [[#IApplicationManagerInterface]] cmd 400
| 704 || [[#ListDownloadTaskStatus]]
|-
|-
| 1 || [[#GetApplicationDesiredLanguage]] || Same as [[#IApplicationManagerInterface]] cmd 55
| 705 || [[#RequestDownloadTaskListData]]
|-
|-
| 2 || ConvertApplicationLanguageToLanguageCode || Same as [[#IApplicationManagerInterface]] cmd 59
| 706 || [4.0.0+] [[#TryCommitCurrentApplicationDownloadTask]]
|-
|-
| 3 || [[#ConvertLanguageCodeToApplicationLanguage]] || Same as [[#IApplicationManagerInterface]] cmd 60
| 707 || [4.0.0+] [[#EnableAutoCommit]]
|-
|-
| 4 || [9.0.0+] SelectApplicationDesiredLanguage ||
| 708 || [4.0.0+] [[#DisableAutoCommit]]
|-
|-
| 5 || [19.0.0+] ||
| 709 || [4.0.0+] [[#TriggerDynamicCommitEvent]]
|-
|-
| 6 || [19.0.0+] ||
| 710 || [20.0.0+]
|}
|}


=== IDynamicRightsInterface ===
==== ClearTaskStatusList ====
This is "nn::ns::detail::IDynamicRightsInterface".
No input/output.


This was added with [6.0.0+].
==== RequestDownloadTaskList ====
No input/output.
 
==== RequestEnsureDownloadTask ====
No input, returns an output Event handle and an [[#IAsyncResult]].
 
==== ListDownloadTaskStatus ====
Takes a type-0x6 output buffer containing an array of [[#DownloadTaskStatus]], returns an output s32 total_out.
 
A maximum of 0x100 tasks can be stored in state.
 
==== TryCommitCurrentApplicationDownloadTask ====
No input/output.
 
==== EnableAutoCommit ====
No input/output.
 
==== DisableAutoCommit ====
No input/output.
 
==== TriggerDynamicCommitEvent ====
No input/output.
 
=== IReadOnlyApplicationRecordInterface ===
This is "nn::ns::detail::IReadOnlyApplicationRecordInterface".
 
This was added with [5.0.0+].


{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Cmd || Name
! Cmd || Name || Notes
|-
|-
| 0 || [[#RequestApplicationRightsOnServer]]
| 0 || HasApplicationRecord || Same as [[#IApplicationManagerInterface]] cmd 910
|-
|-
| 1 || [[#RequestAssignRights]]
| 1 || [10.0.0+] NotifyApplicationFailure ||
|-
|-
| 4 || [[#DeprecatedRequestAssignRightsToResume]]
| 2 || [10.0.0+] IsDataCorruptedResult ||
|-
|-
| 5 || [[#VerifyActivatedRightsOwners]]
| 3 || [20.0.0+] ||
|-
|}
| 6 || [[#DeprecatedGetApplicationRightsStatus]]
 
=== IReadOnlyApplicationControlDataInterface ===
This is "nn::ns::detail::IReadOnlyApplicationControlDataInterface".
 
This was added with [5.1.0+].
 
{| class="wikitable" border="1"
|-
|-
| 7 || [[#RequestPrefetchForDynamicRights]]
! Cmd || Name || Notes
|-
|-
| 8 || [[#GetDynamicRightsState]]
| 0 || [[#GetApplicationControlData]] || Same as [[#IApplicationManagerInterface]] cmd 400
|-
|-
| 9 || [7.0.0+] [[#RequestApplicationRightsOnServerToResume]]
| 1 || [[#GetApplicationDesiredLanguage]] || Same as [[#IApplicationManagerInterface]] cmd 55
|-
|-
| 10 || [7.0.0+] [[#RequestAssignRightsToResume]]
| 2 || ConvertApplicationLanguageToLanguageCode || Same as [[#IApplicationManagerInterface]] cmd 59
|-
|-
| 11 || [7.0.0+] [[#GetActivatedRightsUsers]]
| 3 || [[#ConvertLanguageCodeToApplicationLanguage]] || Same as [[#IApplicationManagerInterface]] cmd 60
|-
|-
| 12 || [8.0.0+] [[#GetApplicationRightsStatus]]
| 4 || [9.0.0+] SelectApplicationDesiredLanguage ||
|-
|-
| 13 || [8.0.0+] [[#GetRunningApplicationStatus]]
| 5 || [19.0.0+] ||
|-
|-
| 14 || [10.0.0-15.0.1] SelectApplicationLicense
| 6 || [19.0.0+] ||
|-
| 15 || [12.0.0+] [[#RequestContentsAuthorizationToken]]
|-
|-
| 16 || [13.0.0+] QualifyUser
| 7 || [20.0.0+] ||
|-
|-
| 17 || [13.0.0+] QualifyUserWithProcessId
| 8 || [20.0.0+] ||
|-
|-
| 18 || [13.0.0+] NotifyApplicationRightsCheckStart
| 9 || [20.0.0+] ||
|-
|-
| 19 || [13.0.0+] UpdateUserList
| 10 || [20.0.0+] ||
|-
|-
| 20 || [13.0.0+] IsRightsLostUser
| 11 || [20.0.0+] ||
|-
|-
| 21 || [13.1.0+] SetRequiredAddOnContentsOnContentsAvailabilityTransition
| 12 || [20.0.0+] ||
|-
|-
| 22 || [14.0.0+] GetLimitedApplicationLicense
| 13 || [20.0.0+] ||
|-
|-
| 23 || [14.0.0+] GetLimitedApplicationLicenseUpgradableEvent
| 14 || [20.0.0+] ||
|-
|-
| 24 || [14.0.0+] NotifyLimitedApplicationLicenseUpgradableEventForDebug
| 15 || [20.0.0+] ||
|-
|-
| 25 || [14.0.0+] RequestProceedDynamicRightsState
| 16 || [20.0.0+] ||
|-
|-
| 26 || [18.0.0+] HasAccountRestrictedRightsInRunningApplications
| 17 || [20.1.0+] ||
|}
|}


==== RequestApplicationRightsOnServer ====
=== IDynamicRightsInterface ===
Takes an input [[NCM_services#ApplicationId|ApplicationId]], an [[Account_services#Uid|Uid]] and an u32. Returns an output Event handle and an [[#IAsyncValue]].
This is "nn::ns::detail::IDynamicRightsInterface".


==== RequestAssignRights ====
This was added with [6.0.0+].
Takes a type-0x5 input buffer containing an array of "nn::ns::ApplicationRightsOnServer". Returns an output Event handle and an [[#IAsyncResult]].


==== DeprecatedRequestAssignRightsToResume ====
{| class="wikitable" border="1"
Takes an input u64 "nn::ns::RightsEnvironmentHandle" and an [[Account_services#Uid|Uid]]. Returns an output Event handle and an [[#IAsyncResult]].
|-
 
! Cmd || Name
==== VerifyActivatedRightsOwners ====
|-
Takes an input u64 "nn::ns::RightsEnvironmentHandle". No output.
| 0 || [[#RequestApplicationRightsOnServer]]
 
|-
==== DeprecatedGetApplicationRightsStatus ====
| 1 || [[#RequestAssignRights]]
Takes an input u64 "nn::ns::RightsEnvironmentHandle". Returns a bool "nn::ns::ApplicationRightsStatus".
|-
 
| 4 || [[#DeprecatedRequestAssignRightsToResume]]
==== RequestPrefetchForDynamicRights ====
|-
Takes an input [[Account_services#Uid|Uid]]. Returns an output Event handle and an [[#IAsyncResult]].
| 5 || [[#VerifyActivatedRightsOwners]]
 
|-
==== GetDynamicRightsState ====
| 6 || [[#DeprecatedGetApplicationRightsStatus]]
No input. Returns a bool "nn::ns::DynamicRightsState".
|-
 
| 7 || [[#RequestPrefetchForDynamicRights]]
==== RequestApplicationRightsOnServerToResume ====
|-
Takes an input u64 "nn::ns::RightsEnvironmentHandle". Returns an output Event handle and an [[#IAsyncValue]].
| 8 || [[#GetDynamicRightsState]]
 
|-
==== RequestAssignRightsToResume ====
| 9 || [7.0.0+] [[#RequestApplicationRightsOnServerToResume]]
Takes an input u64 "nn::ns::RightsEnvironmentHandle". Returns an output Event handle and an [[#IAsyncResult]].
 
==== GetActivatedRightsUsers ====
Takes an input u64 "nn::ns::RightsEnvironmentHandle". Returns a bool, an u32 and a type-0x6 output buffer containing an array of [[Account_services#Uid|Uid]].
 
==== GetApplicationRightsStatus ====
Takes an input "nn::ns::RightsEnvironmentHandle". Returns 2 bools "nn::ns::ApplicationRightsStatus" and "nn::ns::ApplicationLicenseType".
 
==== GetRunningApplicationStatus ====
Takes an input u64 "nn::ns::RightsEnvironmentHandle". Returns an u32 "nn::ns::RunningApplicationStatus".
 
==== RequestContentsAuthorizationToken ====
Takes a total of 0x50-bytes of input, a type-0x5 input buffer. Returns an [[#IAsyncData_2|IAsyncData]] and an output handle.
 
==== IAsyncData ====
This is "nn::ns::detail::IAsyncData".
 
This was added with [12.0.0+].
 
{| class="wikitable" border="1"
|-
|-
! Cmd || Name
| 10 || [7.0.0+] [[#RequestAssignRightsToResume]]
|-
|-
| 0 || GetSize
| 11 || [7.0.0+] [[#GetActivatedRightsUsers]]
|-
|-
| 1 || Get
| 12 || [8.0.0+] [[#GetApplicationRightsStatus]]
|-
|-
| 2 || Cancel
| 13 || [8.0.0+] [[#GetRunningApplicationStatus]]
|-
|-
| 3 || GetErrorContext
| 14 || [10.0.0-15.0.1] SelectApplicationLicense
|}
 
=== IECommerceInterface===
This is "nn::ns::detail::IECommerceInterface".
 
This was added with [4.0.0+].
 
{| class="wikitable" border="1"
|-
|-
! Cmd || Name
| 15 || [12.0.0+] [[#RequestContentsAuthorizationToken]]
|-
| 16 || [13.0.0+] QualifyUser
|-
| 17 || [13.0.0+] QualifyUserWithProcessId
|-
| 18 || [13.0.0+] NotifyApplicationRightsCheckStart
|-
| 19 || [13.0.0+] UpdateUserList
|-
| 20 || [13.0.0+] IsRightsLostUser
|-
|-
| 0 || [[#RequestLinkDevice]]
| 21 || [13.1.0+] SetRequiredAddOnContentsOnContentsAvailabilityTransition
|-
|-
| 1 || [6.0.0+] [[#RequestCleanupAllPreInstalledApplications]]
| 22 || [14.0.0+] GetLimitedApplicationLicense
|-
|-
| 2 || [6.0.0+] [[#RequestCleanupPreInstalledApplication]]
| 23 || [14.0.0+] GetLimitedApplicationLicenseUpgradableEvent
|-
|-
| 3 || [6.0.0+] [[#RequestSyncRights]]
| 24 || [14.0.0+] NotifyLimitedApplicationLicenseUpgradableEventForDebug
|-
|-
| 4 || [6.0.0+] [[#RequestUnlinkDevice]]
| 25 || [14.0.0+] RequestProceedDynamicRightsState
|-
|-
| 5 || [6.1.0+] [[#RequestRevokeAllELicense]]
| 26 || [18.0.0+] HasAccountRestrictedRightsInRunningApplications
|-
|-
| 6 || [9.0.0+] [[#RequestSyncRightsBasedOnAssignedELicenses]]
| 27 || [20.0.0+]
|-
|-
| 7 || [14.0.0+] RequestOnlineSubscriptionFreeTrialAvailability
| 28 || [20.0.0+]
|}
|}


==== RequestLinkDevice ====
==== RequestApplicationRightsOnServer ====
Takes an input [[Account_services#Uid|Uid]], returns an output Event handle and an [[#IAsyncResult]].
Takes an input [[NCM_services#ApplicationId|ApplicationId]], an [[Account_services#Uid|Uid]] and an u32. Returns an output Event handle and an [[#IAsyncValue]].


See [[#RequestApplicationUpdateInfo]] regarding nifm.
==== RequestAssignRights ====
Takes a type-0x5 input buffer containing an array of "nn::ns::ApplicationRightsOnServer". Returns an output Event handle and an [[#IAsyncResult]].


==== RequestCleanupAllPreInstalledApplications ====
==== DeprecatedRequestAssignRightsToResume ====
No input, returns an output Event handle and an [[#IAsyncResult]].
Takes an input u64 "nn::ns::RightsEnvironmentHandle" and an [[Account_services#Uid|Uid]]. Returns an output Event handle and an [[#IAsyncResult]].


==== RequestCleanupPreInstalledApplication ====
==== VerifyActivatedRightsOwners ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].
Takes an input u64 "nn::ns::RightsEnvironmentHandle". No output.


==== RequestSyncRights ====
==== DeprecatedGetApplicationRightsStatus ====
No input, returns an output Event handle and an [[#IAsyncResult]].
Takes an input u64 "nn::ns::RightsEnvironmentHandle". Returns a bool "nn::ns::ApplicationRightsStatus".
 
==== RequestPrefetchForDynamicRights ====
Takes an input [[Account_services#Uid|Uid]]. Returns an output Event handle and an [[#IAsyncResult]].
 
==== GetDynamicRightsState ====
No input. Returns a bool "nn::ns::DynamicRightsState".
 
==== RequestApplicationRightsOnServerToResume ====
Takes an input u64 "nn::ns::RightsEnvironmentHandle". Returns an output Event handle and an [[#IAsyncValue]].
 
==== RequestAssignRightsToResume ====
Takes an input u64 "nn::ns::RightsEnvironmentHandle". Returns an output Event handle and an [[#IAsyncResult]].
 
==== GetActivatedRightsUsers ====
Takes an input u64 "nn::ns::RightsEnvironmentHandle". Returns a bool, an u32 and a type-0x6 output buffer containing an array of [[Account_services#Uid|Uid]].


==== RequestUnlinkDevice ====
==== GetApplicationRightsStatus ====
Takes an input [[Account_services#Uid|Uid]], returns an output Event handle and an [[#IAsyncResult]].
Takes an input "nn::ns::RightsEnvironmentHandle". Returns 2 bools "nn::ns::ApplicationRightsStatus" and "nn::ns::ApplicationLicenseType".


See [[#RequestApplicationUpdateInfo]] regarding nifm.
==== GetRunningApplicationStatus ====
Takes an input u64 "nn::ns::RightsEnvironmentHandle". Returns an u32 "nn::ns::RunningApplicationStatus".


==== RequestRevokeAllELicense ====
==== RequestContentsAuthorizationToken ====
Takes an input [[Account_services#Uid|Uid]], returns an output Event handle and an [[#IAsyncResult]].
Takes a total of 0x50-bytes of input, a type-0x5 input buffer. Returns an [[#IAsyncData_2|IAsyncData]] and an output handle.


==== RequestSyncRightsBasedOnAssignedELicenses ====
==== IAsyncData ====
No input, returns an output Event handle and an [[#IAsyncResult]].
This is "nn::ns::detail::IAsyncData".


=== IFactoryResetInterface ===
This was added with [12.0.0+].
This is "nn::ns::detail::IFactoryResetInterface".


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 2,141: Line 2,285:
! Cmd || Name
! Cmd || Name
|-
|-
| 100 || [[#ResetToFactorySettings]]
| 0 || GetSize
|-
|-
| 101 || [[#ResetToFactorySettingsWithoutUserSaveData]]
| 1 || Get
|-
| 2 || Cancel
|-
| 3 || GetErrorContext
|}
 
=== IECommerceInterface===
This is "nn::ns::detail::IECommerceInterface".
 
This was added with [4.0.0+].
 
{| class="wikitable" border="1"
|-
! Cmd || Name
|-
| 0 || [[#RequestLinkDevice]]
|-
| 1 || [6.0.0+] [[#RequestCleanupAllPreInstalledApplications]]
|-
| 2 || [6.0.0+] [[#RequestCleanupPreInstalledApplication]]
|-
| 3 || [6.0.0+] [[#RequestSyncRights]]
|-
| 4 || [6.0.0+] [[#RequestUnlinkDevice]]
|-
| 5 || [6.1.0+] [[#RequestRevokeAllELicense]]
|-
| 6 || [9.0.0+] [[#RequestSyncRightsBasedOnAssignedELicenses]]
|-
| 7 || [14.0.0+] RequestOnlineSubscriptionFreeTrialAvailability
|-
| 8 || [20.0.0+]
|-
|-
| 102 || [[#ResetToFactorySettingsForRefurbishment]]
| 9 || [20.0.0+]
|-
|-
| 103 || [9.1.0+] [[#ResetToFactorySettingsWithPlatformRegion]]
| 10 || [20.0.0+]
|-
|-
| 104 || [9.1.0+] [[#ResetToFactorySettingsWithPlatformRegionAuthentication]]
| 11 || [20.0.0+]
|-
|-
| 105 || [10.0.0+] [[#RequestResetToFactorySettingsSecurely]]
| 12 || [20.0.0+]
|-
|-
| 106 || [10.0.0+] [[#RequestResetToFactorySettingsWithPlatformRegionAuthenticationSecurely]]
| 13 || [20.0.0+]
|}
|}


==== ResetToFactorySettings ====
==== RequestLinkDevice ====
No input/output.
Takes an input [[Account_services#Uid|Uid]], returns an output Event handle and an [[#IAsyncResult]].


As of [9.1.0] this is the only [[#IFactoryResetInterface]] cmd used by [[qlaunch]].
See [[#RequestApplicationUpdateInfo]] regarding nifm.


==== ResetToFactorySettingsWithoutUserSaveData ====
==== RequestCleanupAllPreInstalledApplications ====
No input/output.
No input, returns an output Event handle and an [[#IAsyncResult]].


==== ResetToFactorySettingsForRefurbishment ====
==== RequestCleanupPreInstalledApplication ====
No input/output.
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].


==== ResetToFactorySettingsWithPlatformRegion ====
==== RequestSyncRights ====
No input/output.
No input, returns an output Event handle and an [[#IAsyncResult]].


==== ResetToFactorySettingsWithPlatformRegionAuthentication ====
==== RequestUnlinkDevice ====
No input/output.
Takes an input [[Account_services#Uid|Uid]], returns an output Event handle and an [[#IAsyncResult]].


==== RequestResetToFactorySettingsSecurely ====
See [[#RequestApplicationUpdateInfo]] regarding nifm.
Takes an input u64 tmem_size, a TransferMemory handle, returns an output [[#IAsyncValueAndProgress]] and an Event handle.


The TransferMemory uses permissions=0.
==== RequestRevokeAllELicense ====
Takes an input [[Account_services#Uid|Uid]], returns an output Event handle and an [[#IAsyncResult]].


==== RequestResetToFactorySettingsWithPlatformRegionAuthenticationSecurely ====
==== RequestSyncRightsBasedOnAssignedELicenses ====
Takes an input u32 "nn::ae::PlatformRegion", an u64 tmem_size, a TransferMemory handle, returns an output [[#IAsyncValueAndProgress]] and an Event handle.
No input, returns an output Event handle and an [[#IAsyncResult]].


The TransferMemory uses permissions=0.
=== IFactoryResetInterface ===
 
This is "nn::ns::detail::IFactoryResetInterface".
===== IAsyncValueAndProgress =====
This is "nn::ns::detail::IAsyncValueAndProgress".
 
This was added with [10.0.0+].


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 2,192: Line 2,364:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 || GetSize
| 100 || [[#ResetToFactorySettings]]
|-
|-
| 1 || Get
| 101 || [[#ResetToFactorySettingsWithoutUserSaveData]]
|-
| 102 || [[#ResetToFactorySettingsForRefurbishment]]
|-
|-
| 2 || Cancel
| 103 || [9.1.0+] [[#ResetToFactorySettingsWithPlatformRegion]]
|-
|-
| 3 || GetErrorContext
| 104 || [9.1.0+] [[#ResetToFactorySettingsWithPlatformRegionAuthentication]]
|-
|-
| 4 || GetProgress
| 105 || [10.0.0+] [[#RequestResetToFactorySettingsSecurely]]
|}
 
=== IApplicationResource ===
This is "nn::ns::detail::IApplicationResource".
 
This was added with [9.0.0+].
 
{| class="wikitable" border="1"
|-
|-
! Cmd || Name
| 106 || [10.0.0+] [[#RequestResetToFactorySettingsWithPlatformRegionAuthenticationSecurely]]
|-
|-
| 0 || Attach
| 107 || [20.0.0+]
|-
|-
| 1 || BoostSystemMemoryResourceLimit
| 108 || [20.0.0+]
|}
|}


= ns:vm =
==== ResetToFactorySettings ====
This is "nn::ns::detail::IVulnerabilityManagerInterface".
No input/output.
 
As of [9.1.0] this is the only [[#IFactoryResetInterface]] cmd used by [[qlaunch]].
 
==== ResetToFactorySettingsWithoutUserSaveData ====
No input/output.


{| class="wikitable" border="1"
==== ResetToFactorySettingsForRefurbishment ====
|-
No input/output.
! Cmd || Name
|-
| 1200 || [3.0.0+] [[#NeedsUpdateVulnerability]]
|-
| 1201 || [4.0.0+] [[#UpdateSafeSystemVersionForDebug]]
|-
| 1202 || [4.0.0+] [[#GetSafeSystemVersion]]
|-
| 3100 || [18.0.0+]
|-
| 3101 || [18.0.0+]
|-
| 3102 || [18.0.0+]
|}


== NeedsUpdateVulnerability ==
==== ResetToFactorySettingsWithPlatformRegion ====
No input, returns an output u8 bool flag.
No input/output.


Web-applets use this command to check if the system needs an update.
==== ResetToFactorySettingsWithPlatformRegionAuthentication ====
No input/output.


== UpdateSafeSystemVersionForDebug ==
==== RequestResetToFactorySettingsSecurely ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]] and an u32 '''version'''.
Takes an input u64 tmem_size, a TransferMemory handle, returns an output [[#IAsyncValueAndProgress]] and an Event handle.


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.
The TransferMemory uses permissions=0.


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'''.
==== RequestResetToFactorySettingsWithPlatformRegionAuthenticationSecurely ====
Takes an input u32 "nn::ae::PlatformRegion", an u64 tmem_size, a TransferMemory handle, returns an output [[#IAsyncValueAndProgress]] and an Event handle.


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".
The TransferMemory uses permissions=0.


== GetSafeSystemVersion ==
===== IAsyncValueAndProgress =====
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>).
This is "nn::ns::detail::IAsyncValueAndProgress".


= ns:su =
This was added with [10.0.0+].
This is "nn::ns::detail::ISystemUpdateInterface".


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 2,261: Line 2,419:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 || [[#GetBackgroundNetworkUpdateState]]
| 0 || GetSize
|-
|-
| 1 || [[#OpenSystemUpdateControl]]
| 1 || Get
|-
|-
| 2 || [[#NotifyExFatDriverRequired]]
| 2 || Cancel
|-
|-
| 3 || [[#ClearExFatDriverStatusForDebug]]
| 3 || GetErrorContext
|-
|-
| 4 || [[#RequestBackgroundNetworkUpdate]]
| 4 || GetProgress
|}
 
=== IApplicationResource ===
This is "nn::ns::detail::IApplicationResource".
 
This was added with [9.0.0+].
 
{| class="wikitable" border="1"
|-
|-
| 5 || [[#NotifyBackgroundNetworkUpdate]]
! Cmd || Name
|-
|-
| 6 || [[#NotifyExFatDriverDownloadedForDebug]]
| 0 || Attach
|-
|-
| 9 || [[#GetSystemUpdateNotificationEventForContentDelivery]]
| 1 || BoostSystemMemoryResourceLimit
|}
 
= ns:vm =
This is "nn::ns::detail::IVulnerabilityManagerInterface".
 
{| class="wikitable" border="1"
|-
|-
| 10 || [[#NotifySystemUpdateForContentDelivery]]
! Cmd || Name
|-
|-
| 11 || [3.0.0+] [[#PrepareShutdown]]
| 1200 || [3.0.0+] [[#NeedsUpdateVulnerability]]
|-
|-
| 12 || [3.0.0-3.0.2]
| 1201 || [4.0.0+] [[#UpdateSafeSystemVersionForDebug]]
|-
|-
| 13 || [3.0.0-3.0.2]
| 1202 || [4.0.0+] [[#GetSafeSystemVersion]]
|-
|-
| 14 || [3.0.0-3.0.2]
| 3100 || [18.0.0+]  
|-
|-
| 15 || [3.0.0-3.0.2]
| 3101 || [18.0.0+]  
|-
|-
| 16 || [4.0.0+] [[#DestroySystemUpdateTask]]
| 3102 || [18.0.0+]  
|-
|}
| 17 || [4.0.0+] [[#RequestSendSystemUpdate]]
 
|-
== NeedsUpdateVulnerability ==
| 18 || [4.0.0+] [[#GetSendSystemUpdateProgress]]
No input, returns an output u8 bool flag.
|}


== GetBackgroundNetworkUpdateState ==
Web-applets use this command to check if the system needs an update.
No input, returns an output [[#BackgroundNetworkUpdateState]].


This is similar to [[#HasDownloaded]], see [[#BackgroundNetworkUpdateState]].
== UpdateSafeSystemVersionForDebug ==
Takes an input [[NCM_services#ApplicationId|ApplicationId]] and an u32 '''version'''.


== OpenSystemUpdateControl ==
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.
No input, returns an [[#ISystemUpdateControl]].


== NotifyExFatDriverRequired ==
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'''.
No input/output.


Only usable when an [[#ISystemUpdateControl]] isn't open.
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".


This uses [[NIM_services|nim]] ListSystemUpdateTask, then when a task is returned uses it with DestroySystemUpdateTask.
== GetSafeSystemVersion ==
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>).


Then this runs ExFat handling, updates state, and sets the same state flag as [[#RequestBackgroundNetworkUpdate]].
= ns:su =
This is "nn::ns::detail::ISystemUpdateInterface".


== ClearExFatDriverStatusForDebug ==
{| class="wikitable" border="1"
No input/output.
|-
 
! Cmd || Name
== RequestBackgroundNetworkUpdate ==
|-
No input/output.
| 0 || [[#GetBackgroundNetworkUpdateState]]
 
|-
Only usable when an [[#ISystemUpdateControl]] isn't open.
| 1 || [[#OpenSystemUpdateControl]]
|-
| 2 || [[#NotifyExFatDriverRequired]]
|-
| 3 || [[#ClearExFatDriverStatusForDebug]]
|-
| 4 || [[#RequestBackgroundNetworkUpdate]]
|-
| 5 || [[#NotifyBackgroundNetworkUpdate]]
|-
| 6 || [[#NotifyExFatDriverDownloadedForDebug]]
|-
| 9 || [[#GetSystemUpdateNotificationEventForContentDelivery]]
|-
| 10 || [[#NotifySystemUpdateForContentDelivery]]
|-
| 11 || [3.0.0+] [[#PrepareShutdown]]
|-
| 12 || [3.0.0-3.0.2]
|-
| 13 || [3.0.0-3.0.2]
|-
| 14 || [3.0.0-3.0.2]
|-
| 15 || [3.0.0-3.0.2]
|-
| 16 || [4.0.0+] [[#DestroySystemUpdateTask]]
|-
| 17 || [4.0.0+] [[#RequestSendSystemUpdate]]
|-
| 18 || [4.0.0+] [[#GetSendSystemUpdateProgress]]
|}


This sets a state flag to value 1.
== GetBackgroundNetworkUpdateState ==
No input, returns an output [[#BackgroundNetworkUpdateState]].


== NotifyBackgroundNetworkUpdate ==
This is similar to [[#HasDownloaded]], see [[#BackgroundNetworkUpdateState]].
Takes an input [[NCM_services#ContentMetaKey|ContentMetaKey]], no output.


This checks whether a sysupdate is needed with the input ContentMetaKey using [[NCM_services|NCM]] commands, if not this will just return 0. Otherwise, this will then run code which is identical to [[#RequestBackgroundNetworkUpdate]].
== OpenSystemUpdateControl ==
No input, returns an [[#ISystemUpdateControl]].
 
== NotifyExFatDriverRequired ==
No input/output.
 
Only usable when an [[#ISystemUpdateControl]] isn't open.
 
This uses [[NIM_services|nim]] ListSystemUpdateTask, then when a task is returned uses it with DestroySystemUpdateTask.
 
Then this runs ExFat handling, updates state, and sets the same state flag as [[#RequestBackgroundNetworkUpdate]].
 
== ClearExFatDriverStatusForDebug ==
No input/output.
 
== RequestBackgroundNetworkUpdate ==
No input/output.
 
Only usable when an [[#ISystemUpdateControl]] isn't open.
 
This sets a state flag to value 1.
 
== NotifyBackgroundNetworkUpdate ==
Takes an input [[NCM_services#ContentMetaKey|ContentMetaKey]], no output.
 
This checks whether a sysupdate is needed with the input ContentMetaKey using [[NCM_services|NCM]] commands, if not this will just return 0. Otherwise, this will then run code which is identical to [[#RequestBackgroundNetworkUpdate]].


== NotifyExFatDriverDownloadedForDebug ==
== NotifyExFatDriverDownloadedForDebug ==
Line 2,659: Line 2,886:
| 7 || [1.0.0-9.2.0] [[#PrepareLaunchProgramFromHost]]
| 7 || [1.0.0-9.2.0] [[#PrepareLaunchProgramFromHost]]
|-
|-
| 8 || [10.0.0-17.0.1] [[#LaunchApplicationFromHost]] ([1.0.0-9.2.0] [[#LaunchApplicationForDevelop]])
| 8 || [10.0.0-17.0.1] [[#LaunchApplicationFromHost]] ([1.0.0-9.2.0] LaunchApplication)
|-
|-
| 9 || [1.0.0-17.0.1] [[#LaunchApplicationWithStorageIdForDevelop]]
| 9 || [1.0.0-17.0.1] [[#LaunchApplicationWithStorageId]]
|-
|-
| 10 || [6.0.0-8.1.0] [[#IsSystemMemoryResourceLimitBoosted]]
| 10 || [6.0.0-8.1.0] [[#IsSystemMemoryResourceLimitBoosted]]
|-
|-
| 11 || [6.0.0+] [[#GetRunningApplicationProcessIdForDevelop]]
| 11 || [6.0.0+] [[#GetRunningApplicationProcessId]]
|-
|-
| 12 || [6.0.0+] [[#SetCurrentApplicationRightsEnvironmentCanBeActiveForDevelop]]
| 12 || [6.0.0+] [[#SetCurrentApplicationRightsEnvironmentCanBeActive]]
|-
|-
| 13 || [9.0.0+] [[#CreateApplicationResourceForDevelop]]
| 13 || [9.0.0+] [[#CreateApplicationResource]]
|-
|-
| 14 || [9.0.0+] [[#IsPreomiaForDevelop]]
| 14 || [9.0.0+] [[#IsPreomia]]
|-
|-
| 15 || [10.0.0-17.0.1] [[#GetApplicationProgramIdFromHost]]
| 15 || [10.0.0-17.0.1] [[#GetApplicationProgramIdFromHost]]
Line 2,687: Line 2,914:
| 21 || [18.0.0+] [[#PrepareLaunchApplication]]
| 21 || [18.0.0+] [[#PrepareLaunchApplication]]
|-
|-
| 22 || [18.0.0+] [[#LaunchApplicationForDevelop]]
| 22 || [18.0.0+] [[#LaunchApplication]]
|-
|-
| 23 || [18.0.0+] [[#GetProgramIdByApplicationLaunchInfo]]
| 23 || [18.0.0+] [[#GetProgramIdByApplicationLaunchInfo]]
Line 2,716: Line 2,943:


Calls [[NCM_services#IPathResolverForStorage|IPathResolverForStorage]] Set...NcaPath functions.
Calls [[NCM_services#IPathResolverForStorage|IPathResolverForStorage]] Set...NcaPath functions.
== LaunchApplicationForDevelop ==
Takes an input u32 [[Process_Manager_services#LaunchFlags|LaunchFlags]] and [[NCM_services#ApplicationId|ApplicationId]], returns an output u64 ProcessId.
Same as [[#LaunchApplicationWithStorageIdForDevelop]] except the last two params passed to the internal vtable funcptr call are value 0x6, instead of from the command input.


== LaunchApplicationFromHost ==
== LaunchApplicationFromHost ==
Takes an input u32 [[Process_Manager_services#LaunchFlags|LaunchFlags]] and a type-0x5 input buffer containing the [[Filesystem_services#FspPath|FspPath]]. Returns an output u64 ProcessId.
Takes an input u32 [[Process_Manager_services#LaunchFlags|LaunchFlags]] and a type-0x5 input buffer containing the [[Filesystem_services#FspPath|FspPath]]. Returns an output u64 ProcessId.


== LaunchApplicationWithStorageIdForDevelop ==
== LaunchApplicationWithStorageId ==
Takes 2 input u8 [[NCM_services#StorageId|StorageIds]], an u32 [[Process_Manager_services#LaunchFlags|LaunchFlags]], and an [[NCM_services#ApplicationId|ApplicationId]]. Returns an output u64 ProcessId.
Takes 2 input u8 [[NCM_services#StorageId|StorageIds]], an u32 [[Process_Manager_services#LaunchFlags|LaunchFlags]], and an [[NCM_services#ApplicationId|ApplicationId]]. Returns an output u64 ProcessId.


Line 2,733: Line 2,955:
No input. Returns a bool.
No input. Returns a bool.


== GetRunningApplicationProcessIdForDevelop ==
== GetRunningApplicationProcessId ==
Returns an output u64 ProcessId.
Returns an output u64 ProcessId.


== SetCurrentApplicationRightsEnvironmentCanBeActiveForDevelop ==
== SetCurrentApplicationRightsEnvironmentCanBeActive ==
Takes an input bool. No output.
Takes an input bool. No output.


== CreateApplicationResourceForDevelop ==
== CreateApplicationResource ==
Takes an input u32 (1 = Preomia/MicroApplication). Returns an [[#IApplicationResource]].
Takes an input u32 (1 = Preomia/MicroApplication). Returns an [[#IApplicationResource]].


== IsPreomiaForDevelop ==
== IsPreomia ==
Takes an input u64 [[NCM_services#ProgramId|ProgramId]]. Returns a bool.
Takes an input u64 [[NCM_services#ProgramId|ProgramId]]. Returns a bool.


Line 2,768: Line 2,990:
[19.0.0+] Now returns a total of 0x80-bytes of output.
[19.0.0+] Now returns a total of 0x80-bytes of output.


== LaunchApplicationForDevelop ==
== LaunchApplication ==
Takes a total of 0x50-bytes of input. Returns a total of 8-bytes of output.
Takes a total of 0x50-bytes of input. Returns a total of 8-bytes of output.


Line 2,851: Line 3,073:
| 190 || [1.0.0-9.2.0] GetUserLastOpenedApplication ||
| 190 || [1.0.0-9.2.0] GetUserLastOpenedApplication ||
|-
|-
| 191 || [7.0.0+] UpdateNotificationReceiverInfo ([5.0.0-5.1.0] ActivateOpenContextHolder) ||
| 191 || [7.0.0-19.0.1] UpdateNotificationReceiverInfo ([5.0.0-5.1.0] ActivateOpenContextHolder) ||
|-
|-
| 200 || BeginUserRegistration ||
| 200 || BeginUserRegistration ||
Line 2,882: Line 3,104:
|-
|-
| 250 || GetBaasAccountAdministrator || Returns an [[#IAdministrator]].
| 250 || GetBaasAccountAdministrator || Returns an [[#IAdministrator]].
|-
| 251 || [20.0.0+] SynchronizeNetworkServiceAccountsSnapshotAsync ||
|-
|-
| 290 || ProxyProcedureForGuestLoginWithNintendoAccount || Returns an [[#IOAuthProcedureForExternalNsa]] (formerly [[#IOAuthProcedureForGuestLogin]] with [1.0.0-2.3.0]).
| 290 || ProxyProcedureForGuestLoginWithNintendoAccount || Returns an [[#IOAuthProcedureForExternalNsa]] (formerly [[#IOAuthProcedureForGuestLogin]] with [1.0.0-2.3.0]).
|-
|-
| 291 || [3.0.0+] ProxyProcedureForFloatingRegistrationWithNintendoAccount || Returns an [[#IOAuthProcedureForExternalNsa]].
| 291 || [3.0.0+] ProxyProcedureForFloatingRegistrationWithNintendoAccount || Returns an [[#IOAuthProcedureForExternalNsa]].
|-
| 292 || [20.0.0+] ProxyProcedureForDeviceMigrationAuthenticatingOperatingUser ||
|-
| 293 || [20.0.0+] ProxyProcedureForDeviceMigrationDownload ||
|-
|-
| 299 || SuspendBackgroundDaemon || Returns an [[#ISessionObject]].
| 299 || SuspendBackgroundDaemon || Returns an [[#ISessionObject]].
|-
| 350 || [20.0.0+] CreateDeviceMigrationUserExportRequest ||
|-
| 351 || [20.0.0+] UploadNasCredential ||
|-
| 352 || [20.0.0+] CreateDeviceMigrationUserImportRequest ||
|-
| 353 || [20.0.0+] DeleteUserMigrationSaveData ||
|-
|-
| 400 || [18.0.0+] SetPinCode ||
| 400 || [18.0.0+] SetPinCode ||
Line 2,893: Line 3,129:
| 401 || [18.0.0+] GetPinCodeLength ||
| 401 || [18.0.0+] GetPinCodeLength ||
|-
|-
| 402 || [18.0.0+] GetPinCode ||
| 402 || [18.0.0-19.0.1] GetPinCode ||
|-
| 403 || [20.0.0+] GetPinCodeParity ||
|-
| 404 || [20.0.0+] VerifyPinCode ||
|-
| 405 || [20.0.0+] IsPinCodeVerificationForbidden ||
|-
|-
| 410 || [18.0.0+] GetPinCodeErrorCount ||
| 410 || [18.0.0+] GetPinCodeErrorCount ||
|-
|-
| 411 || [18.0.0+] ResetPinCodeErrorCount ||
| 411 || [18.0.0-19.0.1] ResetPinCodeErrorCount ||
|-
|-
| 412 || [18.0.0+] IncrementPinCodeErrorCount ||
| 412 || [18.0.0-19.0.1] IncrementPinCodeErrorCount ||
|-
| 413 || [20.0.0+] SetPinCodeErrorCount ||
|-
|-
| 420 || [19.0.0+] SetStartPenaltyTime ||  
| 420 || [19.0.0+] SetStartPenaltyTime ||  
Line 2,941: Line 3,185:
| 2 || EnsureIdTokenCacheAsync || Returns an [[#IAsyncContext]].
| 2 || EnsureIdTokenCacheAsync || Returns an [[#IAsyncContext]].
|-
|-
| 3 || LoadIdTokenCache ||
| 3 || [19.0.0+] LoadIdTokenCacheDeprecated ([1.0.0-18.1.0] LoadIdTokenCache) ||
|-
| 4 || [19.0.0+] LoadIdTokenCache ||
|-
|-
| 100 || SetSystemProgramIdentification ||
| 100 || SetSystemProgramIdentification ||
|-
|-
| 101 || [7.0.0+] RefreshNotificationTokenAsync ||  
| 101 || RefreshNotificationTokenAsync ||  
|-
|-
| 110 || [4.0.0+] GetServiceEntryRequirementCache ||
| 110 || GetServiceEntryRequirementCacheForLogin ||
|-
|-
| 111 || [4.0.0+] InvalidateServiceEntryRequirementCache ||
| 111 || InvalidateServiceEntryRequirementCache ||
|-
|-
| 112 || [4.0.0-6.2.0] InvalidateTokenCache ||
| 113 || GetServiceEntryRequirementCacheForOnlinePlay || Takes a total of 0x8-bytes of input, returns a total of 0x4-bytes of output.
|-
| 113 || [6.1.0+] GetServiceEntryRequirementCacheForOnlinePlay || Takes a total of 0x8-bytes of input, returns a total of 0x4-bytes of output.
|-
|-
| 120 || GetNintendoAccountId ||
| 120 || GetNintendoAccountId ||
|-
|-
| 121 || [9.0.0+] CalculateNintendoAccountAuthenticationFingerprint ||
| 121 || CalculateNintendoAccountAuthenticationFingerprint ||
|-
|-
| 130 || GetNintendoAccountUserResourceCache ||
| 130 || GetNintendoAccountUserResourceCache ||
Line 2,965: Line 3,209:
| 132 || RefreshNintendoAccountUserResourceCacheAsyncIfSecondsElapsed || Returns an [[#IAsyncContext]].
| 132 || RefreshNintendoAccountUserResourceCacheAsyncIfSecondsElapsed || Returns an [[#IAsyncContext]].
|-
|-
| 133 || [9.0.0+] GetNintendoAccountVerificationUrlCache ||
| 133 || GetNintendoAccountVerificationUrlCache ||
|-
| 134 || RefreshNintendoAccountVerificationUrlCacheAsync ||
|-
| 135 || RefreshNintendoAccountVerificationUrlCacheAsyncIfSecondsElapsed ||
|-
|-
| 134 || [9.0.0+] RefreshNintendoAccountVerificationUrlCacheAsync ||
| 136 || [19.0.0+] GetNintendoAccountUserResourceCache ||
|-
|-
| 135 || [9.0.0+] RefreshNintendoAccountVerificationUrlCacheAsyncIfSecondsElapsed ||
| 140 || GetNetworkServiceLicenseCache ||  
|-
|-
| 140 || [5.0.0+] GetNetworkServiceLicenseCache ||
| 141 || RefreshNetworkServiceLicenseCacheAsync || Returns an [[#IAsyncContext]].
|-
|-
| 141 || [5.0.0+] RefreshNetworkServiceLicenseCacheAsync || Returns an [[#IAsyncContext]].
| 142 || RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed || Returns an [[#IAsyncContext]].
|-
|-
| 142 || [5.0.0+] RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed || Returns an [[#IAsyncContext]].
| 143 || [15.0.0+] GetNetworkServiceLicenseCacheEx ||
|-
|-
| 150 || CreateAuthorizationRequest || Returns an [[#IAuthorizationRequest]].
| 150 || CreateAuthorizationRequest || Returns an [[#IAuthorizationRequest]].
Line 2,983: Line 3,231:
| 161 || [16.0.0+] RequireReauthenticationOfNetworkServiceAccount ||
| 161 || [16.0.0+] RequireReauthenticationOfNetworkServiceAccount ||
|-
|-
| 170 || [17.0.0+] CreateDeviceHistoryRequest ||
| 180 || [18.0.0-19.0.1] GetRequestForNintendoAccountReauthentication ||
|-
|-
| 180 || [18.0.0+] GetRequestForNintendoAccountReauthentication ||
| 181 || [20.0.0+] CreateProcedureToReauthenticateNintendoAccount ||
|-
| 182 || [20.0.0+] ResumeProcedureToReauthenticateNintendoAccount ||
|}
|}


Line 3,037: Line 3,287:
| 2 || EnsureIdTokenCacheAsync || Returns an [[#IAsyncContext]].
| 2 || EnsureIdTokenCacheAsync || Returns an [[#IAsyncContext]].
|-
|-
| 3 || LoadIdTokenCache ||
| 3 || [19.0.0+] LoadIdTokenCacheDeprecated ([1.0.0-18.1.0] LoadIdTokenCache) ||
|-
| 4 || [19.0.0+] LoadIdTokenCache ||
|-
|-
| 100 || SetSystemProgramIdentification ||
| 100 || SetSystemProgramIdentification ||
Line 3,066: Line 3,318:
|-
|-
| 135 || [9.0.0+] RefreshNintendoAccountVerificationUrlCacheAsyncIfSecondsElapsed ||
| 135 || [9.0.0+] RefreshNintendoAccountVerificationUrlCacheAsyncIfSecondsElapsed ||
|-
| 136 || [19.0.0+] GetNintendoAccountUserResourceCache ||
|-
|-
| 140 || [5.0.0+] GetNetworkServiceLicenseCache ||
| 140 || [5.0.0+] GetNetworkServiceLicenseCache ||
Line 3,072: Line 3,326:
|-
|-
| 142 || [5.0.0+] RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed ||
| 142 || [5.0.0+] RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed ||
|-
| 143 || [15.0.0+] GetNetworkServiceLicenseCacheEx ||
|-
|-
| 150 || CreateAuthorizationRequest || Returns an [[#IAuthorizationRequest]].
| 150 || CreateAuthorizationRequest || Returns an [[#IAuthorizationRequest]].
Line 3,079: Line 3,335:
| 161 || [16.0.0+] RequireReauthenticationOfNetworkServiceAccount ||
| 161 || [16.0.0+] RequireReauthenticationOfNetworkServiceAccount ||
|-
|-
| 170 || [17.0.0+] CreateDeviceHistoryRequest ||
| 180 || [18.0.0-19.0.1] GetRequestForNintendoAccountReauthentication ||
|-
|-
| 180 || [18.0.0+] GetRequestForNintendoAccountReauthentication ||
| 181 || [20.0.0+] CreateProcedureToReauthenticateNintendoAccount ||
|-
| 182 || [20.0.0+] ResumeProcedureToReauthenticateNintendoAccount ||
|-
|-
| 200 || IsRegistered ||
| 200 || IsRegistered ||
Line 3,090: Line 3,348:
|-
|-
| 203 || DeleteRegistrationInfoLocally ||
| 203 || DeleteRegistrationInfoLocally ||
|-
| 204 || [19.0.0-19.0.1] UnregisterDeviceAsync ||
|-
|-
| 220 || SynchronizeProfileAsync || Returns an [[#IAsyncContext]].
| 220 || SynchronizeProfileAsync || Returns an [[#IAsyncContext]].
Line 3,096: Line 3,356:
|-
|-
| 222 || SynchronizeProfileAsyncIfSecondsElapsed || Returns an [[#IAsyncContext]].
| 222 || SynchronizeProfileAsyncIfSecondsElapsed || Returns an [[#IAsyncContext]].
|-
| 223 || [19.0.0+] DownloadProfileAsync ||
|-
|-
| 250 || IsLinkedWithNintendoAccount ||
| 250 || IsLinkedWithNintendoAccount ||
Line 3,120: Line 3,382:
|-
|-
| 401 || [6.1.0+] RefreshServiceEntryRequirementCacheForOnlinePlayAsync || Takes a total of 0x8-bytes of input, returns an [[#IAsyncContext]].
| 401 || [6.1.0+] RefreshServiceEntryRequirementCacheForOnlinePlayAsync || Takes a total of 0x8-bytes of input, returns an [[#IAsyncContext]].
|-
| 410 || [13.1.0+] CheckRequiredLicenseForLexAsync ||
|-
|-
| 900 || [9.0.0+] GetAuthenticationInfoForWin ||
| 900 || [9.0.0+] GetAuthenticationInfoForWin ||
Line 3,563: Line 3,823:
| 190 || [1.0.0-9.2.0] GetUserLastOpenedApplication ||
| 190 || [1.0.0-9.2.0] GetUserLastOpenedApplication ||
|-
|-
| 191 || [7.0.0+] UpdateNotificationReceiverInfo ([5.0.0-5.1.0] ActivateOpenContextHolder) ||
| 191 || [7.0.0-19.0.1] UpdateNotificationReceiverInfo ([5.0.0-5.1.0] ActivateOpenContextHolder) ||
|-
|-
| 401 || [18.0.0+] GetPinCodeLength ||
| 401 || [18.0.0+] GetPinCodeLength ||
|-
|-
| 402 || [18.0.0+] GetPinCode ||
| 402 || [18.0.0-19.0.1] GetPinCode ||
|-
| 403 || [20.0.0+] GetPinCodeParity ||
|-
| 404 || [20.0.0+] VerifyPinCode ||
|-
| 405 || [20.0.0+] IsPinCodeVerificationForbidden ||
|-
|-
| 997 || [3.0.0+] DebugInvalidateTokenCacheForUser ||
| 997 || [3.0.0+] DebugInvalidateTokenCacheForUser ||
Line 3,624: Line 3,890:
|}
|}


= VersionListData =
= ApplicationRecord =
This is "nn::ns::VersionListData".
This is "nn::ns::ApplicationRecord".
 
= ApplicationUpdateInfo =
This is "nn::ns::ApplicationUpdateInfo". This is an u8.


{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Value
! Offset
! Size
! Description
! Description
|-
|-
| 0 || UpToDate
| 0x0
| 0x8
| [[NCM_services#ApplicationId|Id]]
|-
| 0x8
| 0x1
| [[#ApplicationEvent|LastEvent]]
|-
|-
| 1 || Updatable
| 0x9
|}
| 0x1
 
| Attributes
[[qlaunch]] just checks whether this is 0.
 
= ApplicationOccupiedSize =
This is "nn::ns::ApplicationOccupiedSize". This is a 0x80-byte struct.
 
{| class="wikitable" border="1"
|-
|-
! Offset
| 0xA
! Size
| 0x6
! Description
| Reserved
|-
|-
| 0x0 || 0x20 * 4 || Array of [[#ApplicationOccupiedSizeEntity]]
| 0x10
| 0x8
| LastUpdated
|}
|}


= ApplicationOccupiedSizeEntity =
= ApplicationEvent =
This is "nn::ns::ApplicationOccupiedSizeEntity". This is a 0x20-byte struct.
This is "nn::ns::ApplicationEvent".


{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Offset
! Value
! Size
! Description
! Description
|-
|-
| 0x0 || 0x1 || [[NCM_services#StorageId|StorageId]]
| 0 || Launched
|-
| 1 || LocalInstalled
|-
|-
| 0x1 || 0x7 || Reserved
| 2 || DownloadStarted
|-
|-
| 0x8 || 0x8 || AppSize
| 3 || GameCardInserted
|-
|-
| 0x10 || 0x8 || PatchSize
| 4 || Touched
|-
|-
| 0x18 || 0x8 || AocSize
| 5 ||  
|}
 
= ProgressForDeleteUserSaveDataAll =
This is "nn::ns::detail::ProgressForDeleteUserSaveDataAll". This is a 0x28-byte struct.
 
{| class="wikitable" border="1"
|-
|-
! Offset
| 6 ||
! Size
! Description
|-
|-
| 0x0 || 0x8 || StartedAt
| 7 ||  
|-
|-
| 0x8 || 0x4 || Count
| 8 ||  
|-
|-
| 0xC || 0x4 || Reserved
| 9 ||  
|-
|-
| 0x10 || 0x8 || SizeInBytes
| 10 ||  
|-
|-
| 0x18 || 0x1 || IsSystem
| 11 ||  
|-
|-
| 0x19 || 0x7 || Reserved
| 12 ||  
|-
|-
| 0x20 || 0x8 || ApplicationId
| 13 ||  
|-
| 14 ||
|-
| 15 ||
|-
| 16 ||  
|}
|}


= ApplicationViewDeprecated =
= ApplicationControlSource =
This is "nn::ns::ApplicationViewDeprecated". This is a 0x40-byte struct.
This is "nn::ns::ApplicationControlSource".


{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Offset
! Value
! Size
! Description
! Description
|-
|-
| 0x0 || 0x8 || [[NCM_services#ApplicationId|ApplicationId]]
| 0
| CacheOnly
|-
|-
| 0x8 || 0x4 || Version
| 1
| Storage
|-
|-
| 0xC || 0x4 || [[#ApplicationViewFlag|Flag]]
| 2
|-
| StorageOnly
| 0x10 || 0x18 || [[#ApplicationDownloadProgress|Progress]]
|-
| 0x28 || 0x18 || [[#ApplicationApplyDeltaProgress|ApplyProgress]]
|}
|}


This is converted from [[#ApplicationView]] by [[#GetApplicationViewDeprecated]] on newer system-versions as follows:
= ApplicationContentMetaStatus =
This is "nn::ns::ApplicationContentMetaStatus".


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 3,726: Line 3,990:
! Description
! Description
|-
|-
| 0x0 || 0x20 || Same as [[#ApplicationView]] +0x0.
| 0x0
| 0x1
| [[NCM_services#ContentMetaType|Type]]
|-
|-
| 0x20 || 0x4 || Same as [[#ApplicationView]] +0x20.
| 0x1
| 0x1
| [[NCM_services#StorageId|InstalledStorage]]
|-
|-
| 0x24 || 0x2 || Same as [[#ApplicationView]] +0x24.
| 0x2
| 0x1
| [[#ContentMetaRightsCheck|RightsCheck]]
|-
|-
| 0x26 || 0x2 || Cleared to 0.
| 0x3
| 0x1
| Reserved
|-
|-
| 0x28 || 0x10 || Same as [[#ApplicationView]] +0x30.
| 0x4
| 0x4
| Version
|-
|-
| 0x38 || 0x4 || Same as [[#ApplicationView]] +0x40.
| 0x8
|-
| 0x8
| 0x3C || 0x1 || Same as [[#ApplicationView]] +0x44.
| [[NCM_services#ApplicationId|Id]]
|-
| 0x3D || 0x2 || Cleared to 0.
|-
| 0x3F || 0x1 || Cleared to 0.
|}
|}


= ApplicationViewFlag =
= ContentMetaRightsCheck =
This is "nn::ns::ApplicationViewFlag". This is a 32-bit flag.
This is "nn::ns::ContentMetaRightsCheck".


{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Bit
! Value
! Description
! Description
|-
|-
| 0
| 0
|  
| NotChecked
|-
|-
| 1
| 1
|  
| NotNeeded
|-
|-
| 2
| 2
|  
| CommonRights
|-
|-
| 3
| 3
|  
| PersonalizedRights
|-
|-
| 4
| 4
|  
| NoRights
|}
 
= VersionListData =
This is "nn::ns::VersionListData".
 
= ApplicationUpdateInfo =
This is "nn::ns::ApplicationUpdateInfo".
 
{| class="wikitable" border="1"
|-
|-
| 5
! Value
|
! Description
|-
|-
| 6
| 0 || UpToDate
|  
|-
|-
| 7
| 1 || Updatable
|  
|}
 
= ApplicationOccupiedSize =
This is "nn::ns::ApplicationOccupiedSize". This is a 0x80-byte struct.
 
{| class="wikitable" border="1"
|-
|-
| 8
! Offset
|
! Size
! Description
|-
|-
| 9
| 0x0 || 0x20 * 4 || Array of [[#ApplicationOccupiedSizeEntity]]
|  
|-
| 10
|
|-
| 11
|
|-
| 12
|
|-
| 13
|
|-
| 14
|
|-
| 15
|
|-
| 16
|
|-
| 17
|  
|}
|}


= ApplicationDownloadProgress =
= ApplicationOccupiedSizeEntity =
This is "nn::ns::ApplicationDownloadProgress". This is a 0x18-byte struct.
This is "nn::ns::ApplicationOccupiedSizeEntity". This is a 0x20-byte struct.


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 3,817: Line 4,076:
! Description
! Description
|-
|-
| 0x0 || 0x8 || Downloaded
| 0x0 || 0x1 || [[NCM_services#StorageId|StorageId]]
|-
|-
| 0x8 || 0x8 || Total
| 0x1 || 0x7 || Reserved
|-
|-
| 0x10 || 0x4 || LastResult
| 0x8 || 0x8 || AppSize
|-
|-
| 0x14 || 0x1 || [[#ApplicationDownloadState|State]]
| 0x10 || 0x8 || PatchSize
|-
|-
| 0x15 || 0x3 || Reserved
| 0x18 || 0x8 || AocSize
|}
|}


= ApplicationApplyDeltaProgress =
= ProgressForDeleteUserSaveDataAll =
This is "nn::ns::ApplicationApplyDeltaProgress". This is a 0x18-byte struct.
This is "nn::ns::detail::ProgressForDeleteUserSaveDataAll". This is a 0x28-byte struct.


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 3,837: Line 4,096:
! Description
! Description
|-
|-
| 0x0 || 0x8 || Applied
| 0x0 || 0x8 || StartedAt
|-
| 0x8 || 0x4 || Count
|-
| 0xC || 0x4 || Reserved
|-
|-
| 0x8 || 0x8 || Total
| 0x10 || 0x8 || SizeInBytes
|-
|-
| 0x10 || 0x4 || LastResult
| 0x18 || 0x1 || IsSystem
|-
|-
| 0x14 || 0x1 || [[#ApplicationApplyDeltaState|State]]
| 0x19 || 0x7 || Reserved
|-
|-
| 0x15 || 0x3 || Reserved
| 0x20 || 0x8 || ApplicationId
|}
|}


= ApplicationDownloadState =
= ApplicationViewDeprecated =
This is "nn::ns::ApplicationDownloadState". This is an u8.
This is "nn::ns::ApplicationViewDeprecated". This is a 0x40-byte struct.


{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Value
! Offset
! Size
! Description
! Description
|-
|-
| 0 || Runnable
| 0x0 || 0x8 || [[NCM_services#ApplicationId|ApplicationId]]
|-
|-
| 1 || Suspended
| 0x8 || 0x4 || Version
|-
|-
| 2 || NotEnoughSpace
| 0xC || 0x4 || [[#ApplicationViewFlag|Flag]]
|-
|-
| 3 || Fatal
| 0x10 || 0x18 || [[#ApplicationDownloadProgress|Progress]]
|-
|-
| 4 || Finished
| 0x28 || 0x18 || [[#ApplicationApplyDeltaProgress|ApplyProgress]]
|}
|}


= ApplicationApplyDeltaState =
This is converted from [[#ApplicationView]] by [[#GetApplicationViewDeprecated]] on newer system-versions as follows:
This is "nn::ns::ApplicationApplyDeltaState". This is an u8.


{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Value
! Offset
! Size
! Description
! Description
|-
|-
| 0 || Applying
| 0x0 || 0x20 || Same as [[#ApplicationView]] +0x0.
|-
| 0x20 || 0x4 || Same as [[#ApplicationView]] +0x20.
|-
| 0x24 || 0x2 || Same as [[#ApplicationView]] +0x24.
|-
|-
| 1 || Suspended
| 0x26 || 0x2 || Cleared to 0.
|-
|-
| 2 || NotEnoughSpace
| 0x28 || 0x10 || Same as [[#ApplicationView]] +0x30.
|-
|-
| 3 || Fatal
| 0x38 || 0x4 || Same as [[#ApplicationView]] +0x40.
|-
|-
| 4 || NoTask
| 0x3C || 0x1 || Same as [[#ApplicationView]] +0x44.
|-
|-
| 5 || WaitApply
| 0x3D || 0x2 || Cleared to 0.
|-
|-
| 6 || Applied
| 0x3F || 0x1 || Cleared to 0.
|}
|}


= ApplicationView =
= ApplicationViewFlag =
This is "nn::ns::ApplicationView". This is a 0x50-byte struct.
This is "nn::ns::ApplicationViewFlag". This is a 32-bit flag.


{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Offset
! Bit
! Size
! Description
! Description
|-
|-
| 0x0 || 0x8 || [[NCM_services#ApplicationId|ApplicationId]]
| 0
|  
|-
|-
| 0x8 || 0x4 || ?
| 1
|  
|-
|-
| 0xC || 0x4 || Flags
| 2
|  
|-
|-
| 0x10 || 0x40 || ?
| 3
|}
|  
 
= ApplicationViewWithPromotionInfo =
This is a 0x70-byte struct.
 
{| class="wikitable" border="1"
|-
|-
! Offset
| 4
! Size
|
! Description
|-
|-
| 0x0 || 0x50 || [[#ApplicationView]]
| 5
|  
|-
|-
| 0x50 || 0x20 || [[#PromotionInfo]]
| 6
|}
|  
 
= PromotionInfo =
This is a 0x20-byte struct.
 
{| class="wikitable" border="1"
|-
|-
! Offset
| 7
! Size
|
! Description
|-
|-
| 0x0 || 0x8 || PosixTime start_timestamp.
| 8
|  
|-
|-
| 0x8 || 0x8 || PosixTime end_timestamp.
| 9
|  
|-
|-
| 0x10 || 0x8 || Remaining time until the promotion ends, in nanoseconds ({end_timestamp - current_time} converted to nanoseconds).
| 10
|  
|-
|-
| 0x18 || 0x4 || Not set, left at zero.
| 11
|  
|-
| 12
|
|-
| 13
|
|-
| 14
|
|-
| 15
|  
|-
|-
| 0x1C || 0x1 || Flags. Bit0: whether the PromotionInfo is valid (including bit1). Bit1 clear: u64 +0x10 is set.
| 16
|  
|-
|-
| 0x1D || 0x3 || Padding
| 17
|  
|}
|}


= ApplicationResourceType =
= ApplicationDownloadProgress =
This is "nn::ns::ApplicationResourceType". This is an u8.
This is "nn::ns::ApplicationDownloadProgress". This is a 0x18-byte struct.


{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Value
! Offset
! Size
! Description
! Description
|-
|-
| 0 || ApplicationResource
| 0x0 || 0x8 || Downloaded
|-
| 0x8 || 0x8 || Total
|-
| 0x10 || 0x4 || LastResult
|-
| 0x14 || 0x1 || [[#ApplicationDownloadState|State]]
|-
|-
| 1 || MicroApplicationResource
| 0x15 || 0x3 || Reserved
|}
|}


= ApplicationErrorCodeCategory =
= ApplicationApplyDeltaProgress =
This is "nn::ns::ApplicationErrorCodeCategory". This is an u64.
This is "nn::ns::ApplicationApplyDeltaProgress". This is a 0x18-byte struct.


= NoDownloadRightsErrorResolution =
{| class="wikitable" border="1"
This is "nn::ns::NoDownloadRightsErrorResolution".
|-
! Offset
! Size
! Description
|-
| 0x0 || 0x8 || Applied
|-
| 0x8 || 0x8 || Total
|-
| 0x10 || 0x4 || LastResult
|-
| 0x14 || 0x1 || [[#ApplicationApplyDeltaState|State]]
|-
| 0x15 || 0x3 || Reserved
|}


= BackgroundNetworkUpdateState =
= ApplicationDownloadState =
This is "nn::ns::BackgroundNetworkUpdateState". This is an u8.
This is "nn::ns::ApplicationDownloadState". This is an u8.


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 3,971: Line 4,269:
! Description
! Description
|-
|-
| 0 || None
| 0 || Runnable
|-
| 1 || Suspended
|-
| 2 || NotEnoughSpace
|-
|-
| 1 || InProgress
| 3 || Fatal
|-
|-
| 2 || Ready
| 4 || Finished
|}
|}


Similar to [[#HasDownloaded]], [[#GetBackgroundNetworkUpdateState]] uses [[NIM_services|nim]] ListSystemUpdateTask and [[NIM_services|nim]] GetSystemUpdateTaskInfo. When ListSystemUpdateTask successfully returns a task and GetSystemUpdateTaskInfo is successful, the output value is set to: <code>1 + *((u8*)(taskinfo+0) == 0x3</code>. Otherwise, value=0.
= ApplicationApplyDeltaState =
This is "nn::ns::ApplicationApplyDeltaState". This is an u8.


[[#GetBackgroundNetworkUpdateState]] always returns Result 0, however this will assert if GetSystemUpdateTaskInfo fails with ret!=0x3C89.
{| class="wikitable" border="1"
 
|-
= SystemUpdateProgress =
! Value
This is "nn::ns::SystemUpdateProgress". This is a 0x10-byte struct.
! Description
|-
| 0 || Applying
|-
| 1 || Suspended
|-
| 2 || NotEnoughSpace
|-
| 3 || Fatal
|-
| 4 || NoTask
|-
| 5 || WaitApply
|-
| 6 || Applied
|}
 
= ApplicationView =
This is "nn::ns::ApplicationView". This is a 0x50-byte struct.


{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Offset
! Offset
! Size
! Size
! Description
! Description
|-
|-
| 0x0 || 0x8 || Loaded (this value can be larger than total_size when the async operation is finishing and when total_size is <=0, this current_size field may contain a progress value for when the total_size is not yet determined)
| 0x0 || 0x8 || [[NCM_services#ApplicationId|ApplicationId]]
|-
|-
| 0x8 || 0x8 || Total (this field is only valid when >0)
| 0x8 || 0x4 || ?
|}
|-
 
| 0xC || 0x4 || Flags
Commands which have this as output will return 0 with the output cleared, when no task is available.
|-
 
| 0x10 || 0x40 || ?
= EulaDataPath =
|}
This is "nn::ns::detail::EulaDataPath". This is a 0x100-byte struct.
 
 
= ApplicationViewWithPromotionInfo =
This contains a file path.
This is a 0x70-byte struct.
 
 
= SystemDeliveryInfo =
[20.0.0+] This is a 0x78-byte struct.
This is "nn::ns::SystemDeliveryInfo". This is a 0x100-byte struct.
 
 
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Offset
! Offset
! Size
! Size
! Description
! Description
|-
|-
| 0x0 || 0x50 || [[#ApplicationView]]
| 0x0 || 0x4 || SystemDeliveryProtocolVersion. Must be <= to and match [[System_Settings|system-setting]] <code>contents_delivery!system_delivery_protocol_version</code>.
|-
|-
| 0x50 || 0x20 || [[#PromotionInfo]]
| 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 || 0x1 || HasExFat. Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation.
= PromotionInfo =
|-
This is a 0x20-byte struct.
| 0x9 || 0x3 || Reserved.
 
|-
{| class="wikitable" border="1"
| 0xC || 0x4 || SystemUpdateMetaVersion.
|-
|-
! Offset
| 0x10 || 0x8 || SystemUpdateMetaId.
! Size
|-
! Description
| 0x18 || 0x1 || FirmwareVariationId. Used by [[#RequestSendSystemUpdate]].
|-
| 0x0 || 0x8 || PosixTime start_timestamp.
|-
| 0x8 || 0x8 || PosixTime end_timestamp.
|-
| 0x10 || 0x8 || Remaining time until the promotion ends, in nanoseconds ({end_timestamp - current_time} converted to nanoseconds).
|-
| 0x18 || 0x4 || Not set, left at zero.
|-
| 0x1C || 0x1 || Flags. Bit0: whether the PromotionInfo is valid (including bit1). Bit1 clear: u64 +0x10 is set.
|-
| 0x1D || 0x3 || Padding
|}
 
= ApplicationResourceType =
This is "nn::ns::ApplicationResourceType". This is an u8.
 
{| class="wikitable" border="1"
|-
! Value
! Description
|-
| 0 || ApplicationResource
|-
| 1 || MicroApplicationResource
|}
 
= ApplicationErrorCodeCategory =
This is "nn::ns::ApplicationErrorCodeCategory". This is an u64.
 
= NoDownloadRightsErrorResolution =
This is "nn::ns::NoDownloadRightsErrorResolution".
 
= BackgroundNetworkUpdateState =
This is "nn::ns::BackgroundNetworkUpdateState". This is an u8.
 
{| class="wikitable" border="1"
|-
! Value
! Description
|-
| 0 || None
|-
| 1 || InProgress
|-
| 2 || Ready
|}
 
Similar to [[#HasDownloaded]], [[#GetBackgroundNetworkUpdateState]] uses [[NIM_services|nim]] ListSystemUpdateTask and [[NIM_services|nim]] GetSystemUpdateTaskInfo. When ListSystemUpdateTask successfully returns a task and GetSystemUpdateTaskInfo is successful, the output value is set to: <code>1 + *((u8*)(taskinfo+0) == 0x3</code>. Otherwise, value=0.
 
[[#GetBackgroundNetworkUpdateState]] always returns Result 0, however this will assert if GetSystemUpdateTaskInfo fails with ret!=0x3C89.
 
= SystemUpdateProgress =
This is "nn::ns::SystemUpdateProgress". This is a 0x10-byte struct.
 
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0 || 0x8 || Loaded (this value can be larger than total_size when the async operation is finishing and when total_size is <=0, this current_size field may contain a progress value for when the total_size is not yet determined)
|-
| 0x8 || 0x8 || Total (this field is only valid when >0)
|}
 
Commands which have this as output will return 0 with the output cleared, when no task is available.
 
= 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.
 
[20.0.0+] The used (New)SystemUpdateMetaId as selected by NewSystemUpdateMetaIdFlag must now match one of the Ids in [[System_Settings|system-setting]] <code>contents_delivery!acceptable_system_update_ids_string</code>.
 
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0 || 0x4 || SystemDeliveryProtocolVersion. Must be <= to and match [[System_Settings|system-setting]] <code>contents_delivery!system_delivery_protocol_version</code>.
|-
| 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 || 0x1 || HasExFat. Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation.
|-
| 0x9 || 0x3 || Reserved.
|-
| 0xC || 0x4 || SystemUpdateMetaVersion.
|-
| 0x10 || 0x8 || SystemUpdateMetaId.
|-
| 0x18 || 0x1 || FirmwareVariationId. Used by [[#RequestSendSystemUpdate]].
|-
| 0x19 || 0x1 || UpdatableFirmwareGroupId. Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation.
|-
| 0x1A || 0x1 || PlatformRegion (0x00 = Unknown, 0x01 = Global, 0x02 = China).
|-
| 0x1B || 0x1 || [20.0.0+] SystemDeliveryInfoPlatform. Loaded from [[System_Settings|system-setting]] <code>ns.systemupdate!system_delivery_info_platform</code>. Elsewhere this is compared against the sys-setting, etc.
|-
| 0x1C || 0x1 || [20.0.0+] NewSystemUpdateMetaIdFlag. When non-zero, NewSystemUpdateMetaId is used instead of SystemUpdateMetaId. Always set to 0x1 by [[#GetSystemDeliveryInfo]] with [20.0.0+].
|-
| 0x1D || 0x3 || Padding
|-
|-
| 0x19 || 0x1 || UpdatableFirmwareGroupId. Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation.
| 0x20 || 0x8 || [20.0.0+] NewSystemUpdateMetaId. See above. With [20.0.0+] [[#GetSystemDeliveryInfo]] now writes the Id here instead of SystemUpdateMetaId.
|-
| 0x1A || 0x1 || PlatformRegion (0x00 = Unknown, 0x01 = Global, 0x02 = China).
|-
|-
| 0x1B || 0xC5 || Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation.
| 0x28 || 0xB8 || 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.