NS services: Difference between revisions

No edit summary
 
(71 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 430: Line 398:
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 ===
== ListApplicationContentMetaStatus ==
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.
 
= 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 a permissions check for service+command.
 
[11.0.0+] ns:ro was added.
 
[15.0.0+] ns:sweb was added.
 
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Value
! Cmd || Name || Permission bit
! Description
|-
| 7988 || [6.0.0+] [[#IDynamicRightsInterface|GetDynamicRightsInterface]] || 10
|-
|-
| 0x0
| 7989 || [5.1.0+] [[#IReadOnlyApplicationControlDataInterface|GetReadOnlyApplicationControlDataInterface]] || 9
| CacheOnly (Returns data from cache)
|-
|-
| 0x1
| 7991 || [5.0.0+] [[#IReadOnlyApplicationRecordInterface|GetReadOnlyApplicationRecordInterface]] || 8
| Storage (Returns data from storage if not present in cache)
|-
|-
| 0x2
| 7992 || [4.0.0+] [[#IECommerceInterface|GetECommerceInterface]] || 7
| StorageOnly (Returns data from storage without using cache)
|}
 
== 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.
 
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:
{| class="wikitable" border="1"
|-
|-
! Offset
| 7993 || [4.0.0+] [[#IApplicationVersionInterface|GetApplicationVersionInterface]] || 6
! Size
! Description
|-
|-
| 0x0
| 7994 || [[#IFactoryResetInterface|GetFactoryResetInterface]] || 5
| 0x1
| [[NCM_services#ContentMetaType|ContentMetaType]] ("type")
|-
|-
| 0x1
| 7995 || [[#IAccountProxyInterface|GetAccountProxyInterface]] || 4
| 0x1
| [[NCM_services#StorageId|StorageId]] ("installedStorage")
|-
|-
| 0x2
| 7996 || [[#IApplicationManagerInterface|GetApplicationManagerInterface]] || 3
| 0x1
| Unknown. Non-zero with output from cmd 605, differs for app/update titles.
|-
|-
| 0x3
| 7997 || [[#IDownloadTaskInterface|GetDownloadTaskInterface]] || 1
| 0x1
| Padding
|-
|-
| 0x4
| 7998 || [[#IContentManagementInterface|GetContentManagementInterface]] || 0
| 0x4
| Version
|-
|-
| 0x8
| 7999 || [[#IDocumentInterface|GetDocumentInterface]] || 2
| 0x8
| [[NCM_services#ApplicationId|ApplicationId]]
|}
|}


= ns:am2, ns:ec, ns:rid, ns:rt, ns:web, ns:ro, ns:sweb =
Permissions state field with each service:
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.
 
[11.0.0+] ns:ro was added.
 
[15.0.0+] ns:sweb was added.


{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Cmd || Name
! Service || Permissions
|-
| 7988 || [6.0.0+] [[#IDynamicRightsInterface|GetDynamicRightsInterface]]
|-
| 7989 || [5.1.0+] [[#IReadOnlyApplicationControlDataInterface|GetReadOnlyApplicationControlDataInterface]]
|-
| 7991 || [5.0.0+] [[#IReadOnlyApplicationRecordInterface|GetReadOnlyApplicationRecordInterface]]
|-
| 7992 || [4.0.0+] [[#IECommerceInterface|GetECommerceInterface]]
|-
|-
| 7993 || [4.0.0+] [[#IApplicationVersionInterface|GetApplicationVersionInterface]]
| ns:web || 0x304
|-
|-
| 7994 || [[#IFactoryResetInterface|GetFactoryResetInterface]]
| ns:ec || 0x83
|-
|-
| 7995 || [[#IAccountProxyInterface|GetAccountProxyInterface]]
| ns:sweb || 0x387
|-
|-
| 7996 || [[#IApplicationManagerInterface|GetApplicationManagerInterface]]
| ns:rid || 0x10
|-
|-
| 7997 || [[#IDownloadTaskInterface|GetDownloadTaskInterface]]
| ns:rt || 0x20
|-
|-
| 7998 || [[#IContentManagementInterface|GetContentManagementInterface]]
| ns:ro || 0x301
|-
|-
| 7999 || [[#IDocumentInterface|GetDocumentInterface]]
| ns:am2 || 0x7FF
|}
|}


Line 729: Line 670:
|-
|-
| 307 || TerminateOverlayApplet
| 307 || TerminateOverlayApplet
|-
| 308 || [S2]
|-
| 309 || [S2]
|-
|-
| 400 || [[#GetApplicationControlData]]
| 400 || [[#GetApplicationControlData]]
Line 747: Line 692:
|-
|-
| 408 || [8.0.0+] [[#ListApplicationIcon]]
| 408 || [8.0.0+] [[#ListApplicationIcon]]
|-
| 409 || [S2]
|-
| 410 || [S2]
|-
|-
| 411 || [19.0.0+]
| 411 || [19.0.0+]
Line 760: Line 709:
| 416 || [19.0.0+]
| 416 || [19.0.0+]
|-
|-
| 417 || [19.0.0+]
| 417 || [19.0.0+] InvalidateAllApplicationControlCacheOfTheStage
|-
|-
| 418 || [19.0.0+]
| 418 || [19.0.0+] InvalidateApplicationControlCacheOfTheStage
|-
|-
| 419 || [19.0.0+]
| 419 || [19.0.0+] RequestDownloadApplicationControlDataInBackground
|-
|-
| 420 || [19.0.0+]
| 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 752:
|-
|-
| 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 863: Line 832:
|-
|-
| 916 || [11.0.0+] IsApplicationAutoDeleteDisabled
| 916 || [11.0.0+] IsApplicationAutoDeleteDisabled
|-
| 917 || [20.0.0+]
|-
| 918 || [20.0.0+]
|-
| 919 || [20.0.0+]
|-
| 920 || [20.0.0+]
|-
| 921 || [20.0.0+]
|-
| 922 || [20.0.0+]
|-
| 923 || [20.0.0+]
|-
| 924 || [S2]
|-
| 925 || [S2]
|-
| 926 || [S2]
|-
| 927 || [S2]
|-
| 928 || [20.0.0+]
|-
| 929 || [20.0.0+]
|-
| 930 || [20.0.0+]
|-
| 931 || [20.0.0+]
|-
| 933 || [20.1.0+]
|-
|-
| 1000 || [[#RequestVerifyApplicationDeprecated]]
| 1000 || [[#RequestVerifyApplicationDeprecated]]
Line 913: Line 914:
|-
|-
| 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 940:
|-
|-
| 1705 || [11.0.0+] [[#IsPatchAutoDeletableApplication]]
| 1705 || [11.0.0+] [[#IsPatchAutoDeletableApplication]]
|-
| 1706 || [20.0.0+]
|-
|-
| 1800 || IsNotificationSetupCompleted
| 1800 || IsNotificationSetupCompleted
Line 934: Line 947:
| 1801 || GetLastNotificationInfoCount
| 1801 || GetLastNotificationInfoCount
|-
|-
| 1802 || ListLastNotificationInfo
| 1802 || [[#ListLastNotificationInfo]]
|-
|-
| 1803 || [3.0.0+] ListNotificationTask
| 1803 || [3.0.0+] [[#ListNotificationTask]]
|-
|-
| 1900 || [3.0.0-12.1.0] IsActiveAccount
| 1900 || [3.0.0-12.1.0] IsActiveAccount
Line 983: Line 996:
|-
|-
| 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,038:
|-
|-
| 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,056: Line 1,077:
| 2361 || [19.0.0+] GetMaxApplicationDownloadTaskCount
| 2361 || [19.0.0+] GetMaxApplicationDownloadTaskCount
|-
|-
| 2400 || [8.0.0+] [[#GetPromotionInfo]]
| 2362 || [20.0.0+]
|-
|-
| 2401 || [8.0.0+] CountPromotionInfo
| 2363 || [20.0.0+]
|-
|-
| 2402 || [8.0.0+] ListPromotionInfo
| 2364 || [20.0.0+]
|-
|-
| 2403 || [8.0.0+] [[#ImportPromotionJsonForDebug]]
| 2365 || [20.0.0+]
|-
|-
| 2404 || [8.0.0+] [[#ClearPromotionInfoForDebug]]
| 2366 || [20.0.0+]
|-
| 2367 || [20.0.0+]
|-
| 2368 || [20.0.0+]
|-
| 2400 || [8.0.0+] [[#GetPromotionInfo]]
|-
| 2401 || [8.0.0+] CountPromotionInfo
|-
| 2402 || [8.0.0+] [[#ListPromotionInfo|ListPromotionInfo]]
|-
| 2403 || [8.0.0+] [[#ImportPromotionJsonForDebug]]
|-
| 2404 || [8.0.0+] [[#ClearPromotionInfoForDebug]]
|-
|-
| 2500 || [8.0.0+] ConfirmAvailableTime
| 2500 || [8.0.0+] ConfirmAvailableTime
Line 1,095: Line 1,130:
|-
|-
| 2524 || [19.0.0+]  
| 2524 || [19.0.0+]  
|-
| 2525 || [20.0.0+]
|-
|-
| 2800 || [9.0.0+] GetApplicationIdOfPreomia
| 2800 || [9.0.0+] GetApplicationIdOfPreomia
Line 1,132: Line 1,169:
| 3050 || [14.0.0+] ListAssignELicenseTaskResult
| 3050 || [14.0.0+] ListAssignELicenseTaskResult
|-
|-
| 3100 || [17.0.0+] GetSafeSystemVersionCheckInfo
| 3100 || [17.0.0+] [[#GetSafeSystemVersionCheckInfo|GetSafeSystemVersionCheckInfo]]
|-
|-
| 3101 || [17.0.0+] RequestUpdateSafeSystemVersionCheckInfo
| 3101 || [17.0.0+] [[#RequestUpdateSafeSystemVersionCheckInfo|RequestUpdateSafeSystemVersionCheckInfo]]
|-
|-
| 3102 || [17.0.0+] ResetSafeSystemVersionCheckInfo
| 3102 || [17.0.0+] [[#ResetSafeSystemVersionCheckInfo|ResetSafeSystemVersionCheckInfo]]
|-
|-
| 3104 || [18.0.0+] GetApplicationNintendoLogo
| 3104 || [18.0.0+] GetApplicationNintendoLogo
Line 1,142: Line 1,179:
| 3105 || [18.0.0+] GetApplicationStartupMovie
| 3105 || [18.0.0+] GetApplicationStartupMovie
|-
|-
| 5000 || [18.0.0+]  
| 3150 || [S2]
|-
| 4000 || [20.0.0+]
|-
| 4004 || [20.0.0+]
|-
| 4006 || [20.0.0+]
|-
| 4007 || [20.0.0+]
|-
| 4008 || [20.0.0+]
|-
| 4009 || [20.0.0+]
|-
| 4010 || [20.0.0+]
|-
| 4011 || [20.0.0+]
|-
| 4012 || [20.0.0+]
|-
| 4013 || [20.0.0+]
|-
| 4015 || [20.0.0+]
|-
| 4017 || [20.0.0+]
|-
| 4019 || [20.0.0+]
|-
|-
| 5001 || [18.0.0+]  
| 4020 || [20.0.0+]
|-
|-
| 9999 || [10.0.0-10.2.0] GetApplicationCertificate
| 4021 || [20.0.0+]
|}
|-
 
| 4022 || [20.0.0+]
[4.0.0+] RequestDownloadAddOnContent now takes an additional 8-bytes of input.
|-
 
| 4023 || [20.0.0+]
==== GetApplicationRecordUpdateSystemEvent ====
|-
No input, returns an output Event handle with EventClearMode=1.
| 4024 || [20.0.0+]
 
|-
==== GetApplicationViewDeprecated ====
| 4025 || [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.
|-
 
| 4026 || [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]].
|-
 
| 4027 || [20.0.0+]
==== DeleteApplicationEntity ====
|-
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.
| 4028 || [20.0.0+]
 
|-
==== DeleteApplicationCompletely ====
| 4029 || [20.0.0+]
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.
|-
 
| 4030 || [20.0.0+]
==== DeleteRedundantApplicationEntity ====
|-
No input/output.
| 4031 || [20.0.0+]
 
|-
==== IsApplicationEntityMovable ====
| 4032 || [20.0.0+]
Takes an input u8 [[NCM_services#StorageId|StorageId]], an [[NCM_services#ApplicationId|ApplicationId]], returns an output u8 bool.
|-
 
| 4033 || [20.0.0+]
==== MoveApplicationEntity ====
|-
Takes an input u8 [[NCM_services#StorageId|StorageId]], an [[NCM_services#ApplicationId|ApplicationId]], no output.
| 4034 || [20.0.0+]
 
|-
==== RequestApplicationUpdateInfo ====
| 4035 || [20.0.0+]
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncValue]].
|-
 
| 4037 || [20.0.0+]
The data that can be read from the [[#IAsyncValue]] is [[#ApplicationUpdateInfo]].
|-
 
| 4038 || [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.
|-
 
| 4039 || [20.0.0+]
==== CancelApplicationDownload ====
|-
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.
| 4040 || [20.0.0+]
 
|-
==== ResumeApplicationDownload ====
| 4041 || [20.0.0+]
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.
|-
 
| 4042 || [20.0.0+]
==== CheckApplicationLaunchVersion ====
|-
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.
| 4043 || [20.0.0+]
 
|-
==== CalculateApplicationDownloadRequiredSize ====
| 4044 || [20.0.0+]
Takes an input u8 [[NCM_services#StorageId|StorageId]], an [[NCM_services#ApplicationId|ApplicationId]], returns an output s64.
|-
 
| 4045 || [20.0.0+]
==== CleanupSdCard ====
|-
No input/output.
| 4046 || [20.0.0+]
 
|-
==== GetSdCardMountStatusChangedEvent ====
| 4049 || [20.0.0+]
No input, returns an output Event handle with EventClearMode=0.
|-
 
| 4050 || [20.0.0+]
==== GetGameCardUpdateDetectionEvent ====
|-
No input, returns an output Event handle with EventClearMode=0.
| 4051 || [20.0.0+]
 
|-
==== DisableApplicationAutoDelete ====
| 4052 || [20.0.0+]
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.
|-
 
| 4053 || [20.0.0+]
==== EnableApplicationAutoDelete ====
|-
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.
| 4054 || [20.0.0+]
 
|-
==== SetApplicationTerminateResult ====
| 4055 || [20.0.0+]
Takes an input u32 Result, an [[NCM_services#ApplicationId|ApplicationId]], no output.
|-
 
| 4056 || [20.0.0+]
==== ClearApplicationTerminateResult ====
|-
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.
| 4057 || [20.0.0+]
 
|-
==== GetLastSdCardMountUnexpectedResult ====
| 4058 || [20.0.0+]
No input/output.
|-
 
| 4059 || [20.0.0+]
==== GetRequestServerStopper ====
|-
No input, returns an output [[#IRequestServerStopper]].
| 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
|}
 
[4.0.0+] RequestDownloadAddOnContent now takes an additional 8-bytes of input.
 
==== GetApplicationRecordUpdateSystemEvent ====
No input, returns an output Event handle with EventClearMode=1.
 
==== GetApplicationViewDeprecated ====
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.


==== CancelApplicationApplyDelta ====
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]].
 
==== 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.
This increfs a state ref-count, with decref being handled when the object is closed. This ref-count is checked by [[#GetApplicationDeliveryInfo|GetApplicationDeliveryInfo]] and related cmds.


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


==== DeleteUserSaveDataAll ====
==== CalculateApplicationApplyDeltaRequiredSize ====
Takes an input [[Account_services#Uid|Uid]], returns an output [[#IProgressMonitorForDeleteUserSaveDataAll]].
Takes an input u8 [[NCM_services#StorageId|StorageId]], an [[NCM_services#ApplicationId|ApplicationId]], returns an output s64.


On success, [[#IProgressMonitorForDeleteUserSaveDataAll]] GetProgress is used with the output being copied into object state.
==== ResumeAll ====
No input/output.


==== DeleteUserSystemSaveData ====
==== GetStorageSize ====
Takes an input [[Account_services#Uid|Uid]], an u64 SystemSaveDataId, no output.
Takes an input u8 [[NCM_services#StorageId|StorageId]], returns two output s64s.


==== DeleteSaveData ====
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 u8 [[Filesystem_services#SaveDataSpaceId|SaveDataSpaceId]], an u64 SaveDataId, no output.


==== UnregisterNetworkServiceAccount ====
==== RequestUpdateApplication2 ====
Takes an input [[Account_services#Uid|Uid]], no output.
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].


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


==== LaunchLibraryApplet ====
==== LaunchApplication ====
Takes an input u64 [[NCM_services#ProgramId|ProgramId]], returns an output u64.
Takes an input u8 ProgramIndex, an input [[#ApplicationLaunchInfo]], 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.
[18.0.0+] Now takes a total of 0x58 bytes of input.


This is used by [[Applet_Manager_services|AM]].
[19.0.0+] Now takes a total of 0x88 bytes of input.


==== LaunchSystemApplet ====
==== GetApplicationLaunchInfo ====
No input, returns an output u64.
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output [[#ApplicationLaunchInfo]].


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>.
[18.0.0+] Now returns a total of 0x50 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.
[19.0.0+] Now returns a total of 0x80 bytes of output.


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


==== LaunchOverlayApplet ====
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.
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>.
[18.0.0+] Now returns a total of 0x50 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.
[19.0.0+] Now returns a total of 0x80 bytes of output.


This is used by [[Applet_Manager_services|AM]].
==== GetMainApplicationProgramIndexByApplicationLaunchInfo ====
[18.0.0+] Now takes a total of 0x50 bytes of input.


==== RequestDownloadApplicationControlData ====
[19.0.0+] Now returns a total of 0x80 bytes of output.
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].


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


==== GetApplicationControlProperty ====
This is used by AM cmd [[Applet_Manager_services#LaunchDevMenu|LaunchDevMenu]].
[18.0.0+] Now takes a total of 0x58 bytes of input.


==== ListApplicationTitle ====
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.
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.
[[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.


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


The TransferMemory size must be at least: count*sizeof([[NACP_Format|title-entry]]) + count*sizeof(u64) + count*[[#GetApplicationControlData|0x24000]].
On success, [[#IProgressMonitorForDeleteUserSaveDataAll]] GetProgress is used with the output being copied into object state.


This is essentially an async wrapper for [[#GetApplicationControlData]], with support for multiple ApplicationIds.
==== DeleteUserSystemSaveData ====
Takes an input [[Account_services#Uid|Uid]], an u64 SystemSaveDataId, no output.


==== ListApplicationIcon ====
==== DeleteSaveData ====
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 u8 [[Filesystem_services#SaveDataSpaceId|SaveDataSpaceId]], an u64 SaveDataId, no output.


The user-process creates the TransferMemory with permissions=R--.
==== UnregisterNetworkServiceAccount ====
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.
==== UnregisterNetworkServiceAccountWithUserSaveDataDeletion ====
Takes an input [[Account_services#Uid|Uid]], no output.


The TransferMemory size must be at least: 0x4 + count*sizeof(u64) + count*[[#GetApplicationControlData|0x20000]] + count*sizeof(u64) + [[#GetApplicationControlData|0x24000]].
==== LaunchLibraryApplet ====
Takes an input u64 [[NCM_services#ProgramId|ProgramId]], returns an output u64.


This is essentially an async wrapper for [[#GetApplicationControlData]], with support for multiple ApplicationIds.
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.


==== RequestCheckGameCardRegistration ====
This is used by [[Applet_Manager_services|AM]].
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].


See [[#RequestApplicationUpdateInfo]] regarding nifm.
==== LaunchSystemApplet ====
No input, returns an output u64.


==== RequestGameCardRegistrationGoldPoint ====
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 [[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.
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.


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


==== RequestRegisterGameCard ====
==== LaunchOverlayApplet ====
Takes an input s32, an [[Account_services#Uid|Uid]], an [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].
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>.


==== GetGameCardMountFailureEvent ====
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.
No input, returns an output Event handle with EventClearMode=0.


==== IsGameCardInserted ====
This is used by [[Applet_Manager_services|AM]].
No input, returns an output u8 bool.


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


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


==== ListApplicationIdOnGameCard ====
==== GetApplicationControlProperty ====
Takes a type-0x6 output buffer containing an array of u64 [[NCM_services#ApplicationId|ApplicationIds]], returns an output s32 for total output entries.
[18.0.0+] Now takes a total of 0x58 bytes of input.


==== GetGameCardPlatformRegion ====
==== ListApplicationTitle ====
No input, returns an u8 '''GameCardPlatformRegion''' (0x00 = Global, 0x01 = China).
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]].


This calls [[Filesystem_services#IDeviceOperator|fsp-srv IDeviceOperator]] GetGameCardCompatibilityType and returns the result.
[[qlaunch]] uses value 0x1 for the u8.


==== ListAvailableAddOnContent ====
The user-process creates the TransferMemory with permissions=R--.
[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.
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.


==== RequestDownloadTaskListData ====
The TransferMemory size must be at least: count*sizeof([[NACP_Format|title-entry]]) + count*sizeof(u64) + count*[[#GetApplicationControlData|0x24000]].
No input, returns an output Event handle and an [[#IAsyncValue]].


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


==== IsApplicationUpdateRequested ====
==== ListApplicationIcon ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output u8 bool and an u32.
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]].


The output u32 is only valid when the output bool is set.
The user-process creates the TransferMemory with permissions=R--.


==== WithdrawApplicationUpdateRequest ====
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]], no output.


==== RequestVerifyApplicationDeprecated ====
The TransferMemory size must be at least: 0x4 + count*sizeof(u64) + count*[[#GetApplicationControlData|0x20000]] + count*sizeof(u64) + [[#GetApplicationControlData|0x24000]].
Takes an input TransferMemory handle, an [[NCM_services#ApplicationId|ApplicationId]], an u64 size, returns an output Event handle and an [[#IProgressAsyncResult]].


On newer system-versions this calls the same func as [[#RequestVerifyApplication]], with the u32 value set to 0x7.
This is essentially an async wrapper for [[#GetApplicationControlData]], with support for multiple ApplicationIds.


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


==== RequestVerifyApplication ====
See [[#RequestApplicationUpdateInfo]] regarding nifm.
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.
==== RequestGameCardRegistrationGoldPoint ====
Takes an input [[Account_services#Uid|Uid]], an [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncValue]].


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]].
The data that can be read from the [[#IAsyncValue]] is 4-bytes.


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


==== CleanupUnavailableAddOnContents ====
==== RequestRegisterGameCard ====
Takes an input u64 [[NCM_services#ApplicationId|ApplicationId]], an [[Account_services#Uid|Uid]], no output.
Takes an input s32, an [[Account_services#Uid|Uid]], an [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].


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


The TransferMemory uses permissions=0.
==== GetGameCardMountFailureEvent ====
No input, returns an output Event handle with EventClearMode=0.


==== EstimateSizeToMove ====
==== IsGameCardInserted ====
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.
No input, returns an output u8 bool.


This calls a func also used by [[#RequestMoveApplicationEntity]], then calls another func.
==== EnsureGameCardAccess ====
 
==== FormatSdCard ====
No input/output.
No input/output.


==== NeedsSystemUpdateToFormatSdCard ====
==== GetLastGameCardMountFailureResult ====
No input, returns an output u8 bool.
 
==== GetLastSdCardFormatUnexpectedResult ====
No input/output.
No input/output.


==== GetApplicationView ====
==== ListApplicationIdOnGameCard ====
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.
Takes a type-0x6 output buffer containing an array of u64 [[NCM_services#ApplicationId|ApplicationIds]], returns an output s32 for total output entries.


==== GetApplicationViewDownloadErrorContext ====
==== GetGameCardPlatformRegion ====
Takes a type-0x16 output buffer containg an [[Error_Applet#ErrorContext|ErrorContext]], an u64 [[NCM_services#ApplicationId|ApplicationId]], no output.
No input, returns an u8 '''GameCardPlatformRegion''' (0x00 = Global, 0x01 = China).


==== GetApplicationViewWithPromotionInfo ====
This calls [[Filesystem_services#IDeviceOperator|fsp-srv IDeviceOperator]] GetGameCardCompatibilityType and returns the result.
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 ====
==== ListAvailableAddOnContent ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output bool.
[10.0.0+] This now takes a total of 0x10-bytes of input instead of a total of 0x18-bytes of input.


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.
[15.0.0+] This now takes a total of 0x8-bytes of input instead of a total of 0x10-bytes of input.


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


See [[#RequestApplicationUpdateInfo]] regarding nifm.
==== TouchApplication ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.


==== GetSystemDeliveryInfo ====
==== IsApplicationUpdateRequested ====
Takes a type-0x16 output buffer containing a [[#SystemDeliveryInfo]], no output.
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output u8 bool and an u32.


This generates a [[#SystemDeliveryInfo]] using the currently installed SystemUpdate meta title.
The output u32 is only valid when the output bool is set.


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


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.
==== RequestVerifyApplicationDeprecated ====
Takes an input TransferMemory handle, an [[NCM_services#ApplicationId|ApplicationId]], an u64 size, returns an output Event handle and an [[#IProgressAsyncResult]].


==== VerifyDeliveryProtocolVersion ====
On newer system-versions this calls the same func as [[#RequestVerifyApplication]], with the u32 value set to 0x7.
Takes a type-0x15 input buffer containing a [[#SystemDeliveryInfo]], 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.
==== RequestVerifyAddOnContentsRights ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IProgressAsyncResult]].


==== GetApplicationDeliveryInfo ====
==== RequestVerifyApplication ====
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.
Takes an input TransferMemory handle, an u32, an [[NCM_services#ApplicationId|ApplicationId]], an u64 size, returns an output Event handle and an [[#IProgressAsyncResult]].


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).
Official sw creates the TransferMemory with an user-specified buffer with permissions=0. [[qlaunch]] uses buffer size 0x100000.


==== HasAllContentsToDeliver ====
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-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.
==== IsAnyApplicationEntityInstalled ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output u8 bool.


==== CompareApplicationDeliveryInfo ====
==== CleanupUnavailableAddOnContents ====
Takes two type-0x5 input buffers containing an array of [[#ApplicationDeliveryInfo]], returns an output s32.
Takes an input u64 [[NCM_services#ApplicationId|ApplicationId]], an [[Account_services#Uid|Uid]], no output.


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


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


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


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 calls a func also used by [[#RequestMoveApplicationEntity]], then calls another func.


==== ListContentMetaKeyToDeliverApplication ====
==== FormatSdCard ====
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.
No input/output.


The array-count for ContentMetaKey must be at least 1, and for ApplicationDeliveryInfo it must match 1.
==== NeedsSystemUpdateToFormatSdCard ====
No input, returns an output u8 bool.


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


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


The array-count must match 1.
==== GetApplicationViewDownloadErrorContext ====
Takes a type-0x16 output buffer containg an [[Error_Applet#ErrorContext|ErrorContext]], an u64 [[NCM_services#ApplicationId|ApplicationId]], no output.


After validation etc, this sets the output bool by comparing system-version fields in the [[#SystemDeliveryInfo]]/[[#ApplicationDeliveryInfo]] and with a state field.
==== 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.


==== EstimateRequiredSize ====
==== IsPatchAutoDeletableApplication ====
Takes a type-0x5 input buffer containing an array of [[NCM_services#ContentMetaKey|ContentMetaKey]], returns an output s64.
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output bool.


When the array-count is less than 1, this will return 0 with the s64 set to 0.
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.


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


[[qlaunch]] uses value Any for the StorageId, and value 55556 for the port.
[19.0.0+] The struct size is now 0x98-bytes.


An error is thrown if a state ref-count is zero. An error is thrown if [[NIM_services|nim]] ListApplicationApplyDeltaTask returns a task.
==== ListNotificationTask ====
Takes a type-0x6 buffer containing an array with struct entry size 0xB0-bytes. Returns 4-bytes of output.


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


This does various setup then creates the [[#IAsyncResult]] + the async thread which handles the [[#IAsyncResult]] operation. Then the thread does:
==== RequestDownloadApplicationPrepurchasedRights ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].


* Calls a func which does:
See [[#RequestApplicationUpdateInfo]] regarding nifm.
** 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>.


==== CommitReceiveApplication ====
==== GetSystemDeliveryInfo ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.
Takes a type-0x16 output buffer containing a [[#SystemDeliveryInfo]], no output.


==== GetReceiveApplicationProgress ====
This generates a [[#SystemDeliveryInfo]] using the currently installed SystemUpdate meta title.
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output [[#ReceiveApplicationProgress]].


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


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.
This determines the latest version (RequiredSystemVersion) from the input [[#ApplicationDeliveryInfo]] array (ApplicationDeliveryProtocolVersion and the HMAC are also validated), using value 0 if the array is empty.


==== RequestSendApplication ====
* [20.0.0+] The following code block now only runs when the SystemDeliveryInfoPlatform from the type-0x15 [[#SystemDeliveryInfo]] buffer matches the [[System_Settings|sys-setting]].
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]].
** It then loops through the [[#ApplicationDeliveryInfo]] array again:
** This uses functionality which essentially uses [[Shared_Database_services|pl:s]] GetFunctionBlackListSystemVersionToAuthorize with the [[#ApplicationDeliveryInfo]] ApplicationId and ApplicationFunctionAuthorizationId=0x5 then parses the output, using cached data if available. The error is returned on failure.
** tmp_version = out_u8 == 0 ? 0 : out_u32 + 0x10000;
** Then the current latest-version value is updated with tmp_version, if tmp_version is higher.


[[qlaunch]] uses value 55556 for the port.
If this version value is less than a state field, the state field value is used instead (state field originates from [[System_Settings|system-setting]] <code>contents_delivery!required_system_version_to_deliver_application</code>).


An error is thrown if a state ref-count is zero. An error is thrown if [[NIM_services|nim]] ListApplicationApplyDeltaTask returns a task.
Then this selects the [[#SystemDeliveryInfo]] with the latest version from the input array. The output s32 is an index in that array for the selected entry, -1 if none found.


The [[NCM_services#ContentMetaType|ContentMetaType]] must match Patch.
During the above loop it first calls the [[#SystemDeliveryInfo]] validation func, returning the Result on failure. Then it runs additional validation, with the [[#SystemDeliveryInfo]] entry being ignored on failure:
* The above latest-version value must be at least the version value from the type-0x15 [[#SystemDeliveryInfo]] buffer and the [[#SystemDeliveryInfo]] array entry.
* When HasExFat is set in the type-0x15 [[#SystemDeliveryInfo]] buffer, it must be set in the [[#SystemDeliveryInfo]] array entry.
* FirmwareVariationId in the type-0x15 [[#SystemDeliveryInfo]] buffer must not be 0xFF.
* UpdatableFirmwareGroupId in the [[#SystemDeliveryInfo]] array entry must not be 0xFF. The value must be within bounds of the settings array ([[System_Settings|sys-settings]] <code>contents_delivery!updatable_firmware_group_string</code>).
* PlatformRegion in the [[#SystemDeliveryInfo]] array entry and the type-0x15 [[#SystemDeliveryInfo]] buffer must match.
* Lastly when the following is true, this indicates success: (settings_array[UpdatableFirmwareGroupId] >> {above FirmwareVariationId}) & 1.


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


* Calls a func which does:
This validates the [[#SystemDeliveryInfo]] HMAC and the protocol-version fields. Then an error is returned when SystemUpdateVersion is less than a state field, otherwise 0 is returned (state field originates from [[System_Settings|system-setting]] <code>contents_delivery!required_system_version_to_deliver_application</code>).
** 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 ====
==== GetApplicationDeliveryInfo ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output [[#SendApplicationProgress]].
Takes a type-0x6 output buffer containing an array of [[#ApplicationDeliveryInfo|ApplicationDeliveryInfo]], an input u32 bitmask <code>nn::ns::ApplicationDeliveryAttributeTag</code>, an [[NCM_services#ApplicationId|ApplicationId]], and returns an output s32 total_out.


Same as [[#GetReceiveApplicationProgress]] except this is the Send version, and uses [[NIM_services|nim]] cmd68/cmd63 instead.
[11.0.0+] An error is thrown if LocalContentShare is not [[#IsLocalContentShareEnabled|enabled]].


==== CompareSystemDeliveryInfo ====
An error is thrown if any bit is set in ApplicationDeliveryAttributeTag besides bit1, this must also be <=0x3. 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 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.
[7.0.0+] An error is thrown if the state ref-count for [[#GetRequestServerStopper|RequestServerStopper]] is zero. [7.0.0-7.0.1] The func which checks this would also return success when a field prior to the previously mentioned field is 0 (checked before the ref-count).


==== ListNotCommittedContentMeta ====
An error is thrown if [[NIM_services|nim]] ListApplicationApplyDeltaTask returns a task.
Takes a type-0x6 output buffer containing an array of [[NCM_services#ContentMetaKey|ContentMetaKey]], a s32, an [[NCM_services#ApplicationId|ApplicationId]], returns an output s32 total_out.


==== RecoverDownloadTask ====
HasApplicationRecord is called with the input [[NCM_services#ApplicationId|ApplicationId]], an error is returned if the record isn't found.
Takes a type-0x5 input buffer containing an array of {unknown} and an input u64, no output.


==== GetApplicationDeliveryInfoHash ====
[[#ApplicationDeliveryInfo|RequiredApplicationVersion]] is initially set to the output version from [[Shared_Database_services|avm]] GetLaunchRequiredVersion. Later when ContentMetaType == Application etc, it calls a func. This func uses [[NCM_services|ncm]] IContentMetaDatabase GetRequiredApplicationVersion. If the output version is higher than the [[#ApplicationDeliveryInfo|RequiredApplicationVersion]] field then the output version is written here. Immediately aferwards, it also checks whether the bit for Compacted is set from [[NCM_services|ncm]] IContentMetaDatabase GetAttributes, clearing [[#ApplicationDeliveryInfo|ApplicationVersion]] if the attribute is set.
Takes a type-0x5 input buffer containing an array of [[#ApplicationDeliveryInfo]], returns an output 0x20-byte SHA256 hash.


This extracts data from the input array for hashing with SHA256, with validation being done when handling each entry.
[20.0.0+] [[#ApplicationDeliveryInfo|ApplicationDeliveryInfo]] ContentMetaPlatform and ProperProgramExists are now set using data from [[NCM_services|ncm]].


==== GetApplicationRightsOnClient ====
[20.0.0+] [[Shared_Database_services|pl:s]] GetFunctionBlackListSystemVersionToAuthorize with ApplicationFunctionAuthorizationId=0x5 is now used, the output version is written to [[#ApplicationDeliveryInfo|RequiredSystemVersion]] when it's higher than the value previously written here.
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.
[20.0.0+] [[Shared_Database_services|pl:s]] GetRequiredApplicationVersion with ApplicationFunctionAuthorizationId=0x5 is now used, the output version is written to [[#ApplicationDeliveryInfo|RequiredApplicationVersion]] when it's higher than the value previously written here.


For the output array count, [[qlaunch]] uses value 3.
==== HasAllContentsToDeliver ====
Takes a type-0x5 input buffer containing an array of [[#ApplicationDeliveryInfo]], returns an output u8 bool.


==== GetApplicationTerminateResult ====
The array-count must match 1.
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output u32 Result.


==== GetRightsEnvironmentHandleForApplication ====
This uses the same LocalContentShare check as [[#GetApplicationDeliveryInfo|GetApplicationDeliveryInfo]].
No input, returns a total of 8-bytes of output.


[9.0.0+] Now takes a total of 8-bytes of input, returns a total of 8-bytes of output.
After validating the [[#ApplicationDeliveryInfo]], the output bool is set to [[#ApplicationDeliveryInfo|ApplicationDeliveryAttributeTag]] & 0x10000002 != 0x2, then this returns 0.


==== RequestNoDownloadRightsErrorResolution ====
==== CompareApplicationDeliveryInfo ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncValue]].
Takes two type-0x5 input buffers containing an array of [[#ApplicationDeliveryInfo]], returns an output s32.


The data that can be read from the [[#IAsyncValue]] is [[#NoDownloadRightsErrorResolution]].
This uses the same LocalContentShare check as [[#GetApplicationDeliveryInfo|GetApplicationDeliveryInfo]].


See [[#RequestApplicationUpdateInfo]] regarding nifm.
The array-count for both buffers must be 1, otherwise an error is returned.


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


See [[#RequestApplicationUpdateInfo]] regarding nifm.
The array-count for the second buffer must be 1, otherwise an error is returned.


==== GetPromotionInfo ====
This uses the same LocalContentShare check as [[#GetApplicationDeliveryInfo|GetApplicationDeliveryInfo]].
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.
The second [[#ApplicationDeliveryInfo]] buffer is validated. An error is thrown when [[#ApplicationDeliveryInfo|ApplicationDeliveryAttributeTag]] (second buffer) & 0x3 != 0x2, likewise when bit28 is clear in this field (bitmask 0x10000000).


==== ImportPromotionJsonForDebug ====
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. The first [[#ApplicationDeliveryInfo]] buffer is validated. An error is thrown when [[#ApplicationDeliveryInfo|ApplicationDeliveryAttributeTag]] (first buffer) bit1 is clear or bit0 set. An error is thrown when [[#ApplicationDeliveryInfo|ApplicationDeliveryAttributeTag]] (second buffer) bit1 is clear.
Takes a type-0x5 input buffer, no output.


The output from [[Settings_services#GetDebugModeFlag]] must be 1, otherwise an error is returned.
When [[#ApplicationDeliveryInfo|RequiredApplicationVersion]] (first or second buffer) is higher than [[#ApplicationDeliveryInfo|ApplicationVersion]] (second buffer), this will return 0 with the output bool set to 0.


==== ClearPromotionInfoForDebug ====
When [[#ApplicationDeliveryInfo|ApplicationDeliveryAttributeTag]] (first buffer) bit28 is set (bitmask 0x10000000):
No input/output.
* When [[#ApplicationDeliveryInfo|ApplicationVersion]] (first buffer) >= [[#ApplicationDeliveryInfo|ApplicationVersion]] (second buffer), write 0 to the output bool, otherwise write 1. Then return 0.
Otherwise when the above bit28 is clear:
* When [[#ApplicationDeliveryInfo|ApplicationVersion]] (first buffer) > [[#ApplicationDeliveryInfo|ApplicationVersion]] (second buffer), write 0 to the output bool, otherwise write 1. Then return 0.


The output from [[Settings_services#GetDebugModeFlag]] must be 1, otherwise an error is returned.
==== 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.


This just clears 0xC-bytes in state.
This uses the same LocalContentShare check as [[#GetApplicationDeliveryInfo|GetApplicationDeliveryInfo]].


==== CreateApplicationResource ====
The array-count for ContentMetaKey must be at least 1, and for ApplicationDeliveryInfo it must match 1.
Takes an input [[#ApplicationResourceType]]. Returns an [[#IApplicationResource]].


==== GetApplicationResource ====
The [[#ApplicationDeliveryInfo|ApplicationDeliveryInfo]] is validated (ApplicationDeliveryProtocolVersion/HMAC). An error is thrown when [[#ApplicationDeliveryInfo|ApplicationDeliveryAttributeTag]] bit0 is set.
Takes an input u64 ProcessId and an input [[#ApplicationResourceType]]. Returns an [[#IApplicationResource]].


==== LaunchMicroApplication ====
This uses the same ref-count check as [[#GetApplicationDeliveryInfo|GetApplicationDeliveryInfo]].
[18.0.0+] Now takes a total of 0x50 bytes of input.


[19.0.0+] Now takes a total of 0x80 bytes of input.
An error is thrown if [[NIM_services|nim]] ListApplicationApplyDeltaTask returns a task.


==== CreateApplicationInstance ====
This will only return 1 ContentMetaKey entry. This will not output the entry when the input s32 is larger than 0, or when [[#ApplicationDeliveryInfo|ApplicationDeliveryAttributeTag]] bit1 is clear.
[18.0.0+] Now takes a total of 0x50 bytes of input.


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


==== RegisterDeviceLockKey ====
This uses the same LocalContentShare check as [[#GetApplicationDeliveryInfo|GetApplicationDeliveryInfo]].
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]].
The [[#SystemDeliveryInfo]] is validated (validation for ApplicationDeliveryProtocolVersion is enabled).


This does SHA256 hashing, etc.
The array-count must match 1.


==== UnregisterDeviceLockKey ====
The [[#ApplicationDeliveryInfo]] is validated (ApplicationDeliveryProtocolVersion/HMAC).
No input/output.


Runs code identical to [[#RegisterDeviceLockKey]], except the passed buffer/size are 0.
This then runs functionality similar to [[#SelectLatestSystemDeliveryInfo]]:
* [20.0.0+] The following code block now only runs when the SystemDeliveryInfoPlatform from the input [[#SystemDeliveryInfo]] matches the [[System_Settings|sys-setting]].
* Uses the same functionality as [[#SelectLatestSystemDeliveryInfo]] for GetFunctionBlackListSystemVersionToAuthorize, returning the Result on failure.
* The output bool is set to: out_u8!=0 && out_u32 >= [[#SystemDeliveryInfo]] SystemUpdateVersion (only the upper 16bits are used from the SystemUpdateVersion).


==== VerifyDeviceLockKey ====
Otherwise when the output bool is still false, this sets the output bool by comparing system-version fields in the [[#SystemDeliveryInfo]]/[[#ApplicationDeliveryInfo]] and with a state field (state field originates from [[System_Settings|system-setting]] <code>contents_delivery!required_system_version_to_deliver_application</code>).
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]].
==== EstimateRequiredSize ====
Takes a type-0x5 input buffer containing an array of [[NCM_services#ContentMetaKey|ContentMetaKey]], returns an output s64.


This runs hashing similar to [[#RegisterDeviceLockKey]], with the calculated hash being verified with the one from state.
When the array-count is less than 1, this will return 0 with the s64 set to 0.


==== HideApplicationIcon ====
==== RequestReceiveApplication ====
No input/output.
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]].


==== ShowApplicationIcon ====
[[qlaunch]] uses value Any for the StorageId, and value 55556 for the port.
No input/output.


==== HideApplicationTitle ====
This uses the same LocalContentShare and ref-count checks as [[#GetApplicationDeliveryInfo|GetApplicationDeliveryInfo]].
No input/output.


==== ShowApplicationTitle ====
An error is thrown if [[NIM_services|nim]] ListApplicationApplyDeltaTask returns a task.
No input/output.


==== EnableGameCard ====
HasApplicationRecord is called with the input [[NCM_services#ApplicationId|ApplicationId]], an error is returned if the record isn't found.
No input/output.


==== DisableGameCard ====
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]] CreateLocalCommunicationReceiveApplicationTask, max entries is 0x12.
No input/output.


==== EnableLocalContentShare ====
This does various setup then creates the [[#IAsyncResult]] + the async thread which handles the [[#IAsyncResult]] operation. Then the thread does:
No input/output.


==== DisableLocalContentShare ====
* Calls a func which does:
No input/output.
** Throws an error if a state flag is set.
** Uses [[NIM_services|nim]] CreateLocalCommunicationReceiveApplicationTask, returning the Result on failure.
** Uses [[NIM_services|nim]] RequestLocalCommunicationReceiveApplicationTaskRun, returning the Result on failure. Waits for the IAsyncResult operation from this to finish, then uses the Get cmd to get the output Result.
*** When the Result from Get is an error, a func is called for filling in the [[#IAsyncResult|IAsyncResult]] ErrorContext with Type4.
** 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>.
** This report has the following fields:
*** "ApplicationId"
*** "DestinationVersion"
*** "SourceVersion"
*** "HasApplicationEntity"
*** "HasPatchEntity"
*** "ApplicationStorageId"
*** "PatchStorageId"
*** "Size"
*** "ThroughputKBps"


==== IsApplicationIconHidden ====
==== CommitReceiveApplication ====
No input, returns an output bool.
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.


==== IsApplicationTitleHidden ====
This uses the same LocalContentShare and ref-count checks as [[#GetApplicationDeliveryInfo|GetApplicationDeliveryInfo]].
No input, returns an output bool.


==== IsGameCardEnabled ====
An error is thrown if [[NIM_services|nim]] ListApplicationApplyDeltaTask returns a task.
No input, returns an output bool.


==== IsLocalContentShareEnabled ====
==== GetReceiveApplicationProgress ====
No input, returns an output bool.
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output [[#ReceiveApplicationProgress]].


Various Deliver cmds now load the same flag used by this cmd (IsLocalContentShareEnabled), with an error being returned when it's not enabled.
This uses the same ref-count check as [[#GetApplicationDeliveryInfo|GetApplicationDeliveryInfo]].


=== IGameCardStopper ===
An error is thrown if [[NIM_services|nim]] ListApplicationApplyDeltaTask returns a task.
This is "nn::ns::detail::IGameCardStopper".


This interface has no commands.
Uses [[NIM_services|nim]] ListApplicationLocalCommunicationReceiveApplicationTask, throwing an error if no task is returned. Then [[NIM_services|nim]] GetLocalCommunicationReceiveApplicationTaskInfo 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.


=== IRequestServerStopper ===
==== RequestSendApplication ====
This is "nn::ns::detail::IRequestServerStopper".
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]].


This interface has no commands.
[[qlaunch]] uses value 55556 for the port.


=== IProgressMonitorForDeleteUserSaveDataAll ===
This uses the same LocalContentShare and ref-count checks as [[#GetApplicationDeliveryInfo|GetApplicationDeliveryInfo]].
This is "nn::ns::detail::IProgressMonitorForDeleteUserSaveDataAll".
 
{| class="wikitable" border="1"
|-
! 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.
An error is thrown if [[NIM_services|nim]] ListApplicationApplyDeltaTask returns a task.


* GetSystemEvent: No input, returns an output Event handle. [[qlaunch]] doesn't use this.
This does various setup and loops through the input ContentMetaKey array for initializing the array passed to the nim cmd during the async task. This loop does the following:
* Throws an error if the [[NCM_services#ContentMetaType|ContentMetaType]] in the ContentMetaKey doesn't match Patch.
* Calls a func with the ContentMetaKey and the ApplicationId, throwing an error if the output value is 0.
* Calls a func with the ContentMetaKey for getting the StorageId. This essentially loops through each valid ncm [[NCM_services|IContentMetaDatabase]] using cmd [[NCM_services|Has]] with the input ContentMetaKey, returning the relevant StorageId when found.
* The ContentMetaKey and the StorageId are copied into a tmp struct.
* if (ContentMetaType==Patch && StorageId==GameCard) { <call a func etc> }
* Copies the above tmp struct into the async task state array.


* IsFinished: No input, returns an output u8 bool.
This then creates the [[#IAsyncResult]] + the async thread which handles the [[#IAsyncResult]] operation. Then the thread does:


* GetResult: No input/output.
* Calls a func which does:
** Throws an error if a state flag is set.
** Uses [[NIM_services|nim]] CreateLocalCommunicationSendApplicationTask, returning the Result on failure.
** Uses [[NIM_services|nim]] RequestLocalCommunicationSendApplicationTaskRun, returning the Result on failure. Waits for the IAsyncResult operation from this to finish, then uses the Get cmd to get the output Result.
*** When the Result from Get is an error, a func is called for filling in the [[#IAsyncResult|IAsyncResult]] ErrorContext with Type4.
** 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>.
** This report has the following fields:
*** "ApplicationId"
*** "Version"
*** "ApplicationStorageId"
*** "PatchStorageId"
 
==== GetSendApplicationProgress ====
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]] ListApplicationLocalCommunicationSendApplicationTask/GetLocalCommunicationSendApplicationTaskInfo instead. The data copied to output is also swapped: u64 nim_out+0x8 is copied to out+0x8, and u64 nim_out+0x10 is copied to out+0x0.


* GetProgress: No input, returns an output [[#ProgressForDeleteUserSaveDataAll]]. Official sw writes this struct directly to object state.
==== CompareSystemDeliveryInfo ====
Takes two type-0x15 input buffers containing a [[#SystemDeliveryInfo]], returns an output s32.


=== IProgressAsyncResult ===
This is essentially the same as [[#CompareApplicationDeliveryInfo]], except this compares the [[#SystemDeliveryInfo]] SystemUpdate version.
This is "nn::ns::detail::IProgressAsyncResult".


{| class="wikitable" border="1"
==== 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.
! Cmd || Name
|-
| 0 || Get
|-
| 1 || Cancel
|-
| 2 || GetProgress
|-
| 3 || GetDetailResult
|-
| 4 || [4.0.0+] GetErrorContext
|}


=== IApplicationVersionInterface ===
This uses the same ref-count check as [[#GetApplicationDeliveryInfo|GetApplicationDeliveryInfo]].
This is "nn::ns::detail::IApplicationVersionInterface".


This was added with [4.0.0+].
An error is thrown if [[NIM_services|nim]] ListApplicationApplyDeltaTask returns a task.


{| class="wikitable" border="1"
==== RecoverDownloadTask ====
|-
Takes a type-0x5 input buffer containing an array of {unknown} and an input u64, no output.
! Cmd || Name
 
|-
This uses the same LocalContentShare and ref-count checks as [[#GetApplicationDeliveryInfo|GetApplicationDeliveryInfo]].
| 0 || GetLaunchRequiredVersion
 
|-
==== GetApplicationDeliveryInfoHash ====
| 1 || UpgradeLaunchRequiredVersion
Takes a type-0x5 input buffer containing an array of [[#ApplicationDeliveryInfo]], returns an output 0x20-byte SHA256 hash.
|-
 
| 35 || UpdateVersionList
This uses the same LocalContentShare check as [[#GetApplicationDeliveryInfo|GetApplicationDeliveryInfo]].
|-
 
| 36 || PushLaunchVersion
This extracts data from the input array for hashing with SHA256, with validation being done when handling each entry (ApplicationDeliveryProtocolVersion/HMAC).
|-
| 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 ====
The 0x14-bytes from [[#ApplicationDeliveryInfo|ApplicationDeliveryInfo]]+0x8 are copied into a 0x18-byte struct entry in an array buffer, with the last 4-bytes being cleared. Then each 0x18-byte struct entry is hashed.
No input, returns an output Event handle and an [[#IAsyncValue]].


The data that can be read from the [[#IAsyncValue]] is [[#VersionListData]].
==== Cmd2019 ====
Takes a type-0x15 input buffer containing a [[#SystemDeliveryInfo]], a type-0x5 input buffer containing an array of [[#ApplicationDeliveryInfo]], a type-0x5 input buffer containing an array of [[#ApplicationDeliveryInfo]], returns an output u8 bool.


=== IContentManagementInterface ===
This is essentially an extended version of [[#CanDeliverApplication|CanDeliverApplication]], with additional functionality for determining platform compatibility.
This is "nn::ns::detail::IContentManagementInterface".


{| class="wikitable" border="1"
This calls a func for validating the [[#SystemDeliveryInfo]] from the type-0x15 buffer, returning the Result on failure.
|-
 
! Cmd || Name
Then [[#CanDeliverApplication|CanDeliverApplication]] is called with the output bool and the input arrays, returning the Result on failure.
|-
| 11 || [[#CalculateApplicationOccupiedSize]]
|-
| 43 || [[#CheckSdCardMountStatus]]
|-
| 47 || [[#GetTotalSpaceSize]]
|-
| 48 || [[#GetFreeSpaceSize]]
|-
| 600 || [[#CountApplicationContentMeta]]
|-
| 601 || [[#ListApplicationContentMetaStatus]]
|-
| 605 || [[#ListApplicationContentMetaStatusWithRightsCheck]]
|-
| 607 || [[#IsAnyApplicationRunning]]
|}


==== CalculateApplicationOccupiedSize ====
If the output bool is set after calling the above, it then calls a func with the output bool, the second [[#ApplicationDeliveryInfo]] buffer, and the [[#SystemDeliveryInfo]] from the type-0x15 buffer. This func does the following:
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output [[#ApplicationOccupiedSize]].
* When the SystemDeliveryInfoPlatform from the input [[#SystemDeliveryInfo]] matches the [[System_Settings|sys-setting]], it does the following:
** Uses [[Shared_Database_services|pl:s]] RequestApplicationFunctionAuthorizationByApplicationId with the [[#ApplicationDeliveryInfo]] ApplicationId/ApplicationVersion and ApplicationFunctionAuthorizationId=0x5, handling the Result on failure.
* When the platform fields from the input [[#SystemDeliveryInfo]]/[[#ApplicationDeliveryInfo]] match, write 1 to the output bool and return 0. Otherwise:
** When the [[#SystemDeliveryInfo]] SystemDeliveryInfoPlatform is 0x1 (Ounce): *output = [[#ApplicationDeliveryInfo|ContentMetaPlatform]] == 0 && [[#ApplicationDeliveryInfo|ProperProgramExists]] == 0;
** When the [[#SystemDeliveryInfo]] SystemDeliveryInfoPlatform is 0x0 (NX): write 0 to the output bool and return 0.
** Otherwise, Abort.


==== CheckSdCardMountStatus ====
==== GetApplicationRightsOnClient ====
No input/output.
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.


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


==== ListApplicationContentMetaStatusWithRightsCheck ====
For the output array count, [[qlaunch]] uses value 3.
Same input/output as [[#ListApplicationContentMetaStatus]].


==== IsAnyApplicationRunning ====
==== GetApplicationTerminateResult ====
No input, returns an output u8 bool.
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output u32 Result.


=== IDocumentInterface ===
==== GetRightsEnvironmentHandleForApplication ====
This is "nn::ns::detail::IDocumentInterface".
No input, returns a total of 8-bytes of output.


{| class="wikitable" border="1"
[9.0.0+] Now takes a total of 8-bytes of input, returns a total of 8-bytes of output.
|-
! Cmd || Name
|-
| 21 || GetApplicationContentPath
|-
| 23 || ResolveApplicationContentPath
|-
| 92 || [5.0.0+] GetRunningApplicationProgramId
|-
| 2524 || [19.0.0+]
|}


=== IDownloadTaskInterface ===
==== RequestNoDownloadRightsErrorResolution ====
This is "nn::ns::detail::IDownloadTaskInterface".
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncValue]].


{| class="wikitable" border="1"
The data that can be read from the [[#IAsyncValue]] is [[#NoDownloadRightsErrorResolution]].
|-
! Cmd || Name
|-
| 701 || [[#ClearTaskStatusList]]
|-
| 702 || [[#RequestDownloadTaskList]]
|-
| 703 || [[#RequestEnsureDownloadTask]]
|-
| 704 || [[#ListDownloadTaskStatus]]
|-
| 705 || [[#RequestDownloadTaskListData]]
|-
| 706 || [4.0.0+] [[#TryCommitCurrentApplicationDownloadTask]]
|-
| 707 || [4.0.0+] [[#EnableAutoCommit]]
|-
| 708 || [4.0.0+] [[#DisableAutoCommit]]
|-
| 709 || [4.0.0+] [[#TriggerDynamicCommitEvent]]
|}


==== ClearTaskStatusList ====
See [[#RequestApplicationUpdateInfo]] regarding nifm.
No input/output.
 
==== RequestResolveNoDownloadRightsError ====
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]].


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


==== RequestEnsureDownloadTask ====
==== GetPromotionInfo ====
No input, returns an output Event handle and an [[#IAsyncResult]].
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.


==== ListDownloadTaskStatus ====
Official sw uses hard-coded value 1 for the count with each of these arrays.
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.
==== ListPromotionInfo ====
[20.0.0+] The struct size for the output buffer array is now 0x28-bytes instead of 0x20-bytes.


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


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


==== DisableAutoCommit ====
==== ClearPromotionInfoForDebug ====
No input/output.
No input/output.


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


=== IReadOnlyApplicationRecordInterface ===
This just clears 0xC-bytes in state.
This is "nn::ns::detail::IReadOnlyApplicationRecordInterface".


This was added with [5.0.0+].
==== CreateApplicationResource ====
Takes an input [[#ApplicationResourceType]]. Returns an [[#IApplicationResource]].


{| class="wikitable" border="1"
==== GetApplicationResource ====
|-
Takes an input u64 ProcessId and an input [[#ApplicationResourceType]]. Returns an [[#IApplicationResource]].
! Cmd || Name || Notes
|-
| 0 || HasApplicationRecord || Same as [[#IApplicationManagerInterface]] cmd 910
|-
| 1 || [10.0.0+] NotifyApplicationFailure ||
|-
| 2 || [10.0.0+] IsDataCorruptedResult ||
|}


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


This was added with [5.1.0+].
[19.0.0+] Now takes a total of 0x80 bytes of input.


{| class="wikitable" border="1"
==== CreateApplicationInstance ====
|-
[18.0.0+] Now takes a total of 0x50 bytes of input.
! Cmd || Name || Notes
|-
| 0 || [[#GetApplicationControlData]] || Same as [[#IApplicationManagerInterface]] cmd 400
|-
| 1 || [[#GetApplicationDesiredLanguage]] || Same as [[#IApplicationManagerInterface]] cmd 55
|-
| 2 || ConvertApplicationLanguageToLanguageCode || Same as [[#IApplicationManagerInterface]] cmd 59
|-
| 3 || [[#ConvertLanguageCodeToApplicationLanguage]] || Same as [[#IApplicationManagerInterface]] cmd 60
|-
| 4 || [9.0.0+] SelectApplicationDesiredLanguage ||
|-
| 5 || [19.0.0+] ||
|-
| 6 || [19.0.0+] ||
|}


=== IDynamicRightsInterface ===
[19.0.0+] Now takes a total of 0x80 bytes of input.
This is "nn::ns::detail::IDynamicRightsInterface".


This was added with [6.0.0+].
==== RegisterDeviceLockKey ====
Takes a type-0x5 input buffer containing an InArray of u8, no output.


{| class="wikitable" border="1"
User-processes expose this with two funcs: one which uses an user-specified u8 array directly, while the other uses [[HID_services#NpadButtonSet|NpadButton]].
|-
 
! Cmd || Name
This does SHA256 hashing, etc.
|-
 
| 0 || [[#RequestApplicationRightsOnServer]]
==== UnregisterDeviceLockKey ====
|-
No input/output.
| 1 || [[#RequestAssignRights]]
 
|-
Runs code identical to [[#RegisterDeviceLockKey]], except the passed buffer/size are 0.
| 4 || [[#DeprecatedRequestAssignRightsToResume]]
 
|-
==== VerifyDeviceLockKey ====
| 5 || [[#VerifyActivatedRightsOwners]]
Takes a type-0x5 input buffer containing an InArray of u8, no output.
|-
 
| 6 || [[#DeprecatedGetApplicationRightsStatus]]
User-processes expose this with two funcs: one which uses an user-specified u8 array directly, while the other uses [[HID_services#NpadButtonSet|NpadButton]].
|-
 
| 7 || [[#RequestPrefetchForDynamicRights]]
This runs hashing similar to [[#RegisterDeviceLockKey]], with the calculated hash being verified with the one from state.
|-
 
| 8 || [[#GetDynamicRightsState]]
==== HideApplicationIcon ====
|-
No input/output.
| 9 || [7.0.0+] [[#RequestApplicationRightsOnServerToResume]]
 
|-
==== ShowApplicationIcon ====
| 10 || [7.0.0+] [[#RequestAssignRightsToResume]]
No input/output.
|-
| 11 || [7.0.0+] [[#GetActivatedRightsUsers]]
|-
| 12 || [8.0.0+] [[#GetApplicationRightsStatus]]
|-
| 13 || [8.0.0+] [[#GetRunningApplicationStatus]]
|-
| 14 || [10.0.0-15.0.1] SelectApplicationLicense
|-
| 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
|-
| 21 || [13.1.0+] SetRequiredAddOnContentsOnContentsAvailabilityTransition
|-
| 22 || [14.0.0+] GetLimitedApplicationLicense
|-
| 23 || [14.0.0+] GetLimitedApplicationLicenseUpgradableEvent
|-
| 24 || [14.0.0+] NotifyLimitedApplicationLicenseUpgradableEventForDebug
|-
| 25 || [14.0.0+] RequestProceedDynamicRightsState
|-
| 26 || [18.0.0+] HasAccountRestrictedRightsInRunningApplications
|}


==== RequestApplicationRightsOnServer ====
==== HideApplicationTitle ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], an [[Account_services#Uid|Uid]] and an u32. Returns an output Event handle and an [[#IAsyncValue]].
No input/output.


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


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


==== VerifyActivatedRightsOwners ====
==== DisableGameCard ====
Takes an input u64 "nn::ns::RightsEnvironmentHandle". No output.
No input/output.


==== DeprecatedGetApplicationRightsStatus ====
==== EnableLocalContentShare ====
Takes an input u64 "nn::ns::RightsEnvironmentHandle". Returns a bool "nn::ns::ApplicationRightsStatus".
No input/output.


==== RequestPrefetchForDynamicRights ====
==== DisableLocalContentShare ====
Takes an input [[Account_services#Uid|Uid]]. Returns an output Event handle and an [[#IAsyncResult]].
No input/output.


==== GetDynamicRightsState ====
==== IsApplicationIconHidden ====
No input. Returns a bool "nn::ns::DynamicRightsState".
No input, returns an output bool.


==== RequestApplicationRightsOnServerToResume ====
==== IsApplicationTitleHidden ====
Takes an input u64 "nn::ns::RightsEnvironmentHandle". Returns an output Event handle and an [[#IAsyncValue]].
No input, returns an output bool.


==== RequestAssignRightsToResume ====
==== IsGameCardEnabled ====
Takes an input u64 "nn::ns::RightsEnvironmentHandle". Returns an output Event handle and an [[#IAsyncResult]].
No input, returns an output bool.


==== GetActivatedRightsUsers ====
==== IsLocalContentShareEnabled ====
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]].
No input, returns an output bool.


==== GetApplicationRightsStatus ====
Various Deliver cmds now run essentially the same code as IsLocalContentShareEnabled, with an error being returned when it's not enabled.
Takes an input "nn::ns::RightsEnvironmentHandle". Returns 2 bools "nn::ns::ApplicationRightsStatus" and "nn::ns::ApplicationLicenseType".


==== GetRunningApplicationStatus ====
==== Cmd4026 ====
Takes an input u64 "nn::ns::RightsEnvironmentHandle". Returns an u32 "nn::ns::RunningApplicationStatus".
Takes an input u64, returns an [[#IHostSession|IHostSession]].


==== RequestContentsAuthorizationToken ====
The input u64 must match a state field.
Takes a total of 0x50-bytes of input, a type-0x5 input buffer. Returns an [[#IAsyncData_2|IAsyncData]] and an output handle.


==== IAsyncData ====
This initializes [[LDN_services|ldn]] etc, and creates a network.
This is "nn::ns::detail::IAsyncData".
 
==== Cmd4027 ====
Takes an input u64, returns an [[#IClientSession|IClientSession]].
 
The input u64 must match a state field.
 
This initializes [[LDN_services|ldn]] etc.
 
=== IGameCardStopper ===
This is "nn::ns::detail::IGameCardStopper".
 
This interface has no commands.
 
=== IRequestServerStopper ===
This is "nn::ns::detail::IRequestServerStopper".
 
This interface has no commands.


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


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 2,064: Line 2,107:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 || GetSize
| 0 || GetSystemEvent
|-
|-
| 1 || Get
| 1 || IsFinished
|-
|-
| 2 || Cancel
| 2 || GetResult
|-
|-
| 3 || GetErrorContext
| 10 || GetProgress
|}
|}


=== IECommerceInterface===
When closing the object, official sw uses IsFinished first, asserting when the output bool is false.
This is "nn::ns::detail::IECommerceInterface".
 
* 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.
 
* GetProgress: No input, returns an output [[#ProgressForDeleteUserSaveDataAll]]. Official sw writes this struct directly to object state.


This was added with [4.0.0+].
=== IProgressAsyncResult ===
This is "nn::ns::detail::IProgressAsyncResult".


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 2,082: Line 2,133:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 || [[#RequestLinkDevice]]
| 0 || Get
|-
| 1 || Cancel
|-
|-
| 1 || [6.0.0+] [[#RequestCleanupAllPreInstalledApplications]]
| 2 || GetProgress
|-
|-
| 2 || [6.0.0+] [[#RequestCleanupPreInstalledApplication]]
| 3 || GetDetailResult
|-
|-
| 3 || [6.0.0+] [[#RequestSyncRights]]
| 4 || [4.0.0+] GetErrorContext
|}
 
=== IHostSession ===
This is "nn::ns::vphym::detail::IHostSession".
 
This was added with [20.0.0+].
 
{| class="wikitable" border="1"
|-
|-
| 4 || [6.0.0+] [[#RequestUnlinkDevice]]
! Cmd || Name
|-
|-
| 5 || [6.1.0+] [[#RequestRevokeAllELicense]]
| 0 ||  
|-
|-
| 6 || [9.0.0+] [[#RequestSyncRightsBasedOnAssignedELicenses]]
| 1 ||  
|-
|-
| 7 || [14.0.0+] RequestOnlineSubscriptionFreeTrialAvailability
| 2 ||  
|}
|}


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


See [[#RequestApplicationUpdateInfo]] regarding nifm.
The async task does the following:
* This waits for a client to connect.
* The [[LDN_services|NodeInfo]] UserName is converted into two u64s, which are used to locate a state entry with matching values.
* The client [[LDN_services|NodeInfo]] Ipv4Address is copied into state.
* Then a ptr to the above located state entry is also written into state.


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


==== RequestCleanupPreInstalledApplication ====
The async task uses [[NIM_services|nim]] cmd2018 or cmd2027, depending on a state field. Once finished when a state flag is set, [[LDN_services|ldn]] is finalized and that state flag is cleared.
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].


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


==== RequestUnlinkDevice ====
The async task uses [[NIM_sevices|nim]] cmd2024.
Takes an input [[Account_services#Uid|Uid]], returns an output Event handle and an [[#IAsyncResult]].
 
See [[#RequestApplicationUpdateInfo]] regarding nifm.
 
==== RequestRevokeAllELicense ====
Takes an input [[Account_services#Uid|Uid]], returns an output Event handle and an [[#IAsyncResult]].


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


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


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 2,131: Line 2,188:
! Cmd || Name
! Cmd || Name
|-
|-
| 100 || [[#ResetToFactorySettings]]
| 0 ||  
|-
|-
| 101 || [[#ResetToFactorySettingsWithoutUserSaveData]]
| 1 ||  
|-
| 102 || [[#ResetToFactorySettingsForRefurbishment]]
|-
| 103 || [9.1.0+] [[#ResetToFactorySettingsWithPlatformRegion]]
|-
| 104 || [9.1.0+] [[#ResetToFactorySettingsWithPlatformRegionAuthentication]]
|-
|-
| 105 || [10.0.0+] [[#RequestResetToFactorySettingsSecurely]]
| 2 ||  
|-
| 106 || [10.0.0+] [[#RequestResetToFactorySettingsWithPlatformRegionAuthenticationSecurely]]
|}
|}


==== ResetToFactorySettings ====
==== Cmd0 ====
No input/output.
No input, returns an output Event handle and an [[#IAsyncValue]].


As of [9.1.0] this is the only [[#IFactoryResetInterface]] cmd used by [[qlaunch]].
The async task does the following:
* Uses [[LDN_services|ldn]] Scan.
* After a [[LDN_services|NodeInfo]] is found with a matching UserName, the Ipv4Address for it is copied into state.
* If a timeout didn't occur and a valid NodeInfo was found, it proceeds with connecting to the network.


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


==== ResetToFactorySettingsForRefurbishment ====
The async task uses [[NIM_services|nim]] cmd2019 or cmd2028, depending on a state field. Once finished when a state flag is set, [[LDN_services|ldn]] is finalized and that state flag is cleared.
No input/output.


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


==== ResetToFactorySettingsWithPlatformRegionAuthentication ====
This is identical to [[#IHostSession|IHostSession]] Cmd2.
No input/output.


==== RequestResetToFactorySettingsSecurely ====
=== IApplicationVersionInterface ===
Takes an input u64 tmem_size, a TransferMemory handle, returns an output [[#IAsyncValueAndProgress]] and an Event handle.
This is "nn::ns::detail::IApplicationVersionInterface".


The TransferMemory uses permissions=0.
This was added with [4.0.0+].
 
==== RequestResetToFactorySettingsWithPlatformRegionAuthenticationSecurely ====
Takes an input u32 "nn::ae::PlatformRegion", an u64 tmem_size, a TransferMemory handle, returns an output [[#IAsyncValueAndProgress]] and an Event handle.
 
The TransferMemory uses permissions=0.
 
===== IAsyncValueAndProgress =====
This is "nn::ns::detail::IAsyncValueAndProgress".
 
This was added with [10.0.0+].


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 2,182: Line 2,222:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 || GetSize
| 0 || GetLaunchRequiredVersion
|-
| 1 || UpgradeLaunchRequiredVersion
|-
| 35 || UpdateVersionList
|-
| 36 || PushLaunchVersion
|-
| 37 || ListRequiredVersion
|-
| 800 || RequestVersionList
|-
| 801 || ListVersionList
|-
| 802 || [[#RequestVersionListData]]
|-
| 900 || [12.0.0+] ImportAutoUpdatePolicyJsonForDebug
|-
|-
| 1 || Get
| 901 || [12.0.0+] ListDefaultAutoUpdatePolicy
|-
|-
| 2 || Cancel
| 902 || [12.0.0+] ListAutoUpdatePolicyForSpecificApplication
|-
|-
| 3 || GetErrorContext
| 1000 || PerformAutoUpdate
|-
|-
| 4 || GetProgress
| 1001 || [11.0.0+] ListAutoUpdateSchedule
|}
|}


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


This was added with [9.0.0+].
=== IContentManagementInterface ===
This is "nn::ns::detail::IContentManagementInterface".


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 2,202: Line 2,261:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 || Attach
| 11 || [[#CalculateApplicationOccupiedSize]]
|-
| 43 || [[#CheckSdCardMountStatus]]
|-
|-
| 1 || BoostSystemMemoryResourceLimit
| 47 || [[#GetTotalSpaceSize]]
|}
 
= ns:vm =
This is "nn::ns::detail::IVulnerabilityManagerInterface".
 
{| class="wikitable" border="1"
|-
|-
! Cmd || Name
| 48 || [[#GetFreeSpaceSize]]
|-
|-
| 1200 || [3.0.0+] [[#NeedsUpdateVulnerability]]
| 58 || [20.1.0+]
|-
|-
| 1201 || [4.0.0+] [[#UpdateSafeSystemVersionForDebug]]
| 71 || [20.1.0+]
|-
|-
| 1202 || [4.0.0+] [[#GetSafeSystemVersion]]
| 600 || [[#CountApplicationContentMeta]]
|-
|-
| 3100 || [18.0.0+]  
| 601 || [[#ListApplicationContentMetaStatus]]
|-
|-
| 3101 || [18.0.0+]  
| 605 || [[#ListApplicationContentMetaStatusWithRightsCheck]]
|-
|-
| 3102 || [18.0.0+]  
| 607 || [[#IsAnyApplicationRunning]]
|}
|}


== NeedsUpdateVulnerability ==
==== CalculateApplicationOccupiedSize ====
No input, returns an output u8 bool flag.
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output [[#ApplicationOccupiedSize]].


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


== UpdateSafeSystemVersionForDebug ==
==== CountApplicationContentMeta ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]] and an u32 '''version'''.
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output s32.


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.
==== ListApplicationContentMetaStatusWithRightsCheck ====
Same input/output as [[#ListApplicationContentMetaStatus]].


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'''.
==== IsAnyApplicationRunning ====
No input, returns an output u8 bool.


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".
=== IDocumentInterface ===
 
This is "nn::ns::detail::IDocumentInterface".
== 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>).
 
= ns:su =
This is "nn::ns::detail::ISystemUpdateInterface".


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 2,251: Line 2,304:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 || [[#GetBackgroundNetworkUpdateState]]
| 21 || GetApplicationContentPath
|-
|-
| 1 || [[#OpenSystemUpdateControl]]
| 23 || ResolveApplicationContentPath
|-
|-
| 2 || [[#NotifyExFatDriverRequired]]
| 92 || [5.0.0+] GetRunningApplicationProgramId
|-
|-
| 3 || [[#ClearExFatDriverStatusForDebug]]
| 100 || [S2]
|-
|-
| 4 || [[#RequestBackgroundNetworkUpdate]]
| 101 || [S2]
|-
|-
| 5 || [[#NotifyBackgroundNetworkUpdate]]
| 2524 || [19.0.0+]
|}
 
==== Cmd100 ====
Takes a type-0x16 output buffer containing a 0x300-byte struct, an input u8, an u64. Returns two output u8s.
 
==== Cmd101 ====
Takes a type-0x16 output buffer containing a 0x300-byte struct, an input u8, an u64. Returns an output u8, an u8 [[Filesystem_services|ContentAttributes]], and a [[NCM_services#ProgramId|ProgramId]].
 
This is similar to Cmd2524. On [S2] this is used instead of Cmd2524.
 
==== Cmd2524 ====
Takes a type-0x16 output buffer containing a 0x300-byte struct, an input u8, an u64. Returns an output u8 [[Filesystem_services|ContentAttributes]] and a [[NCM_services#ProgramId|ProgramId]].
 
The user-process uses the output from this as the input for [[Filesystem_services|OpenFileSystemWithId]] (out-buffer is used as the [[Filesystem_services|FspPath]]).
 
=== IDownloadTaskInterface ===
This is "nn::ns::detail::IDownloadTaskInterface".
 
{| class="wikitable" border="1"
|-
|-
| 6 || [[#NotifyExFatDriverDownloadedForDebug]]
! Cmd || Name
|-
|-
| 9 || [[#GetSystemUpdateNotificationEventForContentDelivery]]
| 701 || [[#ClearTaskStatusList]]
|-
|-
| 10 || [[#NotifySystemUpdateForContentDelivery]]
| 702 || [[#RequestDownloadTaskList]]
|-
|-
| 11 || [3.0.0+] [[#PrepareShutdown]]
| 703 || [[#RequestEnsureDownloadTask]]
|-
|-
| 12 || [3.0.0-3.0.2]
| 704 || [[#ListDownloadTaskStatus]]
|-
|-
| 13 || [3.0.0-3.0.2]
| 705 || [[#RequestDownloadTaskListData]]
|-
|-
| 14 || [3.0.0-3.0.2]
| 706 || [4.0.0+] [[#TryCommitCurrentApplicationDownloadTask]]
|-
|-
| 15 || [3.0.0-3.0.2]
| 707 || [4.0.0+] [[#EnableAutoCommit]]
|-
|-
| 16 || [4.0.0+] [[#DestroySystemUpdateTask]]
| 708 || [4.0.0+] [[#DisableAutoCommit]]
|-
|-
| 17 || [4.0.0+] [[#RequestSendSystemUpdate]]
| 709 || [4.0.0+] [[#TriggerDynamicCommitEvent]]
|-
|-
| 18 || [4.0.0+] [[#GetSendSystemUpdateProgress]]
| 710 || [20.0.0+]
|}
|}


== GetBackgroundNetworkUpdateState ==
==== ClearTaskStatusList ====
No input, returns an output [[#BackgroundNetworkUpdateState]].
No input/output.


This is similar to [[#HasDownloaded]], see [[#BackgroundNetworkUpdateState]].
==== RequestDownloadTaskList ====
 
== OpenSystemUpdateControl ==
No input, returns an [[#ISystemUpdateControl]].
 
== NotifyExFatDriverRequired ==
No input/output.
No input/output.


Only usable when an [[#ISystemUpdateControl]] isn't open.
==== RequestEnsureDownloadTask ====
No input, returns an output Event handle and an [[#IAsyncResult]].


This uses [[NIM_services|nim]] ListSystemUpdateTask, then when a task is returned uses it with DestroySystemUpdateTask.
==== ListDownloadTaskStatus ====
Takes a type-0x6 output buffer containing an array of [[#DownloadTaskStatus]], returns an output s32 total_out.


Then this runs ExFat handling, updates state, and sets the same state flag as [[#RequestBackgroundNetworkUpdate]].
A maximum of 0x100 tasks can be stored in state.


== ClearExFatDriverStatusForDebug ==
==== TryCommitCurrentApplicationDownloadTask ====
No input/output.
No input/output.


== RequestBackgroundNetworkUpdate ==
==== EnableAutoCommit ====
No input/output.
No input/output.


Only usable when an [[#ISystemUpdateControl]] isn't open.
==== DisableAutoCommit ====
No input/output.


This sets a state flag to value 1.
==== TriggerDynamicCommitEvent ====
No input/output.


== NotifyBackgroundNetworkUpdate ==
=== IReadOnlyApplicationRecordInterface ===
Takes an input [[NCM_services#ContentMetaKey|ContentMetaKey]], no output.
This is "nn::ns::detail::IReadOnlyApplicationRecordInterface".


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]].
This was added with [5.0.0+].


== NotifyExFatDriverDownloadedForDebug ==
{| class="wikitable" border="1"
No input/output.
|-
! Cmd || Name || Notes
|-
| 0 || HasApplicationRecord || Same as [[#IApplicationManagerInterface]] cmd 910
|-
| 1 || [10.0.0+] NotifyApplicationFailure ||
|-
| 2 || [10.0.0+] IsDataCorruptedResult ||
|-
| 3 || [20.0.0+] [[#ListApplicationRecord|ListApplicationRecord]] ||
|}


== GetSystemUpdateNotificationEventForContentDelivery ==
=== IReadOnlyApplicationControlDataInterface ===
No input, returns an output Event handle with EventClearMode=0.
This is "nn::ns::detail::IReadOnlyApplicationControlDataInterface".


== NotifySystemUpdateForContentDelivery ==
This was added with [5.1.0+].
No input/output.


Signals the Event returned by [[#GetSystemUpdateNotificationEventForContentDelivery]].
{| class="wikitable" border="1"
 
|-
== PrepareShutdown ==
! Cmd || Name || Notes
No input/output.
|-
 
| 0 || [[#GetApplicationControlData]] || Same as [[#IApplicationManagerInterface]] cmd 400
This is used by [[AM_services|AM]].
|-
 
| 1 || [[#GetApplicationDesiredLanguage]] || Same as [[#IApplicationManagerInterface]] cmd 55
Just returns 0 when an [[#ISystemUpdateControl]] is open.
|-
 
| 2 || ConvertApplicationLanguageToLanguageCode || Same as [[#IApplicationManagerInterface]] cmd 59
This does various cleanup / uses various service-cmds etc for shutdown preparation.
|-
 
| 3 || [[#ConvertLanguageCodeToApplicationLanguage]] || Same as [[#IApplicationManagerInterface]] cmd 60
== DestroySystemUpdateTask ==
|-
No input/output.
| 4 || [9.0.0+] SelectApplicationDesiredLanguage ||
 
Only usable when an [[#ISystemUpdateControl]] isn't open.
 
This uses [[NIM_services|nim]] ListSystemUpdateTask, then when a task is returned uses it with DestroySystemUpdateTask.
 
== RequestSendSystemUpdate ==
Takes a type-0x15 input buffer containing a [[#SystemDeliveryInfo]], an u16 port, an u32 Ipv4Address, returns an output Event handle and an [[#IAsyncResult]].
 
[[qlaunch]] uses value 55556 for the port. IP is normally a local-WLAN address, however this can be any address. port/addr are little-endian.
 
[[NIM_services|NIM]] will use the input addr/port with [[Sockets_services|bind()]]. During [[Sockets_services|accept()]] handling the addr from there must match the input addr. Hence, addr must be the client addr. [[NIM_services|NIM]] will also eventually verify that the system is not Internet-connected.
 
This validates the [[#SystemDeliveryInfo]] and generates a [[NCM_services#ContentMetaKey|ContentMetaKey]] from that, and creates the [[#IAsyncResult]] + the async thread which handles the [[#IAsyncResult]] operation. Then the thread does:
* Calls a func which does:
** Uses [[NIM_services|nim]] cmd76, returning the Result on failure.
** Uses [[NIM_services|nim]] cmd77, returning the Result on failure. Waits for the IAsyncResult operation from this to finish, then uses the Get cmd to get the output Result.
** Handles cleanup and returns.
* Unlike [[#RequestReceiveSystemUpdate]], this doesn't save a SystemPlayReport.
 
== GetSendSystemUpdateProgress ==
No input, returns an output [[#SystemUpdateProgress]].
 
Same as [[#GetReceiveProgress]] except this uses nim cmd81 and cmd78.
 
== ISystemUpdateControl ==
This is "nn::ns::detail::ISystemUpdateControl".
 
{| class="wikitable" border="1"
|-
|-
! Cmd || Name
| 5 || [19.0.0+] ||
|-
|-
| 0 || [[#HasDownloaded]]
| 6 || [19.0.0+] ||
|-
|-
| 1 || [[#RequestCheckLatestUpdate]]
| 7 || [20.0.0+] ||
|-
|-
| 2 || [[#RequestDownloadLatestUpdate]]
| 8 || [20.0.0+] ||
|-
|-
| 3 || [[#GetDownloadProgress]]
| 9 || [20.0.0+] ||
|-
|-
| 4 || [[#ApplyDownloadedUpdate]]
| 10 || [20.0.0+] ||
|-
|-
| 5 || [[#RequestPrepareCardUpdate]]
| 11 || [20.0.0+] ||
|-
|-
| 6 || [[#GetPrepareCardUpdateProgress]]
| 12 || [20.0.0+] ||
|-
|-
| 7 || [[#HasPreparedCardUpdate]]
| 13 || [20.0.0+] ||
|-
|-
| 8 || [[#ApplyCardUpdate]]
| 14 || [20.0.0+] ||
|-
|-
| 9 || [[#GetDownloadedEulaDataSize]]
| 15 || [20.0.0+] ||
|-
|-
| 10 || [[#GetDownloadedEulaData]]
| 16 || [20.0.0+] ||
|-
|-
| 11 || [[#SetupCardUpdate]]
| 17 || [20.1.0+] ||
|}
 
=== IDynamicRightsInterface ===
This is "nn::ns::detail::IDynamicRightsInterface".
 
This was added with [6.0.0+].
 
{| class="wikitable" border="1"
|-
! Cmd || Name
|-
| 0 || [[#RequestApplicationRightsOnServer]]
|-
| 1 || [[#RequestAssignRights]]
|-
|-
| 12 || [[#GetPreparedCardUpdateEulaDataSize]]
| 4 || [[#DeprecatedRequestAssignRightsToResume]]
|-
|-
| 13 || [[#GetPreparedCardUpdateEulaData]]
| 5 || [[#VerifyActivatedRightsOwners]]
|-
|-
| 14 || [4.0.0+] [[#SetupCardUpdateViaSystemUpdater]]
| 6 || [[#DeprecatedGetApplicationRightsStatus]]
|-
|-
| 15 || [4.0.0+] [[#HasReceived]]
| 7 || [[#RequestPrefetchForDynamicRights]]
|-
|-
| 16 || [4.0.0+] [[#RequestReceiveSystemUpdate]]
| 8 || [[#GetDynamicRightsState]]
|-
|-
| 17 || [4.0.0+] [[#GetReceiveProgress]]
| 9 || [7.0.0+] [[#RequestApplicationRightsOnServerToResume]]
|-
|-
| 18 || [4.0.0+] [[#ApplyReceivedUpdate]]
| 10 || [7.0.0+] [[#RequestAssignRightsToResume]]
|-
|-
| 19 || [4.0.0+] [[#GetReceivedEulaDataSize]]
| 11 || [7.0.0+] [[#GetActivatedRightsUsers]]
|-
|-
| 20 || [4.0.0+] [[#GetReceivedEulaData]]
| 12 || [8.0.0+] [[#GetApplicationRightsStatus]]
|-
|-
| 21 || [4.0.0+] [[#SetupToReceiveSystemUpdate]]
| 13 || [8.0.0+] [[#GetRunningApplicationStatus]]
|-
|-
| 22 || [6.0.0+] [[#RequestCheckLatestUpdateIncludesRebootlessUpdate]]
| 14 || [10.0.0-15.0.1] SelectApplicationLicense
|}
|-
 
| 15 || [12.0.0+] [[#RequestContentsAuthorizationToken]]
Only 1 ISystemUpdateControl can be open at a time.
|-
 
| 16 || [13.0.0+] QualifyUser
All Card cmds except SetupCardUpdate* require [[#SetupCardUpdate]]/[[#SetupCardUpdateViaSystemUpdater]] to be used previously. [[#GetPreparedCardUpdateEulaDataSize]]/[[#GetPreparedCardUpdateEulaData]] checks a different state flag.
|-
| 17 || [13.0.0+] QualifyUserWithProcessId
|-
| 18 || [13.0.0+] NotifyApplicationRightsCheckStart
|-
| 19 || [13.0.0+] UpdateUserList
|-
| 20 || [13.0.0+] IsRightsLostUser
|-
| 21 || [13.1.0+] SetRequiredAddOnContentsOnContentsAvailabilityTransition
|-
| 22 || [14.0.0+] GetLimitedApplicationLicense
|-
| 23 || [14.0.0+] GetLimitedApplicationLicenseUpgradableEvent
|-
| 24 || [14.0.0+] NotifyLimitedApplicationLicenseUpgradableEventForDebug
|-
| 25 || [14.0.0+] RequestProceedDynamicRightsState
|-
| 26 || [18.0.0+] HasAccountRestrictedRightsInRunningApplications
|-
| 27 || [20.0.0+]
|-
| 28 || [20.0.0+]
|}


=== HasDownloaded ===
==== RequestApplicationRightsOnServer ====
No input, returns an output u8 bool flag.
Takes an input [[NCM_services#ApplicationId|ApplicationId]], an [[Account_services#Uid|Uid]] and an u32. Returns an output Event handle and an [[#IAsyncValue]].


Gets whether a network sysupdate was downloaded, with install pending.
==== RequestAssignRights ====
Takes a type-0x5 input buffer containing an array of "nn::ns::ApplicationRightsOnServer". Returns an output Event handle and an [[#IAsyncResult]].


Uses [[NIM_services|nim]] ListSystemUpdateTask and [[NIM_services|nim]] GetSystemUpdateTaskInfo. When ListSystemUpdateTask successfully returns a task and GetSystemUpdateTaskInfo is successful, the output flag is set to: <code>*((u8*)(taskinfo+0) == 0x3</code>. Otherwise, flag=0.
==== DeprecatedRequestAssignRightsToResume ====
Takes an input u64 "nn::ns::RightsEnvironmentHandle" and an [[Account_services#Uid|Uid]]. Returns an output Event handle and an [[#IAsyncResult]].


This always returns 0, however this will assert if GetSystemUpdateTaskInfo fails with ret!=0x3C89.
==== VerifyActivatedRightsOwners ====
Takes an input u64 "nn::ns::RightsEnvironmentHandle". No output.
 
==== DeprecatedGetApplicationRightsStatus ====
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]].


=== RequestCheckLatestUpdate ===
==== GetDynamicRightsState ====
No input, returns an output Event handle and an [[#IAsyncValue]].
No input. Returns a bool "nn::ns::DynamicRightsState".


The data that can be read from the [[#IAsyncValue]] is [[#LatestSystemUpdate]].
==== RequestApplicationRightsOnServerToResume ====
Takes an input u64 "nn::ns::RightsEnvironmentHandle". Returns an output Event handle and an [[#IAsyncValue]].


=== RequestDownloadLatestUpdate ===
==== RequestAssignRightsToResume ====
No input, returns an output Event handle and an [[#IAsyncResult]].
Takes an input u64 "nn::ns::RightsEnvironmentHandle". Returns an output Event handle and an [[#IAsyncResult]].


=== GetDownloadProgress ===
==== GetActivatedRightsUsers ====
No input, returns an output [[#SystemUpdateProgress]].
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]].


Similar to [[#HasDownloaded]] except instead of a flag, this returns the 0x10-bytes from taskinfo+8. The output struct is cleared when the task(info) isn't available.
==== GetApplicationRightsStatus ====
Takes an input "nn::ns::RightsEnvironmentHandle". Returns 2 bools "nn::ns::ApplicationRightsStatus" and "nn::ns::ApplicationLicenseType".


=== ApplyDownloadedUpdate ===
==== GetRunningApplicationStatus ====
No input/output.
Takes an input u64 "nn::ns::RightsEnvironmentHandle". Returns an u32 "nn::ns::RunningApplicationStatus".


Runs code similar to [[#HasDownloaded]], throwing an error if a network sysupdate isn't ready for install. Then the sysupdate is installed:
==== RequestContentsAuthorizationToken ====
Takes a total of 0x50-bytes of input, a type-0x5 input buffer. Returns an [[#IAsyncData_2|IAsyncData]] and an output handle.


* Uses ListSystemUpdateTask again, then [[NIM_services|nim]] IsExFatDriverIncluded. Runs ExFat handling when the output flag is set.
==== IAsyncData ====
* On newer system-versions, this uses [[NIM_services|nim]] GetSystemUpdateTaskInfo then on success uses data from there to save a SystemPlayReport when the cached [[System_Settings|system-setting]] "systemreport!enabled" is set.
This is "nn::ns::detail::IAsyncData".
** The EventId is "systemupdate_dl_throughput" with ApplicationId 0100000000001018.
** The following fields are added to the report, see [[NIM_services#SystemUpdateTaskInfo|nim SystemUpdateTaskInfo]]: "ContentMetaId", "Version", "DownloadSize", and "ThroughputKBps".
* On newer system-versions, this saves another SystemPlayReport when a state flag is set (same flag mentioned above).
** The EventId is "systemupdate_pass" with ApplicationId 0100000000001021.
** This report has the following fields:
*** "Type"
*** "SourceSystemUpdateMetaId"
*** "SourceSystemUpdateMetaVersion"
*** "SourceExFatStatus"
*** "DestinationSystemUpdateMetaId"
*** "DestinationSystemUpdateMetaVersion"
*** "DestinationExFatStatus"
*** "Rebootless"
* Since FIRM will be installed later, the two flags in [[Flash_Filesystem#System_Update_Control]] are set to 1.
* Uses [[NIM_services|nim]] CommitSystemUpdateTask and [[NIM_services|nim]] DestroySystemUpdateTask.
* Installs FIRM. After installing each FIRM, the associated flag in [[Flash_Filesystem#System_Update_Control]] is set to 0.
* On newer system versions when an input flag is set, this uses [[Filesystem_services|NotifySystemDataUpdateEvent]], however this doesn't happen with ApplyDownloadedUpdate since that input flag is 0.


=== RequestPrepareCardUpdate ===
This was added with [12.0.0+].
No input, returns an output Event handle and an [[#IAsyncResult]].


=== GetPrepareCardUpdateProgress ===
{| class="wikitable" border="1"
No input, returns an output [[#SystemUpdateProgress]].
|-
! Cmd || Name
|-
| 0 || GetSize
|-
| 1 || Get
|-
| 2 || Cancel
|-
| 3 || GetErrorContext
|}


=== HasPreparedCardUpdate ===
=== IECommerceInterface===
No input, returns an output u8 bool flag.
This is "nn::ns::detail::IECommerceInterface".


=== ApplyCardUpdate ===
This was added with [4.0.0+].
No input/output.


=== GetDownloadedEulaDataSize ===
{| class="wikitable" border="1"
Takes a type-0x15 input buffer [[#EulaDataPath]], returns an output u64 '''filesize'''.
|-
! 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+]
|-
| 9 || [20.0.0+]
|-
| 10 || [20.0.0+]
|-
| 11 || [20.0.0+]
|-
| 12 || [20.0.0+]
|-
| 13 || [20.0.0+]
|}


Runs code similar to [[#HasDownloaded]], throwing an error if a network sysupdate isn't ready for install.
==== RequestLinkDevice ====
Takes an input [[Account_services#Uid|Uid]], returns an output Event handle and an [[#IAsyncResult]].


Uses ListSystemUpdateTask again. Then [[NIM_services|nim]] GetDownloadedSystemDataPath, with the output ContentPath being used to mount the EULA title with FS.
See [[#RequestApplicationUpdateInfo]] regarding nifm.


Then "<mountname>:/<[[#EulaDataPath]]>" is opened, gets the '''filesize''', then runs cleanup.
==== RequestCleanupAllPreInstalledApplications ====
No input, returns an output Event handle and an [[#IAsyncResult]].


=== GetDownloadedEulaData ===
==== RequestCleanupPreInstalledApplication ====
Takes a type-0x15 input buffer [[#EulaDataPath]] and a type-0x6 output buffer, returns an output u64 '''filesize'''.
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].


Similar to [[#GetDownloadedEulaDataSize]] except this reads the file instead, using the specified output buffer with size=filesize. This will throw an error if the filesize is larger than the buffer size.
==== RequestSyncRights ====
No input, returns an output Event handle and an [[#IAsyncResult]].


=== SetupCardUpdate ===
==== RequestUnlinkDevice ====
Takes an input u64 size and a TransferMemory handle, no output.
Takes an input [[Account_services#Uid|Uid]], returns an output Event handle and an [[#IAsyncResult]].


Official sw creates the TransferMemory with an user-specified buffer, with permissions=None.
See [[#RequestApplicationUpdateInfo]] regarding nifm.


[[qlaunch]] uses size 0x100000 for the TransferMemory buffer.
==== RequestRevokeAllELicense ====
Takes an input [[Account_services#Uid|Uid]], returns an output Event handle and an [[#IAsyncResult]].


=== GetPreparedCardUpdateEulaDataSize ===
==== RequestSyncRightsBasedOnAssignedELicenses ====
Takes a type-0x15 input buffer [[#EulaDataPath]], returns an output u64 '''filesize'''.
No input, returns an output Event handle and an [[#IAsyncResult]].


This is similar to [[#GetDownloadedEulaDataSize]].
=== IFactoryResetInterface ===
This is "nn::ns::detail::IFactoryResetInterface".


=== GetPreparedCardUpdateEulaData ===
{| class="wikitable" border="1"
Takes a type-0x15 input buffer [[#EulaDataPath]] and a type-0x6 output buffer, returns an output u64 '''filesize'''.
|-
! Cmd || Name
|-
| 100 || [[#ResetToFactorySettings]]
|-
| 101 || [[#ResetToFactorySettingsWithoutUserSaveData]]
|-
| 102 || [[#ResetToFactorySettingsForRefurbishment]]
|-
| 103 || [9.1.0+] [[#ResetToFactorySettingsWithPlatformRegion]]
|-
| 104 || [9.1.0+] [[#ResetToFactorySettingsWithPlatformRegionAuthentication]]
|-
| 105 || [10.0.0+] [[#RequestResetToFactorySettingsSecurely]]
|-
| 106 || [10.0.0+] [[#RequestResetToFactorySettingsWithPlatformRegionAuthenticationSecurely]]
|-
| 107 || [20.0.0+]
|-
| 108 || [20.0.0+]
|}


This is similar to [[#GetDownloadedEulaData]].
==== ResetToFactorySettings ====
No input/output.


=== SetupCardUpdateViaSystemUpdater ===
As of [9.1.0] this is the only [[#IFactoryResetInterface]] cmd used by [[qlaunch]].
Takes an input u64 size and a TransferMemory handle, no output.
 
==== ResetToFactorySettingsWithoutUserSaveData ====
No input/output.
 
==== ResetToFactorySettingsForRefurbishment ====
No input/output.


The permissions for the TransferMemory is None.
==== ResetToFactorySettingsWithPlatformRegion ====
No input/output.


Same as [[#SetupCardUpdate]], except this doesn't have the code for [[Filesystem_services|GetGameCardHandle/GetGameCardUpdatePartitionInfo]], and uses [[Filesystem_services|OpenRegisteredUpdatePartition]] instead of [[Filesystem_services|OpenGameCardFileSystem]]. This uses the same is_initialized bool state flag.
==== ResetToFactorySettingsWithPlatformRegionAuthentication ====
No input/output.


=== HasReceived ===
==== RequestResetToFactorySettingsSecurely ====
No input, returns an output u8 bool.
Takes an input u64 tmem_size, a TransferMemory handle, returns an output [[#IAsyncValueAndProgress]] and an Event handle.


Same as [[#HasDownloaded]] except this uses [[NIM_services|nim]] cmd71 and cmd73.
The TransferMemory uses permissions=0.


=== RequestReceiveSystemUpdate ===
==== RequestResetToFactorySettingsWithPlatformRegionAuthenticationSecurely ====
Takes a type-0x15 input buffer containing a [[#SystemDeliveryInfo]], an u16 port, an u32 Ipv4Address, returns an output Event handle and an [[#IAsyncResult]].
Takes an input u32 "nn::ae::PlatformRegion", an u64 tmem_size, a TransferMemory handle, returns an output [[#IAsyncValueAndProgress]] and an Event handle.


[[qlaunch]] uses the same value for the port as [[#RequestSendSystemUpdate]] (see [[#RequestSendSystemUpdate]] for addr as well).
The TransferMemory uses permissions=0.


[[NIM_services|NIM]] will use the input addr/port with [[Sockets_services|connect()]].
===== IAsyncValueAndProgress =====
This is "nn::ns::detail::IAsyncValueAndProgress".


This validates the [[#SystemDeliveryInfo]] and generates a [[NCM_services#ContentMetaKey|ContentMetaKey]] from that, and creates the [[#IAsyncResult]] + the async thread which handles the [[#IAsyncResult]] operation. Then the thread does:
This was added with [10.0.0+].


* Calls a func which does:
{| class="wikitable" border="1"
** Throws an error if [[NIM_services#ListSystemUpdateTask|ListSystemUpdateTask]] returns any task.
|-
** Checks whether a sysupdate is actually required using the previously generated [[NCM_services#ContentMetaKey|ContentMetaKey]], throwing an error if not.
! Cmd || Name
** Uses [[NIM_services|nim]] cmd69, returning the Result on failure.
|-
** Uses [[NIM_services|nim]] cmd72, returning the Result on failure. Waits for the IAsyncResult operation from this to finish, then uses the Get cmd to get the output Result.
| 0 || GetSize
** 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.
| 1 || Get
** The EventId is "receive_system_update" with ApplicationId <NS ProgramId>.
|-
** This report has the following fields:
| 2 || Cancel
*** "SourceSystemUpdateId"
|-
*** "DestinationSystemUpdateId"
| 3 || GetErrorContext
*** "SourceSystemUpdateVersion"
|-
*** "DestinationSystemUpdateVersion"
| 4 || GetProgress
*** "SenderFirmwareVariationId"
|}
*** "ReceiverFirmwareVariationId"
*** "SenderPlatformRegion"
*** "ReceiverPlatformRegion"
*** "SenderHasExFat"
*** "ReceiverHasExFat"
*** "Size"
*** "ThroughputKBps"


=== GetReceiveProgress ===
=== IApplicationResource ===
No input, returns an output [[#SystemUpdateProgress]].
This is "nn::ns::detail::IApplicationResource".


Same as [[#GetDownloadProgress]] except this uses [[NIM_services|nim]] cmd71 and cmd73.
This was added with [9.0.0+].


=== ApplyReceivedUpdate ===
{| class="wikitable" border="1"
No input/output.
|-
! Cmd || Name
|-
| 0 || Attach
|-
| 1 || BoostSystemMemoryResourceLimit
|}


=== GetReceivedEulaDataSize ===
= ns:vm =
Takes a type-0x15 input buffer [[#EulaDataPath]], returns an output u64 '''filesize'''.
This is "nn::ns::detail::IVulnerabilityManagerInterface".
 
This is similar to [[#GetDownloadedEulaDataSize]].
 
=== GetReceivedEulaData ===
Takes a type-0x15 input buffer [[#EulaDataPath]] and a type-0x6 output buffer, returns an output u64 '''filesize'''.
 
This is similar to [[#GetDownloadedEulaData]].
 
=== SetupToReceiveSystemUpdate ===
No input/output.
 
This just uses [[NIM_services|nim]] ListSystemUpdateTask, then when a task is returned uses it with DestroySystemUpdateTask.
 
[[qlaunch]] uses this before [[#RequestReceiveSystemUpdate]].
 
=== RequestCheckLatestUpdateIncludesRebootlessUpdate ===
No input, returns an output Event handle and an [[#IAsyncValue]].
 
= IAsyncValue =
This is "nn::ns::detail::IAsyncValue".


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 2,590: Line 2,726:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 || GetSize
| 1200 || [3.0.0+] [[#NeedsUpdateVulnerability]]
|-
| 1201 || [4.0.0+] [[#UpdateSafeSystemVersionForDebug]]
|-
| 1202 || [4.0.0+] [[#GetSafeSystemVersion]]
|-
|-
| 1 || Get
| 3100 || [18.0.0+] [[#GetSafeSystemVersionCheckInfo|GetSafeSystemVersionCheckInfo]]
|-
|-
| 2 || Cancel
| 3101 || [18.0.0+] [[#RequestUpdateSafeSystemVersionCheckInfo|RequestUpdateSafeSystemVersionCheckInfo]]
|-
|-
| 3 || [4.0.0+] GetErrorContext
| 3102 || [18.0.0+] [[#ResetSafeSystemVersionCheckInfo|ResetSafeSystemVersionCheckInfo]]
|}
|}


Official sw creates a container object for this using the output from the service commands, which contains the IAsyncValue object, and the Event with EventClearMode=0.
== NeedsUpdateVulnerability ==
No input, returns an output u8 bool flag.


* GetSize: No input, returns an output u64.
[S1] Web-applets use this command to check if the system needs an update.
* Get: Takes a type-0x6 output buffer, no output. Official sw waits on the Event prior to using this cmd.
* Cancel: No input/output. Used by official sw when closing the object, when the serv-obj is initialized (after using the cmd, official sw will also wait on the Event). This cmd is also used in other official sw funcs.
* GetErrorContext: No input/output, takes a type-0x16 output buffer containing an [[Error_Applet#ErrorContext|ErrorContext]].


= IAsyncResult =
== UpdateSafeSystemVersionForDebug ==
This is "nn::ns::detail::IAsyncResult".
Takes an input u32 '''version''' and an [[NCM_services#ApplicationId|ApplicationId]].


{| class="wikitable" border="1"
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.
|-
 
! Cmd || Name
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'''.
|-
 
| 0 || Get
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".
|-
 
| 1 || Cancel
== 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>).
| 2 || [4.0.0+] GetErrorContext
 
|}
== GetSafeSystemVersionCheckInfo ==
No input, returns 0x10-bytes of output.
 
[S2] Used by web-applets via ns:vm.
 
== RequestUpdateSafeSystemVersionCheckInfo ==
No input, returns an output Event handle and an [[#IAsyncResult|IAsyncResult]].
 
[S2] Used by web-applets via ns:vm.


Official sw creates a container object for this using the output from the service commands, which contains the IAsyncResult object, and the Event with EventClearMode=0.
The async task thread uses [[NIM_services|nim]] RequestCheckSafeSystemVersion, etc.


* Get: No input/output. Official sw waits on the Event prior to using this cmd.
== ResetSafeSystemVersionCheckInfo ==
* Cancel: No input/output. Used by official sw when closing the object, when the serv-obj is initialized (after using the cmd, official sw will also wait on the Event). This cmd is also used in other official sw funcs.
No input/output.
* GetErrorContext: No input/output, takes a type-0x16 output buffer containing an [[Error_Applet#ErrorContext|ErrorContext]].


= ns:dev =
This throws an error if [[Settings_services|GetDebugModeFlag]] returns false.
This is "nn::ns::detail::IDevelopInterface".


[10.0.0+] Some of these cmds were replaced by the [[PGL_services|pgl]] system module.
= ns:su =
This is "nn::ns::detail::ISystemUpdateInterface".


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 2,635: Line 2,780:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 || [1.0.0-9.2.0] [[#LaunchProgram]]
| 0 || [[#GetBackgroundNetworkUpdateState]]
|-
|-
| 1 || [[#TerminateProcess]]
| 1 || [[#OpenSystemUpdateControl]]
|-
|-
| 2 || [1.0.0-9.2.0] [[#TerminateProgram]]
| 2 || [[#NotifyExFatDriverRequired]]
|-
|-
| 4 || [1.0.0-9.2.0] [[#GetShellEvent]]
| 3 || [[#ClearExFatDriverStatusForDebug]]
|-
|-
| 5 || [1.0.0-9.2.0] [[#GetShellEventInfo]]
| 4 || [[#RequestBackgroundNetworkUpdate]]
|-
|-
| 6 || [[#TerminateApplication]]
| 5 || [[#NotifyBackgroundNetworkUpdate]]
|-
|-
| 7 || [1.0.0-9.2.0] [[#PrepareLaunchProgramFromHost]]
| 6 || [[#NotifyExFatDriverDownloadedForDebug]]
|-
|-
| 8 || [10.0.0-17.0.1] [[#LaunchApplicationFromHost]] ([1.0.0-9.2.0] [[#LaunchApplicationForDevelop]])
| 9 || [[#GetSystemUpdateNotificationEventForContentDelivery]]
|-
|-
| 9 || [1.0.0-17.0.1] [[#LaunchApplicationWithStorageIdForDevelop]]
| 10 || [[#NotifySystemUpdateForContentDelivery]]
|-
|-
| 10 || [6.0.0-8.1.0] [[#IsSystemMemoryResourceLimitBoosted]]
| 11 || [3.0.0+] [[#PrepareShutdown]]
|-
|-
| 11 || [6.0.0+] [[#GetRunningApplicationProcessIdForDevelop]]
| 12 || [3.0.0-3.0.2]
|-
|-
| 12 || [6.0.0+] [[#SetCurrentApplicationRightsEnvironmentCanBeActiveForDevelop]]
| 13 || [3.0.0-3.0.2]
|-
|-
| 13 || [9.0.0+] [[#CreateApplicationResourceForDevelop]]
| 14 || [3.0.0-3.0.2]
|-
|-
| 14 || [9.0.0+] [[#IsPreomiaForDevelop]]
| 15 || [3.0.0-3.0.2]
|-
|-
| 15 || [10.0.0-17.0.1] [[#GetApplicationProgramIdFromHost]]
| 16 || [4.0.0+] [[#DestroySystemUpdateTask]]
|-
|-
| 16 || [12.0.0+] RefreshCachedDebugValues
| 17 || [4.0.0+] [[#RequestSendSystemUpdate]]
|-
|-
| 17 || [12.0.0+] [[#PrepareLaunchApplicationFromHost]]
| 18 || [4.0.0+] [[#GetSendSystemUpdateProgress]]
|-
| 18 || [12.0.0+] [[#GetLaunchEvent]]
|-
| 19 || [12.0.0+] [[#GetLaunchResult]]
|-
| 20 || [14.0.0+] GetProgramId
|-
| 21 || [18.0.0+] PrepareLaunchApplication
|-
|-
| 22 || [18.0.0+] LaunchApplicationForDevelop
| 19 || [S2]
|-
|-
| 23 || [18.0.0+] GetProgramIdByApplicationLaunchInfo
| 20 || [S2]
|-
| 24 || [18.0.0+] DestroyApplicationLaunchPreparation
|}
|}


== LaunchProgram ==
== GetBackgroundNetworkUpdateState ==
Wrapper for "pm:shell" [[Process_Manager_services#pm:shell|LaunchProcess]].
No input, returns an output [[#BackgroundNetworkUpdateState]].


== TerminateProcess ==
This is similar to [[#HasDownloaded]], see [[#BackgroundNetworkUpdateState]].
Wrapper for "pm:shell" [[Process_Manager_services#pm:shell|TerminateProcess]].


== TerminateProgram ==
== OpenSystemUpdateControl ==
Wrapper for "pm:shell" [[Process_Manager_services#pm:shell|TerminateProgram]].
No input, returns an [[#ISystemUpdateControl]].


== GetShellEvent ==
Only 1 ISystemUpdateControl can be open at a time.
Wrapper for "pm:shell" [[Process_Manager_services#pm:shell|GetProcessEventHandle]].


== GetShellEventInfo ==
== NotifyExFatDriverRequired ==
Wrapper for "pm:shell" [[Process_Manager_services#pm:shell|GetProcessEventInfo]].
No input/output.


== TerminateApplication ==
Only usable when an [[#ISystemUpdateControl]] isn't open.
Calls "pm:shell" [[Process_Manager_services#pm:shell|GetApplicationProcessIdForShell]] and sends the ProcessId to [[Process_Manager_services#pm:shell|TerminateProcess]].


== PrepareLaunchProgramFromHost ==
This uses [[NIM_services|nim]] ListSystemUpdateTask, then when a task is returned uses it with DestroySystemUpdateTask.
Takes a type-0x5 input buffer containing the [[Filesystem_services#FspPath|FspPath]], returns an output 0x10-byte struct.


Calls [[NCM_services#IPathResolverForStorage|IPathResolverForStorage]] Set...NcaPath functions.
Then this runs ExFat handling, updates state, and sets the same state flag as [[#RequestBackgroundNetworkUpdate]].


== LaunchApplicationForDevelop ==
== ClearExFatDriverStatusForDebug ==
Takes an input u32 [[Process_Manager_services#LaunchFlags|LaunchFlags]] and [[NCM_services#ApplicationId|ApplicationId]], returns an output u64 ProcessId.
No input/output.


Same as [[#LaunchApplicationWithStorageIdForDevelop]] except the last two params passed to the internal vtable funcptr call are value 0x6, instead of from the command input.
== RequestBackgroundNetworkUpdate ==
No input/output.


== LaunchApplicationFromHost ==
Only usable when an [[#ISystemUpdateControl]] isn't open.
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 ==
This sets a state flag to value 1.
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.


Launches an application title which is registered with NS.
== NotifyBackgroundNetworkUpdate ==
Takes an input [[NCM_services#ContentMetaKey|ContentMetaKey]], no output.


== IsSystemMemoryResourceLimitBoosted ==
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]].
No input. Returns a bool.


== GetRunningApplicationProcessIdForDevelop ==
== NotifyExFatDriverDownloadedForDebug ==
Returns an output u64 ProcessId.
No input/output.


== SetCurrentApplicationRightsEnvironmentCanBeActiveForDevelop ==
== GetSystemUpdateNotificationEventForContentDelivery ==
Takes an input bool. No output.
No input, returns an output Event handle with EventClearMode=0.


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


== IsPreomiaForDevelop ==
Signals the Event returned by [[#GetSystemUpdateNotificationEventForContentDelivery]].
Takes an input u64 [[NCM_services#ProgramId|ProgramId]]. Returns a bool.


== GetApplicationProgramIdFromHost ==
== PrepareShutdown ==
Takes a type-0x5 input buffer containing the [[Filesystem_services#FspPath|FspPath]]. Returns an u64 [[NCM_services#ProgramId|ProgramId]].
No input/output.
 
This is used by [[AM_services|AM]].
 
Just returns 0 when an [[#ISystemUpdateControl]] is open.
 
This does various cleanup / uses various service-cmds etc for shutdown preparation.
 
== DestroySystemUpdateTask ==
No input/output.


== PrepareLaunchApplicationFromHost ==
Only usable when an [[#ISystemUpdateControl]] isn't open.
[18.0.0+] Now returns a total of 0x50 bytes of output.


[19.0.0+] Now returns a total of 0x80 bytes of output.
This uses [[NIM_services|nim]] ListSystemUpdateTask, then when a task is returned uses it with DestroySystemUpdateTask.


== GetLaunchEvent ==
== RequestSendSystemUpdate ==
[18.0.0+] Now takes a total of 0x50 bytes of input.
Takes a type-0x15 input buffer containing a [[#SystemDeliveryInfo]], an u16 port, an u32 Ipv4Address, returns an output Event handle and an [[#IAsyncResult]].


[19.0.0+] Now takes a total of 0x80 bytes of input.
[[qlaunch]] uses value 55556 for the port. IP is normally a local-WLAN address, however this can be any address. port/addr are little-endian.


== GetLaunchResult ==
See [[NIM_services|nim]] regarding the input addr/port usage, etc.
[18.0.0+] Now takes a total of 0x50 bytes of input.


[19.0.0+] Now takes a total of 0x80 bytes of input.
[11.0.0+] An error is thrown if LocalContentShare is not [[#IsLocalContentShareEnabled|enabled]].


= acc:su =
This validates the [[#SystemDeliveryInfo]] and generates a [[NCM_services#ContentMetaKey|ContentMetaKey]] from that, and creates the [[#IAsyncResult]] + the async thread which handles the [[#IAsyncResult]] operation.
This is "nn::account::IAccountServiceForAdministrator".


[13.0.0+] This was moved from [[Account_services|account]].
The above validation verifies that the HMAC and SystemDeliveryProtocolVersion are valid. The OldSystemUpdateId ([20.0.0+] SystemUpdateId, SystemUpdateIdFlag ignored) must match the Id for the installed SystemUpdate as returned by [[NCM_services|ncm]].


This is only available when the output from [[Process_Manager_services|pm:bm]] GetBootMode is Normal/Maintenance.
Then the thread does:
* Calls a func which does:
** Uses [[NIM_services|nim]] CreateLocalCommunicationSendSystemUpdateTask, returning the Result on failure.
*** The input firmware_variation is from the [[#SystemDeliveryInfo|FirmwareVariationId]].
** Uses [[NIM_services|nim]] RequestLocalCommunicationSendSystemUpdateTaskRun, returning the Result on failure. Waits for the IAsyncResult operation from this to finish, then uses the Get cmd to get the output Result.
*** When the Result from Get is an error, a func is called for filling in the [[#IAsyncResult|IAsyncResult]] ErrorContext with Type4.
** Handles cleanup and returns.
* Unlike [[#RequestReceiveSystemUpdate]], this doesn't save a SystemPlayReport.


{| class="wikitable" border="1"
== GetSendSystemUpdateProgress ==
|-
No input, returns an output [[#SystemUpdateProgress]].
! Cmd || Name || Notes
 
|-
Same as [[#GetReceiveProgress]] except this uses nim ListLocalCommunicationSendSystemUpdateTask and GetLocalCommunicationSendSystemUpdateTaskInfo. The data copied to output is also swapped: u64 nim_out+0x8 is copied to out+0x8, and u64 nim_out+0x10 is copied to out+0x0.
| 0 || GetUserCount ||
 
|-
== Cmd19 ==
| 1 || GetUserExistence ||
This is exclusive to S2.
 
No input/output.
 
== Cmd20 ==
This is exclusive to S2.
 
No input, returns an output u8.
 
== ISystemUpdateControl ==
This is "nn::ns::detail::ISystemUpdateControl".
 
{| class="wikitable" border="1"
|-
|-
| 2 || ListAllUsers ||
! Cmd || Name
|-
|-
| 3 || ListOpenUsers ||
| 0 || [[#HasDownloaded]]
|-
|-
| 4 || GetLastOpenedUser ||
| 1 || [[#RequestCheckLatestUpdate]]
|-
|-
| 5 || GetProfile || Returns an [[#IProfile]].
| 2 || [[#RequestDownloadLatestUpdate]]
|-
|-
| 6 || [3.0.0+] GetProfileDigest ||
| 3 || [[#GetDownloadProgress]]
|-
|-
| 50 || [[#IsUserRegistrationRequestPermitted]] ||
| 4 || [[#ApplyDownloadedUpdate]]
|-
|-
| 51 || [[#TrySelectUserWithoutInteraction]] ||
| 5 || [[#RequestPrepareCardUpdate]]
|-
|-
| 60 || [5.0.0-5.1.0] ListOpenContextStoredUsers ||
| 6 || [[#GetPrepareCardUpdateProgress]]
|-
|-
| 99 || [6.0.0+] DebugActivateOpenContextRetention || No input, returns an [[#ISessionObject]].
| 7 || [[#HasPreparedCardUpdate]]
|-
|-
| 100 || GetUserRegistrationNotifier || Returns an [[#INotifier]].
| 8 || [[#ApplyCardUpdate]]
|-
|-
| 101 || GetUserStateChangeNotifier || Returns an [[#INotifier]].
| 9 || [[#GetDownloadedEulaDataSize]]
|-
|-
| 102 || GetBaasAccountManagerForSystemService || Returns an [[#IManagerForSystemService]].
| 10 || [[#GetDownloadedEulaData]]
|-
|-
| 103 || GetBaasUserAvailabilityChangeNotifier || Returns an [[#INotifier]].
| 11 || [[#SetupCardUpdate]]
|-
|-
| 104 || GetProfileUpdateNotifier || Returns an [[#INotifier]].
| 12 || [[#GetPreparedCardUpdateEulaDataSize]]
|-
|-
| 105 || [4.0.0+] CheckNetworkServiceAvailabilityAsync || Returns an [[#IAsyncContext]].
| 13 || [[#GetPreparedCardUpdateEulaData]]
|-
|-
| 106 || [9.0.0+] GetProfileSyncNotifier ||
| 14 || [4.0.0+] [[#SetupCardUpdateViaSystemUpdater]]
|-
|-
| 110 || StoreSaveDataThumbnail ||
| 15 || [4.0.0+] [[#HasReceived]]
|-
|-
| 111 || ClearSaveDataThumbnail ||
| 16 || [4.0.0+] [[#RequestReceiveSystemUpdate]]
|-
|-
| 112 || LoadSaveDataThumbnail ||
| 17 || [4.0.0+] [[#GetReceiveProgress]]
|-
|-
| 113 || [5.0.0+] GetSaveDataThumbnailExistence ||
| 18 || [4.0.0+] [[#ApplyReceivedUpdate]]
|-
|-
| 120 || [10.0.0+] ListOpenUsersInApplication ||
| 19 || [4.0.0+] [[#GetReceivedEulaDataSize]]
|-
|-
| 130 || [6.0.0+] ActivateOpenContextRetention || Takes a total of 0x8-bytes of input, returns an [[#ISessionObject]].
| 20 || [4.0.0+] [[#GetReceivedEulaData]]
|-
|-
| 140 || [6.0.0+] ListQualifiedUsers ||
| 21 || [4.0.0+] [[#SetupToReceiveSystemUpdate]]
|-
|-
| 150 || [10.0.0-10.2.0] AuthenticateApplicationAsync ||
| 22 || [6.0.0+] [[#RequestCheckLatestUpdateIncludesRebootlessUpdate]]
|-
|}
| 151 || [12.0.0+] EnsureSignedDeviceIdentifierCacheForNintendoAccountAsync ||
 
|-
All Card cmds except SetupCardUpdate* require [[#SetupCardUpdate]]/[[#SetupCardUpdateViaSystemUpdater]] to be used previously. [[#GetPreparedCardUpdateEulaDataSize]]/[[#GetPreparedCardUpdateEulaData]] checks a different state flag.
| 152 || [12.0.0+] LoadSignedDeviceIdentifierCacheForNintendoAccount ||
 
|-
=== HasDownloaded ===
| 170 || [13.0.0+] GetNasOp2MembershipStateChangeNotifier ||
No input, returns an output u8 bool flag.
|-
 
| 190 || [1.0.0-9.2.0] GetUserLastOpenedApplication ||
Gets whether a network sysupdate was downloaded, with install pending.
|-
 
| 191 || [7.0.0+] UpdateNotificationReceiverInfo ([5.0.0-5.1.0] ActivateOpenContextHolder) ||
Uses [[NIM_services|nim]] ListSystemUpdateTask and [[NIM_services|nim]] GetSystemUpdateTaskInfo. When ListSystemUpdateTask successfully returns a task and GetSystemUpdateTaskInfo is successful, the output flag is set to: <code>*((u8*)(taskinfo+0) == 0x3</code>. Otherwise, flag=0.
|-
 
| 200 || BeginUserRegistration ||
This always returns 0, however this will assert if GetSystemUpdateTaskInfo fails with ret!=0x3C89.
|-
 
| 201 || CompleteUserRegistration ||
=== RequestCheckLatestUpdate ===
|-
No input, returns an output Event handle and an [[#IAsyncValue]].
| 202 || CancelUserRegistration ||
 
|-
The data that can be read from the [[#IAsyncValue]] is [[#LatestSystemUpdate]].
| 203 || DeleteUser ||
 
|-
=== RequestDownloadLatestUpdate ===
| 204 || SetUserPosition ||
No input, returns an output Event handle and an [[#IAsyncResult]].
|-
 
| 205 || GetProfileEditor || Takes an input userID and returns an [[#IProfileEditor]].
=== GetDownloadProgress ===
|-
No input, returns an output [[#SystemUpdateProgress]].
| 206 || CompleteUserRegistrationForcibly ||
 
|-
Similar to [[#HasDownloaded]] except instead of a flag, this returns the 0x10-bytes from taskinfo+8. The output struct is cleared when the task(info) isn't available.
| 210 || [3.0.0+] CreateFloatingRegistrationRequest || Returns an [[#IFloatingRegistrationRequest]].
 
|-
=== ApplyDownloadedUpdate ===
| 211 || [8.0.0+] CreateProcedureToRegisterUserWithNintendoAccount || Takes a total of 0x4-bytes of input and a handle, returns an [[#IOAuthProcedureForUserRegistration]].
No input/output.
|-
 
| 212 || [8.0.0+] ResumeProcedureToRegisterUserWithNintendoAccount || Takes a total of 0x14-bytes of input and a handle, returns an [[#IOAuthProcedureForUserRegistration]].
Runs code similar to [[#HasDownloaded]], throwing an error if a network sysupdate isn't ready for install. Then the sysupdate is installed:
|-
| 213 || [17.0.0+] CreateProcedureToCreateUserWithNintendoAccount ||
|-
| 214 || [17.0.0+] ResumeProcedureToCreateUserWithNintendoAccount ||
|-
| 215 || [17.0.0+] ResumeProcedureToCreateUserWithNintendoAccountAfterApplyResponse ||
|-
| 230 || AuthenticateServiceAsync || Returns an [[#IAsyncContext]].
|-
| 250 || GetBaasAccountAdministrator || Returns an [[#IAdministrator]].
|-
| 290 || ProxyProcedureForGuestLoginWithNintendoAccount || Returns an [[#IOAuthProcedureForExternalNsa]] (formerly [[#IOAuthProcedureForGuestLogin]] with [1.0.0-2.3.0]).
|-
| 291 || [3.0.0+] ProxyProcedureForFloatingRegistrationWithNintendoAccount || Returns an [[#IOAuthProcedureForExternalNsa]].
|-
| 299 || SuspendBackgroundDaemon || Returns an [[#ISessionObject]].
|-
| 400 || [18.0.0+] SetPinCode ||
|-
| 401 || [18.0.0+] GetPinCodeLength ||
|-
| 402 || [18.0.0+] GetPinCode ||
|-
| 410 || [18.0.0+] GetPinCodeErrorCount ||
|-
| 411 || [18.0.0+] ResetPinCodeErrorCount ||
|-
| 412 || [18.0.0+] IncrementPinCodeErrorCount ||
|-
| 900 || [13.0.0+] SetUserUnqualifiedForDebug ||
|-
| 901 || [13.0.0+] UnsetUserUnqualifiedForDebug ||
|-
| 902 || [13.0.0+] ListUsersUnqualifiedForDebug ||
|-
| 910 || [16.0.0+] RefreshFirmwareSettingsForDebug ||
|-
| 997 || [3.0.0+] DebugInvalidateTokenCacheForUser ||
|-
| 998 || DebugSetUserStateClose ||
|-
| 999 || DebugSetUserStateOpen ||
|}


[10.0.0+] DebugSetUserStateClose/DebugSetUserStateOpen now takes an additional 8-bytes of input.
* Uses ListSystemUpdateTask again, then [[NIM_services|nim]] IsExFatDriverIncluded. Runs ExFat handling when the output flag is set.
* On newer system-versions, this uses [[NIM_services|nim]] GetSystemUpdateTaskInfo then on success uses data from there to save a SystemPlayReport when the cached [[System_Settings|system-setting]] "systemreport!enabled" is set.
** The EventId is "systemupdate_dl_throughput" with ApplicationId 0100000000001018.
** The following fields are added to the report, see [[NIM_services#SystemUpdateTaskInfo|nim SystemUpdateTaskInfo]]: "ContentMetaId", "Version", "DownloadSize", and "ThroughputKBps".
* On newer system-versions, this saves another SystemPlayReport when a state flag is set (same flag mentioned above).
** The EventId is "systemupdate_pass" with ApplicationId 0100000000001021.
** This report has the following fields:
*** "Type"
*** "SourceSystemUpdateMetaId"
*** "SourceSystemUpdateMetaVersion"
*** "SourceExFatStatus"
*** "DestinationSystemUpdateMetaId"
*** "DestinationSystemUpdateMetaVersion"
*** "DestinationExFatStatus"
*** "Rebootless"
* Since BootImagePackage will be installed later, the two flags in [[Flash_Filesystem#System_Update_Control]] are set to 1.
* Uses [[NIM_services|nim]] CommitSystemUpdateTask and [[NIM_services|nim]] DestroySystemUpdateTask.
* Installs BootImagePackage. After installing each BootImagePackage, the associated flag in [[Flash_Filesystem#System_Update_Control]] is set to 0.
* On newer system versions when an input flag is set, this uses [[Filesystem_services|NotifySystemDataUpdateEvent]], however this doesn't happen with ApplyDownloadedUpdate since that input flag is 0.
 
=== RequestPrepareCardUpdate ===
No input, returns an output Event handle and an [[#IAsyncResult]].


== IsUserRegistrationRequestPermitted ==
=== GetPrepareCardUpdateProgress ===
Takes a PID, an input u64 pid_reserved, and returns an output u8 bool.
No input, returns an output [[#SystemUpdateProgress]].


== TrySelectUserWithoutInteraction ==
=== HasPreparedCardUpdate ===
Takes an input u8 bool isNetworkServiceAccountRequired, returns an output Uid.
No input, returns an output u8 bool flag.


== IManagerForSystemService ==
=== ApplyCardUpdate ===
This is "nn::account::baas::IManagerForSystemService".
No input/output.


{| class="wikitable" border="1"
=== GetDownloadedEulaDataSize ===
|-
Takes a type-0x15 input buffer [[#EulaDataPath]], returns an output u64 '''filesize'''.
! Cmd || Name || Notes
 
|-
Runs code similar to [[#HasDownloaded]], throwing an error if a network sysupdate isn't ready for install.
| 0 || CheckAvailability ||
 
|-
Uses ListSystemUpdateTask again. Then [[NIM_services|nim]] GetDownloadedSystemDataPath, with the output ContentPath being used to mount the EULA title with FS.
| 1 || GetAccountId ||
 
|-
Then "<mountname>:/<[[#EulaDataPath]]>" is opened, gets the '''filesize''', then runs cleanup.
| 2 || EnsureIdTokenCacheAsync || Returns an [[#IAsyncContext]].
 
|-
=== GetDownloadedEulaData ===
| 3 || LoadIdTokenCache ||
Takes a type-0x15 input buffer [[#EulaDataPath]] and a type-0x6 output buffer, returns an output u64 '''filesize'''.
|-
 
| 100 || SetSystemProgramIdentification ||
Similar to [[#GetDownloadedEulaDataSize]] except this reads the file instead, using the specified output buffer with size=filesize. This will throw an error if the filesize is larger than the buffer size.
|-
 
| 101 || [7.0.0+] RefreshNotificationTokenAsync ||
=== SetupCardUpdate ===
|-
Takes an input u64 size and a TransferMemory handle, no output.
| 110 || [4.0.0+] GetServiceEntryRequirementCache ||
 
|-
Official sw creates the TransferMemory with an user-specified buffer, with permissions=None.
| 111 || [4.0.0+] InvalidateServiceEntryRequirementCache ||
 
|-
[[qlaunch]] uses size 0x100000 for the TransferMemory buffer.
| 112 || [4.0.0-6.2.0] InvalidateTokenCache ||
 
|-
=== GetPreparedCardUpdateEulaDataSize ===
| 113 || [6.1.0+] GetServiceEntryRequirementCacheForOnlinePlay || Takes a total of 0x8-bytes of input, returns a total of 0x4-bytes of output.
Takes a type-0x15 input buffer [[#EulaDataPath]], returns an output u64 '''filesize'''.
|-
 
| 120 || GetNintendoAccountId ||
This is similar to [[#GetDownloadedEulaDataSize]].
|-
| 121 || [9.0.0+] CalculateNintendoAccountAuthenticationFingerprint ||
|-
| 130 || GetNintendoAccountUserResourceCache ||
|-
| 131 || RefreshNintendoAccountUserResourceCacheAsync || Returns an [[#IAsyncContext]].
|-
| 132 || RefreshNintendoAccountUserResourceCacheAsyncIfSecondsElapsed || Returns an [[#IAsyncContext]].
|-
| 133 || [9.0.0+] GetNintendoAccountVerificationUrlCache ||
|-
| 134 || [9.0.0+] RefreshNintendoAccountVerificationUrlCacheAsync ||
|-
| 135 || [9.0.0+] RefreshNintendoAccountVerificationUrlCacheAsyncIfSecondsElapsed ||
|-
| 140 || [5.0.0+] GetNetworkServiceLicenseCache ||
|-
| 141 || [5.0.0+] RefreshNetworkServiceLicenseCacheAsync || Returns an [[#IAsyncContext]].
|-
| 142 || [5.0.0+] RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed || Returns an [[#IAsyncContext]].
|-
| 150 || CreateAuthorizationRequest || Returns an [[#IAuthorizationRequest]].
|-
| 160 || [15.0.0+] RequiresUpdateNetworkServiceAccountIdTokenCache ||
|-
| 161 || [16.0.0+] RequireReauthenticationOfNetworkServiceAccount ||
|-
| 170 || [17.0.0+] CreateDeviceHistoryRequest ||
|-
| 180 || [18.0.0+] GetRequestForNintendoAccountReauthentication ||
|}


== IFloatingRegistrationRequest ==
=== GetPreparedCardUpdateEulaData ===
This is "nn::account::baas::IFloatingRegistrationRequest".
Takes a type-0x15 input buffer [[#EulaDataPath]] and a type-0x6 output buffer, returns an output u64 '''filesize'''.


Added with [3.0.0+].
This is similar to [[#GetDownloadedEulaData]].


{| class="wikitable" border="1"
=== SetupCardUpdateViaSystemUpdater ===
|-
Takes an input u64 size and a TransferMemory handle, no output.
! Cmd || Name || Notes
 
|-
The permissions for the TransferMemory is None.
| 0 || GetSessionId ||
 
|-
Same as [[#SetupCardUpdate]], except this doesn't have the code for [[Filesystem_services|GetGameCardHandle/GetGameCardUpdatePartitionInfo]], and uses [[Filesystem_services|OpenRegisteredUpdatePartition]] instead of [[Filesystem_services|OpenGameCardFileSystem]]. This uses the same is_initialized bool state flag.
| 12 || GetAccountId ||
 
|-
=== HasReceived ===
| 13 || GetLinkedNintendoAccountId ||
No input, returns an output u8 bool.
|-
| 14 || GetNickname ||
|-
| 15 || GetProfileImage ||
|-
| 16 || [18.0.0+] GetProfileLargeImage ||
|-
| 21 || LoadIdTokenCache ||
|-
| 100 || RegisterUser ([1.0.0-3.0.2] RegisterAsync) || [1.0.0-3.0.2] Used to return an [[#IAsyncContext]].
|-
| 101 || RegisterUserWithUid ([1.0.0-3.0.2] RegisterWithUidAsync) || [1.0.0-3.0.2] Used to return an [[#IAsyncContext]].
|-
| 102 || [4.0.0+] RegisterNetworkServiceAccountAsync || Returns an [[#IAsyncContext]].
|-
| 103 || [4.0.0+] RegisterNetworkServiceAccountWithUidAsync || Returns an [[#IAsyncContext]].
|-
| 110 || SetSystemProgramIdentification ||
|-
| 111 || EnsureIdTokenCacheAsync || Returns an [[#IAsyncContext]].
|}


== IAdministrator ==
Same as [[#HasDownloaded]] except this uses [[NIM_services|nim]] ListLocalCommunicationReceiveSystemUpdateTask and GetLocalCommunicationReceiveSystemUpdateTaskInfo.
This is "nn::account::baas::IAdministrator".


{| class="wikitable" border="1"
=== RequestReceiveSystemUpdate ===
|-
Takes a type-0x15 input buffer containing a [[#SystemDeliveryInfo]], an u16 port, an u32 Ipv4Address, returns an output Event handle and an [[#IAsyncResult]].
! Cmd || Name || Notes
 
|-
[[qlaunch]] uses the same value for the port as [[#RequestSendSystemUpdate]] (see [[#RequestSendSystemUpdate]] for addr as well).
| 0 || CheckAvailability ||
 
|-
See [[NIM_services|nim]] regarding the input addr/port usage, etc.
| 1 || GetAccountId ||
 
|-
This uses the same LocalContentShare check as [[#RequestSendSystemUpdate|RequestSendSystemUpdate]].
| 2 || EnsureIdTokenCacheAsync || Returns an [[#IAsyncContext]].
 
|-
An error is thrown if a state flag is clear.
| 3 || LoadIdTokenCache ||
 
|-
This validates the [[#SystemDeliveryInfo]] (same as [[#RequestSendSystemUpdate|RequestSendSystemUpdate]]) and generates a [[NCM_services#ContentMetaKey|ContentMetaKey]] from that, and creates the [[#IAsyncResult]] + the async thread which handles the [[#IAsyncResult]] operation.
| 100 || SetSystemProgramIdentification ||
 
|-
Then the thread does:
| 101 || [7.0.0+] RefreshNotificationTokenAsync
 
|-
* Calls a func which does:
| 110 || [4.0.0+] GetServiceEntryRequirementCache ||
** Throws an error if [[NIM_services#ListSystemUpdateTask|ListSystemUpdateTask]] returns any task.
|-
** Checks whether a sysupdate is actually required using the previously generated [[NCM_services#ContentMetaKey|ContentMetaKey]] (this func is also passed the below statefield as the last param), throwing an error if not.
| 111 || [4.0.0+] InvalidateServiceEntryRequirementCache ||
*** [20.0.0+] The above check-sysupdate func was updated (which is also used elsewhere), flag handling during the loop was updated (which uses the last input param).
|-
** Uses [[NIM_services|nim]] CreateLocalCommunicationReceiveSystemUpdateTask, returning the Result on failure.
| 112 || [4.0.0-6.2.0] InvalidateTokenCache ||
*** The input firmware_variation is from [[System_Settings|system-setting]] <code>ns.systemupdate!firmware_variation</code> or <code>ns.systemupdate!t_firmware_variation</code>, depending on the [[Settings_services|PlatformRegion]] (value 0xFF is used when the output setting-size is invalid).
|-
*** The input '''unk''' is set to: <code>unk = statefield == 0 ? 0x4 : 0xC</code> ([20.0.0+] uses statefield & 1 == 0). [20.0.0+] Additional data is now ORRed with unk afterwards: <code>unk |= ((statefield>>1) & 0x3) << 8;</code> (same statefield as before)
| 113 || [6.1.0+] GetServiceEntryRequirementCacheForOnlinePlay || Takes a total of 0x8-bytes of input, returns a total of 0x4-bytes of output.
** Uses [[NIM_services|nim]] RequestLocalCommunicationReceiveSystemUpdateTaskRun, returning the Result on failure. Waits for the IAsyncResult operation from this to finish, then uses the Get cmd to get the output Result.
|-
*** When the Result from Get is an error, a func is called for filling in the [[#IAsyncResult|IAsyncResult]] ErrorContext with Type4.
| 120 || GetNintendoAccountId ||
** 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.
| 121 || [9.0.0+] CalculateNintendoAccountAuthenticationFingerprint ||
** The EventId is "receive_system_update" with ApplicationId <NS ProgramId>.
|-
** This report has the following fields:
| 130 || GetNintendoAccountUserResourceCache ||
*** "SourceSystemUpdateId"
|-
*** "DestinationSystemUpdateId"
| 131 || RefreshNintendoAccountUserResourceCacheAsync || Returns an [[#IAsyncContext]].
*** "SourceSystemUpdateVersion"
|-
*** "DestinationSystemUpdateVersion"
| 132 || RefreshNintendoAccountUserResourceCacheAsyncIfSecondsElapsed || Returns an [[#IAsyncContext]].
*** "SenderFirmwareVariationId"
|-
*** "ReceiverFirmwareVariationId"
| 133 || [9.0.0+] GetNintendoAccountVerificationUrlCache ||
*** "SenderPlatformRegion"
|-
*** "ReceiverPlatformRegion"
| 134 || [9.0.0+] RefreshNintendoAccountVerificationUrlCacheAsync ||
*** "SenderHasExFat"
|-
*** "ReceiverHasExFat"
| 135 || [9.0.0+] RefreshNintendoAccountVerificationUrlCacheAsyncIfSecondsElapsed ||
*** "Size"
|-
*** "ThroughputKBps"
| 140 || [5.0.0+] GetNetworkServiceLicenseCache ||
 
|-
=== GetReceiveProgress ===
| 141 || [5.0.0+] RefreshNetworkServiceLicenseCacheAsync ||
No input, returns an output [[#SystemUpdateProgress]].
|-
 
| 142 || [5.0.0+] RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed ||
Same as [[#GetDownloadProgress]] except this uses [[NIM_services|nim]] ListLocalCommunicationReceiveSystemUpdateTask and GetLocalCommunicationReceiveSystemUpdateTaskInfo.
 
=== ApplyReceivedUpdate ===
No input/output.
 
This uses the same LocalContentShare check as [[#RequestSendSystemUpdate|RequestSendSystemUpdate]].
 
=== GetReceivedEulaDataSize ===
Takes a type-0x15 input buffer [[#EulaDataPath]], returns an output u64 '''filesize'''.
 
This is similar to [[#GetDownloadedEulaDataSize]].
 
=== GetReceivedEulaData ===
Takes a type-0x15 input buffer [[#EulaDataPath]] and a type-0x6 output buffer, returns an output u64 '''filesize'''.
 
This is similar to [[#GetDownloadedEulaData]].
 
=== SetupToReceiveSystemUpdate ===
No input/output.
 
This just uses [[NIM_services|nim]] ListSystemUpdateTask, then when a task is returned uses it with DestroySystemUpdateTask.
 
[[qlaunch]] uses this before [[#RequestReceiveSystemUpdate]].
 
=== RequestCheckLatestUpdateIncludesRebootlessUpdate ===
No input, returns an output Event handle and an [[#IAsyncValue]].
 
= IAsyncValue =
This is "nn::ns::detail::IAsyncValue".
 
{| class="wikitable" border="1"
|-
|-
| 150 || CreateAuthorizationRequest || Returns an [[#IAuthorizationRequest]].
! Cmd || Name
|-
|-
| 160 || [15.0.0+] RequiresUpdateNetworkServiceAccountIdTokenCache ||
| 0 || GetSize
|-
|-
| 161 || [16.0.0+] RequireReauthenticationOfNetworkServiceAccount ||
| 1 || Get
|-
|-
| 170 || [17.0.0+] CreateDeviceHistoryRequest ||
| 2 || Cancel
|-
|-
| 180 || [18.0.0+] GetRequestForNintendoAccountReauthentication ||
| 3 || [4.0.0+] GetErrorContext
|-
|}
| 200 || IsRegistered ||
 
|-
Official sw creates a container object for this using the output from the service commands, which contains the IAsyncValue object, and the Event with EventClearMode=0.
| 201 || RegisterAsync || Returns an [[#IAsyncContext]].
 
|-
* GetSize: No input, returns an output u64.
| 202 || UnregisterAsync || Returns an [[#IAsyncContext]].
* Get: Takes a type-0x6 output buffer, no output. Official sw waits on the Event prior to using this cmd.
* Cancel: No input/output. Used by official sw when closing the object, when the serv-obj is initialized (after using the cmd, official sw will also wait on the Event). This cmd is also used in other official sw funcs.
* GetErrorContext: No input/output, takes a type-0x16 output buffer containing an [[Error_Applet#ErrorContext|ErrorContext]].
 
= IAsyncResult =
This is "nn::ns::detail::IAsyncResult".
 
{| class="wikitable" border="1"
|-
|-
| 203 || DeleteRegistrationInfoLocally ||
! Cmd || Name
|-
|-
| 220 || SynchronizeProfileAsync || Returns an [[#IAsyncContext]].
| 0 || Get
|-
|-
| 221 || UploadProfileAsync || Returns an [[#IAsyncContext]].
| 1 || Cancel
|-
|-
| 222 || SynchronizeProfileAsyncIfSecondsElapsed || Returns an [[#IAsyncContext]].
| 2 || [4.0.0+] GetErrorContext
|}
 
Official sw creates a container object for this using the output from the service commands, which contains the IAsyncResult object, and the Event with EventClearMode=0.
 
* Get: No input/output. Official sw waits on the Event prior to using this cmd.
* Cancel: No input/output. Used by official sw when closing the object, when the serv-obj is initialized (after using the cmd, official sw will also wait on the Event). This cmd is also used in other official sw funcs.
* GetErrorContext: No input/output, takes a type-0x16 output buffer containing an [[Error_Applet#ErrorContext|ErrorContext]].
 
= ns:dev =
This is "nn::ns::detail::IDevelopInterface".
 
[10.0.0+] Some of these cmds were replaced by the [[PGL_services|pgl]] system module.
 
{| class="wikitable" border="1"
|-
|-
| 250 || IsLinkedWithNintendoAccount ||
! Cmd || Name
|-
|-
| 251 || CreateProcedureToLinkWithNintendoAccount || Returns an [[#IOAuthProcedureForNintendoAccountLinkage]].
| 0 || [1.0.0-9.2.0] [[#LaunchProgram]]
|-
|-
| 252 || ResumeProcedureToLinkWithNintendoAccount || Returns an [[#IOAuthProcedureForNintendoAccountLinkage]].
| 1 || [[#TerminateProcess]]
|-
|-
| 255 || CreateProcedureToUpdateLinkageStateOfNintendoAccount || Returns an [[#IOAuthProcedure]].
| 2 || [1.0.0-9.2.0] [[#TerminateProgram]]
|-
|-
| 256 || ResumeProcedureToUpdateLinkageStateOfNintendoAccount || Returns an [[#IOAuthProcedure]].
| 4 || [1.0.0-9.2.0] [[#GetShellEvent]]
|-
|-
| 260 || [3.0.0+] CreateProcedureToLinkNnidWithNintendoAccount || Returns an [[#IOAuthProcedure]].
| 5 || [1.0.0-9.2.0] [[#GetShellEventInfo]]
|-
| 6 || [[#TerminateApplication]]
|-
|-
| 261 || [3.0.0+] ResumeProcedureToLinkNnidWithNintendoAccount || Returns an [[#IOAuthProcedure]].
| 7 || [1.0.0-9.2.0] [[#PrepareLaunchProgramFromHost]]
|-
|-
| 280 || ProxyProcedureToAcquireApplicationAuthorizationForNintendoAccount || Returns an [[#IOAuthProcedure]].
| 8 || [10.0.0-17.0.1] [[#LaunchApplicationFromHost]] ([1.0.0-9.2.0] LaunchApplication)
|-
|-
| 290 || [8.0.0+] GetRequestForNintendoAccountUserResourceView ||
| 9 || [1.0.0-17.0.1] [[#LaunchApplicationWithStorageId]]
|-
|-
| 300 || [6.0.0+] TryRecoverNintendoAccountUserStateAsync || Returns an [[#IAsyncContext]].
| 10 || [6.0.0-8.1.0] [[#IsSystemMemoryResourceLimitBoosted]]
|-
|-
| 400 || [6.1.0+] IsServiceEntryRequirementCacheRefreshRequiredForOnlinePlay || Takes a total of 0x8-bytes of input, returns an output u8.
| 11 || [6.0.0+] [[#GetRunningApplicationProcessId]]
|-
|-
| 401 || [6.1.0+] RefreshServiceEntryRequirementCacheForOnlinePlayAsync || Takes a total of 0x8-bytes of input, returns an [[#IAsyncContext]].
| 12 || [6.0.0+] [[#SetCurrentApplicationRightsEnvironmentCanBeActive]]
|-
|-
| 410 || [13.1.0+] CheckRequiredLicenseForLexAsync ||
| 13 || [9.0.0+] [[#CreateApplicationResource]]
|-
|-
| 900 || [9.0.0+] GetAuthenticationInfoForWin ||
| 14 || [9.0.0+] [[#IsPreomia]]
|-
|-
| 901 || [9.0.0+] ImportAsyncForWin ||
| 15 || [10.0.0-17.0.1] [[#GetApplicationProgramIdFromHost]]
|-
|-
| 997 || DebugUnlinkNintendoAccountAsync || Returns an [[#IAsyncContext]].
| 16 || [12.0.0+] RefreshCachedDebugValues
|-
|-
| 998 || DebugSetAvailabilityErrorDetail ||
| 17 || [12.0.0+] [[#PrepareLaunchApplicationFromHost]]
|}
 
== IAuthorizationRequest ==
This is "nn::account::nas::IAuthorizationRequest".
 
{| class="wikitable" border="1"
|-
|-
! Cmd || Name || Notes
| 18 || [12.0.0+] [[#GetLaunchEvent]]
|-
|-
| 0 || GetSessionId ||
| 19 || [12.0.0+] [[#GetLaunchResult]]
|-
|-
| 10 || InvokeWithoutInteractionAsync || Returns an [[#IAsyncContext]].
| 20 || [14.0.0+] GetProgramId
|-
|-
| 19 || IsAuthorized ||
| 21 || [18.0.0+] [[#PrepareLaunchApplication]]
|-
|-
| 20 || GetAuthorizationCode ||
| 22 || [18.0.0+] [[#LaunchApplication]]
|-
|-
| 21 || GetIdToken ||
| 23 || [18.0.0+] [[#GetProgramIdByApplicationLaunchInfo]]
|-
|-
| 22 || GetState ||
| 24 || [18.0.0+] DestroyApplicationLaunchPreparation
|}
|}


== IOAuthProcedure ==
== LaunchProgram ==
This is "nn::account::http::IOAuthProcedure".
Wrapper for "pm:shell" [[Process_Manager_services#pm:shell|LaunchProcess]].


{| class="wikitable" border="1"
== TerminateProcess ==
|-
Wrapper for "pm:shell" [[Process_Manager_services#pm:shell|TerminateProcess]].
! Cmd || Name || Notes
 
|-
== TerminateProgram ==
| 0 || PrepareAsync || Returns an [[#IAsyncContext]].
Wrapper for "pm:shell" [[Process_Manager_services#pm:shell|TerminateProgram]].
|-
 
| 1 || GetRequest ||
== GetShellEvent ==
|-
Wrapper for "pm:shell" [[Process_Manager_services#pm:shell|GetProcessEventHandle]].
| 2 || ApplyResponse ||
 
|-
== GetShellEventInfo ==
| 3 || ApplyResponseAsync || Returns an [[#IAsyncContext]].
Wrapper for "pm:shell" [[Process_Manager_services#pm:shell|GetProcessEventInfo]].
|-
| 10 || Suspend ||
|}


== IOAuthProcedureForExternalNsa ==
== TerminateApplication ==
This is "nn::account::nas::IOAuthProcedureForExternalNsa".
Calls "pm:shell" [[Process_Manager_services#pm:shell|GetApplicationProcessIdForShell]] and sends the ProcessId to [[Process_Manager_services#pm:shell|TerminateProcess]].


Added with [3.0.0+].
== PrepareLaunchProgramFromHost ==
Takes a type-0x5 input buffer containing the [[Filesystem_services#FspPath|FspPath]], returns an output 0x10-byte struct.


{| class="wikitable" border="1"
Calls [[NCM_services#IPathResolverForStorage|IPathResolverForStorage]] Set...NcaPath functions.
|-
 
! Cmd || Name || Notes
== 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.
| 0 || PrepareAsync || Returns an [[#IAsyncContext]].
 
|-
== LaunchApplicationWithStorageId ==
| 1 || GetRequest ||
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.
|-
 
| 2 || ApplyResponse ||
Launches an application title which is registered with NS.
|-
 
| 3 || ApplyResponseAsync || Returns an [[#IAsyncContext]].
== IsSystemMemoryResourceLimitBoosted ==
|-
No input. Returns a bool.
| 10 || Suspend ||
|-
| 100 || GetAccountId ||
|-
| 101 || GetLinkedNintendoAccountId ||
|-
| 102 || GetNickname ||
|-
| 103 || GetProfileImage ||
|-
| 104 || [18.0.0+] GetProfileLargeImage ||
|}


== IOAuthProcedureForNintendoAccountLinkage ==
== GetRunningApplicationProcessId ==
This is "nn::account::nas::IOAuthProcedureForNintendoAccountLinkage".
Returns an output u64 ProcessId.


{| class="wikitable" border="1"
== SetCurrentApplicationRightsEnvironmentCanBeActive ==
|-
Takes an input bool. No output.
! Cmd || Name || Notes
 
|-
== CreateApplicationResource ==
| 0 || PrepareAsync || Returns an [[#IAsyncContext]].
Takes an input u32 (1 = Preomia/MicroApplication). Returns an [[#IApplicationResource]].
|-
 
| 1 || GetRequest ||
== IsPreomia ==
|-
Takes an input u64 [[NCM_services#ProgramId|ProgramId]]. Returns a bool.
| 2 || ApplyResponse ||
|-
| 3 || ApplyResponseAsync || Returns an [[#IAsyncContext]].
|-
| 10 || Suspend ||
|-
| 100 || GetRequestWithTheme ||
|-
| 101 || IsNetworkServiceAccountReplaced ||
|-
| 199 || [2.0.0-5.1.0] GetUrlForIntroductionOfExtraMembership ||
|-
| 200 || [16.0.0+] ApplyAsyncWithAuthorizedToken ||
|}


== INotifier ==
== GetApplicationProgramIdFromHost ==
This is "nn::account::detail::INotifier".
Takes a type-0x5 input buffer containing the [[Filesystem_services#FspPath|FspPath]]. Returns an u64 [[NCM_services#ProgramId|ProgramId]].


{| class="wikitable" border="1"
== PrepareLaunchApplicationFromHost ==
|-
[18.0.0+] Now returns a total of 0x50 bytes of output.
! Cmd || Name
|-
| 0 || GetSystemEvent
|}


== IProfile ==
[19.0.0+] Now returns a total of 0x80 bytes of output.
This is "nn::account::profile::IProfile".


{| class="wikitable" border="1"
== GetLaunchEvent ==
|-
[18.0.0+] Now takes a total of 0x50 bytes of input.
! Cmd || Name
 
|-
[19.0.0+] Now takes a total of 0x80 bytes of input.
| 0 || [[#Get]]
 
|-
== GetLaunchResult ==
| 1 || [[#GetBase]]
[18.0.0+] Now takes a total of 0x50 bytes of input.
|-
 
| 10 || [[#GetImageSize]]
[19.0.0+] Now takes a total of 0x80 bytes of input.
|-
 
| 11 || [[#LoadImage]]
== PrepareLaunchApplication ==
|-
Takes a total of 0x10-bytes of input. Returns a total of 0x50-bytes of output.
| 20 || [18.0.0+] GetLargeImageSize
 
|-
[19.0.0+] Now returns a total of 0x80-bytes of output.
| 21 || [18.0.0+] LoadLargeImage
 
|-
== LaunchApplication ==
| 30 || [18.0.0+] GetImageId
Takes a total of 0x50-bytes of input. Returns a total of 8-bytes of output.
|}


=== Get ===
[19.0.0+] Now takes a total of 0x80 bytes of input.
Takes an output type-0x1A buffer for [[#UserData]], returns an output [[#ProfileBase]].


=== GetBase ===
== GetProgramIdByApplicationLaunchInfo ==
No input, returns an output [[#ProfileBase]].
Takes a total of 0x50-bytes of input. Returns a total of 8-bytes of output.


=== GetImageSize ===
[19.0.0+] Now takes a total of 0x80 bytes of input.
No input, returns an output u32 for the size of the image buffer.


=== LoadImage ===  
= acc:su =
Takes an output type-0x6 buffer, returns the same output u32 as [[#GetImageSize]].
This is "nn::account::IAccountServiceForAdministrator".


The output buffer contains the JPEG profile image icon. This is valid for both Miis and character icons.
[13.0.0+] This was moved from [[Account_services|account]].


== IProfileEditor ==
This is only available when the output from [[Process_Manager_services|pm:bm]] GetBootMode is Normal/Maintenance.
This is "nn::account::profile::IProfileEditor".


{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Cmd || Name
! Cmd || Name || Notes
|-
|-
| 0 || [[#Get]]
| 0 || GetUserCount ||
|-
|-
| 1 || [[#GetBase]]
| 1 || GetUserExistence ||
|-
|-
| 10 || [[#GetImageSize]]
| 2 || ListAllUsers ||
|-
|-
| 11 || [[#LoadImage]]
| 3 || ListOpenUsers ||
|-
|-
| 20 || [18.0.0+] GetLargeImageSize
| 4 || GetLastOpenedUser ||
|-
|-
| 21 || [18.0.0+] LoadLargeImage
| 5 || GetProfile || Returns an [[#IProfile]].
|-
|-
| 30 || [18.0.0+] GetImageId
| 6 || [3.0.0+] GetProfileDigest ||
|-
|-
| 100 || [[#Store]]
| 50 || [[#IsUserRegistrationRequestPermitted]] ||
|-
|-
| 101 || [[#StoreWithImage]]
| 51 || TrySelectUserWithoutInteractionDeprecated ([1.0.0-18.1.0] [[#TrySelectUserWithoutInteraction]]) ||
|-
|-
| 110 || [18.0.0+] StoreWithLargeImage
| 52 || [19.0.0+] TrySelectUserWithoutInteraction ||
|}
 
=== Store ===
Takes a [[#ProfileBase]] and an input type-0x19 buffer for [[#UserData]].
 
=== StoreWithImage ===
Takes a [[#ProfileBase]], an input type-0x19 buffer for [[#UserData]], and an input type-0x5 buffer.
 
== IAsyncContext ==
This is "nn::account::detail::IAsyncContext".
 
{| class="wikitable" border="1"
|-
|-
! Cmd || Name
| 60 || [5.0.0-5.1.0] ListOpenContextStoredUsers ||
|-
|-
| 0 || GetSystemEvent
| 99 || [6.0.0+] DebugActivateOpenContextRetention || No input, returns an [[#ISessionObject]].
|-
|-
| 1 || Cancel
| 100 || GetUserRegistrationNotifier || Returns an [[#INotifier]].
|-
|-
| 2 || HasDone
| 101 || GetUserStateChangeNotifier || Returns an [[#INotifier]].
|-
|-
| 3 || GetResult
| 102 || GetBaasAccountManagerForSystemService || Returns an [[#IManagerForSystemService]].
|}
 
== ISessionObject ==
This is "nn::account::detail::ISessionObject".
 
{| class="wikitable" border="1"
|-
|-
! Cmd || Name
| 103 || GetBaasUserAvailabilityChangeNotifier || Returns an [[#INotifier]].
|-
|-
| 999 || Dummy
| 104 || GetProfileUpdateNotifier || Returns an [[#INotifier]].
|}
 
= acc:u0 =
This is "nn::account::IAccountServiceForApplication".
 
[13.0.0+] This was moved from [[Account_services|account]].
 
This is only available when the output from [[Process_Manager_services|pm:bm]] GetBootMode is Normal/Maintenance.
 
{| class="wikitable" border="1"
|-
|-
! Cmd || Name || Notes
| 105 || [4.0.0+] CheckNetworkServiceAvailabilityAsync || Returns an [[#IAsyncContext]].
|-
|-
| 0 || GetUserCount ||
| 106 || [9.0.0+] GetProfileSyncNotifier ||
|-
|-
| 1 || GetUserExistence ||
| 110 || StoreSaveDataThumbnail ||
|-
|-
| 2 || ListAllUsers ||
| 111 || ClearSaveDataThumbnail ||
|-
|-
| 3 || ListOpenUsers ||
| 112 || LoadSaveDataThumbnail ||
|-
|-
| 4 || GetLastOpenedUser ||
| 113 || [5.0.0+] GetSaveDataThumbnailExistence ||
|-
|-
| 5 || GetProfile || Takes an input userID, returns an [[#IProfile]].
| 120 || [10.0.0+] ListOpenUsersInApplication ||
|-
|-
| 6 || [3.0.0+] GetProfileDigest ||
| 130 || [6.0.0+] ActivateOpenContextRetention || Takes a total of 0x8-bytes of input, returns an [[#ISessionObject]].
|-
|-
| 50 || [[#IsUserRegistrationRequestPermitted]] ||
| 140 || [6.0.0+] ListQualifiedUsers ||  
|-
|-
| 51 || [[#TrySelectUserWithoutInteraction]] ||
| 150 || [10.0.0-10.2.0] AuthenticateApplicationAsync ||
|-
| 151 || [12.0.0+] EnsureSignedDeviceIdentifierCacheForNintendoAccountAsync ||
|-
| 152 || [12.0.0+] LoadSignedDeviceIdentifierCacheForNintendoAccount ||
|-
| 170 || [13.0.0+] GetNasOp2MembershipStateChangeNotifier ||
|-
|-
| 60 || [5.0.0-5.1.0] ListOpenContextStoredUsers ||
| 190 || [1.0.0-9.2.0] GetUserLastOpenedApplication ||
|-
|-
| 99 || [6.0.0+] DebugActivateOpenContextRetention || No input, returns an [[#ISessionObject]].
| 191 || [7.0.0-19.0.1] UpdateNotificationReceiverInfo ([5.0.0-5.1.0] ActivateOpenContextHolder) ||
|-
|-
| 100 || [[#InitializeApplicationInfoV0]] ||
| 200 || BeginUserRegistration ||
|-
|-
| 101 || GetBaasAccountManagerForApplication || Takes an input userID, returns an [[#IManagerForApplication]].
| 201 || CompleteUserRegistration ||
|-
|-
| 102 || AuthenticateApplicationAsync || Returns an [[#IAsyncContext]].
| 202 || CancelUserRegistration ||
|-
|-
| 103 || [4.0.0+] CheckNetworkServiceAvailabilityAsync || Returns an [[#IAsyncContext]].
| 203 || DeleteUser ||
|-
|-
| 110 || StoreSaveDataThumbnail ||
| 204 || SetUserPosition ||
|-
|-
| 111 || ClearSaveDataThumbnail ||
| 205 || GetProfileEditor || Takes an input userID and returns an [[#IProfileEditor]].
|-
|-
| 120 || CreateGuestLoginRequest || Returns an [[#IGuestLoginRequest]].
| 206 || CompleteUserRegistrationForcibly ||
|-
|-
| 130 || [5.0.0+] LoadOpenContext ||
| 210 || [3.0.0+] CreateFloatingRegistrationRequest || Returns an [[#IFloatingRegistrationRequest]].
|-
|-
| 131 || [6.0.0+] ListOpenContextStoredUsers ||  
| 211 || [8.0.0+] CreateProcedureToRegisterUserWithNintendoAccount || Takes a total of 0x4-bytes of input and a handle, returns an [[#IOAuthProcedureForUserRegistration]].
|-
|-
| 140 || [6.0.0+] [[#InitializeApplicationInfoV1]] ||
| 212 || [8.0.0+] ResumeProcedureToRegisterUserWithNintendoAccount || Takes a total of 0x14-bytes of input and a handle, returns an [[#IOAuthProcedureForUserRegistration]].
|-
|-
| 141 || [6.0.0+] ListQualifiedUsers ||  
| 213 || [17.0.0+] CreateProcedureToCreateUserWithNintendoAccount ||
|-
|-
| 150 || [6.0.0+] IsUserAccountSwitchLocked ||  
| 214 || [17.0.0+] ResumeProcedureToCreateUserWithNintendoAccount ||
|-
|-
| 160 || [13.0.0+] InitializeApplicationInfoV2 ||  
| 215 || [17.0.0+] ResumeProcedureToCreateUserWithNintendoAccountAfterApplyResponse ||
|}
 
InitializeApplicationInfo* is used by the user-process during service init.
 
== InitializeApplicationInfoV0 ==
Takes a PID and an input u64 pid_placeholder, no output.
 
== InitializeApplicationInfoV1 ==
Takes a PID and an input u64 pid_placeholder, no output.
 
== IGuestLoginRequest ==
This is "nn::account::baas::IGuestLoginRequest".
 
{| class="wikitable" border="1"
|-
|-
! Cmd || Name
| 230 || AuthenticateServiceAsync || Returns an [[#IAsyncContext]].
|-
|-
| 0 || GetSessionId
| 250 || GetBaasAccountAdministrator || Returns an [[#IAdministrator]].
|-
|-
| 11 || [1.0.0-2.3.0]  
| 251 || [20.0.0+] SynchronizeNetworkServiceAccountsSnapshotAsync ||
|-
|-
| 12 || GetAccountId
| 290 || ProxyProcedureForGuestLoginWithNintendoAccount || Returns an [[#IOAuthProcedureForExternalNsa]] (formerly [[#IOAuthProcedureForGuestLogin]] with [1.0.0-2.3.0]).
|-
|-
| 13 || GetLinkedNintendoAccountId
| 291 || [3.0.0+] ProxyProcedureForFloatingRegistrationWithNintendoAccount || Returns an [[#IOAuthProcedureForExternalNsa]].
|-
|-
| 14 || GetNickname
| 292 || [20.0.0+] ProxyProcedureForDeviceMigrationAuthenticatingOperatingUser ||
|-
|-
| 15 || GetProfileImage
| 293 || [20.0.0+] ProxyProcedureForDeviceMigrationDownload ||
|-
|-
| 16 || [18.0.0+] GetProfileLargeImage
| 299 || SuspendBackgroundDaemon || Returns an [[#ISessionObject]].
|-
|-
| 21 || [3.0.0+] LoadIdTokenCache
| 350 || [20.0.0+] CreateDeviceMigrationUserExportRequest ||
|}
 
== IManagerForApplication ==
This is "nn::account::baas::IManagerForApplication".
 
{| class="wikitable" border="1"
|-
|-
! Cmd || Name || Notes
| 351 || [20.0.0+] UploadNasCredential ||
|-
|-
| 0 || CheckAvailability ||
| 352 || [20.0.0+] CreateDeviceMigrationUserImportRequest ||
|-
|-
| 1 || GetAccountId ||
| 353 || [20.0.0+] DeleteUserMigrationSaveData ||
|-
|-
| 2 || EnsureIdTokenCacheAsync || Returns an [[#IAsyncContext]].
| 400 || [18.0.0+] SetPinCode ||
|-
|-
| 3 || LoadIdTokenCache ||
| 401 || [18.0.0+] GetPinCodeLength ||
|-
|-
| 130 || GetNintendoAccountUserResourceCacheForApplication ||
| 402 || [18.0.0-19.0.1] GetPinCode ||
|-
|-
| 150 || CreateAuthorizationRequest || Returns an [[#IAuthorizationRequest]].
| 403 || [20.0.0+] GetPinCodeParity ||
|-
|-
| 160 || [5.0.0+] StoreOpenContext ||
| 404 || [20.0.0+] VerifyPinCode ||
|-
|-
| 170 || [13.0.0+] EnsureIdTokenCacheForOnlinePlayAsync ([6.0.0-12.1.0] LoadNetworkServiceLicenseKindAsync) || No input, returns an [[#IAsyncContextForLoginForOnlinePlay]] ([6.0.0-12.1.0] [[#IAsyncNetworkServiceLicenseKindContext]]).
| 405 || [20.0.0+] IsPinCodeVerificationForbidden ||
|}
|-
 
| 410 || [18.0.0+] GetPinCodeErrorCount ||
== IAsyncNetworkServiceLicenseKindContext ==
This is "nn::account::detail::IAsyncNetworkServiceLicenseKindContext".
 
This was added with [6.0.0+].
 
{| class="wikitable" border="1"
|-
|-
! Cmd || Name || Notes
| 411 || [18.0.0-19.0.1] ResetPinCodeErrorCount ||
|-
|-
| 0 || GetSystemEvent ||  
| 412 || [18.0.0-19.0.1] IncrementPinCodeErrorCount ||
|-
|-
| 1 || Cancel ||  
| 413 || [20.0.0+] SetPinCodeErrorCount ||
|-
|-
| 2 || HasDone ||  
| 420 || [19.0.0+] SetStartPenaltyTime ||  
|-
|-
| 3 || GetResult ||  
| 421 || [19.0.0+] GetStartPenaltyTime ||  
|-
|-
| 100 || GetNetworkServiceLicenseKind ||
| 900 || [13.0.0+] SetUserUnqualifiedForDebug ||
|}
 
== IAsyncContextForLoginForOnlinePlay ==
This is "nn::account::baas::IAsyncContextForLoginForOnlinePlay".
 
This was added with [13.0.0+].
 
{| class="wikitable" border="1"
|-
|-
! Cmd || Name || Notes
| 901 || [13.0.0+] UnsetUserUnqualifiedForDebug ||
|-
|-
| 0 || GetSystemEvent ||  
| 902 || [13.0.0+] ListUsersUnqualifiedForDebug ||
|-
|-
| 1 || Cancel ||  
| 910 || [16.0.0+] RefreshFirmwareSettingsForDebug ||
|-
|-
| 2 || HasDone ||  
| 997 || [3.0.0+] DebugInvalidateTokenCacheForUser ||
|-
|-
| 3 || GetResult ||  
| 998 || DebugSetUserStateClose ||
|-
|-
| 100 || GetNetworkServiceLicenseInfoForOnlinePlay ||  
| 999 || DebugSetUserStateOpen ||
|}
|}


= acc:u1 =
[10.0.0+] DebugSetUserStateClose/DebugSetUserStateOpen now takes an additional 8-bytes of input.
This is "nn::account::IAccountServiceForSystemService".
 
== IsUserRegistrationRequestPermitted ==
Takes a PID, an input u64 pid_reserved, and returns an output u8 bool.


[13.0.0+] This was moved from [[Account_services|account]].
== TrySelectUserWithoutInteraction ==
Takes an input u8 bool isNetworkServiceAccountRequired, returns an output Uid.


This is only available when the output from [[Process_Manager_services|pm:bm]] GetBootMode is Normal/Maintenance.
== IManagerForSystemService ==
This is "nn::account::baas::IManagerForSystemService".


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 3,468: Line 3,505:
! Cmd || Name || Notes
! Cmd || Name || Notes
|-
|-
| 0 || GetUserCount ||
| 0 || CheckAvailability ||
|-
|-
| 1 || GetUserExistence ||
| 1 || GetAccountId ||
|-
|-
| 2 || ListAllUsers ||
| 2 || EnsureIdTokenCacheAsync || Returns an [[#IAsyncContext]].
|-
|-
| 3 || ListOpenUsers ||
| 3 || [19.0.0+] LoadIdTokenCacheDeprecated ([1.0.0-18.1.0] LoadIdTokenCache) ||
|-
|-
| 4 || GetLastOpenedUser ||
| 4 || [19.0.0+] LoadIdTokenCache ||
|-
|-
| 5 || GetProfile || Returns an [[#IProfile]].
| 100 || SetSystemProgramIdentification ||
|-
|-
| 6 || [3.0.0+] GetProfileDigest ||
| 101 || RefreshNotificationTokenAsync ||  
|-
|-
| 50 || [[#IsUserRegistrationRequestPermitted]] ||
| 110 || GetServiceEntryRequirementCacheForLogin ||
|-
|-
| 51 || [[#TrySelectUserWithoutInteraction]] ||
| 111 || InvalidateServiceEntryRequirementCache ||
|-
|-
| 60 || [5.0.0-5.1.0] ListOpenContextStoredUsers ||
| 113 || GetServiceEntryRequirementCacheForOnlinePlay || Takes a total of 0x8-bytes of input, returns a total of 0x4-bytes of output.
|-
|-
| 99 || [6.0.0+] DebugActivateOpenContextRetention || No input, returns an [[#ISessionObject]].
| 120 || GetNintendoAccountId ||
|-
|-
| 100 || GetUserRegistrationNotifier || Returns an [[#INotifier]].
| 121 || CalculateNintendoAccountAuthenticationFingerprint ||
|-
|-
| 101 || GetUserStateChangeNotifier || Returns an [[#INotifier]].
| 130 || GetNintendoAccountUserResourceCache ||
|-
|-
| 102 || GetBaasAccountManagerForSystemService || Returns an [[#IManagerForSystemService]].
| 131 || RefreshNintendoAccountUserResourceCacheAsync || Returns an [[#IAsyncContext]].
|-
|-
| 103 || GetBaasUserAvailabilityChangeNotifier || Returns an [[#INotifier]].
| 132 || RefreshNintendoAccountUserResourceCacheAsyncIfSecondsElapsed || Returns an [[#IAsyncContext]].
|-
|-
| 104 || GetProfileUpdateNotifier || Returns an [[#INotifier]].
| 133 || GetNintendoAccountVerificationUrlCache ||
|-
|-
| 105 || [4.0.0+] CheckNetworkServiceAvailabilityAsync || Returns an [[#IAsyncContext]].
| 134 || RefreshNintendoAccountVerificationUrlCacheAsync ||
|-
|-
| 106 || [9.0.0+] GetProfileSyncNotifier ||
| 135 || RefreshNintendoAccountVerificationUrlCacheAsyncIfSecondsElapsed ||
|-
|-
| 110 || StoreSaveDataThumbnail ||
| 136 || [19.0.0+] GetNintendoAccountUserResourceCache ||
|-
|-
| 111 || ClearSaveDataThumbnail ||
| 140 || GetNetworkServiceLicenseCache ||  
|-
|-
| 112 || LoadSaveDataThumbnail ||
| 141 || RefreshNetworkServiceLicenseCacheAsync || Returns an [[#IAsyncContext]].
|-
|-
| 113 || [5.0.0+] GetSaveDataThumbnailExistence ||
| 142 || RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed || Returns an [[#IAsyncContext]].
|-
|-
| 120 || [10.0.0+] ListOpenUsersInApplication ||
| 143 || [15.0.0+] GetNetworkServiceLicenseCacheEx ||
|-
|-
| 130 || [6.0.0+] ActivateOpenContextRetention || Takes a total of 0x8-bytes of input, returns an [[#ISessionObject]].
| 150 || CreateAuthorizationRequest || Returns an [[#IAuthorizationRequest]].
|-
|-
| 140 || [6.0.0+] ListQualifiedUsers ||  
| 160 || [15.0.0+] RequiresUpdateNetworkServiceAccountIdTokenCache ||
|-
|-
| 150 || [10.0.0-10.2.0] AuthenticateApplicationAsync ||
| 161 || [16.0.0+] RequireReauthenticationOfNetworkServiceAccount ||
|-
| 151 || [12.0.0+] EnsureSignedDeviceIdentifierCacheForNintendoAccountAsync ||
|-
| 152 || [12.0.0+] LoadSignedDeviceIdentifierCacheForNintendoAccount ||
|-
| 170 || [13.0.0+] GetNasOp2MembershipStateChangeNotifier ||
|-
| 190 || [1.0.0-9.2.0] GetUserLastOpenedApplication ||
|-
| 191 || [7.0.0+] UpdateNotificationReceiverInfo ([5.0.0-5.1.0] ActivateOpenContextHolder) ||
|-
| 401 || [18.0.0+] GetPinCodeLength ||
|-
|-
| 402 || [18.0.0+] GetPinCode ||
| 180 || [18.0.0-19.0.1] GetRequestForNintendoAccountReauthentication ||
|-
|-
| 997 || [3.0.0+] DebugInvalidateTokenCacheForUser ||
| 181 || [20.0.0+] CreateProcedureToReauthenticateNintendoAccount ||
|-
| 998 || DebugSetUserStateClose ||
|-
|-
| 999 || DebugSetUserStateOpen ||
| 182 || [20.0.0+] ResumeProcedureToReauthenticateNintendoAccount ||
|}
|}


[10.0.0+] DebugSetUserStateClose/DebugSetUserStateOpen now takes an additional 8-bytes of input.  
== IFloatingRegistrationRequest ==
This is "nn::account::baas::IFloatingRegistrationRequest".


== IOAuthProcedureForUserRegistration ==
Added with [3.0.0+].
This is "nn::account::nas::IOAuthProcedureForUserRegistration".
 
This was added with [8.0.0+].


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 3,552: Line 3,573:
! Cmd || Name || Notes
! Cmd || Name || Notes
|-
|-
| 0 || PrepareAsync || No input, returns an [[#IAsyncContext]].
| 0 || GetSessionId ||
|-
|-
| 1 || GetRequest ||  
| 12 || GetAccountId ||
|-
|-
| 2 || ApplyResponse ||  
| 13 || GetLinkedNintendoAccountId ||
|-
|-
| 3 || ApplyResponseAsync || Takes a type-0x9 input buffer, returns an [[#IAsyncContext]].
| 14 || GetNickname ||
|-
|-
| 10 || Suspend ||  
| 15 || GetProfileImage ||
|-
|-
| 100 || GetAccountId ||  
| 16 || [18.0.0+] GetProfileLargeImage ||
|-
|-
| 101 || GetLinkedNintendoAccountId ||  
| 21 || LoadIdTokenCache ||
|-
|-
| 102 || GetNickname ||  
| 100 || RegisterUser ([1.0.0-3.0.2] RegisterAsync) || [1.0.0-3.0.2] Used to return an [[#IAsyncContext]].
|-
|-
| 103 || GetProfileImage ||  
| 101 || RegisterUserWithUid ([1.0.0-3.0.2] RegisterWithUidAsync) || [1.0.0-3.0.2] Used to return an [[#IAsyncContext]].
|-
|-
| 104 || [18.0.0+] GetProfileLargeImage ||  
| 102 || [4.0.0+] RegisterNetworkServiceAccountAsync || Returns an [[#IAsyncContext]].
|-
|-
| 110 || RegisterUserAsync || No input, returns an [[#IAsyncContext]].
| 103 || [4.0.0+] RegisterNetworkServiceAccountWithUidAsync || Returns an [[#IAsyncContext]].
|-
|-
| 111 || GetUid ||  
| 110 || SetSystemProgramIdentification ||
|-
|-
| 200 || [17.0.0+] ApplyResponseForUserCreationAsync ||
| 111 || EnsureIdTokenCacheAsync || Returns an [[#IAsyncContext]].
|-
| 205 || [17.0.0+] SuspendAfterApplyResponse ||
|-
| 210 || [17.0.0+] IsProfileAvailable ||
|-
| 220 || [17.0.0+] RegisterUserAsyncWithoutProfile ||
|-
| 221 || [17.0.0+] RegisterUserWithProfileAsync ||
|-
| 230 || [18.0.0+] RegisterUserWithLargeImageProfileAsync ||
|}
|}


= VersionListData =
== IAdministrator ==
This is "nn::ns::VersionListData".
This is "nn::account::baas::IAdministrator".
 
= ApplicationUpdateInfo =
This is "nn::ns::ApplicationUpdateInfo". This is an u8.


{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Value
! Cmd || Name || Notes
! Description
|-
| 0 || CheckAvailability ||
|-
|-
| 0 || UpToDate
| 1 || GetAccountId ||
|-
|-
| 1 || Updatable
| 2 || EnsureIdTokenCacheAsync || Returns an [[#IAsyncContext]].
|}
|-
 
| 3 || [19.0.0+] LoadIdTokenCacheDeprecated ([1.0.0-18.1.0] LoadIdTokenCache) ||
[[qlaunch]] just checks whether this is 0.
 
= ApplicationOccupiedSize =
This is "nn::ns::ApplicationOccupiedSize". This is a 0x80-byte struct.
 
{| class="wikitable" border="1"
|-
|-
! Offset
| 4 || [19.0.0+] LoadIdTokenCache ||
! Size
! Description
|-
|-
| 0x0 || 0x20 * 4 || Array of [[#ApplicationOccupiedSizeEntity]]
| 100 || SetSystemProgramIdentification ||
|}
 
= ApplicationOccupiedSizeEntity =
This is "nn::ns::ApplicationOccupiedSizeEntity". This is a 0x20-byte struct.
 
{| class="wikitable" border="1"
|-
|-
! Offset
| 101 || [7.0.0+] RefreshNotificationTokenAsync
! Size
! Description
|-
|-
| 0x0 || 0x1 || [[NCM_services#StorageId|StorageId]]
| 110 || [4.0.0+] GetServiceEntryRequirementCache ||
|-
|-
| 0x1 || 0x7 || Reserved
| 111 || [4.0.0+] InvalidateServiceEntryRequirementCache ||
|-
|-
| 0x8 || 0x8 || AppSize
| 112 || [4.0.0-6.2.0] InvalidateTokenCache ||
|-
|-
| 0x10 || 0x8 || PatchSize
| 113 || [6.1.0+] GetServiceEntryRequirementCacheForOnlinePlay || Takes a total of 0x8-bytes of input, returns a total of 0x4-bytes of output.
|-
|-
| 0x18 || 0x8 || AocSize
| 120 || GetNintendoAccountId ||
|}
 
= ProgressForDeleteUserSaveDataAll =
This is "nn::ns::detail::ProgressForDeleteUserSaveDataAll". This is a 0x28-byte struct.
 
{| class="wikitable" border="1"
|-
|-
! Offset
| 121 || [9.0.0+] CalculateNintendoAccountAuthenticationFingerprint ||
! Size
! Description
|-
|-
| 0x0 || 0x8 || StartedAt
| 130 || GetNintendoAccountUserResourceCache ||
|-
|-
| 0x8 || 0x4 || Count
| 131 || RefreshNintendoAccountUserResourceCacheAsync || Returns an [[#IAsyncContext]].
|-
|-
| 0xC || 0x4 || Reserved
| 132 || RefreshNintendoAccountUserResourceCacheAsyncIfSecondsElapsed || Returns an [[#IAsyncContext]].
|-
|-
| 0x10 || 0x8 || SizeInBytes
| 133 || [9.0.0+] GetNintendoAccountVerificationUrlCache ||
|-
|-
| 0x18 || 0x1 || IsSystem
| 134 || [9.0.0+] RefreshNintendoAccountVerificationUrlCacheAsync ||
|-
|-
| 0x19 || 0x7 || Reserved
| 135 || [9.0.0+] RefreshNintendoAccountVerificationUrlCacheAsyncIfSecondsElapsed ||
|-
|-
| 0x20 || 0x8 || ApplicationId
| 136 || [19.0.0+] GetNintendoAccountUserResourceCache ||
|}
 
= ApplicationViewDeprecated =
This is "nn::ns::ApplicationViewDeprecated". This is a 0x40-byte struct.
 
{| class="wikitable" border="1"
|-
|-
! Offset
| 140 || [5.0.0+] GetNetworkServiceLicenseCache ||
! Size
! Description
|-
|-
| 0x0 || 0x8 || [[NCM_services#ApplicationId|ApplicationId]]
| 141 || [5.0.0+] RefreshNetworkServiceLicenseCacheAsync ||
|-
|-
| 0x8 || 0x4 || Version
| 142 || [5.0.0+] RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed ||
|-
|-
| 0xC || 0x4 || [[#ApplicationViewFlag|Flag]]
| 143 || [15.0.0+] GetNetworkServiceLicenseCacheEx ||
|-
|-
| 0x10 || 0x18 || [[#ApplicationDownloadProgress|Progress]]
| 150 || CreateAuthorizationRequest || Returns an [[#IAuthorizationRequest]].
|-
|-
| 0x28 || 0x18 || [[#ApplicationApplyDeltaProgress|ApplyProgress]]
| 160 || [15.0.0+] RequiresUpdateNetworkServiceAccountIdTokenCache ||
|}
 
This is converted from [[#ApplicationView]] by [[#GetApplicationViewDeprecated]] on newer system-versions as follows:
 
{| class="wikitable" border="1"
|-
|-
! Offset
| 161 || [16.0.0+] RequireReauthenticationOfNetworkServiceAccount ||
! Size
! Description
|-
|-
| 0x0 || 0x20 || Same as [[#ApplicationView]] +0x0.
| 180 || [18.0.0-19.0.1] GetRequestForNintendoAccountReauthentication ||
|-
|-
| 0x20 || 0x4 || Same as [[#ApplicationView]] +0x20.
| 181 || [20.0.0+] CreateProcedureToReauthenticateNintendoAccount ||
|-
|-
| 0x24 || 0x2 || Same as [[#ApplicationView]] +0x24.
| 182 || [20.0.0+] ResumeProcedureToReauthenticateNintendoAccount ||
|-
|-
| 0x26 || 0x2 || Cleared to 0.
| 200 || IsRegistered ||
|-
|-
| 0x28 || 0x10 || Same as [[#ApplicationView]] +0x30.
| 201 || RegisterAsync || Returns an [[#IAsyncContext]].
|-
|-
| 0x38 || 0x4 || Same as [[#ApplicationView]] +0x40.
| 202 || UnregisterAsync || Returns an [[#IAsyncContext]].
|-
|-
| 0x3C || 0x1 || Same as [[#ApplicationView]] +0x44.
| 203 || DeleteRegistrationInfoLocally ||
|-
|-
| 0x3D || 0x2 || Cleared to 0.
| 204 || [19.0.0-19.0.1] UnregisterDeviceAsync ||
|-
|-
| 0x3F || 0x1 || Cleared to 0.
| 220 || SynchronizeProfileAsync || Returns an [[#IAsyncContext]].
|}
 
= ApplicationViewFlag =
This is "nn::ns::ApplicationViewFlag". This is a 32-bit flag.
 
{| class="wikitable" border="1"
|-
|-
! Bit
| 221 || UploadProfileAsync || Returns an [[#IAsyncContext]].
! Description
|-
|-
| 0
| 222 || SynchronizeProfileAsyncIfSecondsElapsed || Returns an [[#IAsyncContext]].
|  
|-
|-
| 1
| 223 || [19.0.0+] DownloadProfileAsync ||
|  
|-
|-
| 2
| 250 || IsLinkedWithNintendoAccount ||
|  
|-
|-
| 3
| 251 || CreateProcedureToLinkWithNintendoAccount || Returns an [[#IOAuthProcedureForNintendoAccountLinkage]].
|  
|-
|-
| 4
| 252 || ResumeProcedureToLinkWithNintendoAccount || Returns an [[#IOAuthProcedureForNintendoAccountLinkage]].
|  
|-
|-
| 5
| 255 || CreateProcedureToUpdateLinkageStateOfNintendoAccount || Returns an [[#IOAuthProcedure]].
|  
|-
|-
| 6
| 256 || ResumeProcedureToUpdateLinkageStateOfNintendoAccount || Returns an [[#IOAuthProcedure]].
|  
|-
|-
| 7
| 260 || [3.0.0+] CreateProcedureToLinkNnidWithNintendoAccount || Returns an [[#IOAuthProcedure]].
|  
|-
|-
| 8
| 261 || [3.0.0+] ResumeProcedureToLinkNnidWithNintendoAccount || Returns an [[#IOAuthProcedure]].
|  
|-
|-
| 9
| 280 || ProxyProcedureToAcquireApplicationAuthorizationForNintendoAccount || Returns an [[#IOAuthProcedure]].
|  
|-
|-
| 10
| 290 || [8.0.0+] GetRequestForNintendoAccountUserResourceView ||  
|  
|-
|-
| 11
| 300 || [6.0.0+] TryRecoverNintendoAccountUserStateAsync || Returns an [[#IAsyncContext]].
|  
|-
|-
| 12
| 400 || [6.1.0+] IsServiceEntryRequirementCacheRefreshRequiredForOnlinePlay || Takes a total of 0x8-bytes of input, returns an output u8.
|  
|-
|-
| 13
| 401 || [6.1.0+] RefreshServiceEntryRequirementCacheForOnlinePlayAsync || Takes a total of 0x8-bytes of input, returns an [[#IAsyncContext]].
|  
|-
|-
| 14
| 900 || [9.0.0+] GetAuthenticationInfoForWin ||
|  
|-
|-
| 15
| 901 || [9.0.0+] ImportAsyncForWin ||
|  
|-
|-
| 16
| 997 || DebugUnlinkNintendoAccountAsync || Returns an [[#IAsyncContext]].
|  
|-
|-
| 17
| 998 || DebugSetAvailabilityErrorDetail ||
|  
|}
|}


= ApplicationDownloadProgress =
== IAuthorizationRequest ==
This is "nn::ns::ApplicationDownloadProgress". This is a 0x18-byte struct.
This is "nn::account::nas::IAuthorizationRequest".


{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Offset
! Cmd || Name || Notes
! Size
|-
! Description
| 0 || GetSessionId ||
|-
|-
| 0x0 || 0x8 || Downloaded
| 10 || InvokeWithoutInteractionAsync || Returns an [[#IAsyncContext]].
|-
|-
| 0x8 || 0x8 || Total
| 19 || IsAuthorized ||
|-
|-
| 0x10 || 0x4 || LastResult
| 20 || GetAuthorizationCode ||
|-
|-
| 0x14 || 0x1 || [[#ApplicationDownloadState|State]]
| 21 || GetIdToken ||
|-
|-
| 0x15 || 0x3 || Reserved
| 22 || GetState ||
|}
|}


= ApplicationApplyDeltaProgress =
== IOAuthProcedure ==
This is "nn::ns::ApplicationApplyDeltaProgress". This is a 0x18-byte struct.
This is "nn::account::http::IOAuthProcedure".


{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Offset
! Cmd || Name || Notes
! Size
! Description
|-
|-
| 0x0 || 0x8 || Applied
| 0 || PrepareAsync || Returns an [[#IAsyncContext]].
|-
|-
| 0x8 || 0x8 || Total
| 1 || GetRequest ||
|-
|-
| 0x10 || 0x4 || LastResult
| 2 || ApplyResponse ||
|-
|-
| 0x14 || 0x1 || [[#ApplicationApplyDeltaState|State]]
| 3 || ApplyResponseAsync || Returns an [[#IAsyncContext]].
|-
|-
| 0x15 || 0x3 || Reserved
| 10 || Suspend ||
|}
|}


= ApplicationDownloadState =
== IOAuthProcedureForExternalNsa ==
This is "nn::ns::ApplicationDownloadState". This is an u8.
This is "nn::account::nas::IOAuthProcedureForExternalNsa".
 
Added with [3.0.0+].


{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Value
! Cmd || Name || Notes
! Description
|-
| 0 || PrepareAsync || Returns an [[#IAsyncContext]].
|-
| 1 || GetRequest ||
|-
| 2 || ApplyResponse ||
|-
| 3 || ApplyResponseAsync || Returns an [[#IAsyncContext]].
|-
| 10 || Suspend ||
|-
|-
| 0 || Runnable
| 100 || GetAccountId ||
|-
|-
| 1 || Suspended
| 101 || GetLinkedNintendoAccountId ||
|-
|-
| 2 || NotEnoughSpace
| 102 || GetNickname ||
|-
|-
| 3 || Fatal
| 103 || GetProfileImage ||
|-
|-
| 4 || Finished
| 104 || [18.0.0+] GetProfileLargeImage ||
|}
|}


= ApplicationApplyDeltaState =
== IOAuthProcedureForNintendoAccountLinkage ==
This is "nn::ns::ApplicationApplyDeltaState". This is an u8.
This is "nn::account::nas::IOAuthProcedureForNintendoAccountLinkage".


{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Value
! Cmd || Name || Notes
! Description
|-
|-
| 0 || Applying
| 0 || PrepareAsync || Returns an [[#IAsyncContext]].
|-
|-
| 1 || Suspended
| 1 || GetRequest ||
|-
|-
| 2 || NotEnoughSpace
| 2 || ApplyResponse ||
|-
|-
| 3 || Fatal
| 3 || ApplyResponseAsync || Returns an [[#IAsyncContext]].
|-
| 10 || Suspend ||
|-
| 100 || GetRequestWithTheme ||
|-
|-
| 4 || NoTask
| 101 || IsNetworkServiceAccountReplaced ||
|-
|-
| 5 || WaitApply
| 199 || [2.0.0-5.1.0] GetUrlForIntroductionOfExtraMembership ||
|-
|-
| 6 || Applied
| 200 || [16.0.0+] ApplyAsyncWithAuthorizedToken ||
|}
|}


= ApplicationView =
== INotifier ==
This is "nn::ns::ApplicationView". This is a 0x50-byte struct.
This is "nn::account::detail::INotifier".


{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Offset
! Cmd || Name
! Size
! Description
|-
|-
| 0x0 || 0x8 || [[NCM_services#ApplicationId|ApplicationId]]
| 0 || GetSystemEvent
|-
| 0x8 || 0x4 || ?
|-
| 0xC || 0x4 || Flags
|-
| 0x10 || 0x40 || ?
|}
|}


= ApplicationViewWithPromotionInfo =
== IProfile ==
This is a 0x70-byte struct.
This is "nn::account::profile::IProfile".


{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Offset
! Cmd || Name
! Size
! Description
|-
|-
| 0x0 || 0x50 || [[#ApplicationView]]
| 0 || [[#Get]]
|-
|-
| 0x50 || 0x20 || [[#PromotionInfo]]
| 1 || [[#GetBase]]
|-
| 10 || [[#GetImageSize]]
|-
| 11 || [[#LoadImage]]
|-
| 20 || [18.0.0+] GetLargeImageSize
|-
| 21 || [18.0.0+] LoadLargeImage
|-
| 30 || [18.0.0+] GetImageId
|}
|}


= PromotionInfo =
=== Get ===
This is a 0x20-byte struct.
Takes an output type-0x1A buffer for [[#UserData]], returns an output [[#ProfileBase]].
 
=== GetBase ===
No input, returns an output [[#ProfileBase]].
 
=== GetImageSize ===
No input, returns an output u32 for the size of the image buffer.
 
=== LoadImage ===
Takes an output type-0x6 buffer, returns the same output u32 as [[#GetImageSize]].
 
The output buffer contains the JPEG profile image icon. This is valid for both Miis and character icons.
 
== IProfileEditor ==
This is "nn::account::profile::IProfileEditor".


{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Offset
! Cmd || Name
! Size
! Description
|-
|-
| 0x0 || 0x8 || PosixTime start_timestamp.
| 0 || [[#Get]]
|-
|-
| 0x8 || 0x8 || PosixTime end_timestamp.
| 1 || [[#GetBase]]
|-
|-
| 0x10 || 0x8 || Remaining time until the promotion ends, in nanoseconds ({end_timestamp - current_time} converted to nanoseconds).
| 10 || [[#GetImageSize]]
|-
|-
| 0x18 || 0x4 || Not set, left at zero.
| 11 || [[#LoadImage]]
|-
|-
| 0x1C || 0x1 || Flags. Bit0: whether the PromotionInfo is valid (including bit1). Bit1 clear: u64 +0x10 is set.
| 20 || [18.0.0+] GetLargeImageSize
|-
| 21 || [18.0.0+] LoadLargeImage
|-
|-
| 0x1D || 0x3 || Padding
| 30 || [18.0.0+] GetImageId
|}
 
= ApplicationResourceType =
This is "nn::ns::ApplicationResourceType". This is an u8.
 
{| class="wikitable" border="1"
|-
|-
! Value
| 100 || [[#Store]]
! Description
|-
|-
| 0 || ApplicationResource
| 101 || [[#StoreWithImage]]
|-
|-
| 1 || MicroApplicationResource
| 110 || [18.0.0+] StoreWithLargeImage
|}
|}


= ApplicationErrorCodeCategory =
=== Store ===
This is "nn::ns::ApplicationErrorCodeCategory". This is an u64.
Takes a [[#ProfileBase]] and an input type-0x19 buffer for [[#UserData]].


= NoDownloadRightsErrorResolution =
=== StoreWithImage ===
This is "nn::ns::NoDownloadRightsErrorResolution".
Takes a [[#ProfileBase]], an input type-0x19 buffer for [[#UserData]], and an input type-0x5 buffer.


= BackgroundNetworkUpdateState =
== IAsyncContext ==
This is "nn::ns::BackgroundNetworkUpdateState". This is an u8.
This is "nn::account::detail::IAsyncContext".


{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Value
! Cmd || Name
! Description
|-
|-
| 0 || None
| 0 || GetSystemEvent
|-
|-
| 1 || InProgress
| 1 || Cancel
|-
|-
| 2 || Ready
| 2 || HasDone
|-
| 3 || GetResult
|}
|}


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.
== ISessionObject ==
 
This is "nn::account::detail::ISessionObject".
[[#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"
{| class="wikitable" border="1"
|-
|-
! Offset
! Cmd || Name
! 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)
| 999 || Dummy
|-
| 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.
= acc:u0 =
This is "nn::account::IAccountServiceForApplication".


= EulaDataPath =
[13.0.0+] This was moved from [[Account_services|account]].
This is "nn::ns::detail::EulaDataPath". This is a 0x100-byte struct.


This contains a file path.
This is only available when the output from [[Process_Manager_services|pm:bm]] GetBootMode is Normal/Maintenance.


= SystemDeliveryInfo =
{| class="wikitable" border="1"
This is "nn::ns::SystemDeliveryInfo". This is a 0x100-byte struct.
|-
 
! Cmd || Name || Notes
{| class="wikitable" border="1"
|-
|-
| 0 || GetUserCount ||
! Offset
|-
! Size
| 1 || GetUserExistence ||
! Description
|-
|-
| 2 || ListAllUsers ||
| 0x0 || 0x4 || SystemDeliveryProtocolVersion. Must be <= to and match [[System_Settings|system-setting]] <code>contents_delivery!system_delivery_protocol_version</code>.
|-
|-
| 3 || ListOpenUsers ||
| 0x4 || 0x4 || ApplicationDeliveryProtocolVersion. Loaded from [[System_Settings|system-setting]] <code>contents_delivery!application_delivery_protocol_version</code>. Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation.
|-
|-
| 4 || GetLastOpenedUser ||
| 0x8 || 0x1 || HasExFat. Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation.
|-
|-
| 5 || GetProfile || Takes an input userID, returns an [[#IProfile]].
| 0x9 || 0x3 || Reserved.
|-
|-
| 6 || [3.0.0+] GetProfileDigest ||
| 0xC || 0x4 || SystemUpdateMetaVersion.
|-
|-
| 50 || [[#IsUserRegistrationRequestPermitted]] ||
| 0x10 || 0x8 || SystemUpdateMetaId.
|-
|-
| 51 || TrySelectUserWithoutInteractionDeprecated ([1.0.0-18.1.0] [[#TrySelectUserWithoutInteraction]]) ||
| 0x18 || 0x1 || FirmwareVariationId. Used by [[#RequestSendSystemUpdate]].
|-
|-
| 52 || [19.0.0+] TrySelectUserWithoutInteraction ||
| 0x19 || 0x1 || UpdatableFirmwareGroupId. Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation.
|-
|-
| 60 || [5.0.0-5.1.0] ListOpenContextStoredUsers ||
| 0x1A || 0x1 || PlatformRegion (0x00 = Unknown, 0x01 = Global, 0x02 = China).
|-
|-
| 99 || [6.0.0+] DebugActivateOpenContextRetention || No input, returns an [[#ISessionObject]].
| 0x1B || 0xC5 || Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation.
|-
|-
| 100 || [[#InitializeApplicationInfoV0]] ||
| 0xE0 || 0x20 || HMAC-SHA256 over the previous 0xE0-bytes.
|-
|}
| 101 || GetBaasAccountManagerForApplication || Takes an input userID, returns an [[#IManagerForApplication]].
 
|-
= ApplicationDeliveryInfo =
| 102 || AuthenticateApplicationAsync || Returns an [[#IAsyncContext]].
This is "nn::ns::ApplicationDeliveryInfo". This is a 0x100-byte struct.
|-
 
| 103 || [4.0.0+] CheckNetworkServiceAvailabilityAsync || Returns an [[#IAsyncContext]].
{| class="wikitable" border="1"
|-
|-
| 110 || StoreSaveDataThumbnail ||
! Offset
|-
! Size
| 111 || ClearSaveDataThumbnail ||
! Description
|-
|-
| 120 || CreateGuestLoginRequest || Returns an [[#IGuestLoginRequest]].
| 0x0 || 0x8 || ?
|-
| 130 || [5.0.0+] LoadOpenContext ||
|-
| 131 || [6.0.0+] ListOpenContextStoredUsers ||
|-
| 140 || [6.0.0+] [[#InitializeApplicationInfoV1]] ||
|-
| 141 || [6.0.0+] ListQualifiedUsers ||
|-
| 150 || [6.0.0+] IsUserAccountSwitchLocked ||
|-
| 160 || [13.0.0+] InitializeApplicationInfoV2 ||
|}
 
InitializeApplicationInfo* is used by the user-process during service init.
 
== InitializeApplicationInfoV0 ==
Takes a PID and an input u64 pid_placeholder, no output.
 
== InitializeApplicationInfoV1 ==
Takes a PID and an input u64 pid_placeholder, no output.
 
== IGuestLoginRequest ==
This is "nn::account::baas::IGuestLoginRequest".
 
{| class="wikitable" border="1"
|-
! Cmd || Name
|-
| 0 || GetSessionId
|-
| 11 || [1.0.0-2.3.0]
|-
| 12 || GetAccountId
|-
| 13 || GetLinkedNintendoAccountId
|-
| 14 || GetNickname
|-
| 15 || GetProfileImage
|-
| 16 || [18.0.0+] GetProfileLargeImage
|-
| 21 || [3.0.0+] LoadIdTokenCache
|}
 
== IManagerForApplication ==
This is "nn::account::baas::IManagerForApplication".
 
{| class="wikitable" border="1"
|-
! Cmd || Name || Notes
|-
| 0 || CheckAvailability ||
|-
| 1 || GetAccountId ||
|-
| 2 || EnsureIdTokenCacheAsync || Returns an [[#IAsyncContext]].
|-
| 3 || LoadIdTokenCache ||
|-
| 130 || GetNintendoAccountUserResourceCacheForApplication ||
|-
| 150 || CreateAuthorizationRequest || Returns an [[#IAuthorizationRequest]].
|-
| 160 || [5.0.0+] StoreOpenContext ||
|-
| 170 || [13.0.0+] EnsureIdTokenCacheForOnlinePlayAsync ([6.0.0-12.1.0] LoadNetworkServiceLicenseKindAsync) || No input, returns an [[#IAsyncContextForLoginForOnlinePlay]] ([6.0.0-12.1.0] [[#IAsyncNetworkServiceLicenseKindContext]]).
|}
 
== IAsyncNetworkServiceLicenseKindContext ==
This is "nn::account::detail::IAsyncNetworkServiceLicenseKindContext".
 
This was added with [6.0.0+].
 
{| class="wikitable" border="1"
|-
! Cmd || Name || Notes
|-
| 0 || GetSystemEvent ||
|-
| 1 || Cancel ||
|-
| 2 || HasDone ||
|-
| 3 || GetResult ||
|-
| 100 || GetNetworkServiceLicenseKind ||
|}
 
== IAsyncContextForLoginForOnlinePlay ==
This is "nn::account::baas::IAsyncContextForLoginForOnlinePlay".
 
This was added with [13.0.0+].
 
{| class="wikitable" border="1"
|-
! Cmd || Name || Notes
|-
| 0 || GetSystemEvent ||
|-
| 1 || Cancel ||
|-
| 2 || HasDone ||
|-
| 3 || GetResult ||
|-
| 100 || GetNetworkServiceLicenseInfoForOnlinePlay ||
|}
 
= acc:u1 =
This is "nn::account::IAccountServiceForSystemService".
 
[13.0.0+] This was moved from [[Account_services|account]].
 
This is only available when the output from [[Process_Manager_services|pm:bm]] GetBootMode is Normal/Maintenance.
 
{| class="wikitable" border="1"
|-
! Cmd || Name || Notes
|-
| 0 || GetUserCount ||
|-
| 1 || GetUserExistence ||
|-
| 2 || ListAllUsers ||
|-
| 3 || ListOpenUsers ||
|-
| 4 || GetLastOpenedUser ||
|-
| 5 || GetProfile || Returns an [[#IProfile]].
|-
| 6 || [3.0.0+] GetProfileDigest ||
|-
| 50 || [[#IsUserRegistrationRequestPermitted]] ||
|-
| 51 || TrySelectUserWithoutInteractionDeprecated ([1.0.0-18.1.0] [[#TrySelectUserWithoutInteraction]]) ||
|-
| 52 || [19.0.0+] TrySelectUserWithoutInteraction ||
|-
| 60 || [5.0.0-5.1.0] ListOpenContextStoredUsers ||
|-
| 99 || [6.0.0+] DebugActivateOpenContextRetention || No input, returns an [[#ISessionObject]].
|-
| 100 || GetUserRegistrationNotifier || Returns an [[#INotifier]].
|-
| 101 || GetUserStateChangeNotifier || Returns an [[#INotifier]].
|-
| 102 || GetBaasAccountManagerForSystemService || Returns an [[#IManagerForSystemService]].
|-
| 103 || GetBaasUserAvailabilityChangeNotifier || Returns an [[#INotifier]].
|-
| 104 || GetProfileUpdateNotifier || Returns an [[#INotifier]].
|-
| 105 || [4.0.0+] CheckNetworkServiceAvailabilityAsync || Returns an [[#IAsyncContext]].
|-
| 106 || [9.0.0+] GetProfileSyncNotifier ||
|-
| 110 || StoreSaveDataThumbnail ||
|-
| 111 || ClearSaveDataThumbnail ||
|-
| 112 || LoadSaveDataThumbnail ||
|-
| 113 || [5.0.0+] GetSaveDataThumbnailExistence ||
|-
| 120 || [10.0.0+] ListOpenUsersInApplication ||
|-
| 130 || [6.0.0+] ActivateOpenContextRetention || Takes a total of 0x8-bytes of input, returns an [[#ISessionObject]].
|-
| 140 || [6.0.0+] ListQualifiedUsers ||
|-
| 150 || [10.0.0-10.2.0] AuthenticateApplicationAsync ||
|-
| 151 || [12.0.0+] EnsureSignedDeviceIdentifierCacheForNintendoAccountAsync ||
|-
| 152 || [12.0.0+] LoadSignedDeviceIdentifierCacheForNintendoAccount ||
|-
| 170 || [13.0.0+] GetNasOp2MembershipStateChangeNotifier ||
|-
| 190 || [1.0.0-9.2.0] GetUserLastOpenedApplication ||
|-
| 191 || [7.0.0-19.0.1] UpdateNotificationReceiverInfo ([5.0.0-5.1.0] ActivateOpenContextHolder) ||
|-
| 401 || [18.0.0+] GetPinCodeLength ||
|-
| 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 ||
|-
| 998 || DebugSetUserStateClose ||
|-
| 999 || DebugSetUserStateOpen ||
|}
 
[10.0.0+] DebugSetUserStateClose/DebugSetUserStateOpen now takes an additional 8-bytes of input.
 
== IOAuthProcedureForUserRegistration ==
This is "nn::account::nas::IOAuthProcedureForUserRegistration".
 
This was added with [8.0.0+].
 
{| class="wikitable" border="1"
|-
! Cmd || Name || Notes
|-
| 0 || PrepareAsync || No input, returns an [[#IAsyncContext]].
|-
| 1 || GetRequest ||
|-
| 2 || ApplyResponse ||
|-
| 3 || ApplyResponseAsync || Takes a type-0x9 input buffer, returns an [[#IAsyncContext]].
|-
| 10 || Suspend ||
|-
| 100 || GetAccountId ||
|-
| 101 || GetLinkedNintendoAccountId ||
|-
| 102 || GetNickname ||
|-
| 103 || GetProfileImage ||
|-
| 104 || [18.0.0+] GetProfileLargeImage ||
|-
| 110 || RegisterUserAsync || No input, returns an [[#IAsyncContext]].
|-
| 111 || GetUid ||
|-
| 200 || [17.0.0+] ApplyResponseForUserCreationAsync ||
|-
| 205 || [17.0.0+] SuspendAfterApplyResponse ||
|-
| 210 || [17.0.0+] IsProfileAvailable ||
|-
| 220 || [17.0.0+] RegisterUserAsyncWithoutProfile ||
|-
| 221 || [17.0.0+] RegisterUserWithProfileAsync ||
|-
| 230 || [18.0.0+] RegisterUserWithLargeImageProfileAsync ||
|}
 
= ApplicationRecord =
This is "nn::ns::ApplicationRecord".
 
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0
| 0x8
| [[NCM_services#ApplicationId|Id]]
|-
| 0x8
| 0x1
| [[#ApplicationEvent|LastEvent]]
|-
| 0x9
| 0x1
| Attributes
|-
| 0xA
| 0x6
| Reserved
|-
| 0x10
| 0x8
| LastUpdated
|}
 
= ApplicationEvent =
This is "nn::ns::ApplicationEvent".
 
{| class="wikitable" border="1"
|-
! Value
! Description
|-
| 0 || Launched
|-
| 1 || LocalInstalled
|-
| 2 || DownloadStarted
|-
| 3 || GameCardInserted
|-
| 4 || Touched
|-
| 5 ||
|-
| 6 ||
|-
| 7 ||
|-
| 8 ||
|-
| 9 ||
|-
| 10 ||
|-
| 11 ||
|-
| 12 ||
|-
| 13 ||
|-
| 14 ||
|-
| 15 ||
|-
| 16 ||
|}
 
= ApplicationControlSource =
This is "nn::ns::ApplicationControlSource".
 
{| class="wikitable" border="1"
|-
! Value
! Description
|-
| 0
| CacheOnly
|-
| 1
| Storage
|-
| 2
| StorageOnly
|}
 
= ApplicationContentMetaStatus =
This is "nn::ns::ApplicationContentMetaStatus".
 
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0
| 0x1
| [[NCM_services#ContentMetaType|Type]]
|-
| 0x1
| 0x1
| [[NCM_services#StorageId|InstalledStorage]]
|-
| 0x2
| 0x1
| [[#ContentMetaRightsCheck|RightsCheck]]
|-
| 0x3
| 0x1
| Reserved
|-
| 0x4
| 0x4
| Version
|-
| 0x8
| 0x8
| [[NCM_services#ApplicationId|Id]]
|}
 
= ContentMetaRightsCheck =
This is "nn::ns::ContentMetaRightsCheck".
 
{| class="wikitable" border="1"
|-
! Value
! Description
|-
| 0
| NotChecked
|-
| 1
| NotNeeded
|-
| 2
| CommonRights
|-
| 3
| PersonalizedRights
|-
| 4
| NoRights
|}
 
= VersionListData =
This is "nn::ns::VersionListData".
 
= ApplicationUpdateInfo =
This is "nn::ns::ApplicationUpdateInfo".
 
{| class="wikitable" border="1"
|-
! Value
! Description
|-
| 0 || UpToDate
|-
| 1 || Updatable
|}
 
= ApplicationOccupiedSize =
This is "nn::ns::ApplicationOccupiedSize". This is a 0x80-byte struct.
 
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0 || 0x20 * 4 || Array of [[#ApplicationOccupiedSizeEntity]]
|}
 
= ApplicationOccupiedSizeEntity =
This is "nn::ns::ApplicationOccupiedSizeEntity". This is a 0x20-byte struct.
 
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0 || 0x1 || [[NCM_services#StorageId|StorageId]]
|-
| 0x1 || 0x7 || Reserved
|-
| 0x8 || 0x8 || AppSize
|-
| 0x10 || 0x8 || PatchSize
|-
| 0x18 || 0x8 || AocSize
|}
 
= ProgressForDeleteUserSaveDataAll =
This is "nn::ns::detail::ProgressForDeleteUserSaveDataAll". This is a 0x28-byte struct.
 
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0 || 0x8 || StartedAt
|-
| 0x8 || 0x4 || Count
|-
| 0xC || 0x4 || Reserved
|-
| 0x10 || 0x8 || SizeInBytes
|-
| 0x18 || 0x1 || IsSystem
|-
| 0x19 || 0x7 || Reserved
|-
| 0x20 || 0x8 || ApplicationId
|}
 
= ApplicationViewDeprecated =
This is "nn::ns::ApplicationViewDeprecated". This is a 0x40-byte struct.
 
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0 || 0x8 || [[NCM_services#ApplicationId|ApplicationId]]
|-
| 0x8 || 0x4 || Version
|-
| 0xC || 0x4 || [[#ApplicationViewFlag|Flag]]
|-
| 0x10 || 0x18 || [[#ApplicationDownloadProgress|Progress]]
|-
| 0x28 || 0x18 || [[#ApplicationApplyDeltaProgress|ApplyProgress]]
|}
 
This is converted from [[#ApplicationView]] by [[#GetApplicationViewDeprecated]] on newer system-versions as follows:
 
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0 || 0x20 || Same as [[#ApplicationView]] +0x0.
|-
| 0x20 || 0x4 || Same as [[#ApplicationView]] +0x20.
|-
| 0x24 || 0x2 || Same as [[#ApplicationView]] +0x24.
|-
| 0x26 || 0x2 || Cleared to 0.
|-
| 0x28 || 0x10 || Same as [[#ApplicationView]] +0x30.
|-
| 0x38 || 0x4 || Same as [[#ApplicationView]] +0x40.
|-
| 0x3C || 0x1 || Same as [[#ApplicationView]] +0x44.
|-
| 0x3D || 0x2 || Cleared to 0.
|-
| 0x3F || 0x1 || Cleared to 0.
|}
 
= ApplicationViewFlag =
This is "nn::ns::ApplicationViewFlag". This is a 32-bit flag.
 
{| class="wikitable" border="1"
|-
! Bit
! Description
|-
| 0
|
|-
| 1
|
|-
| 2
|
|-
| 3
|
|-
| 4
|
|-
| 5
|
|-
| 6
|
|-
| 7
|
|-
| 8
|
|-
| 9
|
|-
| 10
|
|-
| 11
|
|-
| 12
|
|-
| 13
|
|-
| 14
|
|-
| 15
|
|-
| 16
|
|-
| 17
|
|}
 
= ApplicationDownloadProgress =
This is "nn::ns::ApplicationDownloadProgress". This is a 0x18-byte struct.
 
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0 || 0x8 || Downloaded
|-
| 0x8 || 0x8 || Total
|-
| 0x10 || 0x4 || LastResult
|-
| 0x14 || 0x1 || [[#ApplicationDownloadState|State]]
|-
| 0x15 || 0x3 || Reserved
|}
 
= ApplicationApplyDeltaProgress =
This is "nn::ns::ApplicationApplyDeltaProgress". This is a 0x18-byte struct.
 
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0 || 0x8 || Applied
|-
| 0x8 || 0x8 || Total
|-
| 0x10 || 0x4 || LastResult
|-
| 0x14 || 0x1 || [[#ApplicationApplyDeltaState|State]]
|-
| 0x15 || 0x3 || Reserved
|}
 
= ApplicationDownloadState =
This is "nn::ns::ApplicationDownloadState". This is an u8.
 
{| class="wikitable" border="1"
|-
! Value
! Description
|-
| 0 || Runnable
|-
| 1 || Suspended
|-
| 2 || NotEnoughSpace
|-
| 3 || Fatal
|-
| 4 || Finished
|}
 
= ApplicationApplyDeltaState =
This is "nn::ns::ApplicationApplyDeltaState". This is an u8.
 
{| class="wikitable" border="1"
|-
! Value
! 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"
|-
! Offset
! Size
! Description
|-
| 0x0 || 0x8 || [[NCM_services#ApplicationId|ApplicationId]]
|-
| 0x8 || 0x4 || ?
|-
| 0xC || 0x4 || Flags
|-
| 0x10 || 0x40 || ?
|}
 
= ApplicationViewWithPromotionInfo =
This is a 0x70-byte struct.
 
[20.0.0+] This is a 0x78-byte struct.
 
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0 || 0x50 || [[#ApplicationView]]
|-
| 0x50 || 0x20 || [[#PromotionInfo]]
|}
 
= PromotionInfo =
This is a 0x20-byte struct.
 
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 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.
 
Originally the SystemDeliveryInfo validation func verified that OldSystemUpdateId matched the installed SystemUpdate Id. [20.0.0+] The used (Old)SystemUpdateId as selected by SystemUpdateIdFlag must now match one of the Ids in [[System_Settings|system-setting]] <code>contents_delivery!acceptable_system_update_ids_string</code> (replaces the previously mentioned installed-SystemUpdate check).
 
{| 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 || SystemUpdateVersion.
|-
| 0x10 || 0x8 || OldSystemUpdateId. [20.0.0+] Always the NX Id: this is loaded from [[System_Settings|system-setting]] <code>contents_delivery!old_system_update_id</code>.
|-
| 0x18 || 0x1 || FirmwareVariationId. Used by [[#RequestSendSystemUpdate]]. Loaded from [[System_Settings|system-setting]] <code>ns.systemupdate!firmware_variation</code> or <code>ns.systemupdate!t_firmware_variation</code>, depending on the [[Settings_services|PlatformRegion]].
|-
| 0x19 || 0x1 || UpdatableFirmwareGroupId. Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation. Loaded from [[System_Settings|system-setting]] <code>ns.systemupdate!updatable_firmware_group_id</code> or <code>ns.systemupdate!t_updatable_firmware_group_id</code>, depending on the [[Settings_services|PlatformRegion]].
|-
| 0x1A || 0x1 || PlatformRegion (0x00 = Unknown/Global, 0x01 = 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+] SystemUpdateIdFlag. When non-zero, SystemUpdateId is used instead of OldSystemUpdateId. Always set to 0x1 by [[#GetSystemDeliveryInfo]] with [20.0.0+].
|-
| 0x1D || 0x3 || Padding
|-
| 0x20 || 0x8 || [20.0.0+] SystemUpdateId. See above. With [20.0.0+] [[#GetSystemDeliveryInfo]] now writes the Id here instead of OldSystemUpdateId (for the installed SystemUpdate). On S2 this is set to the Ounce Id.
|-
| 0x28 || 0xB8 || Reserved
|-
| 0xE0 || 0x20 || HMAC-SHA256 over the previous 0xE0-bytes.
|}
 
= ApplicationDeliveryInfo =
This is "nn::ns::ApplicationDeliveryInfo". This is a 0x100-byte struct.
 
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0 || 0x4 || ApplicationDeliveryProtocolVersion. Loaded from [[System_Settings|system-setting]] <code>contents_delivery!application_delivery_protocol_version</code>. An error is thrown when [[System_Settings|system-setting]] <code>contents_delivery!application_delivery_protocol_version</code> < version, or when [[System_Settings|system-setting]] <code>contents_delivery!acceptable_application_delivery_protocol_version</code> > version.
|-
| 0x4 || 0x4 || Padding
|-
| 0x8 || 0x8 || ApplicationId.
|-
| 0x10 || 0x4 || ApplicationVersion.
|-
| 0x14 || 0x4 || RequiredApplicationVersion.
|-
| 0x18 || 0x4 || RequiredSystemVersion.
|-
|-
| 0x8 || 0x8 || ApplicationId.
| 0x1C || 0x4 || u32 bitmask <code>nn::ns::ApplicationDeliveryAttributeTag</code>. [[#GetApplicationDeliveryInfo|GetApplicationDeliveryInfo]] sets this to the input u32. Bit30 and bit28 are additionally set, depending on [[NCM_services|ContentMetaType]] == Patch, etc.
|-
|-
| 0x10 || 0x4 || ApplicationVersion.
| 0x20 || 0x1 || [20.0.0+] [[NCM_services|ContentMetaPlatform]]. Loaded from [[NCM_services|ncm]] IContentMetaDatabase GetPlatform.
|-
| 0x14 || 0x4 || ?
|-
| 0x18 || 0x4 || RequiredSystemVersion.
|-
|-
| 0x1C || 0x4 || ?
| 0x21 || 0x1 || [20.0.0+] ProperProgramExists. Set to whether the bit for ProperProgramExists is set from [[NCM_services|ncm]] IContentMetaDatabase GetAttributes.
|-
|-
| 0x20 || 0xC0 || ?
| 0x22 || 0xBE || Reserved
|-
|-
| 0xE0 || 0x20 || HMAC-SHA256 over the previous 0xE0-bytes. Uses a different key than [[#SystemDeliveryInfo]].
| 0xE0 || 0x20 || HMAC-SHA256 over the previous 0xE0-bytes. Uses a different key than [[#SystemDeliveryInfo]].