Difference between revisions of "NS Services"

From Nintendo Switch Brew
Jump to navigation Jump to search
 
(76 intermediate revisions by 3 users not shown)
Line 23: Line 23:
 
|-
 
|-
 
| 8 || [4.0.0+] GetAddOnContentListChangedEvent
 
| 8 || [4.0.0+] GetAddOnContentListChangedEvent
 +
|-
 +
| 9 || [10.0.0+] GetAddOnContentLostErrorCode
 
|-
 
|-
 
| 100 || [7.0.0+] [[#IPurchaseEventManager|CreateEcPurchasedEventManager]]
 
| 100 || [7.0.0+] [[#IPurchaseEventManager|CreateEcPurchasedEventManager]]
Line 76: Line 78:
 
| 9 || MoveApplicationEntity
 
| 9 || MoveApplicationEntity
 
|-
 
|-
| 11 || CalculateApplicationOccupiedSize
+
| 11 || [[#CalculateApplicationOccupiedSize]]
 
|-
 
|-
 
| 16 || PushApplicationRecord
 
| 16 || PushApplicationRecord
Line 82: Line 84:
 
| 17 || ListApplicationRecordContentMeta
 
| 17 || ListApplicationRecordContentMeta
 
|-
 
|-
| 18 ||  
+
| 18 || CheckLaunchRights
 
|-
 
|-
 
| 19 || [[#LaunchApplication]]
 
| 19 || [[#LaunchApplication]]
Line 122: Line 124:
 
| 42 || CleanupSdCard
 
| 42 || CleanupSdCard
 
|-
 
|-
| 43 || CheckSdCardMountStatus
+
| 43 || [[#CheckSdCardMountStatus]]
 
|-
 
|-
 
| 44 || GetSdCardMountStatusChangedEvent
 
| 44 || GetSdCardMountStatusChangedEvent
Line 212: Line 214:
 
| 504 || [2.0.0+] RequestRegisterGameCard
 
| 504 || [2.0.0+] RequestRegisterGameCard
 
|-
 
|-
| 600 || [2.0.0+] CountApplicationContentMeta
+
| 600 || [2.0.0+] [[#CountApplicationContentMeta]]
 
|-
 
|-
 
| 601 || [2.0.0+] [[#ListApplicationContentMetaStatus]]
 
| 601 || [2.0.0+] [[#ListApplicationContentMetaStatus]]
Line 226: Line 228:
 
| 700 || [2.0.0+] PushDownloadTaskList
 
| 700 || [2.0.0+] PushDownloadTaskList
 
|-
 
|-
| 701 || [2.0.0+] ClearTaskStatusList
+
| 701 || [2.0.0+] [[#ClearTaskStatusList]]
 
|-
 
|-
| 702 || [2.0.0+] RequestDownloadTaskList
+
| 702 || [2.0.0+] [[#RequestDownloadTaskList]]
 
|-
 
|-
| 703 || [2.0.0+] RequestEnsureDownloadTask
+
| 703 || [2.0.0+] [[#RequestEnsureDownloadTask]]
 
|-
 
|-
| 704 || [2.0.0+] ListDownloadTaskStatus
+
| 704 || [2.0.0+] [[#ListDownloadTaskStatus]]
 
|-
 
|-
 
| 705 || [2.0.0+] RequestDownloadTaskListData
 
| 705 || [2.0.0+] RequestDownloadTaskListData
Line 309: Line 311:
 
| 0x8
 
| 0x8
 
| 0x1
 
| 0x1
| Type? (Known values: 2=Installing?, 3=Gamecard?, 4=Installed?)
+
| Type? (Known values: 0x2=Installing?, 0x3=Installed / Gamecard inserted, 0x5=Gamecard not inserted, 0xB=Archived)
 
|-
 
|-
 
| 0x9
 
| 0x9
Line 345: Line 347:
  
 
== GetTotalSpaceSize ==
 
== GetTotalSpaceSize ==
Takes an input media-id that must be 5.
+
Takes an input u8 [[NCM_services#StorageId|StorageId]], no output.
 +
 
 +
The StorageId must be SdCard.
  
Returns the u64 from [[Content_Manager_services#IContentStorage]] cmd22.
+
Returns the s64 from [[NCM_services#IContentStorage]] GetFreeSpaceSize.
  
 
== GetFreeSpaceSize ==
 
== GetFreeSpaceSize ==
Takes an input media-id that must be 5.
+
Takes an input u8 [[NCM_services#StorageId|StorageId]], no output.
 +
 
 +
The StorageId must be SdCard.
  
Returns the u64 from [[Content_Manager_services#IContentStorage]] cmd23.
+
Returns the s64 from [[NCM_services#IContentStorage]] GetTotalSpaceSize.
  
 
== GetApplicationDesiredLanguage ==
 
== GetApplicationDesiredLanguage ==
Line 365: Line 371:
  
 
== GetApplicationControlData ==
 
== GetApplicationControlData ==
Takes an input u8 [[#ApplicationControlSource]], an [[NCM_services#ApplicationId|ApplicationId]], and a type-0x6 output buffer. Returns an output u32 for actual_size. Official user-processes use buffer size 0x24000. [[qlaunch]] only uses flag value 0x1 (Storage if not in cache).
+
Takes an input u8 [[#ApplicationControlSource]], an [[NCM_services#ApplicationId|ApplicationId]], and a type-0x6 output buffer. Returns an output u32 for actual_size. Official user-processes use buffer size 0x24000. [[qlaunch]] only uses source value 0x1 (Storage if not in cache).
  
 
Loads cached [[control.nacp]] to buf+0 and the cached icon to buf+0x4000. Returns an error if the buffer is too small.
 
Loads cached [[control.nacp]] to buf+0 and the cached icon to buf+0x4000. Returns an error if the buffer is too small.
  
===ApplicationControlSource===
+
=== ApplicationControlSource ===
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
Line 473: Line 479:
 
| 1 || GenerateApplicationRecordCount
 
| 1 || GenerateApplicationRecordCount
 
|-
 
|-
| 2 || GetApplicationRecordUpdateSystemEvent
+
| 2 || [[#GetApplicationRecordUpdateSystemEvent]]
 
|-
 
|-
| 3 || GetApplicationViewDeprecated
+
| 3 || [[#GetApplicationViewDeprecated]]
 
|-
 
|-
| 4 || DeleteApplicationEntity
+
| 4 || [[#DeleteApplicationEntity]]
 
|-
 
|-
| 5 || DeleteApplicationCompletely
+
| 5 || [[#DeleteApplicationCompletely]]
 
|-
 
|-
 
| 6 || IsAnyApplicationEntityRedundant
 
| 6 || IsAnyApplicationEntityRedundant
 
|-
 
|-
| 7 || DeleteRedundantApplicationEntity
+
| 7 || [[#DeleteRedundantApplicationEntity]]
 
|-
 
|-
| 8 || IsApplicationEntityMovable
+
| 8 || [[#IsApplicationEntityMovable]]
 
|-
 
|-
| 9 || MoveApplicationEntity
+
| 9 || [1.0.0-9.2.0] [[#MoveApplicationEntity]]
 
|-
 
|-
| 11 || CalculateApplicationOccupiedSize
+
| 11 || [[#CalculateApplicationOccupiedSize]]
 
|-
 
|-
 
| 16 || PushApplicationRecord
 
| 16 || PushApplicationRecord
Line 511: Line 517:
 
| 31 || [1.0.0-3.0.2]  
 
| 31 || [1.0.0-3.0.2]  
 
|-
 
|-
| 32 || CancelApplicationDownload
+
| 32 || [[#CancelApplicationDownload]]
 
|-
 
|-
| 33 || ResumeApplicationDownload
+
| 33 || [[#ResumeApplicationDownload]]
 
|-
 
|-
 
| 35 || UpdateVersionList
 
| 35 || UpdateVersionList
Line 521: Line 527:
 
| 37 || ListRequiredVersion
 
| 37 || ListRequiredVersion
 
|-
 
|-
| 38 || CheckApplicationLaunchVersion
+
| 38 || [[#CheckApplicationLaunchVersion]]
 
|-
 
|-
 
| 39 || [1.0.0-6.2.0] CheckApplicationLaunchRights
 
| 39 || [1.0.0-6.2.0] CheckApplicationLaunchRights
Line 529: Line 535:
 
| 41 || CalculateApplicationDownloadRequiredSize
 
| 41 || CalculateApplicationDownloadRequiredSize
 
|-
 
|-
| 42 || CleanupSdCard
+
| 42 || [[#CleanupSdCard]]
 
|-
 
|-
| 43 || CheckSdCardMountStatus
+
| 43 || [[#CheckSdCardMountStatus]]
 
|-
 
|-
| 44 || GetSdCardMountStatusChangedEvent
+
| 44 || [[#GetSdCardMountStatusChangedEvent]]
 
|-
 
|-
 
| 45 || GetGameCardAttachmentEvent
 
| 45 || GetGameCardAttachmentEvent
Line 545: Line 551:
 
| 49 || GetSdCardRemovedEvent
 
| 49 || GetSdCardRemovedEvent
 
|-
 
|-
| 52 || GetGameCardUpdateDetectionEvent
+
| 52 || [[#GetGameCardUpdateDetectionEvent]]
 
|-
 
|-
| 53 || DisableApplicationAutoDelete
+
| 53 || [[#DisableApplicationAutoDelete]]
 
|-
 
|-
| 54 || EnableApplicationAutoDelete
+
| 54 || [[#EnableApplicationAutoDelete]]
 
|-
 
|-
 
| 55 || GetApplicationDesiredLanguage
 
| 55 || GetApplicationDesiredLanguage
 
|-
 
|-
| 56 || SetApplicationTerminateResult
+
| 56 || [[#SetApplicationTerminateResult]]
 
|-
 
|-
| 57 || ClearApplicationTerminateResult
+
| 57 || [[#ClearApplicationTerminateResult]]
 
|-
 
|-
| 58 || GetLastSdCardMountUnexpectedResult
+
| 58 || [[#GetLastSdCardMountUnexpectedResult]]
 
|-
 
|-
 
| 59 || ConvertApplicationLanguageToLanguageCode
 
| 59 || ConvertApplicationLanguageToLanguageCode
Line 571: Line 577:
 
| 64 || StartApplyDeltaTask
 
| 64 || StartApplyDeltaTask
 
|-
 
|-
| 65 || GetRequestServerStopper
+
| 65 || [[#GetRequestServerStopper]]
 
|-
 
|-
 
| 66 || [3.0.0+] GetBackgroundApplyDeltaStressTaskInfo
 
| 66 || [3.0.0+] GetBackgroundApplyDeltaStressTaskInfo
 
|-
 
|-
| 67 || [3.0.0+] CancelApplicationApplyDelta
+
| 67 || [3.0.0+] [[#CancelApplicationApplyDelta]]
 
|-
 
|-
| 68 || [3.0.0+] ResumeApplicationApplyDelta
+
| 68 || [3.0.0+] [[#ResumeApplicationApplyDelta]]
 
|-
 
|-
| 69 || [3.0.0+] CalculateApplicationApplyDeltaRequiredSize
+
| 69 || [3.0.0+] [[#CalculateApplicationApplyDeltaRequiredSize]]
 
|-
 
|-
| 70 || [3.0.0+] ResumeAll
+
| 70 || [3.0.0+] [[#ResumeAll]]
 
|-
 
|-
| 71 || [3.0.0+] GetStorageSize
+
| 71 || [3.0.0+] [[#GetStorageSize]]
 
|-
 
|-
 
| 80 || [3.0.0+] RequestDownloadApplication
 
| 80 || [3.0.0+] RequestDownloadApplication
Line 595: Line 601:
 
| 84 || [4.0.0+] GetDynamicCommitEvent
 
| 84 || [4.0.0+] GetDynamicCommitEvent
 
|-
 
|-
| 85 || [4.0.0+] RequestUpdateApplication2
+
| 85 || [4.0.0+] [[#RequestUpdateApplication2]]
 
|-
 
|-
 
| 86 || [4.0.0+] EnableApplicationCrashReport
 
| 86 || [4.0.0+] EnableApplicationCrashReport
Line 609: Line 615:
 
| 93 || [5.0.0+] GetMainApplicationProgramIndex
 
| 93 || [5.0.0+] GetMainApplicationProgramIndex
 
|-
 
|-
| 94 || [6.0.0+] LaunchApplication
+
| 94 || [6.0.0+] [[#LaunchApplication_2|LaunchApplication]]
 
|-
 
|-
| 95 || [6.0.0+] GetApplicationLaunchInfo
+
| 95 || [6.0.0+] [[#GetApplicationLaunchInfo]]
 
|-
 
|-
| 96 || [6.0.0+] AcquireApplicationLaunchInfo
+
| 96 || [6.0.0+] [[#AcquireApplicationLaunchInfo]]
 
|-
 
|-
 
| 97 || [6.0.0+] GetMainApplicationProgramIndexByApplicationLaunchInfo
 
| 97 || [6.0.0+] GetMainApplicationProgramIndexByApplicationLaunchInfo
Line 621: Line 627:
 
| 99 || [8.0.0+] [[#LaunchDevMenu]]
 
| 99 || [8.0.0+] [[#LaunchDevMenu]]
 
|-
 
|-
| 100 || ResetToFactorySettings
+
| 100 || [[#ResetToFactorySettings]]
 +
|-
 +
| 101 || [[#ResetToFactorySettingsWithoutUserSaveData]]
 +
|-
 +
| 102 || [[#ResetToFactorySettingsForRefurbishment]]
 
|-
 
|-
| 101 || ResetToFactorySettingsWithoutUserSaveData
+
| 103 || [9.1.0+] [[#ResetToFactorySettingsWithPlatformRegion]]
 
|-
 
|-
| 102 || ResetToFactorySettingsForRefurbishment
+
| 104 || [9.1.0+] [[#ResetToFactorySettingsWithPlatformRegionAuthentication]]
 
|-
 
|-
| 103 || [9.1.0+]
+
| 105 || [10.0.0+] [[#RequestResetToFactorySettingsSecurely]]
 
|-
 
|-
| 104 || [9.1.0+]
+
| 106 || [10.0.0+] [[#RequestResetToFactorySettingsWithPlatformRegionAuthenticationSecurely]]
 
|-
 
|-
 
| 200 || CalculateUserSaveDataStatistics
 
| 200 || CalculateUserSaveDataStatistics
 
|-
 
|-
| 201 || DeleteUserSaveDataAll
+
| 201 || [[#DeleteUserSaveDataAll]]
 
|-
 
|-
| 210 || DeleteUserSystemSaveData
+
| 210 || [[#DeleteUserSystemSaveData]]
 
|-
 
|-
| 211 || [6.0.0+] DeleteSaveData
+
| 211 || [6.0.0+] [[#DeleteSaveData]]
 
|-
 
|-
| 220 || UnregisterNetworkServiceAccount
+
| 220 || [[#UnregisterNetworkServiceAccount]]
 
|-
 
|-
| 221 || [6.0.0+] UnregisterNetworkServiceAccountWithUserSaveDataDeletion
+
| 221 || [6.0.0+] [[#UnregisterNetworkServiceAccountWithUserSaveDataDeletion]]
 
|-
 
|-
 
| 300 || GetApplicationShellEvent
 
| 300 || GetApplicationShellEvent
Line 647: Line 657:
 
| 301 || PopApplicationShellEventInfo
 
| 301 || PopApplicationShellEventInfo
 
|-
 
|-
| 302 || LaunchLibraryApplet
+
| 302 || [[#LaunchLibraryApplet]]
 
|-
 
|-
 
| 303 || TerminateLibraryApplet
 
| 303 || TerminateLibraryApplet
 
|-
 
|-
| 304 || LaunchSystemApplet
+
| 304 || [[#LaunchSystemApplet]]
 
|-
 
|-
 
| 305 || TerminateSystemApplet
 
| 305 || TerminateSystemApplet
 
|-
 
|-
| 306 || LaunchOverlayApplet
+
| 306 || [[#LaunchOverlayApplet]]
 
|-
 
|-
 
| 307 || TerminateOverlayApplet
 
| 307 || TerminateOverlayApplet
 
|-
 
|-
| 400 || GetApplicationControlData
+
| 400 || [[#GetApplicationControlData]]
 
|-
 
|-
 
| 401 || InvalidateAllApplicationControlCache
 
| 401 || InvalidateAllApplicationControlCache
 
|-
 
|-
| 402 || RequestDownloadApplicationControlData
+
| 402 || [[#RequestDownloadApplicationControlData]]
 
|-
 
|-
 
| 403 || GetMaxApplicationControlCacheCount
 
| 403 || GetMaxApplicationControlCacheCount
Line 677: Line 687:
 
| 408 || [8.0.0+] [[#ListApplicationIcon]]
 
| 408 || [8.0.0+] [[#ListApplicationIcon]]
 
|-
 
|-
| 502 || RequestCheckGameCardRegistration
+
| 502 || [[#RequestCheckGameCardRegistration]]
 
|-
 
|-
 
| 503 || [[#RequestGameCardRegistrationGoldPoint]]
 
| 503 || [[#RequestGameCardRegistrationGoldPoint]]
 
|-
 
|-
| 504 || RequestRegisterGameCard
+
| 504 || [[#RequestRegisterGameCard]]
 
|-
 
|-
| 505 || [3.0.0+] GetGameCardMountFailureEvent
+
| 505 || [3.0.0+] [[#GetGameCardMountFailureEvent]]
 
|-
 
|-
| 506 || [3.0.0+] IsGameCardInserted
+
| 506 || [3.0.0+] [[#IsGameCardInserted]]
 
|-
 
|-
| 507 || [3.0.0+] EnsureGameCardAccess
+
| 507 || [3.0.0+] [[#EnsureGameCardAccess]]
 
|-
 
|-
| 508 || [3.0.0+] GetLastGameCardMountFailureResult
+
| 508 || [3.0.0+] [[#GetLastGameCardMountFailureResult]]
 
|-
 
|-
| 509 || [5.0.0+] ListApplicationIdOnGameCard
+
| 509 || [5.0.0+] [[#ListApplicationIdOnGameCard]]
 
|-
 
|-
 
| 510 || [9.0.0+] [[#GetGameCardPlatformRegion]]
 
| 510 || [9.0.0+] [[#GetGameCardPlatformRegion]]
 
|-
 
|-
| 600 || CountApplicationContentMeta
+
| 600 || [[#CountApplicationContentMeta]]
 
|-
 
|-
 
| 601 || [[#ListApplicationContentMetaStatus]]
 
| 601 || [[#ListApplicationContentMetaStatus]]
Line 709: Line 719:
 
| 606 || [3.0.0+] GetContentMetaStorage
 
| 606 || [3.0.0+] GetContentMetaStorage
 
|-
 
|-
| 607 || [6.0.0+] ListAvailableAddOnContent
+
| 607 || [6.0.0+] [[#ListAvailableAddOnContent]]
 
|-
 
|-
 
| 700 || PushDownloadTaskList
 
| 700 || PushDownloadTaskList
 
|-
 
|-
| 701 || ClearTaskStatusList
+
| 701 || [[#ClearTaskStatusList]]
 
|-
 
|-
| 702 || RequestDownloadTaskList
+
| 702 || [[#RequestDownloadTaskList]]
 
|-
 
|-
| 703 || RequestEnsureDownloadTask
+
| 703 || [[#RequestEnsureDownloadTask]]
 
|-
 
|-
| 704 || ListDownloadTaskStatus
+
| 704 || [[#ListDownloadTaskStatus]]
 
|-
 
|-
 
| 705 || [[#RequestDownloadTaskListData]]
 
| 705 || [[#RequestDownloadTaskListData]]
Line 737: Line 747:
 
| 903 || DisableApplicationAutoUpdate
 
| 903 || DisableApplicationAutoUpdate
 
|-
 
|-
| 904 || TouchApplication
+
| 904 || [[#TouchApplication]]
 
|-
 
|-
 
| 905 || RequestApplicationUpdate
 
| 905 || RequestApplicationUpdate
 
|-
 
|-
| 906 || IsApplicationUpdateRequested
+
| 906 || [[#IsApplicationUpdateRequested]]
 
|-
 
|-
| 907 || WithdrawApplicationUpdateRequest
+
| 907 || [[#WithdrawApplicationUpdateRequest]]
 
|-
 
|-
 
| 908 || ListApplicationRecordInstalledContentMeta
 
| 908 || ListApplicationRecordInstalledContentMeta
Line 761: Line 771:
 
| 915 || [9.0.0+] ShowApplicationRecord
 
| 915 || [9.0.0+] ShowApplicationRecord
 
|-
 
|-
| 1000 || RequestVerifyApplicationDeprecated
+
| 1000 || [[#RequestVerifyApplicationDeprecated]]
 
|-
 
|-
 
| 1001 || CorruptApplicationForDebug
 
| 1001 || CorruptApplicationForDebug
 
|-
 
|-
| 1002 || [3.0.0+] RequestVerifyAddOnContentsRights
+
| 1002 || [3.0.0-9.2.0] [[#RequestVerifyAddOnContentsRights]]
 
|-
 
|-
| 1003 || [5.0.0+] RequestVerifyApplication
+
| 1003 || [5.0.0+] [[#RequestVerifyApplication]]
 
|-
 
|-
 
| 1004 || [5.0.0+] CorruptContentForDebug
 
| 1004 || [5.0.0+] CorruptContentForDebug
Line 773: Line 783:
 
| 1200 || [[#NeedsUpdateVulnerability]]
 
| 1200 || [[#NeedsUpdateVulnerability]]
 
|-
 
|-
| 1300 || IsAnyApplicationEntityInstalled
+
| 1300 || [[#IsAnyApplicationEntityInstalled]]
 
|-
 
|-
 
| 1301 || DeleteApplicationContentEntities
 
| 1301 || DeleteApplicationContentEntities
Line 779: Line 789:
 
| 1302 || CleanupUnrecordedApplicationEntity
 
| 1302 || CleanupUnrecordedApplicationEntity
 
|-
 
|-
| 1303 || [3.0.0+] CleanupAddOnContentsWithNoRights
+
| 1303 || [3.0.0-9.2.0] CleanupAddOnContentsWithNoRights
 
|-
 
|-
 
| 1304 || [3.0.0+] DeleteApplicationContentEntity
 
| 1304 || [3.0.0+] DeleteApplicationContentEntity
Line 785: Line 795:
 
| 1308 || [5.0.0+] DeleteApplicationCompletelyForDebug
 
| 1308 || [5.0.0+] DeleteApplicationCompletelyForDebug
 
|-
 
|-
| 1309 || [6.0.0+] CleanupUnavailableAddOnContents
+
| 1309 || [6.0.0+] [[#CleanupUnavailableAddOnContents]]
 +
|-
 +
| 1310 || [10.0.0+] RequestMoveApplicationEntity
 +
|-
 +
| 1311 || [10.0.0+] EstimateSizeToMove
 +
|-
 +
| 1312 || [10.0.0+] HasMovableEntity
 
|-
 
|-
 
| 1400 || PrepareShutdown
 
| 1400 || PrepareShutdown
 
|-
 
|-
| 1500 || FormatSdCard
+
| 1500 || [[#FormatSdCard]]
 
|-
 
|-
| 1501 || NeedsSystemUpdateToFormatSdCard
+
| 1501 || [[#NeedsSystemUpdateToFormatSdCard]]
 
|-
 
|-
| 1502 || GetLastSdCardFormatUnexpectedResult
+
| 1502 || [[#GetLastSdCardFormatUnexpectedResult]]
 
|-
 
|-
 
| 1504 || [3.0.0+] InsertSdCard
 
| 1504 || [3.0.0+] InsertSdCard
Line 807: Line 823:
 
| 1700 || ListApplicationDownloadingContentMeta
 
| 1700 || ListApplicationDownloadingContentMeta
 
|-
 
|-
| 1701 || [3.0.0+] GetApplicationView
+
| 1701 || [3.0.0+] [[#GetApplicationView]]
 
|-
 
|-
 
| 1702 || [3.0.0+] GetApplicationDownloadTaskStatus
 
| 1702 || [3.0.0+] GetApplicationDownloadTaskStatus
 
|-
 
|-
| 1703 || [4.0.0+] GetApplicationViewDownloadErrorContext
+
| 1703 || [4.0.0+] [[#GetApplicationViewDownloadErrorContext]]
 
|-
 
|-
| 1704 || [8.0.0+] GetApplicationViewWithPromotionInfo
+
| 1704 || [8.0.0+] [[#GetApplicationViewWithPromotionInfo]]
 
|-
 
|-
 
| 1800 || IsNotificationSetupCompleted
 
| 1800 || IsNotificationSetupCompleted
Line 825: Line 841:
 
| 1900 || [3.0.0+] IsActiveAccount
 
| 1900 || [3.0.0+] IsActiveAccount
 
|-
 
|-
| 1901 || [4.0.0+] RequestDownloadApplicationPrepurchasedRights
+
| 1901 || [4.0.0+] [[#RequestDownloadApplicationPrepurchasedRights]]
 
|-
 
|-
 
| 1902 || [5.0.0+] GetApplicationTicketInfo
 
| 1902 || [5.0.0+] GetApplicationTicketInfo
Line 867: Line 883:
 
| 2018 || [5.0.0+] [[#GetApplicationDeliveryInfoHash]]
 
| 2018 || [5.0.0+] [[#GetApplicationDeliveryInfoHash]]
 
|-
 
|-
| 2050 || [6.0.0+] GetApplicationRightsOnClient
+
| 2050 || [6.0.0+] [[#GetApplicationRightsOnClient]]
 
|-
 
|-
 
| 2051 || [9.0.0+] InvalidateRightsIdCache
 
| 2051 || [9.0.0+] InvalidateRightsIdCache
 
|-
 
|-
| 2100 || [6.0.0+] GetApplicationTerminateResult
+
| 2100 || [6.0.0+] [[#GetApplicationTerminateResult]]
 
|-
 
|-
 
| 2101 || [6.0.0+] GetRawApplicationTerminateResult
 
| 2101 || [6.0.0+] GetRawApplicationTerminateResult
Line 887: Line 903:
 
| 2155 || [7.0.0+] UpdateRightsEnvironmentStatus
 
| 2155 || [7.0.0+] UpdateRightsEnvironmentStatus
 
|-
 
|-
| 2156 || [9.0.0+] CreateRightsEnvironmentForPreomia
+
| 2156 || [10.0.0+] CreateRightsEnvironmentForMicroApplication ([9.0.0-9.2.0] CreateRightsEnvironmentForPreomia)
 
|-
 
|-
 
| 2160 || [6.0.0+] AddTargetApplicationToRightsEnvironment
 
| 2160 || [6.0.0+] AddTargetApplicationToRightsEnvironment
Line 907: Line 923:
 
| 2199 || [6.0.0+] GetRightsEnvironmentCountForDebug
 
| 2199 || [6.0.0+] GetRightsEnvironmentCountForDebug
 
|-
 
|-
| 2200 || [6.0.0+] GetGameCardApplicationCopyIdentifier
+
| 2200 || [6.0.0-9.2.0] GetGameCardApplicationCopyIdentifier
 
|-
 
|-
| 2201 || [6.0.0+] GetInstalledApplicationCopyIdentifier
+
| 2201 || [6.0.0-9.2.0] GetInstalledApplicationCopyIdentifier
 
|-
 
|-
 
| 2250 || [6.0.0-6.2.0] RequestReportActiveELicence
 
| 2250 || [6.0.0-6.2.0] RequestReportActiveELicence
Line 921: Line 937:
 
| 2352 || [9.0.0+] [[#RequestResolveNoDownloadRightsError]]
 
| 2352 || [9.0.0+] [[#RequestResolveNoDownloadRightsError]]
 
|-
 
|-
| 2400 || [8.0.0+] GetPromotionInfo
+
| 2353 || [10.0.0+] GetApplicationDownloadTaskInfo
 +
|-
 +
| 2400 || [8.0.0+] [[#GetPromotionInfo]]
 
|-
 
|-
 
| 2401 || [8.0.0+] CountPromotionInfo
 
| 2401 || [8.0.0+] CountPromotionInfo
Line 927: Line 945:
 
| 2402 || [8.0.0+] ListPromotionInfo
 
| 2402 || [8.0.0+] ListPromotionInfo
 
|-
 
|-
| 2403 || [8.0.0+] ImportPromotionJsonForDebug
+
| 2403 || [8.0.0+] [[#ImportPromotionJsonForDebug]]
 
|-
 
|-
| 2404 || [8.0.0+] ClearPromotionInfoForDebug
+
| 2404 || [8.0.0+] [[#ClearPromotionInfoForDebug]]
 
|-
 
|-
 
| 2500 || [8.0.0+] ConfirmAvailableTime
 
| 2500 || [8.0.0+] ConfirmAvailableTime
Line 937: Line 955:
 
| 2511 || [9.0.0+] [[#GetApplicationResource]]
 
| 2511 || [9.0.0+] [[#GetApplicationResource]]
 
|-
 
|-
| 2513 || [9.0.0+] LaunchPreomia
+
| 2513 || [10.0.0+] LaunchMicroApplication ([9.0.0-9.2.0] LaunchPreomia)
 
|-
 
|-
 
| 2514 || [9.0.0+] ClearTaskOfAsyncTaskManager
 
| 2514 || [9.0.0+] ClearTaskOfAsyncTaskManager
 +
|-
 +
| 2515 || [10.0.0+] CleanupAllPlaceHolderAndFragmentsIfNoTask
 +
|-
 +
| 2516 || [10.0.0+] EnsureApplicationCertificate
 
|-
 
|-
 
| 2800 || [9.0.0+] GetApplicationIdOfPreomia
 
| 2800 || [9.0.0+] GetApplicationIdOfPreomia
 +
|-
 +
| 9999 || [10.0.0+] GetApplicationCertificate
 
|}
 
|}
  
 
[4.0.0+] RequestDownloadAddOnContent now takes an additional 8-bytes of input.
 
[4.0.0+] RequestDownloadAddOnContent now takes an additional 8-bytes of input.
  
==== RequestApplicationUpdateInfo ====
+
==== GetApplicationRecordUpdateSystemEvent ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncValue]].
+
No input, returns an output Event handle with EventClearMode=1.
  
The data that can be read from the [[#IAsyncValue]] is [[#ApplicationUpdateInfo]].
+
==== 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.
  
==== LaunchDevMenu ====
+
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]].
No input/output.
 
  
This is used by AM cmd [[Applet_Manager_services#LaunchDevMenu|LaunchDevMenu]].
+
==== DeleteApplicationEntity ====
 +
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.
  
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.
+
==== DeleteApplicationCompletely ====
 +
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.
  
[[NCM_services#ncm|OpenContentMetaDatabase]] is used with StorageId = NandSystem, then IContentMetaDatabase GetLatestContentMetaKey is used with both of the above ProgramIds to verify that the cmd is successful.
+
==== DeleteRedundantApplicationEntity ====
 +
No input/output.
  
Then if the above succeeds, the above titles are launched with the above StorageId via [[Process_Manager_services|pmshell]] LaunchProgram, with a 0.5s sleep-thread afterwards on success.
+
==== IsApplicationEntityMovable ====
 +
Takes an input u8 [[NCM_services#StorageId|StorageId]], an [[NCM_services#ApplicationId|ApplicationId]], returns an output u8 bool.
  
==== ListApplicationTitle ====
+
==== MoveApplicationEntity ====
Takes a total of 0x10-bytes of input, a type-0x5 input buffer, an input handle, returns an output Event handle and an [[#IAsyncValue]].
+
Takes an input u8 [[NCM_services#StorageId|StorageId]], an [[NCM_services#ApplicationId|ApplicationId]], no output.
  
==== ListApplicationIcon ====
+
==== RequestApplicationUpdateInfo ====
Takes a total of 0x10-bytes of input, a type-0x5 input buffer, an input handle, returns an output Event handle and an [[#IAsyncValue]].
+
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncValue]].
  
==== RequestGameCardRegistrationGoldPoint ====
+
The data that can be read from the [[#IAsyncValue]] is [[#ApplicationUpdateInfo]].
Takes a total of 0x18-bytes of input, returns an output Event handle and an [[#IAsyncValue]].
 
  
==== GetGameCardPlatformRegion ====
+
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.
No input, returns an u8 '''GameCardPlatformRegion''' (0x00 = Global, 0x01 = China).
 
  
This calls [[Filesystem_services#IDeviceOperator|fsp-srv IDeviceOperator]] GetGameCardCompatibilityType and returns the result.
+
==== CancelApplicationDownload ====
 +
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.
  
==== RequestDownloadTaskListData ====
+
==== ResumeApplicationDownload ====
No input, returns an output Event handle and an [[#IAsyncValue]].
+
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.
  
==== GetRightsEnvironmentHandleForApplication ====
+
==== CheckApplicationLaunchVersion ====
No input, returns a total of 8-bytes of output.
+
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.
  
[9.0.0+] Now takes a total of 8-bytes of input, returns a total of 8-bytes of output.
+
==== CalculateApplicationDownloadRequiredSize ====
 +
Takes an input u8 [[NCM_services#StorageId|StorageId]], an [[NCM_services#ApplicationId|ApplicationId]], returns an output s64.
  
==== RequestNoDownloadRightsErrorResolution ====
+
==== CleanupSdCard ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncValue]].
+
No input/output.
  
The data that can be read from the [[#IAsyncValue]] is [[#NoDownloadRightsErrorResolution]].
+
==== GetSdCardMountStatusChangedEvent ====
 +
No input, returns an output Event handle with EventClearMode=0.
  
==== RequestResolveNoDownloadRightsError ====
+
==== GetGameCardUpdateDetectionEvent ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncValue]].
+
No input, returns an output Event handle with EventClearMode=0.
  
The data that can be read from the [[#IAsyncValue]] is [[#NoDownloadRightsErrorResolution]].
+
==== DisableApplicationAutoDelete ====
 +
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.
  
==== CreateApplicationResource ====
+
==== EnableApplicationAutoDelete ====
Returns an [[#IApplicationResource]].
+
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.
  
==== GetApplicationResource ====
+
==== SetApplicationTerminateResult ====
Returns an [[#IApplicationResource]].
+
Takes an input u32 Result, an [[NCM_services#ApplicationId|ApplicationId]], no output.
  
==== GetSystemDeliveryInfo ====
+
==== ClearApplicationTerminateResult ====
Takes a type-0x16 output buffer containing a [[#SystemDeliveryInfo]], no output.
+
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.
  
This generates a [[#SystemDeliveryInfo]] using the currently installed SystemUpdate meta title.
+
==== GetLastSdCardMountUnexpectedResult ====
 +
No input/output.
  
==== SelectLatestSystemDeliveryInfo ====
+
==== GetRequestServerStopper ====
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.
+
No input, returns an output [[#IRequestServerStopper]].
  
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.
+
==== CancelApplicationApplyDelta ====
 +
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.
  
==== VerifyDeliveryProtocolVersion ====
+
==== ResumeApplicationApplyDelta ====
Takes a type-0x15 input buffer containing a [[#SystemDeliveryInfo]], no output.
+
Takes an input [[NCM_services#ApplicationId|ApplicationId]], 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.
+
==== CalculateApplicationApplyDeltaRequiredSize ====
 +
Takes an input u8 [[NCM_services#StorageId|StorageId]], an [[NCM_services#ApplicationId|ApplicationId]], returns an output s64.
  
==== GetApplicationDeliveryInfo ====
+
==== ResumeAll ====
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.
+
No input/output.
  
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).
+
==== GetStorageSize ====
 +
Takes an input u8 [[NCM_services#StorageId|StorageId]], returns two output s64s.
  
==== HasAllContentsToDeliver ====
+
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 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.
+
==== RequestUpdateApplication2 ====
 +
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].
  
==== CompareApplicationDeliveryInfo ====
+
See [[#RequestApplicationUpdateInfo]] regarding nifm.
Takes two type-0x5 input buffers containing an array of [[#ApplicationDeliveryInfo]], returns an output s32.
 
  
The array-count for both buffers must be 1, otherwise an error is returned.
+
==== LaunchApplication ====
 +
Takes an input u8 ProgramIndex, an input [[#ApplicationLaunchInfo]], returns an output u64.
  
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.
+
==== GetApplicationLaunchInfo ====
 +
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output [[#ApplicationLaunchInfo]].
  
==== CanDeliverApplication ====
+
==== AcquireApplicationLaunchInfo ====
Takes two type-0x5 input buffers containing an array of [[#ApplicationDeliveryInfo]], returns an output u8 bool.
+
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output [[#ApplicationLaunchInfo]].
  
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 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.
  
==== ListContentMetaKeyToDeliverApplication ====
+
==== LaunchDevMenu ====
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.
+
This is used by AM cmd [[Applet_Manager_services#LaunchDevMenu|LaunchDevMenu]].
  
This will only return 1 ContentMetaKey entry. This will not output the entry when the input s32 is larger than 0. This also does other validation, etc.
+
This 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.
  
==== NeedsSystemUpdateToDeliverApplication ====
+
[[NCM_services#ncm|OpenContentMetaDatabase]] is used with StorageId = NandSystem, then IContentMetaDatabase GetLatestContentMetaKey is used with both of the above ProgramIds to verify that the cmd is successful.
Takes a type-0x15 input buffer containing a [[#SystemDeliveryInfo]], a type-0x5 input buffer containing an array of [[#ApplicationDeliveryInfo]], and returns an output u8 bool.
 
  
The array-count must match 1.
+
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.
  
After validation etc, this sets the output bool by comparing system-version fields in the [[#SystemDeliveryInfo]]/[[#ApplicationDeliveryInfo]] and with a state field.
+
==== DeleteUserSaveDataAll ====
 +
Takes an input [[Account_services#Uid|Uid]], returns an output [[#IProgressMonitorForDeleteUserSaveDataAll]].
  
==== EstimateRequiredSize ====
+
On success, [[#IProgressMonitorForDeleteUserSaveDataAll]] GetProgress is used with the output being copied into object state.
Takes a type-0x5 input buffer containing an array of [[NCM_services#ContentMetaKey|ContentMetaKey]], returns an output s64.
 
  
When the array-count is less than 1, this will return 0 with the s64 set to 0.
+
==== DeleteUserSystemSaveData ====
 +
Takes an input [[Account_services#Uid|Uid]], an u64 SystemSaveDataId, no output.
  
==== RequestReceiveApplication ====
+
==== DeleteSaveData ====
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 an input u8 [[Filesystem_services#SaveDataSpaceId|SaveDataSpaceId]], an u64 SaveDataId, no output.
  
[[qlaunch]] uses value Any for the StorageId, and value 55556 for the port.
+
==== UnregisterNetworkServiceAccount ====
 +
Takes an input [[Account_services#Uid|Uid]], no output.
  
An error is thrown if a state ref-count is zero. An error is thrown if [[NIM_services|nim]] ListApplicationApplyDeltaTask returns a task.
+
==== UnregisterNetworkServiceAccountWithUserSaveDataDeletion ====
 +
Takes an input [[Account_services#Uid|Uid]], no 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.
+
==== LaunchLibraryApplet ====
 +
Takes an input u64 [[NCM_services#ProgramId|ProgramId]], returns an output u64.
  
This does various setup then creates the [[#IAsyncResult]] + the async thread which handles the [[#IAsyncResult]] operation. Then the thread does:
+
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.
  
* Calls a func which does:
+
This is used by [[Applet_Manager_services|AM]].
** 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 a state flag is set.
 
** The EventId is "receive_app_contents" with ApplicationId <NS ProgramId>.
 
  
==== CommitReceiveApplication ====
+
==== LaunchSystemApplet ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.
+
No input, returns an output u64.
  
==== GetReceiveApplicationProgress ====
+
A state flag must be 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>.
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.
+
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.
  
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 is used by [[Applet_Manager_services|AM]].
  
==== RequestSendApplication ====
+
==== LaunchOverlayApplet ====
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]].
+
No input, returns an output u64.
  
[[qlaunch]] uses value 55556 for the port.
+
A state flag must be zero, otherwise an error is thrown. The ProgramId is loaded from [[System_Settings|system-setting]] <code>ns.applet!overlay_applet_id</code>.
  
An error is thrown if a state ref-count is zero. An error is thrown if [[NIM_services|nim]] ListApplicationApplyDeltaTask returns a task.
+
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.
  
The [[NCM_services#ContentMetaType|ContentMetaType]] must match Patch.
+
This is used by [[Applet_Manager_services|AM]].
  
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:
+
==== RequestDownloadApplicationControlData ====
 +
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]] cmd60, returning the Result on failure.
+
==== ListApplicationTitle ====
** 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.
+
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]].
** Handles cleanup and returns.
+
 
* On success, this loads various data which is then used for saving a SystemPlayReport when a state flag is set.
+
[[qlaunch]] uses value 0x1 for the u8.
** The EventId is "send_app_contents" with ApplicationId <NS ProgramId>.
+
 
 +
The user-process creates the TransferMemory with permissions=R--.
  
==== GetSendApplicationProgress ====
+
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.
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output [[#SendApplicationProgress]].
 
  
Same as [[#GetReceiveApplicationProgress]] except this is the Send version, and uses [[NIM_services|nim]] cmd68/cmd63 instead.
+
The TransferMemory size must be at least: count*sizeof([[NACP_Format|title-entry]]) + count*sizeof(u64) + count*[[#GetApplicationControlData|0x24000]].
  
==== CompareSystemDeliveryInfo ====
+
This is essentially an async wrapper for [[#GetApplicationControlData]], with support for multiple ApplicationIds.
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.
+
==== ListApplicationIcon ====
 +
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]].
  
==== ListNotCommittedContentMeta ====
+
The user-process creates the TransferMemory with permissions=R--.
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 ====
+
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 a type-0x5 input buffer containing an array of {unknown} and an input u64, no output.
 
  
==== GetApplicationDeliveryInfoHash ====
+
The TransferMemory size must be at least: 0x4 + count*sizeof(u64) + count*[[#GetApplicationControlData|0x20000]] + count*sizeof(u64) + [[#GetApplicationControlData|0x24000]].
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.
+
This is essentially an async wrapper for [[#GetApplicationControlData]], with support for multiple ApplicationIds.
  
=== IApplicationVersionInterface ===
+
==== RequestCheckGameCardRegistration ====
This is "nn::ns::detail::IApplicationVersionInterface".
+
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].
  
This was added with [4.0.0+].
+
See [[#RequestApplicationUpdateInfo]] regarding nifm.
  
{| class="wikitable" border="1"
+
==== RequestGameCardRegistrationGoldPoint ====
|-
+
Takes an input [[Account_services#Uid|Uid]], an [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncValue]].
! Cmd || Name
+
 
|-
+
The data that can be read from the [[#IAsyncValue]] is 4-bytes.
| 0 || GetLaunchRequiredVersion
+
 
|-
+
See [[#RequestApplicationUpdateInfo]] regarding nifm.
| 1 || UpgradeLaunchRequiredVersion
 
|-
 
| 35 || UpdateVersionList
 
|-
 
| 36 || PushLaunchVersion
 
|-
 
| 37 || ListRequiredVersion
 
|-
 
| 800 || RequestVersionList
 
|-
 
| 801 || ListVersionList
 
|-
 
| 802 || [[#RequestVersionListData]]
 
|-
 
| 1000 || PerformAutoUpdate
 
|}
 
  
==== RequestVersionListData ====
+
==== RequestRegisterGameCard ====
No input, returns an output Event handle and an [[#IAsyncValue]].
+
Takes an input s32, an [[Account_services#Uid|Uid]], an [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].
  
The data that can be read from the [[#IAsyncValue]] is [[#VersionListData]].
+
See [[#RequestApplicationUpdateInfo]] regarding nifm.
  
=== IContentManagerInterface ===
+
==== GetGameCardMountFailureEvent ====
This is "nn::ns::detail::IContentManagementInterface".
+
No input, returns an output Event handle with EventClearMode=0.
  
{| class="wikitable" border="1"
+
==== IsGameCardInserted ====
|-
+
No input, returns an output u8 bool.
! Cmd || Name
 
|-
 
| 11 || CalculateApplicationOccupiedSize
 
|-
 
| 43 || CheckSdCardMountStatus
 
|-
 
| 47 || GetTotalSpaceSize
 
|-
 
| 48 || GetFreeSpaceSize
 
|-
 
| 600 || CountApplicationContentMeta
 
|-
 
| 601 || ListApplicationContentMetaStatus
 
|-
 
| 605 || ListApplicationContentMetaStatusWithRightsCheck
 
|-
 
| 607 || IsAnyApplicationRunning
 
|}
 
  
=== IDocumentInterface ===
+
==== EnsureGameCardAccess ====
This is "nn::ns::detail::IDocumentInterface".
+
No input/output.
  
{| class="wikitable" border="1"
+
==== GetLastGameCardMountFailureResult ====
|-
+
No input/output.
! Cmd || Name
 
|-
 
| 21 || GetApplicationContentPath
 
|-
 
| 23 || ResolveApplicationContentPath
 
|-
 
| 92 || [5.0.0+] GetRunningApplicationProgramId
 
|}
 
  
=== IDownloadTaskInterface ===
+
==== ListApplicationIdOnGameCard ====
This is "nn::ns::detail::IDownloadTaskInterface".
+
Takes a type-0x6 output buffer containing an array of u64 [[NCM_services#ApplicationId|ApplicationIds]], returns an output s32 for total output entries.
  
{| class="wikitable" border="1"
+
==== GetGameCardPlatformRegion ====
|-
+
No input, returns an u8 '''GameCardPlatformRegion''' (0x00 = Global, 0x01 = China).
! Cmd || Name
+
 
|-
+
This calls [[Filesystem_services#IDeviceOperator|fsp-srv IDeviceOperator]] GetGameCardCompatibilityType and returns the result.
| 701 || ClearTaskStatusList
 
|-
 
| 702 || RequestDownloadTaskList
 
|-
 
| 703 || RequestEnsureDownloadTask
 
|-
 
| 704 || ListDownloadTaskStatus
 
|-
 
| 705 || [[#RequestDownloadTaskListData]]
 
|-
 
| 706 || [4.0.0+] TryCommitCurrentApplicationDownloadTask
 
|-
 
| 707 || [4.0.0+] EnableAutoCommit
 
|-
 
| 708 || [4.0.0+] DisableAutoCommit
 
|-
 
| 709 || [4.0.0+] TriggerDynamicCommitEvent
 
|}
 
  
=== IReadOnlyApplicationRecordInterface ===
+
==== ListAvailableAddOnContent ====
This is "nn::ns::detail::IReadOnlyApplicationRecordInterface".
+
[10.0.0+] This now takes a total of 0x10-bytes of input instead of a total of 0x18-bytes of input.
  
This was added with [5.0.0+].
+
==== RequestDownloadTaskListData ====
 +
No input, returns an output Event handle and an [[#IAsyncValue]].
  
{| class="wikitable" border="1"
+
==== TouchApplication ====
|-
+
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.
! Cmd || Name || Notes
 
|-
 
| 0 || HasApplicationRecord || Same as [[#IApplicationManagerInterface]] cmd 910
 
|}
 
  
=== IReadOnlyApplicationControlDataInterface ===
+
==== IsApplicationUpdateRequested ====
This is "nn::ns::detail::IReadOnlyApplicationControlDataInterface".
+
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output u8 bool and an u32.
  
This was added with [5.1.0+].
+
The output u32 is only valid when the output bool is set.
  
{| class="wikitable" border="1"
+
==== WithdrawApplicationUpdateRequest ====
|-
+
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.
! Cmd || Name || Notes
+
 
|-
+
==== RequestVerifyApplicationDeprecated ====
| 0 || [[#GetApplicationControlData]] || Same as [[#IApplicationManagerInterface]] cmd 400
+
Takes an input TransferMemory handle, an [[NCM_services#ApplicationId|ApplicationId]], an u64 size, returns an output Event handle and an [[#IProgressAsyncResult]].
|-
+
 
| 1 || [[#GetApplicationDesiredLanguage]] || Same as [[#IApplicationManagerInterface]] cmd 55
+
On newer system-versions this calls the same func as [[#RequestVerifyApplication]], with the u32 value set to 0x7.
|-
+
 
| 2 || ConvertApplicationLanguageToLanguageCode || Same as [[#IApplicationManagerInterface]] cmd 59
+
==== RequestVerifyAddOnContentsRights ====
|-
+
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IProgressAsyncResult]].
| 3 || [[#ConvertLanguageCodeToApplicationLanguage]] || Same as [[#IApplicationManagerInterface]] cmd 60
+
 
|-
+
==== RequestVerifyApplication ====
| 4 || [9.0.0+] SelectApplicationDesiredLanguage ||
+
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.
 +
 
 +
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]].
  
=== IDynamicRightsInterface ===
+
==== IsAnyApplicationEntityInstalled ====
This is "nn::ns::detail::IDynamicRightsInterface".
+
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output u8 bool.
  
This was added with [6.0.0+].
+
==== CleanupUnavailableAddOnContents ====
 +
Takes an input u64 [[NCM_services#ApplicationId|ApplicationId]], an [[Account_services#Uid|Uid]], no output.
  
{| class="wikitable" border="1"
+
==== FormatSdCard ====
|-
+
No input/output.
! Cmd || Name || Notes
+
 
|-
+
==== NeedsSystemUpdateToFormatSdCard ====
| 0 || [[#RequestApplicationRightsOnServer]] ||
+
No input, returns an output u8 bool.
|-
 
| 1 || RequestAssignRights ||
 
|-
 
| 4 || DeprecatedRequestAssignRightsToResume ||
 
|-
 
| 5 || VerifyActivatedRightsOwners ||
 
|-
 
| 6 || DeprecatedGetApplicationRightsStatus ||
 
|-
 
| 7 || RequestPrefetchForDynamicRights ||
 
|-
 
| 8 || GetDynamicRightsState ||
 
|-
 
| 9 || [7.0.0+] [[#RequestApplicationRightsOnServerToResume]] ||
 
|-
 
| 10 || [7.0.0+] RequestAssignRightsToResume ||
 
|-
 
| 11 || [7.0.0+] GetActivatedRightsUsers ||
 
|-
 
| 12 || [8.0.0+] GetApplicationRightsStatus ||
 
|-
 
| 13 || [8.0.0+] GetRunningApplicationStatus ||
 
|}
 
  
==== RequestApplicationRightsOnServer ====
+
==== GetLastSdCardFormatUnexpectedResult ====
Takes a total of 0x20-bytes of input, returns an output Event handle and an [[#IAsyncValue]].
+
No input/output.
  
==== RequestApplicationRightsOnServerToResume ====
+
==== GetApplicationView ====
Takes a total of 8-bytes of input, returns an output Event handle and an [[#IAsyncValue]].
+
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.
  
=== IECommerceInterface===
+
==== GetApplicationViewDownloadErrorContext ====
This is "nn::ns::detail::IECommerceInterface".
+
Takes a type-0x16 output buffer containg an [[Error_Applet#ErrorContext|ErrorContext]], an u64 [[NCM_services#ApplicationId|ApplicationId]], no output.
  
This was added with [4.0.0+].
+
==== GetApplicationViewWithPromotionInfo ====
 +
Takes a type-0x6 output buffer containing an array of [[#ApplicationViewWithPromotionInfo]], a type-0x5 input buffer containing an array of u64 [[NCM_services#ApplicationId|ApplicationIds]], no output.
  
{| class="wikitable" border="1"
+
==== RequestDownloadApplicationPrepurchasedRights ====
|-
+
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].
! Cmd || Name || Notes
 
|-
 
| 0 || RequestLinkDevice || Takes a total of 0x10-bytes of input, returns an [[#IAsyncResult]].
 
|-
 
| 1 || [6.0.0+] RequestCleanupAllPreInstalledApplications || No input, returns an [[#IAsyncResult]].
 
|-
 
| 2 || [6.0.0+] RequestCleanupPreInstalledApplication || Takes a total of 0x8-bytes of input, returns an [[#IAsyncResult]].
 
|-
 
| 3 || [6.0.0+] RequestSyncRights || No input, returns an [[#IAsyncResult]].
 
|-
 
| 4 || [6.0.0+] RequestUnlinkDevice || Takes a total of 0x10-bytes of input, returns an [[#IAsyncResult]].
 
|-
 
| 5 || [6.1.0+] RequestRevokeAllELicense || Takes a total of 0x10-bytes of input, returns an [[#IAsyncResult]].
 
|-
 
| 6 || [9.0.0+] RequestSyncRightsBasedOnAssignedELicenses ||
 
|}
 
  
=== IFactoryResetInterface ===
+
See [[#RequestApplicationUpdateInfo]] regarding nifm.
This is "nn::ns::detail::IFactoryResetInterface".
 
  
{| class="wikitable" border="1"
+
==== GetSystemDeliveryInfo ====
|-
+
Takes a type-0x16 output buffer containing a [[#SystemDeliveryInfo]], no output.
! Cmd || Name
 
|-
 
| 100 || ResetToFactorySettings
 
|-
 
| 101 || ResetToFactorySettingsWithoutUserSaveData
 
|-
 
| 102 || ResetToFactorySettingsForRefurbishment
 
|-
 
| 103 || [9.1.0+]
 
|-
 
| 104 || [9.1.0+]
 
|}
 
  
=== IApplicationResource ===
+
This generates a [[#SystemDeliveryInfo]] using the currently installed SystemUpdate meta title.
This is "nn::ns::detail::IApplicationResource".
 
  
This was added with [9.0.0+].
+
==== 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.
  
{| class="wikitable" border="1"
+
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.
|-
 
! Cmd || Name
 
|-
 
| 0 || Attach
 
|-
 
| 1 || BoostSystemMemoryResourceLimit
 
|}
 
  
= ns:vm =
+
==== VerifyDeliveryProtocolVersion ====
This is "nn::ns::detail::IVulnerabilityManagerInterface".
+
Takes a type-0x15 input buffer containing a [[#SystemDeliveryInfo]], no output.
  
{| class="wikitable" border="1"
+
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.
|-
 
! Cmd || Name
 
|-
 
| 1200 || [3.0.0+] [[#NeedsUpdateVulnerability]]
 
|-
 
| 1201 || [4.0.0+] [[#UpdateSafeSystemVersionForDebug]]
 
|-
 
| 1202 || [4.0.0+] [[#GetSafeSystemVersion]]
 
|}
 
  
== NeedsUpdateVulnerability ==
+
==== GetApplicationDeliveryInfo ====
No input, returns an output u8 bool flag.
+
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.
  
Web-applets use this command to check if the system needs an update.
+
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).
  
== UpdateSafeSystemVersionForDebug ==
+
==== HasAllContentsToDeliver ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]] and an u32 '''version'''.
+
Takes a type-0x5 input buffer containing an array of [[#ApplicationDeliveryInfo]], returns an output u8 bool.
  
This command is not available for retail units. On a debug unit, if the [[System_Settings|system setting]] <code>vulnerability!enable_debug</code> is set, this mounts the system savegame [[Flash_Filesystem#System_Savegames|0x8000000000000049]] as "ns_ssversion:/", opens the file "ns_ssversion:/entry" and writes the supplied [[NCM_services#ApplicationId|ApplicationId]] and '''version''' in it.
+
The array-count must match 1. After validating the [[#ApplicationDeliveryInfo]], the output bool is set to u32 [[#ApplicationDeliveryInfo]]+0x1C & 0x10000002 != 0x2, then this returns 0.
  
Finally, it calls [[NCM_services#ncm|OpenContentMetaDatabase]] with [[NCM_services#StorageId|StorageId]] 3, then calls [[NCM_services#IContentMetaDatabase|GetLatestContentMetaKey]] with the supplied [[NCM_services#ApplicationId|ApplicationId]] and compares the version field from the returned [[CNMT#Content_Meta_Records|Content Meta Record]] with the supplied '''version'''.
+
==== CompareApplicationDeliveryInfo ====
 +
Takes two type-0x5 input buffers containing an array of [[#ApplicationDeliveryInfo]], returns an output s32.
  
If the supplied '''version''' is higher than the one in NCM's database, the value returned by [[NS_Services#NeedsUpdateVulnerability|NeedsUpdateVulnerability]] is set to "true".
+
The array-count for both buffers must be 1, otherwise an error is returned.
 +
 
 +
Both [[#ApplicationDeliveryInfo]] are validated, then the application-version in the first/second buffer are compared. The output s32 is set to the comparison result: -1 for less than, 0 for equal, and 1 for higher than.
 +
 
 +
==== CanDeliverApplication ====
 +
Takes two type-0x5 input buffers containing an array of [[#ApplicationDeliveryInfo]], returns an output u8 bool.
 +
 
 +
The array-count for the second buffer must be 1 and the array-count for the first buffer must be <=1, otherwise an error is returned. If the array-count for the first buffer is 0, this will return 0 with the output bool set to 0.
 +
 
 +
==== ListContentMetaKeyToDeliverApplication ====
 +
Takes a type-0x6 output buffer containing an array of [[NCM_services#ContentMetaKey|ContentMetaKey]], a type-0x5 input buffer containing an array of [[#ApplicationDeliveryInfo]], a s32, and returns an output s32 total_out.
  
== GetSafeSystemVersion ==
+
The array-count for ContentMetaKey must be at least 1, and for ApplicationDeliveryInfo it must match 1.
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 will only return 1 ContentMetaKey entry. This will not output the entry when the input s32 is larger than 0. This also does other validation, etc.
This is "nn::ns::detail::ISystemUpdateInterface".
 
  
{| class="wikitable" border="1"
+
==== 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.
! Cmd || Name
 
|-
 
| 0 || [[#GetBackgroundNetworkUpdateState]]
 
|-
 
| 1 || [[#OpenSystemUpdateControl]]
 
|-
 
| 2 || [[#NotifyExFatDriverRequired]]
 
|-
 
| 3 || [[#ClearExFatDriverStatusForDebug]]
 
|-
 
| 4 || [[#RequestBackgroundNetworkUpdate]]
 
|-
 
| 5 || [[#NotifyBackgroundNetworkUpdate]]
 
|-
 
| 6 || [[#NotifyExFatDriverDownloadedForDebug]]
 
|-
 
| 9 || [[#GetSystemUpdateNotificationEventForContentDelivery]]
 
|-
 
| 10 || [[#NotifySystemUpdateForContentDelivery]]
 
|-
 
| 11 || [3.0.0+] [[#PrepareShutdown]]
 
|-
 
| 12 || [3.0.0-3.0.2]
 
|-
 
| 13 || [3.0.0-3.0.2]
 
|-
 
| 14 || [3.0.0-3.0.2]
 
|-
 
| 15 || [3.0.0-3.0.2]
 
|-
 
| 16 || [4.0.0+] [[#DestroySystemUpdateTask]]
 
|-
 
| 17 || [4.0.0+] [[#RequestSendSystemUpdate]]
 
|-
 
| 18 || [4.0.0+] [[#GetSendSystemUpdateProgress]]
 
|}
 
  
== GetBackgroundNetworkUpdateState ==
+
The array-count must match 1.
No input, returns an output [[#BackgroundNetworkUpdateState]].
 
  
This is similar to [[#HasDownloaded]], see [[#BackgroundNetworkUpdateState]].
+
After validation etc, this sets the output bool by comparing system-version fields in the [[#SystemDeliveryInfo]]/[[#ApplicationDeliveryInfo]] and with a state field.
  
== OpenSystemUpdateControl ==
+
==== EstimateRequiredSize ====
No input, returns an [[#ISystemUpdateControl]].
+
Takes a type-0x5 input buffer containing an array of [[NCM_services#ContentMetaKey|ContentMetaKey]], returns an output s64.
  
== NotifyExFatDriverRequired ==
+
When the array-count is less than 1, this will return 0 with the s64 set to 0.
No input/output.
 
  
Only usable when an [[#ISystemUpdateControl]] isn't open.
+
==== RequestReceiveApplication ====
 +
Takes a type-0x5 input buffer containing an array of [[NCM_services#ContentMetaKey|ContentMetaKey]], a [[NCM_services#StorageId|StorageId]], an u16 port, an u32 Ipv4Address, an [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].
  
This uses [[NIM_services|nim]] ListSystemUpdateTask, then when a task is returned uses it with DestroySystemUpdateTask.
+
[[qlaunch]] uses value Any for the StorageId, and value 55556 for the port.
  
Then this runs ExFat handling, updates state, and sets the same state flag as [[#RequestBackgroundNetworkUpdate]].
+
An error is thrown if a state ref-count is zero. An error is thrown if [[NIM_services|nim]] ListApplicationApplyDeltaTask returns a task.
  
== ClearExFatDriverStatusForDebug ==
+
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.
No input/output.
 
  
== RequestBackgroundNetworkUpdate ==
+
This does various setup then creates the [[#IAsyncResult]] + the async thread which handles the [[#IAsyncResult]] operation. Then the thread does:
No input/output.
 
  
Only usable when an [[#ISystemUpdateControl]] isn't open.
+
* Calls a func which does:
 +
** 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>.
  
This sets a state flag to value 1.
+
==== CommitReceiveApplication ====
 +
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.
  
== NotifyBackgroundNetworkUpdate ==
+
==== GetReceiveApplicationProgress ====
Takes an input [[NCM_services#ContentMetaKey|ContentMetaKey]], no output.
+
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output [[#ReceiveApplicationProgress]].
  
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]].
+
An error is thrown if a state ref-count is zero. An error is thrown if [[NIM_services|nim]] ListApplicationApplyDeltaTask returns a task.
  
== NotifyExFatDriverDownloadedForDebug ==
+
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.
No input/output.
 
  
== GetSystemUpdateNotificationEventForContentDelivery ==
+
==== RequestSendApplication ====
No input, returns an output Event handle with EventClearMode=0.
+
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]].
  
== NotifySystemUpdateForContentDelivery ==
+
[[qlaunch]] uses value 55556 for the port.
No input/output.
 
  
Signals the Event returned by [[#GetSystemUpdateNotificationEventForContentDelivery]].
+
An error is thrown if a state ref-count is zero. An error is thrown if [[NIM_services|nim]] ListApplicationApplyDeltaTask returns a task.
  
== PrepareShutdown ==
+
The [[NCM_services#ContentMetaType|ContentMetaType]] must match Patch.
No input/output.
 
  
This is used by [[AM_services|AM]].
+
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:
  
Just returns 0 when an [[#ISystemUpdateControl]] is open.  
+
* Calls a func which does:
 
+
** Throws an error if a state flag is set.
This does various cleanup / uses various service-cmds etc for shutdown preparation.
+
** 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 ====
 +
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output [[#SendApplicationProgress]].
  
== DestroySystemUpdateTask ==
+
Same as [[#GetReceiveApplicationProgress]] except this is the Send version, and uses [[NIM_services|nim]] cmd68/cmd63 instead.
No input/output.
 
  
Only usable when an [[#ISystemUpdateControl]] isn't open.
+
==== CompareSystemDeliveryInfo ====
 +
Takes two type-0x15 input buffers containing a [[#SystemDeliveryInfo]], returns an output s32.
  
This uses [[NIM_services|nim]] ListSystemUpdateTask, then when a task is returned uses it with DestroySystemUpdateTask.
+
This is essentially the same as [[#CompareApplicationDeliveryInfo]], except this compares the [[#SystemDeliveryInfo]] SystemUpdate version.
  
== RequestSendSystemUpdate ==
+
==== ListNotCommittedContentMeta ====
Takes a type-0x15 input buffer containing a [[#SystemDeliveryInfo]], an u16 port, an u32 Ipv4Address, returns an output Event handle and an [[#IAsyncResult]].
+
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.
  
[[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.
+
==== RecoverDownloadTask ====
 +
Takes a type-0x5 input buffer containing an array of {unknown} and an input u64, no output.
  
[[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.
+
==== GetApplicationDeliveryInfoHash ====
 +
Takes a type-0x5 input buffer containing an array of [[#ApplicationDeliveryInfo]], returns an output 0x20-byte SHA256 hash.
  
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 extracts data from the input array for hashing with SHA256, with validation being done when handling each entry.
* Calls a func which does:
+
 
** Uses [[NIM_services|nim]] cmd76, returning the Result on failure.
+
==== GetApplicationRightsOnClient ====
** 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.
+
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.
** Handles cleanup and returns.
+
 
* Unlike [[#RequestReceiveSystemUpdate]], this doesn't save a SystemPlayReport.
+
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.
 +
 
 +
For the output array count, [[qlaunch]] uses value 3.
 +
 
 +
==== GetApplicationTerminateResult ====
 +
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output u32 Result.
 +
 
 +
==== GetRightsEnvironmentHandleForApplication ====
 +
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.
  
== GetSendSystemUpdateProgress ==
+
==== RequestNoDownloadRightsErrorResolution ====
No input, returns an output [[#SystemUpdateProgress]].
+
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncValue]].
  
Same as [[#GetReceiveProgress]] except this uses nim cmd81 and cmd78.
+
The data that can be read from the [[#IAsyncValue]] is [[#NoDownloadRightsErrorResolution]].
  
== ISystemUpdateControl ==
+
See [[#RequestApplicationUpdateInfo]] regarding nifm.
{| class="wikitable" border="1"
+
 
|-
+
==== RequestResolveNoDownloadRightsError ====
! Cmd || Name
+
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncValue]].
|-
+
 
| 0 || [[#HasDownloaded]]
+
The data that can be read from the [[#IAsyncValue]] is [[#NoDownloadRightsErrorResolution]].
|-
+
 
| 1 || [[#RequestCheckLatestUpdate]]
+
See [[#RequestApplicationUpdateInfo]] regarding nifm.
|-
+
 
| 2 || [[#RequestDownloadLatestUpdate]]
+
==== GetPromotionInfo ====
|-
+
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.
| 3 || [[#GetDownloadProgress]]
+
 
 +
Official sw uses hard-coded value 1 for the count with each of these arrays.
 +
 
 +
==== ImportPromotionJsonForDebug ====
 +
Takes a type-0x5 input buffer, no output.
 +
 
 +
The output from [[Settings_services#GetDebugModeFlag]] must be 1, otherwise an error is returned.
 +
 
 +
==== ClearPromotionInfoForDebug ====
 +
No input/output.
 +
 
 +
The output from [[Settings_services#GetDebugModeFlag]] must be 1, otherwise an error is returned.
 +
 
 +
This just clears 0xC-bytes in state.
 +
 
 +
==== CreateApplicationResource ====
 +
Returns an [[#IApplicationResource]].
 +
 
 +
==== GetApplicationResource ====
 +
Returns an [[#IApplicationResource]].
 +
 
 +
=== IGameCardStopper ===
 +
This is "nn::ns::detail::IGameCardStopper".
 +
 
 +
This interface has no commands.
 +
 
 +
=== IRequestServerStopper ===
 +
This is "nn::ns::detail::IRequestServerStopper".
 +
 
 +
This interface has no commands.
 +
 
 +
=== IProgressMonitorForDeleteUserSaveDataAll ===
 +
This is "nn::ns::detail::IProgressMonitorForDeleteUserSaveDataAll".
 +
 
 +
{| class="wikitable" border="1"
 
|-
 
|-
| 4 || [[#ApplyDownloadedUpdate]]
+
! Cmd || Name
 
|-
 
|-
| 5 || [[#RequestPrepareCardUpdate]]
+
| 0 || GetSystemEvent
 
|-
 
|-
| 6 || [[#GetPrepareCardUpdateProgress]]
+
| 1 || IsFinished
 
|-
 
|-
| 7 || [[#HasPreparedCardUpdate]]
+
| 2 || GetResult
 
|-
 
|-
| 8 || [[#ApplyCardUpdate]]
+
| 10 || GetProgress
 +
|}
 +
 
 +
When closing the object, official sw uses IsFinished first, asserting when the output bool is false.
 +
 
 +
* 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.
 +
 
 +
=== IProgressAsyncResult ===
 +
This is "nn::ns::detail::IProgressAsyncResult".
 +
 
 +
{| class="wikitable" border="1"
 
|-
 
|-
| 9 || [[#GetDownloadedEulaDataSize]]
+
! Cmd || Name
 
|-
 
|-
| 10 || [[#GetDownloadedEulaData]]
+
| 0 || Get
 
|-
 
|-
| 11 || [[#SetupCardUpdate]]
+
| 1 || Cancel
 
|-
 
|-
| 12 || [[#GetPreparedCardUpdateEulaDataSize]]
+
| 2 || GetProgress
 
|-
 
|-
| 13 || [[#GetPreparedCardUpdateEulaData]]
+
| 3 || GetDetailResult
 
|-
 
|-
| 14 || [4.0.0+] [[#SetupCardUpdateViaSystemUpdater]]
+
| 4 || [4.0.0+] GetErrorContext
 +
|}
 +
 
 +
=== IApplicationVersionInterface ===
 +
This is "nn::ns::detail::IApplicationVersionInterface".
 +
 
 +
This was added with [4.0.0+].
 +
 
 +
{| class="wikitable" border="1"
 
|-
 
|-
| 15 || [4.0.0+] [[#HasReceived]]
+
! Cmd || Name
 +
|-
 +
| 0 || GetLaunchRequiredVersion
 +
|-
 +
| 1 || UpgradeLaunchRequiredVersion
 
|-
 
|-
| 16 || [4.0.0+] [[#RequestReceiveSystemUpdate]]
+
| 35 || UpdateVersionList
 
|-
 
|-
| 17 || [4.0.0+] [[#GetReceiveProgress]]
+
| 36 || PushLaunchVersion
 
|-
 
|-
| 18 || [4.0.0+] [[#ApplyReceivedUpdate]]
+
| 37 || ListRequiredVersion
 
|-
 
|-
| 19 || [4.0.0+] [[#GetReceivedEulaDataSize]]
+
| 800 || RequestVersionList
 
|-
 
|-
| 20 || [4.0.0+] [[#GetReceivedEulaData]]
+
| 801 || ListVersionList
 
|-
 
|-
| 21 || [4.0.0+] [[#SetupToReceiveSystemUpdate]]
+
| 802 || [[#RequestVersionListData]]
 
|-
 
|-
| 22 || [6.0.0+] [[#RequestCheckLatestUpdateIncludesRebootlessUpdate]]
+
| 1000 || PerformAutoUpdate
 
|}
 
|}
  
Only 1 ISystemUpdateControl can be open at a time.
+
==== RequestVersionListData ====
 +
No input, returns an output Event handle and an [[#IAsyncValue]].
  
All Card cmds except SetupCardUpdate* require [[#SetupCardUpdate]]/[[#SetupCardUpdateViaSystemUpdater]] to be used previously. [[#GetPreparedCardUpdateEulaDataSize]]/[[#GetPreparedCardUpdateEulaData]] checks a different state flag.
+
The data that can be read from the [[#IAsyncValue]] is [[#VersionListData]].
  
=== HasDownloaded ===
+
=== IContentManagementInterface ===
No input, returns an output u8 bool flag.
+
This is "nn::ns::detail::IContentManagementInterface".
  
Gets whether a network sysupdate was downloaded, with install pending.
+
{| class="wikitable" border="1"
 +
|-
 +
! Cmd || Name
 +
|-
 +
| 11 || [[#CalculateApplicationOccupiedSize]]
 +
|-
 +
| 43 || [[#CheckSdCardMountStatus]]
 +
|-
 +
| 47 || [[#GetTotalSpaceSize]]
 +
|-
 +
| 48 || [[#GetFreeSpaceSize]]
 +
|-
 +
| 600 || [[#CountApplicationContentMeta]]
 +
|-
 +
| 601 || [[#ListApplicationContentMetaStatus]]
 +
|-
 +
| 605 || [[#ListApplicationContentMetaStatusWithRightsCheck]]
 +
|-
 +
| 607 || [[#IsAnyApplicationRunning]]
 +
|}
  
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.
+
==== CalculateApplicationOccupiedSize ====
 +
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output [[#ApplicationOccupiedSize]].
  
This always returns 0, however this will assert if GetSystemUpdateTaskInfo fails with ret!=0x3C89.
+
==== CheckSdCardMountStatus ====
 +
No input/output.
  
=== RequestCheckLatestUpdate ===
+
==== CountApplicationContentMeta ====
No input, returns an output Event handle and an [[#IAsyncValue]].
+
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output s32.
  
The data that can be read from the [[#IAsyncValue]] is [[#LatestSystemUpdate]].
+
==== ListApplicationContentMetaStatusWithRightsCheck ====
 +
Same input/output as [[#ListApplicationContentMetaStatus]].
  
=== RequestDownloadLatestUpdate ===
+
==== IsAnyApplicationRunning ====
No input, returns an output Event handle and an [[#IAsyncResult]].
+
No input, returns an output u8 bool.
  
=== GetDownloadProgress ===
+
=== IDocumentInterface ===
No input, returns an output [[#SystemUpdateProgress]].
+
This is "nn::ns::detail::IDocumentInterface".
  
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.
+
{| class="wikitable" border="1"
 
+
|-
=== ApplyDownloadedUpdate ===
+
! Cmd || Name
 +
|-
 +
| 21 || GetApplicationContentPath
 +
|-
 +
| 23 || ResolveApplicationContentPath
 +
|-
 +
| 92 || [5.0.0+] GetRunningApplicationProgramId
 +
|}
 +
 
 +
=== IDownloadTaskInterface ===
 +
This is "nn::ns::detail::IDownloadTaskInterface".
 +
 
 +
{| class="wikitable" border="1"
 +
|-
 +
! Cmd || Name
 +
|-
 +
| 701 || [[#ClearTaskStatusList]]
 +
|-
 +
| 702 || [[#RequestDownloadTaskList]]
 +
|-
 +
| 703 || [[#RequestEnsureDownloadTask]]
 +
|-
 +
| 704 || [[#ListDownloadTaskStatus]]
 +
|-
 +
| 705 || [[#RequestDownloadTaskListData]]
 +
|-
 +
| 706 || [4.0.0+] [[#TryCommitCurrentApplicationDownloadTask]]
 +
|-
 +
| 707 || [4.0.0+] [[#EnableAutoCommit]]
 +
|-
 +
| 708 || [4.0.0+] [[#DisableAutoCommit]]
 +
|-
 +
| 709 || [4.0.0+] [[#TriggerDynamicCommitEvent]]
 +
|}
 +
 
 +
==== ClearTaskStatusList ====
 
No input/output.
 
No input/output.
  
Runs code similar to [[#HasDownloaded]], throwing an error if a network sysupdate isn't ready for install. Then the sysupdate is installed:
+
==== RequestDownloadTaskList ====
 +
No input/output.
  
* Uses ListSystemUpdateTask again, then [[NIM_services|nim]] IsExFatDriverIncluded. Runs ExFat handling when the output flag is set.
+
==== RequestEnsureDownloadTask ====
* On newer system-versions, this uses [[NIM_services|nim]] GetSystemUpdateTaskInfo then on success uses data from there to save a SystemPlayReport when a state flag is set (by default it's not 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 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 ===
 
 
No input, returns an output Event handle and an [[#IAsyncResult]].
 
No input, returns an output Event handle and an [[#IAsyncResult]].
  
=== GetPrepareCardUpdateProgress ===
+
==== ListDownloadTaskStatus ====
No input, returns an output [[#SystemUpdateProgress]].
+
Takes a type-0x6 output buffer containing an array of [[#DownloadTaskStatus]], returns an output s32 total_out.
  
=== HasPreparedCardUpdate ===
+
A maximum of 0x100 tasks can be stored in state.
No input, returns an output u8 bool flag.
 
  
=== ApplyCardUpdate ===
+
==== TryCommitCurrentApplicationDownloadTask ====
 
No input/output.
 
No input/output.
  
=== GetDownloadedEulaDataSize ===
+
==== EnableAutoCommit ====
Takes a type-0x15 input buffer [[#EulaDataPath]], returns an output u64 '''filesize'''.
+
No input/output.
  
Runs code similar to [[#HasDownloaded]], throwing an error if a network sysupdate isn't ready for install.
+
==== DisableAutoCommit ====
 +
No input/output.
  
Uses ListSystemUpdateTask again. Then [[NIM_services|nim]] GetDownloadedSystemDataPath, with the output ContentPath being used to mount the EULA title with FS.
+
==== TriggerDynamicCommitEvent ====
 +
No input/output.
  
Then "<mountname>:/<[[#EulaDataPath]]>" is opened, gets the '''filesize''', then runs cleanup.
+
=== IReadOnlyApplicationRecordInterface ===
 +
This is "nn::ns::detail::IReadOnlyApplicationRecordInterface".
  
=== GetDownloadedEulaData ===
+
This was added with [5.0.0+].
Takes a type-0x15 input buffer [[#EulaDataPath]] and a type-0x6 output buffer, returns an output u64 '''filesize'''.
 
  
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.
+
{| class="wikitable" border="1"
 +
|-
 +
! Cmd || Name || Notes
 +
|-
 +
| 0 || HasApplicationRecord || Same as [[#IApplicationManagerInterface]] cmd 910
 +
|-
 +
| 1 || [10.0.0+] NotifyApplicationFailure ||
 +
|-
 +
| 2 || [10.0.0+] IsDataCorruptedResult ||
 +
|}
  
=== SetupCardUpdate ===
+
=== IReadOnlyApplicationControlDataInterface ===
Takes an input u64 size and a TransferMemory handle, no output.
+
This is "nn::ns::detail::IReadOnlyApplicationControlDataInterface".
  
Official sw creates the TransferMemory with an user-specified buffer, with permissions=None.
+
This was added with [5.1.0+].
  
[[qlaunch]] uses size 0x100000 for the TransferMemory buffer.
+
{| class="wikitable" border="1"
 
+
|-
=== GetPreparedCardUpdateEulaDataSize ===
+
! Cmd || Name || Notes
Takes a type-0x15 input buffer [[#EulaDataPath]], returns an output u64 '''filesize'''.
+
|-
 +
| 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 ||
 +
|}
  
This is similar to [[#GetDownloadedEulaDataSize]].
+
=== IDynamicRightsInterface ===
 +
This is "nn::ns::detail::IDynamicRightsInterface".
  
=== GetPreparedCardUpdateEulaData ===
+
This was added with [6.0.0+].
Takes a type-0x15 input buffer [[#EulaDataPath]] and a type-0x6 output buffer, returns an output u64 '''filesize'''.
 
  
This is similar to [[#GetDownloadedEulaData]].
+
{| class="wikitable" border="1"
 
+
|-
=== SetupCardUpdateViaSystemUpdater ===
+
! Cmd || Name
Takes an input u64 size and a TransferMemory handle, no output.
+
|-
 
+
| 0 || [[#RequestApplicationRightsOnServer]]
The permissions for the TransferMemory is None.
+
|-
 
+
| 1 || [[#RequestAssignRights]]
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.
+
|-
 +
| 4 || [[#DeprecatedRequestAssignRightsToResume]]
 +
|-
 +
| 5 || [[#VerifyActivatedRightsOwners]]
 +
|-
 +
| 6 || [[#DeprecatedGetApplicationRightsStatus]]
 +
|-
 +
| 7 || [[#RequestPrefetchForDynamicRights]]
 +
|-
 +
| 8 || [[#GetDynamicRightsState]]
 +
|-
 +
| 9 || [7.0.0+] [[#RequestApplicationRightsOnServerToResume]]
 +
|-
 +
| 10 || [7.0.0+] [[#RequestAssignRightsToResume]]
 +
|-
 +
| 11 || [7.0.0+] [[#GetActivatedRightsUsers]]
 +
|-
 +
| 12 || [8.0.0+] [[#GetApplicationRightsStatus]]
 +
|-
 +
| 13 || [8.0.0+] [[#GetRunningApplicationStatus]]
 +
|-
 +
| 14 || [10.0.0+] SelectApplicationLicense
 +
|}
  
=== HasReceived ===
+
==== RequestApplicationRightsOnServer ====
No input, returns an output u8 bool.
+
Takes an input [[NCM_services#ApplicationId|ApplicationId]], an [[Account_services#Uid|Uid]] and an u32. Returns an output Event handle and an [[#IAsyncValue]].
  
Same as [[#HasDownloaded]] except this uses [[NIM_services|nim]] cmd71 and cmd73.
+
==== RequestAssignRights ====
 +
Takes a type-0x5 input buffer containing an array of "nn::ns::ApplicationRightsOnServer". Returns an output Event handle and an [[#IAsyncResult]].
  
=== RequestReceiveSystemUpdate ===
+
==== DeprecatedRequestAssignRightsToResume ====
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 u64 "nn::ns::RightsEnvironmentHandle" and an [[Account_services#Uid|Uid]]. Returns an output Event handle and an [[#IAsyncResult]].
  
[[qlaunch]] uses the same value for the port as [[#RequestSendSystemUpdate]] (see [[#RequestSendSystemUpdate]] for addr as well).
+
==== VerifyActivatedRightsOwners ====
 +
Takes an input u64 "nn::ns::RightsEnvironmentHandle". No output.
  
[[NIM_services|NIM]] will use the input addr/port with [[Sockets_services|connect()]].
+
==== DeprecatedGetApplicationRightsStatus ====
 +
Takes an input u64 "nn::ns::RightsEnvironmentHandle". Returns a bool "nn::ns::ApplicationRightsStatus".
  
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:
+
==== RequestPrefetchForDynamicRights ====
 +
Takes an input [[Account_services#Uid|Uid]]. Returns an output Event handle and an [[#IAsyncResult]].
  
* Calls a func which does:
+
==== GetDynamicRightsState ====
** Throws an error if [[NIM_services#ListSystemUpdateTask|ListSystemUpdateTask]] returns any task.
+
No input. Returns a bool "nn::ns::DynamicRightsState".
** Checks whether a sysupdate is actually required using the previously generated [[NCM_services#ContentMetaKey|ContentMetaKey]], throwing an error if not.
 
** 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.
 
** Handles cleanup and returns.
 
* On success, this loads various data which is then used for saving a SystemPlayReport when a state flag is set.
 
** The EventId is "receive_system_update" with ApplicationId <NS ProgramId>.
 
  
=== GetReceiveProgress ===
+
==== RequestApplicationRightsOnServerToResume ====
No input, returns an output [[#SystemUpdateProgress]].
+
Takes an input u64 "nn::ns::RightsEnvironmentHandle". Returns an output Event handle and an [[#IAsyncValue]].
  
Same as [[#GetDownloadProgress]] except this uses [[NIM_services|nim]] cmd71 and cmd73.
+
==== RequestAssignRightsToResume ====
 +
Takes an input u64 "nn::ns::RightsEnvironmentHandle". Returns an output Event handle and an [[#IAsyncResult]].
  
=== ApplyReceivedUpdate ===
+
==== GetActivatedRightsUsers ====
No input/output.
+
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]].
  
=== GetReceivedEulaDataSize ===
+
==== GetApplicationRightsStatus ====
Takes a type-0x15 input buffer [[#EulaDataPath]], returns an output u64 '''filesize'''.
+
Takes an input "nn::ns::RightsEnvironmentHandle". Returns 2 bools "nn::ns::ApplicationRightsStatus" and "nn::ns::ApplicationLicenseType".
  
This is similar to [[#GetDownloadedEulaDataSize]].
+
==== GetRunningApplicationStatus ====
 +
Takes an input u64 "nn::ns::RightsEnvironmentHandle". Returns an u32 "nn::ns::RunningApplicationStatus".
  
=== GetReceivedEulaData ===
+
=== IECommerceInterface===
Takes a type-0x15 input buffer [[#EulaDataPath]] and a type-0x6 output buffer, returns an output u64 '''filesize'''.
+
This is "nn::ns::detail::IECommerceInterface".
  
This is similar to [[#GetDownloadedEulaData]].
+
This was added with [4.0.0+].
 
 
=== 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 1,712: Line 1,738:
 
! Cmd || Name
 
! Cmd || Name
 
|-
 
|-
| 0 || GetSize
+
| 0 || [[#RequestLinkDevice]]
 +
|-
 +
| 1 || [6.0.0+] [[#RequestCleanupAllPreInstalledApplications]]
 
|-
 
|-
| 1 || Get
+
| 2 || [6.0.0+] [[#RequestCleanupPreInstalledApplication]]
 
|-
 
|-
| 2 || Cancel
+
| 3 || [6.0.0+] [[#RequestSyncRights]]
 
|-
 
|-
| 3 || [4.0.0+] GetErrorContext
+
| 4 || [6.0.0+] [[#RequestUnlinkDevice]]
 +
|-
 +
| 5 || [6.1.0+] [[#RequestRevokeAllELicense]]
 +
|-
 +
| 6 || [9.0.0+] [[#RequestSyncRightsBasedOnAssignedELicenses]]
 
|}
 
|}
  
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.
+
==== RequestLinkDevice ====
 +
Takes an input [[Account_services#Uid|Uid]], returns an output Event handle and an [[#IAsyncResult]].
 +
 
 +
See [[#RequestApplicationUpdateInfo]] regarding nifm.
 +
 
 +
==== RequestCleanupAllPreInstalledApplications ====
 +
No input, returns an output Event handle and an [[#IAsyncResult]].
 +
 
 +
==== RequestCleanupPreInstalledApplication ====
 +
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].
 +
 
 +
==== RequestSyncRights ====
 +
No input, returns an output Event handle and an [[#IAsyncResult]].
 +
 
 +
==== RequestUnlinkDevice ====
 +
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]].
  
* GetSize: No input, returns an output u64.
+
==== RequestSyncRightsBasedOnAssignedELicenses ====
* Get: Takes a type-0x6 output buffer, no output. Official sw waits on the Event prior to using this cmd.
+
No input, returns an output Event handle and an [[#IAsyncResult]].
* 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 =
+
=== IFactoryResetInterface ===
This is "nn::ns::detail::IAsyncResult".
+
This is "nn::ns::detail::IFactoryResetInterface".
  
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 1,735: Line 1,785:
 
! Cmd || Name
 
! Cmd || Name
 
|-
 
|-
| 0 || Get
+
| 100 || [[#ResetToFactorySettings]]
 +
|-
 +
| 101 || [[#ResetToFactorySettingsWithoutUserSaveData]]
 +
|-
 +
| 102 || [[#ResetToFactorySettingsForRefurbishment]]
 +
|-
 +
| 103 || [9.1.0+] [[#ResetToFactorySettingsWithPlatformRegion]]
 +
|-
 +
| 104 || [9.1.0+] [[#ResetToFactorySettingsWithPlatformRegionAuthentication]]
 
|-
 
|-
| 1 || Cancel
+
| 105 || [10.0.0+] [[#RequestResetToFactorySettingsSecurely]]
 
|-
 
|-
| 2 || [4.0.0+] GetErrorContext
+
| 106 || [10.0.0+] [[#RequestResetToFactorySettingsWithPlatformRegionAuthenticationSecurely]]
 
|}
 
|}
  
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.
+
==== ResetToFactorySettings ====
 +
No input/output.
  
* Get: No input/output. Official sw waits on the Event prior to using this cmd.
+
As of [9.1.0] this is the only [[#IFactoryResetInterface]] cmd used by [[qlaunch]].
* 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]].
+
==== ResetToFactorySettingsWithoutUserSaveData ====
 +
No input/output.
 +
 
 +
==== ResetToFactorySettingsForRefurbishment ====
 +
No input/output.
 +
 
 +
==== ResetToFactorySettingsWithPlatformRegion ====
 +
No input/output.
 +
 
 +
==== ResetToFactorySettingsWithPlatformRegionAuthentication ====
 +
No input/output.
 +
 
 +
==== RequestResetToFactorySettingsSecurely ====
 +
Takes a total of 8-bytes of input, a handle, returns an output [[#IAsyncValueAndProgress]] and a handle.
 +
 
 +
==== RequestResetToFactorySettingsWithPlatformRegionAuthenticationSecurely ====
 +
Takes a total of 0x10-bytes of input, a handle, returns an output [[#IAsyncValueAndProgress]] and a handle.
 +
 
 +
===== IAsyncValueAndProgress =====
 +
This is "nn::ns::detail::IAsyncValueAndProgress".
  
= ns:dev =
+
This was added with [10.0.0+].
This is "nn::ns::detail::IDevelopInterface".
 
  
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 1,755: Line 1,832:
 
! Cmd || Name
 
! Cmd || Name
 
|-
 
|-
| 0 || [[#LaunchProgram]]
+
| 0 || GetSize
 
|-
 
|-
| 1 || [[#TerminateProcess]]
+
| 1 || Get
 
|-
 
|-
| 2 || [[#TerminateProgram]]
+
| 2 || Cancel
 
|-
 
|-
| 4 || [[#GetShellEvent]]
+
| 3 || GetErrorContext
 
|-
 
|-
| 5 || [[#GetShellEventInfo]]
+
| 4 || GetProgress
 +
|}
 +
 
 +
=== IApplicationResource ===
 +
This is "nn::ns::detail::IApplicationResource".
 +
 
 +
This was added with [9.0.0+].
 +
 
 +
{| class="wikitable" border="1"
 
|-
 
|-
| 6 || [[#TerminateApplication]]
+
! Cmd || Name
 
|-
 
|-
| 7 || [[#PrepareLaunchProgramFromHost]]
+
| 0 || Attach
 
|-
 
|-
| 8 || [[#LaunchApplicationForDevelop]]
+
| 1 || BoostSystemMemoryResourceLimit
 +
|}
 +
 
 +
= ns:vm =
 +
This is "nn::ns::detail::IVulnerabilityManagerInterface".
 +
 
 +
{| class="wikitable" border="1"
 
|-
 
|-
| 9 || [[#LaunchApplicationWithStorageIdForDevelop]]
+
! Cmd || Name
 
|-
 
|-
| 10 || [6.0.0-8.1.0] IsSystemMemoryResourceLimitBoosted
+
| 1200 || [3.0.0+] [[#NeedsUpdateVulnerability]]
 
|-
 
|-
| 11 || [6.0.0+] GetRunningApplicationProcessIdForDevelop
+
| 1201 || [4.0.0+] [[#UpdateSafeSystemVersionForDebug]]
 
|-
 
|-
| 12 || [6.0.0+] SetCurrentApplicationRightsEnvironmentCanBeActiveForDevelop
+
| 1202 || [4.0.0+] [[#GetSafeSystemVersion]]
|-
 
| 13 || [9.0.0+] [[#CreateApplicationResourceForDevelop]]
 
|-
 
| 14 || [9.0.0+] [[#IsPreomiaForDevelop]]
 
 
|}
 
|}
  
== LaunchProgram ==
+
== NeedsUpdateVulnerability ==
Wrapper for "pm:shell" [[Process_Manager_services#pm:shell|LaunchProcess]].
+
No input, returns an output u8 bool flag.
  
== TerminateProcess ==
+
Web-applets use this command to check if the system needs an update.
Wrapper for "pm:shell" [[Process_Manager_services#pm:shell|TerminateProcess]].
 
  
== TerminateProgram ==
+
== UpdateSafeSystemVersionForDebug ==
Wrapper for "pm:shell" [[Process_Manager_services#pm:shell|TerminateProgram]].
+
Takes an input [[NCM_services#ApplicationId|ApplicationId]] and an u32 '''version'''.
  
== GetShellEvent ==
+
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.
Wrapper for "pm:shell" [[Process_Manager_services#pm:shell|GetProcessEventHandle]].
 
  
== GetShellEventInfo ==
+
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'''.
Wrapper for "pm:shell" [[Process_Manager_services#pm:shell|GetProcessEventInfo]].
 
  
== TerminateApplication ==
+
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".
Calls "pm:shell" [[Process_Manager_services#pm:shell|GetApplicationProcessIdForShell]] and sends PID to [[Process_Manager_services#pm:shell|TerminateProcess]].
 
  
== PrepareLaunchProgramFromHost ==
+
== GetSafeSystemVersion ==
Takes a type-0x5 input buffer containing the [[Filesystem_services|ContentPath]], returns an output 0x10-byte struct.
+
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>).
  
Calls [[NCM_services#IPathResolverForStorage|IPathResolverForStorage]] Set...NcaPath functions.
+
= ns:su =
 +
This is "nn::ns::detail::ISystemUpdateInterface".
  
== LaunchApplicationForDevelop ==
+
{| class="wikitable" border="1"
Takes an input u32 [[Process_Manager_services#LaunchFlags|LaunchFlags]] and [[NCM_services#ApplicationId|ApplicationId]], returns an output u64 PID.
+
|-
 
+
! Cmd || Name
Same as LaunchApplicationWithStorageId except the last two params passed to the internal vtable funcptr call are value 0x6, instead of from the command input.
+
|-
 
+
| 0 || [[#GetBackgroundNetworkUpdateState]]
== LaunchApplicationWithStorageIdForDevelop ==
+
|-
Takes 2 input u8s, an u32 [[Process_Manager_services#LaunchFlags|LaunchFlags]], and an [[NCM_services#ApplicationId|ApplicationId]]. Returns an output u64 PID.
+
| 1 || [[#OpenSystemUpdateControl]]
 
+
|-
Launches an application title which is registered with NS.
+
| 2 || [[#NotifyExFatDriverRequired]]
 
+
|-
== CreateApplicationResourceForDevelop ==
+
| 3 || [[#ClearExFatDriverStatusForDebug]]
Takes an input u32 (1 = Preomia). Returns an [[#IApplicationResource]].
+
|-
 
+
| 4 || [[#RequestBackgroundNetworkUpdate]]
== IsPreomiaForDevelop ==
+
|-
Takes an u64 [[NCM_services#ProgramId|ProgramId]]. Returns a bool.
+
| 5 || [[#NotifyBackgroundNetworkUpdate]]
 
+
|-
= VersionListData =
+
| 6 || [[#NotifyExFatDriverDownloadedForDebug]]
This is "nn::ns::VersionListData".
+
|-
 
+
| 9 || [[#GetSystemUpdateNotificationEventForContentDelivery]]
= ApplicationUpdateInfo =
+
|-
This is "nn::ns::ApplicationUpdateInfo".
+
| 10 || [[#NotifySystemUpdateForContentDelivery]]
 
 
= NoDownloadRightsErrorResolution =
 
This is "nn::ns::NoDownloadRightsErrorResolution".
 
 
 
= BackgroundNetworkUpdateState =
 
{| class="wikitable" border="1"
 
 
|-
 
|-
!  Value
+
| 11 || [3.0.0+] [[#PrepareShutdown]]
!  Description
+
|-
 +
| 12 || [3.0.0-3.0.2]
 +
|-
 +
| 13 || [3.0.0-3.0.2]
 +
|-
 +
| 14 || [3.0.0-3.0.2]
 +
|-
 +
| 15 || [3.0.0-3.0.2]
 +
|-
 +
| 16 || [4.0.0+] [[#DestroySystemUpdateTask]]
 +
|-
 +
| 17 || [4.0.0+] [[#RequestSendSystemUpdate]]
 +
|-
 +
| 18 || [4.0.0+] [[#GetSendSystemUpdateProgress]]
 +
|}
 +
 
 +
== GetBackgroundNetworkUpdateState ==
 +
No input, returns an output [[#BackgroundNetworkUpdateState]].
 +
 
 +
This is similar to [[#HasDownloaded]], see [[#BackgroundNetworkUpdateState]].
 +
 
 +
== OpenSystemUpdateControl ==
 +
No input, returns an [[#ISystemUpdateControl]].
 +
 
 +
== NotifyExFatDriverRequired ==
 +
No input/output.
 +
 
 +
Only usable when an [[#ISystemUpdateControl]] isn't open.
 +
 
 +
This uses [[NIM_services|nim]] ListSystemUpdateTask, then when a task is returned uses it with DestroySystemUpdateTask.
 +
 
 +
Then this runs ExFat handling, updates state, and sets the same state flag as [[#RequestBackgroundNetworkUpdate]].
 +
 
 +
== ClearExFatDriverStatusForDebug ==
 +
No input/output.
 +
 
 +
== RequestBackgroundNetworkUpdate ==
 +
No input/output.
 +
 
 +
Only usable when an [[#ISystemUpdateControl]] isn't open.
 +
 
 +
This sets a state flag to value 1.
 +
 
 +
== NotifyBackgroundNetworkUpdate ==
 +
Takes an input [[NCM_services#ContentMetaKey|ContentMetaKey]], no output.
 +
 
 +
This checks whether a sysupdate is needed with the input ContentMetaKey using [[NCM_services|NCM]] commands, if not this will just return 0. Otherwise, this will then run code which is identical to [[#RequestBackgroundNetworkUpdate]].
 +
 
 +
== NotifyExFatDriverDownloadedForDebug ==
 +
No input/output.
 +
 
 +
== GetSystemUpdateNotificationEventForContentDelivery ==
 +
No input, returns an output Event handle with EventClearMode=0.
 +
 
 +
== NotifySystemUpdateForContentDelivery ==
 +
No input/output.
 +
 
 +
Signals the Event returned by [[#GetSystemUpdateNotificationEventForContentDelivery]].
 +
 
 +
== PrepareShutdown ==
 +
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.
 +
 
 +
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 ==
 +
{| class="wikitable" border="1"
 +
|-
 +
! Cmd || Name
 +
|-
 +
| 0 || [[#HasDownloaded]]
 +
|-
 +
| 1 || [[#RequestCheckLatestUpdate]]
 +
|-
 +
| 2 || [[#RequestDownloadLatestUpdate]]
 +
|-
 +
| 3 || [[#GetDownloadProgress]]
 +
|-
 +
| 4 || [[#ApplyDownloadedUpdate]]
 +
|-
 +
| 5 || [[#RequestPrepareCardUpdate]]
 +
|-
 +
| 6 || [[#GetPrepareCardUpdateProgress]]
 +
|-
 +
| 7 || [[#HasPreparedCardUpdate]]
 +
|-
 +
| 8 || [[#ApplyCardUpdate]]
 +
|-
 +
| 9 || [[#GetDownloadedEulaDataSize]]
 +
|-
 +
| 10 || [[#GetDownloadedEulaData]]
 +
|-
 +
| 11 || [[#SetupCardUpdate]]
 +
|-
 +
| 12 || [[#GetPreparedCardUpdateEulaDataSize]]
 +
|-
 +
| 13 || [[#GetPreparedCardUpdateEulaData]]
 +
|-
 +
| 14 || [4.0.0+] [[#SetupCardUpdateViaSystemUpdater]]
 +
|-
 +
| 15 || [4.0.0+] [[#HasReceived]]
 +
|-
 +
| 16 || [4.0.0+] [[#RequestReceiveSystemUpdate]]
 +
|-
 +
| 17 || [4.0.0+] [[#GetReceiveProgress]]
 +
|-
 +
| 18 || [4.0.0+] [[#ApplyReceivedUpdate]]
 +
|-
 +
| 19 || [4.0.0+] [[#GetReceivedEulaDataSize]]
 +
|-
 +
| 20 || [4.0.0+] [[#GetReceivedEulaData]]
 +
|-
 +
| 21 || [4.0.0+] [[#SetupToReceiveSystemUpdate]]
 +
|-
 +
| 22 || [6.0.0+] [[#RequestCheckLatestUpdateIncludesRebootlessUpdate]]
 +
|}
 +
 
 +
Only 1 ISystemUpdateControl can be open at a time.
 +
 
 +
All Card cmds except SetupCardUpdate* require [[#SetupCardUpdate]]/[[#SetupCardUpdateViaSystemUpdater]] to be used previously. [[#GetPreparedCardUpdateEulaDataSize]]/[[#GetPreparedCardUpdateEulaData]] checks a different state flag.
 +
 
 +
=== HasDownloaded ===
 +
No input, returns an output u8 bool flag.
 +
 
 +
Gets whether a network sysupdate was downloaded, with install pending.
 +
 
 +
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.
 +
 
 +
This always returns 0, however this will assert if GetSystemUpdateTaskInfo fails with ret!=0x3C89.
 +
 
 +
=== RequestCheckLatestUpdate ===
 +
No input, returns an output Event handle and an [[#IAsyncValue]].
 +
 
 +
The data that can be read from the [[#IAsyncValue]] is [[#LatestSystemUpdate]].
 +
 
 +
=== RequestDownloadLatestUpdate ===
 +
No input, returns an output Event handle and an [[#IAsyncResult]].
 +
 
 +
=== GetDownloadProgress ===
 +
No input, returns an output [[#SystemUpdateProgress]].
 +
 
 +
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.
 +
 
 +
=== ApplyDownloadedUpdate ===
 +
No input/output.
 +
 
 +
Runs code similar to [[#HasDownloaded]], throwing an error if a network sysupdate isn't ready for install. Then the sysupdate is installed:
 +
 
 +
* 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 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 ===
 +
No input, returns an output Event handle and an [[#IAsyncResult]].
 +
 
 +
=== GetPrepareCardUpdateProgress ===
 +
No input, returns an output [[#SystemUpdateProgress]].
 +
 
 +
=== HasPreparedCardUpdate ===
 +
No input, returns an output u8 bool flag.
 +
 
 +
=== ApplyCardUpdate ===
 +
No input/output.
 +
 
 +
=== GetDownloadedEulaDataSize ===
 +
Takes a type-0x15 input buffer [[#EulaDataPath]], returns an output u64 '''filesize'''.
 +
 
 +
Runs code similar to [[#HasDownloaded]], throwing an error if a network sysupdate isn't ready for install.
 +
 
 +
Uses ListSystemUpdateTask again. Then [[NIM_services|nim]] GetDownloadedSystemDataPath, with the output ContentPath being used to mount the EULA title with FS.
 +
 
 +
Then "<mountname>:/<[[#EulaDataPath]]>" is opened, gets the '''filesize''', then runs cleanup.
 +
 
 +
=== GetDownloadedEulaData ===
 +
Takes a type-0x15 input buffer [[#EulaDataPath]] and a type-0x6 output buffer, returns an output u64 '''filesize'''.
 +
 
 +
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.
 +
 
 +
=== SetupCardUpdate ===
 +
Takes an input u64 size and a TransferMemory handle, no output.
 +
 
 +
Official sw creates the TransferMemory with an user-specified buffer, with permissions=None.
 +
 
 +
[[qlaunch]] uses size 0x100000 for the TransferMemory buffer.
 +
 
 +
=== GetPreparedCardUpdateEulaDataSize ===
 +
Takes a type-0x15 input buffer [[#EulaDataPath]], returns an output u64 '''filesize'''.
 +
 
 +
This is similar to [[#GetDownloadedEulaDataSize]].
 +
 
 +
=== GetPreparedCardUpdateEulaData ===
 +
Takes a type-0x15 input buffer [[#EulaDataPath]] and a type-0x6 output buffer, returns an output u64 '''filesize'''.
 +
 
 +
This is similar to [[#GetDownloadedEulaData]].
 +
 
 +
=== SetupCardUpdateViaSystemUpdater ===
 +
Takes an input u64 size and a TransferMemory handle, no output.
 +
 
 +
The permissions for the TransferMemory is None.
 +
 
 +
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.
 +
 
 +
=== HasReceived ===
 +
No input, returns an output u8 bool.
 +
 
 +
Same as [[#HasDownloaded]] except this uses [[NIM_services|nim]] cmd71 and cmd73.
 +
 
 +
=== RequestReceiveSystemUpdate ===
 +
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 the same value for the port as [[#RequestSendSystemUpdate]] (see [[#RequestSendSystemUpdate]] for addr as well).
 +
 
 +
[[NIM_services|NIM]] will use the input addr/port with [[Sockets_services|connect()]].
 +
 
 +
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:
 +
** 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.
 +
** 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.
 +
** 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_system_update" with ApplicationId <NS ProgramId>.
 +
** This report has the following fields:
 +
*** "SourceSystemUpdateId"
 +
*** "DestinationSystemUpdateId"
 +
*** "SourceSystemUpdateVersion"
 +
*** "DestinationSystemUpdateVersion"
 +
*** "SenderFirmwareVariationId"
 +
*** "ReceiverFirmwareVariationId"
 +
*** "SenderPlatformRegion"
 +
*** "ReceiverPlatformRegion"
 +
*** "SenderHasExFat"
 +
*** "ReceiverHasExFat"
 +
*** "Size"
 +
*** "ThroughputKBps"
 +
 
 +
=== GetReceiveProgress ===
 +
No input, returns an output [[#SystemUpdateProgress]].
 +
 
 +
Same as [[#GetDownloadProgress]] except this uses [[NIM_services|nim]] cmd71 and cmd73.
 +
 
 +
=== ApplyReceivedUpdate ===
 +
No input/output.
 +
 
 +
=== 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"
 +
|-
 +
! Cmd || Name
 +
|-
 +
| 0 || GetSize
 +
|-
 +
| 1 || Get
 +
|-
 +
| 2 || Cancel
 +
|-
 +
| 3 || [4.0.0+] GetErrorContext
 +
|}
 +
 
 +
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.
 +
 
 +
* GetSize: No input, returns an output u64.
 +
* 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"
 +
|-
 +
! Cmd || Name
 +
|-
 +
| 0 || Get
 +
|-
 +
| 1 || Cancel
 +
|-
 +
| 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"
 +
|-
 +
! Cmd || Name
 +
|-
 +
| 0 || [1.0.0-9.2.0] [[#LaunchProgram]]
 +
|-
 +
| 1 || [[#TerminateProcess]]
 +
|-
 +
| 2 || [1.0.0-9.2.0] [[#TerminateProgram]]
 +
|-
 +
| 4 || [1.0.0-9.2.0] [[#GetShellEvent]]
 +
|-
 +
| 5 || [1.0.0-9.2.0] [[#GetShellEventInfo]]
 +
|-
 +
| 6 || [[#TerminateApplication]]
 +
|-
 +
| 7 || [1.0.0-9.2.0] [[#PrepareLaunchProgramFromHost]]
 +
|-
 +
| 8 || [10.0.0+] [[#LaunchApplicationFromHost]] ([1.0.0-9.2.0] [[#LaunchApplicationForDevelop]])
 +
|-
 +
| 9 || [[#LaunchApplicationWithStorageIdForDevelop]]
 +
|-
 +
| 10 || [6.0.0-8.1.0] [[#IsSystemMemoryResourceLimitBoosted]]
 +
|-
 +
| 11 || [6.0.0+] [[#GetRunningApplicationProcessIdForDevelop]]
 +
|-
 +
| 12 || [6.0.0+] [[#SetCurrentApplicationRightsEnvironmentCanBeActiveForDevelop]]
 +
|-
 +
| 13 || [9.0.0+] [[#CreateApplicationResourceForDevelop]]
 +
|-
 +
| 14 || [9.0.0+] [[#IsPreomiaForDevelop]]
 +
|-
 +
| 15 || [10.0.0+] [[#GetApplicationProgramIdFromHost]]
 +
|}
 +
 
 +
== LaunchProgram ==
 +
Wrapper for "pm:shell" [[Process_Manager_services#pm:shell|LaunchProcess]].
 +
 
 +
== TerminateProcess ==
 +
Wrapper for "pm:shell" [[Process_Manager_services#pm:shell|TerminateProcess]].
 +
 
 +
== TerminateProgram ==
 +
Wrapper for "pm:shell" [[Process_Manager_services#pm:shell|TerminateProgram]].
 +
 
 +
== GetShellEvent ==
 +
Wrapper for "pm:shell" [[Process_Manager_services#pm:shell|GetProcessEventHandle]].
 +
 
 +
== GetShellEventInfo ==
 +
Wrapper for "pm:shell" [[Process_Manager_services#pm:shell|GetProcessEventInfo]].
 +
 
 +
== TerminateApplication ==
 +
Calls "pm:shell" [[Process_Manager_services#pm:shell|GetApplicationProcessIdForShell]] and sends the ProcessId to [[Process_Manager_services#pm:shell|TerminateProcess]].
 +
 
 +
== PrepareLaunchProgramFromHost ==
 +
Takes a type-0x5 input buffer containing the [[Filesystem_services|ContentPath]], returns an output 0x10-byte struct.
 +
 
 +
Calls [[NCM_services#IPathResolverForStorage|IPathResolverForStorage]] Set...NcaPath functions.
 +
 
 +
== LaunchApplicationForDevelop ==
 +
Takes an input u32 [[Process_Manager_services#LaunchFlags|LaunchFlags]] and [[NCM_services#ApplicationId|ApplicationId]], returns an output u64 ProcessId.
 +
 
 +
Same as [[#LaunchApplicationWithStorageIdForDevelop]] except the last two params passed to the internal vtable funcptr call are value 0x6, instead of from the command input.
 +
 
 +
== LaunchApplicationFromHost ==
 +
Takes an input u32 [[Process_Manager_services#LaunchFlags|LaunchFlags]] and a type-0x5 input buffer containing the [[Filesystem_services|ContentPath]]. Returns an output u64 ProcessId.
 +
 
 +
== LaunchApplicationWithStorageIdForDevelop ==
 +
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.
 +
 
 +
== IsSystemMemoryResourceLimitBoosted ==
 +
No input. Returns a bool.
 +
 
 +
== GetRunningApplicationProcessIdForDevelop ==
 +
Returns an output u64 ProcessId.
 +
 
 +
== SetCurrentApplicationRightsEnvironmentCanBeActiveForDevelop ==
 +
Takes an input bool. No output.
 +
 
 +
== CreateApplicationResourceForDevelop ==
 +
Takes an input u32 (1 = Preomia/MicroApplication). Returns an [[#IApplicationResource]].
 +
 
 +
== IsPreomiaForDevelop ==
 +
Takes an input u64 [[NCM_services#ProgramId|ProgramId]]. Returns a bool.
 +
 
 +
== GetApplicationProgramIdFromHost ==
 +
Takes a type-0x5 input buffer containing the [[Filesystem_services|ContentPath]]. Returns an u64 [[NCM_services#ProgramId|ProgramId]].
 +
 
 +
= VersionListData =
 +
This is "nn::ns::VersionListData".
 +
 
 +
= ApplicationUpdateInfo =
 +
This is "nn::ns::ApplicationUpdateInfo".
 +
 
 +
This is an u8. [[qlaunch]] just checks whether this is 0.
 +
 
 +
= ApplicationOccupiedSize =
 +
This is "nn::ns::ApplicationOccupiedSize". This is a 0x80-byte struct.
 +
 
 +
= ProgressForDeleteUserSaveDataAll =
 +
This is "nn::ns::detail::ProgressForDeleteUserSaveDataAll". This is a 0x28-byte struct.
 +
 
 +
= ApplicationViewDeprecated =
 +
This is "nn::ns::ApplicationViewDeprecated". This is a 0x40-byte struct.
 +
 
 +
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.
 +
|}
 +
 
 +
= 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.
 +
 
 +
{| 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
 +
|}
 +
 
 +
= NoDownloadRightsErrorResolution =
 +
This is "nn::ns::NoDownloadRightsErrorResolution".
 +
 
 +
= BackgroundNetworkUpdateState =
 +
{| class="wikitable" border="1"
 +
|-
 +
!  Value
 +
!  Description
 
|-
 
|-
 
| 0 || No sysupdate task exists.
 
| 0 || No sysupdate task exists.
 
|-
 
|-
| 1 || Sysupdate download in progress.
+
| 1 || Sysupdate download in progress.
 +
|-
 +
| 2 || Sysupdate ready, pending install.
 +
|}
 +
 
 +
This is "nn::ns::BackgroundNetworkUpdateState". This is an u8.
 +
 
 +
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 =
 +
{| class="wikitable" border="1"
 +
|-
 +
! Offset
 +
! Size
 +
! Description
 +
|-
 +
| 0x0 || 0x8 || s64 Current size. This value can be larger than total_size when the async operation is finishing. 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 || s64 Total size, this field is only valid when >0.
 +
|}
 +
 
 +
This is "nn::ns::SystemUpdateProgress". This is a 0x10-byte struct.
 +
 
 +
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 =
 +
{| class="wikitable" border="1"
 +
|-
 +
! Offset
 +
! Size
 +
! Description
 +
|-
 +
| 0x0 || 0x4 || SystemDeliveryProtocolVersion. Must be <= to and match [[System_Settings|system-setting]] <code>contents_delivery!system_delivery_protocol_version</code>.
 +
|-
 +
| 0x4 || 0x4 || ApplicationDeliveryProtocolVersion. Loaded from [[System_Settings|system-setting]] <code>contents_delivery!application_delivery_protocol_version</code>. Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation.
 +
|-
 +
| 0x8 || 0x1 || HasExFat. Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation.
 +
|-
 +
| 0x9 || 0x3 || Reserved.
 +
|-
 +
| 0xC || 0x4 || SystemUpdateMetaVersion.
 +
|-
 +
| 0x10 || 0x8 || SystemUpdateMetaId.
 +
|-
 +
| 0x18 || 0x1 || FirmwareVariationId. Used by [[#RequestSendSystemUpdate]].
 +
|-
 +
| 0x19 || 0x1 || UpdatableFirmwareGroupId. Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation.
 +
|-
 +
| 0x1A || 0x1 || PlatformRegion (0x00 = Unknown, 0x01 = Global, 0x02 = China).
 +
|-
 +
| 0x1B || 0xC5 || Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation.
 +
|-
 +
| 0xE0 || 0x20 || HMAC-SHA256 over the previous 0xE0-bytes.
 +
|}
 +
 
 +
This is "nn::ns::SystemDeliveryInfo". This is a 0x100-byte struct.
 +
 
 +
= ApplicationDeliveryInfo =
 +
{| class="wikitable" border="1"
 +
|-
 +
! Offset
 +
! Size
 +
! Description
 +
|-
 +
| 0x0 || 0x8 || ?
 +
|-
 +
| 0x8 || 0x8 || ApplicationId.
 +
|-
 +
| 0x10 || 0x4 || ApplicationVersion.
 +
|-
 +
| 0x14 || 0x4 || ?
 +
|-
 +
| 0x18 || 0x4 || RequiredSystemVersion.
 +
|-
 +
| 0x1C || 0x4 || ?
 +
|-
 +
| 0x20 || 0xC0 || ?
 +
|-
 +
| 0xE0 || 0x20 || HMAC-SHA256 over the previous 0xE0-bytes. Uses a different key than [[#SystemDeliveryInfo]].
 +
|}
 +
 
 +
This is "nn::ns::ApplicationDeliveryInfo". This is a 0x100-byte struct.
 +
 
 +
= LatestSystemUpdate =
 +
{| class="wikitable" border="1"
 +
|-
 +
!  Value
 +
!  Description
 +
|-
 +
| 1 || Unknown.
 +
|-
 +
| 2 || Unknown.
 +
|-
 +
| Other values || Unknown.
 +
|}
 +
 
 +
This is "nn::ns::LatestSystemUpdate". This is an u8.
 +
 
 +
= ReceiveApplicationProgress =
 +
This is "nn::ns::ReceiveApplicationProgress". This is a 0x10-byte struct.
 +
 
 +
= SendApplicationProgress =
 +
This is "nn::ns::SendApplicationProgress". This is a 0x10-byte struct.
 +
 
 +
= ApplicationRightsOnClient =
 +
This is a 0x20-byte struct.
 +
 
 +
[[qlaunch]] only uses +0x18/+0x19 in this struct.
 +
 
 +
{| class="wikitable" border="1"
 +
|-
 +
! Offset
 +
! Size
 +
! Description
 +
|-
 +
| 0x0 || 0x8 || [[NCM_services#ApplicationId|ApplicationId]]
 
|-
 
|-
| 2 || Sysupdate ready, pending install.
+
| 0x8 || 0x10 || [[Account_services#Uid|Uid]]
|}
 
 
 
This is "nn::ns::BackgroundNetworkUpdateState". This is an u8.
 
 
 
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 =
 
{| class="wikitable" border="1"
 
 
|-
 
|-
! Offset
+
| 0x18 || 0x1 || Flags, [[qlaunch]] only uses bit0-bit4 and bit7.
! Size
 
! Description
 
 
|-
 
|-
| 0x0 || 0x8 || s64 Current size. This value can be larger than total_size when the async operation is finishing. When total_size is <=0, this current_size field may contain a progress value for when the total_size is not yet determined.
+
| 0x19 || 0x1 || Flags, [[qlaunch]] only uses bit0.
 
|-
 
|-
| 0x8 || 0x8 || s64 Total size, this field is only valid when >0.
+
| 0x1A || 0x6 || Unknown
 
|}
 
|}
  
This is "nn::ns::SystemUpdateProgress". This is a 0x10-byte struct.
+
= DownloadTaskStatus =
 
+
This is "nn::ns::DownloadTaskStatus". This is a 0x20-byte struct.
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 =
 
{| class="wikitable" border="1"
 
|-
 
! Offset
 
! Size
 
! Description
 
|-
 
| 0x0 || 0x4 || SystemDeliveryProtocolVersion. Must be <= to and match [[System_Settings|system-setting]] <code>contents_delivery!system_delivery_protocol_version</code>.
 
|-
 
| 0x4 || 0x4 || ApplicationDeliveryProtocolVersion. Loaded from [[System_Settings|system-setting]] <code>contents_delivery!application_delivery_protocol_version</code>. Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation.
 
|-
 
| 0x8 || 0x1 || HasExFat. Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation.
 
|-
 
| 0x9 || 0x3 || Reserved.
 
|-
 
| 0xC || 0x4 || SystemUpdateMetaVersion.
 
|-
 
| 0x10 || 0x8 || SystemUpdateMetaId.
 
|-
 
| 0x18 || 0x1 || FirmwareVariationId. Used by [[#RequestSendSystemUpdate]].
 
|-
 
| 0x19 || 0x1 || UpdatableFirmwareGroupId. Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation.
 
|-
 
| 0x1A || 0x1 || PlatformRegion (0x00 = Unknown, 0x01 = Global, 0x02 = China).
 
|-
 
| 0x1B || 0xC5 || Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation.
 
|-
 
| 0xE0 || 0x20 || HMAC-SHA256 over the previous 0xE0-bytes.
 
|}
 
  
This is "nn::ns::SystemDeliveryInfo". This is a 0x100-byte struct.
+
= ApplicationLaunchInfo =
 +
This is a 0x40-byte struct.
  
= ApplicationDeliveryInfo =
 
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
Line 1,911: Line 2,616:
 
! Description
 
! Description
 
|-
 
|-
| 0x0 || 0x8 || ?
+
| 0x0 || 0x8 || [[NCM_services#ApplicationId|ApplicationId]]
|-
 
| 0x8 || 0x8 || ApplicationId.
 
|-
 
| 0x10 || 0x4 || ApplicationVersion.
 
|-
 
| 0x14 || 0x4 || ?
 
|-
 
| 0x18 || 0x4 || RequiredSystemVersion.
 
|-
 
| 0x1C || 0x4 || ?
 
 
|-
 
|-
| 0x20 || 0xC0 || ?
+
| 0x8 || 0x4 || Application version
|-
 
| 0xE0 || 0x20 || HMAC-SHA256 over the previous 0xE0-bytes. Uses a different key than [[#SystemDeliveryInfo]].
 
|}
 
 
 
This is "nn::ns::ApplicationDeliveryInfo". This is a 0x100-byte struct.
 
 
 
= LatestSystemUpdate =
 
{| class="wikitable" border="1"
 
 
|-
 
|-
!  Value
+
| 0xC || 0x4 || [[Process_Manager_services#LaunchFlags|LaunchFlags]], set to hard-coded value 0xB by [[#GetApplicationLaunchInfo]].
!  Description
 
 
|-
 
|-
| 1 || Unknown.
+
| 0x10 || 0x1 || Application [[NCM_services#StorageId|StorageId]]
 
|-
 
|-
| 2 || Unknown.
+
| 0x11 || 0x1 || Update [[NCM_services#StorageId|StorageId]]
 
|-
 
|-
| Other values || Unknown.
+
| 0x12 || 0x2E ||  
 
|}
 
|}
 
This is "nn::ns::LatestSystemUpdate". This is an u8.
 
 
= ReceiveApplicationProgress =
 
This is "nn::ns::ReceiveApplicationProgress". This is a 0x10-byte struct.
 
 
= SendApplicationProgress =
 
This is "nn::ns::SendApplicationProgress". This is a 0x10-byte struct.
 
  
 
[[Category:Services]]
 
[[Category:Services]]

Latest revision as of 17:55, 18 August 2020

Contents

aoc:u

This is "nn::aocsrv::detail::IAddOnContentManager".

Cmd Name
0 [1.0.0-6.2.0] CountAddOnContentByApplicationId
1 [1.0.0-6.2.0] ListAddOnContentByApplicationId
2 CountAddOnContent
3 ListAddOnContent
4 [1.0.0-6.2.0] GetAddOnContentBaseIdByApplicationId
5 GetAddOnContentBaseId
6 [1.0.0-6.2.0] PrepareAddOnContentByApplicationId
7 PrepareAddOnContent
8 [4.0.0+] GetAddOnContentListChangedEvent
9 [10.0.0+] GetAddOnContentLostErrorCode
100 [7.0.0+] CreateEcPurchasedEventManager
101 [9.0.0+] CreatePermanentEcPurchasedEventManager

IPurchaseEventManager

This is "nn::ec::IPurchaseEventManager".

Cmd Name
0 SetDefaultDeliveryTarget
1 SetDeliveryTarget
2 GetPurchasedEventReadableHandle
3 PopPurchasedProductInfo
4 [9.0.0+] PopPurchasedProductInfoWithUid

ns:am

This is "nn::ns::detail::IApplicationManagerInterface".

[3.0.0+] This service was replaced by ns:am2.

Cmd Name
0 #ListApplicationRecord
1 GenerateApplicationRecordCount
2 GetApplicationRecordUpdateSystemEvent
3 GetApplicationViewDeprecated
4 DeleteApplicationEntity
5 DeleteApplicationCompletely
6 IsAnyApplicationEntityRedundant
7 DeleteRedundantApplicationEntity
8 IsApplicationEntityMovable
9 MoveApplicationEntity
11 #CalculateApplicationOccupiedSize
16 PushApplicationRecord
17 ListApplicationRecordContentMeta
18 CheckLaunchRights
19 #LaunchApplication
21 #GetApplicationContentPath
22 TerminateApplication
23 [2.0.0+] ResolveApplicationContentPath
26 BeginInstallApplication
27 DeleteApplicationRecord
30 RequestApplicationUpdateInfo
31 RequestUpdateApplication
32 CancelApplicationDownload
33 ResumeApplicationDownload
34
35 UpdateVersionList
36 PushLaunchVersion
37 ListRequiredVersion
38 CheckApplicationLaunchVersion
39 CheckApplicationLaunchRights
40 GetApplicationLogoData
41 CalculateApplicationDownloadRequiredSize
42 CleanupSdCard
43 #CheckSdCardMountStatus
44 GetSdCardMountStatusChangedEvent
45 GetGameCardAttachmentEvent
46 GetGameCardAttachmentInfo
47 #GetTotalSpaceSize
48 #GetFreeSpaceSize
49 GetSdCardRemovedEvent
52 GetGameCardUpdateDetectionEvent
53 DisableApplicationAutoDelete
54 EnableApplicationAutoDelete
55 #GetApplicationDesiredLanguage
56 SetApplicationTerminateResult
57 ClearApplicationTerminateResult
58 GetLastSdCardMountUnexpectedResult
59 ConvertApplicationLanguageToLanguageCode
60 #ConvertLanguageCodeToApplicationLanguage
61 GetBackgroundDownloadStressTaskInfo
62 GetGameCardStopper
63 IsSystemProgramInstalled
64 [2.0.0+] StartApplyDeltaTask
65 [2.0.0+] GetRequestServerStopper
100 ResetToFactorySettings
101 ResetToFactorySettingsWithoutUserSaveData
102 [2.0.0+] ResetToFactorySettingsForRefurbishment
200 CalculateUserSaveDataStatistics
201 DeleteUserSaveDataAll
210 DeleteUserSystemSaveData
220 UnregisterNetworkServiceAccount
300 GetApplicationShellEvent
301 PopApplicationShellEventInfo
302 LaunchLibraryApplet
303 TerminateLibraryApplet
304 LaunchSystemApplet
305 TerminateSystemApplet
306 LaunchOverlayApplet
307 TerminateOverlayApplet
400 #GetApplicationControlData
401 InvalidateAllApplicationControlCache
402 RequestDownloadApplicationControlData
403 GetMaxApplicationControlCacheCount
404 [2.0.0+] InvalidateApplicationControlCache
405 [2.0.0+] ListApplicationControlCacheEntryInfo
502 [2.0.0+] RequestCheckGameCardRegistration
503 [2.0.0+] RequestGameCardRegistrationGoldPoint
504 [2.0.0+] RequestRegisterGameCard
600 [2.0.0+] #CountApplicationContentMeta
601 [2.0.0+] #ListApplicationContentMetaStatus
602 [2.0.0+] ListAvailableAddOnContent
603 [2.0.0+] GetOwnedApplicationContentMetaStatus
604 [2.0.0+] RegisterContentsExternalKey
605 [2.0.0+] ListApplicationContentMetaStatusWithRightsCheck
700 [2.0.0+] PushDownloadTaskList
701 [2.0.0+] #ClearTaskStatusList
702 [2.0.0+] #RequestDownloadTaskList
703 [2.0.0+] #RequestEnsureDownloadTask
704 [2.0.0+] #ListDownloadTaskStatus
705 [2.0.0+] RequestDownloadTaskListData
800 [2.0.0+] RequestVersionList
801 [2.0.0+] ListVersionList
900 [2.0.0+] GetApplicationRecord
901 [2.0.0+] GetApplicationRecordProperty
902 [2.0.0+] EnableApplicationAutoUpdate
903 [2.0.0+] DisableApplicationAutoUpdate
904 [2.0.0+] TouchApplication
905 [2.0.0+] RequestApplicationUpdate
906 [2.0.0+] IsApplicationUpdateRequested
907 [2.0.0+] WithdrawApplicationUpdateRequest
908 [2.0.0+] ListApplicationRecordInstalledContentMeta
1000 [2.0.0+] RequestVerifyApplicationDeprecated
1001 [2.0.0+] CorruptApplicationForDebug
1200 [2.0.0+] #NeedsUpdateVulnerability
1300 [2.0.0+] IsAnyApplicationEntityInstalled
1301 [2.0.0+] DeleteApplicationContentEntities
1302 [2.0.0+] CleanupUnrecordedApplicationEntity
1400 [2.0.0+] PrepareShutdown
1500 [2.0.0+] FormatSdCard
1501 [2.0.0+] NeedsSystemUpdateToFormatSdCard
1502 [2.0.0+] GetLastSdCardFormatUnexpectedResult
1503 [2.0.0+]
1600 [2.0.0+] GetSystemSeedForPseudoDeviceId
1700 [2.0.0+] ListApplicationDownloadingContentMeta
1800 [2.0.0+] IsNotificationSetupCompleted
1801 [2.0.0+] GetLastNotificationInfoCount
1802 [2.0.0+] ListLastNotificationInfo

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.

Returns an array of entries with the below format using the specified offset and count.

Application Record Format

Offset Size Description
0x0 0x8 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

Takes an input ApplicationId, returns an output u64 PID.

Launches an application title which is registered with NS.

GetApplicationContentPath

Takes a 0x16-type output buffer, an u8 ContentMetaType, and an ApplicationId.

The input ApplicationId is used with the application-title table like various other cmds, anything not in that table can't be used with this.

Returns a string path for the specified type of patch content with this ApplicationId, otherwise returns regular-application paths when update-title not installed. Returns an error when the specified type of content doesn't exist for this title. Starts with "@{SdCardContent,UserContent}://" and ends in ".nca".

For gamecard content, the output path is: "@GcSXXXXXXXX:/<NcaId>.nca". NCA-type0 with gamecard returns 0 with an empty output string.

The output string is then used by the user-process with FS to mount the content.

GetTotalSpaceSize

Takes an input u8 StorageId, no output.

The StorageId must be SdCard.

Returns the s64 from NCM_services#IContentStorage GetFreeSpaceSize.

GetFreeSpaceSize

Takes an input u8 StorageId, no output.

The StorageId must be SdCard.

Returns the s64 from NCM_services#IContentStorage GetTotalSpaceSize.

GetApplicationDesiredLanguage

Takes an input u8 language-bitmask, returns an output u8 control.nacp langentry index.

User-processes generate the language-bitmask with the following for all 16 lang-entries: if(<either string in langentry[i] is non-empty>)bitmask |= 1<<i

ConvertLanguageCodeToApplicationLanguage

Takes an input u8 pointer for the resulting Id to be written to and a string represented as a u64 (i.e 0x53552D6E65 for 'en-US').

Returns 0 if an ID was successfully found, otherwise returns 0x25810.

GetApplicationControlData

Takes an input u8 #ApplicationControlSource, an ApplicationId, and a type-0x6 output buffer. Returns an output u32 for actual_size. Official user-processes use buffer size 0x24000. qlaunch only uses source value 0x1 (Storage if not in cache).

Loads cached control.nacp to buf+0 and the cached icon to buf+0x4000. Returns an error if the buffer is too small.

ApplicationControlSource

Value Description
0x0 CacheOnly (Returns data from cache)
0x1 Storage (Returns data from storage if not present in cache)
0x2 StorageOnly (Returns data from storage without using cache)

ListApplicationContentMetaStatus

Takes a type-0x6 output buffer containing an array of the below entries, an input s32 index and ApplicationId, returns an output s32 out_entrycount.

Returns 0x10-byte entries using the specified 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:

Offset Size Description
0x0 0x1 ContentMetaType ("type")
0x1 0x1 StorageId ("installedStorage")
0x2 0x1 Unknown. Non-zero with output from cmd 605, differs for app/update titles.
0x3 0x1 Padding
0x4 0x4 Version
0x8 0x8 ApplicationId

ns:am2, ns:ec, ns:rid, ns:rt, ns:web

These services are all, at the top level, "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.

Cmd Name
7988 [6.0.0+] GetDynamicRightsInterface.
7989 [5.1.0+] GetReadOnlyApplicationControlDataInterface.
7991 [5.0.0+] GetReadOnlyApplicationRecordInterface.
7992 [4.0.0+] GetECommerceInterface
7993 [4.0.0+] GetApplicationVersionInterface
7994 GetFactoryResetInterface
7995 GetAccountProxyInterface
7996 GetApplicationManagerInterface
7997 GetDownloadTaskInterface
7998 GetContentManagementInterface
7999 GetDocumentInterface

IAccountProxyInterface

This is "nn::ns::detail::IAccountProxyInterface".

Cmd Name
0 CreateUserAccount

IApplicationManagerInterface

This is "nn::ns::detail::IApplicationManagerInterface".

Cmd Name
0 #ListApplicationRecord
1 GenerateApplicationRecordCount
2 #GetApplicationRecordUpdateSystemEvent
3 #GetApplicationViewDeprecated
4 #DeleteApplicationEntity
5 #DeleteApplicationCompletely
6 IsAnyApplicationEntityRedundant
7 #DeleteRedundantApplicationEntity
8 #IsApplicationEntityMovable
9 [1.0.0-9.2.0] #MoveApplicationEntity
11 #CalculateApplicationOccupiedSize
16 PushApplicationRecord
17 ListApplicationRecordContentMeta
19 [1.0.0-5.1.0] LaunchApplicationOld
21 #GetApplicationContentPath
22 TerminateApplication
23 ResolveApplicationContentPath
26 BeginInstallApplication
27 DeleteApplicationRecord
30 #RequestApplicationUpdateInfo
31 [1.0.0-3.0.2]
32 #CancelApplicationDownload
33 #ResumeApplicationDownload
35 UpdateVersionList
36 PushLaunchVersion
37 ListRequiredVersion
38 #CheckApplicationLaunchVersion
39 [1.0.0-6.2.0] CheckApplicationLaunchRights
40 GetApplicationLogoData
41 CalculateApplicationDownloadRequiredSize
42 #CleanupSdCard
43 #CheckSdCardMountStatus
44 #GetSdCardMountStatusChangedEvent
45 GetGameCardAttachmentEvent
46 GetGameCardAttachmentInfo
47 #GetTotalSpaceSize
48 #GetFreeSpaceSize
49 GetSdCardRemovedEvent
52 #GetGameCardUpdateDetectionEvent
53 #DisableApplicationAutoDelete
54 #EnableApplicationAutoDelete
55 GetApplicationDesiredLanguage
56 #SetApplicationTerminateResult
57 #ClearApplicationTerminateResult
58 #GetLastSdCardMountUnexpectedResult
59 ConvertApplicationLanguageToLanguageCode
60 #ConvertLanguageCodeToApplicationLanguage
61 GetBackgroundDownloadStressTaskInfo
62 GetGameCardStopper
63 IsSystemProgramInstalled
64 StartApplyDeltaTask
65 #GetRequestServerStopper
66 [3.0.0+] GetBackgroundApplyDeltaStressTaskInfo
67 [3.0.0+] #CancelApplicationApplyDelta
68 [3.0.0+] #ResumeApplicationApplyDelta
69 [3.0.0+] #CalculateApplicationApplyDeltaRequiredSize
70 [3.0.0+] #ResumeAll
71 [3.0.0+] #GetStorageSize
80 [3.0.0+] RequestDownloadApplication
81 [3.0.0+] RequestDownloadAddOnContent
82 [3.0.0+] DownloadApplication
83 [4.0.0-6.2.0] CheckApplicationResumeRights
84 [4.0.0+] GetDynamicCommitEvent
85 [4.0.0+] #RequestUpdateApplication2
86 [4.0.0+] EnableApplicationCrashReport
87 [4.0.0+] IsApplicationCrashReportEnabled
90 [4.0.0-8.1.0] BoostSystemMemoryResourceLimit
91 [5.0.0+] DeprecatedLaunchApplication
92 [5.0.0+] GetRunningApplicationProgramId
93 [5.0.0+] GetMainApplicationProgramIndex
94 [6.0.0+] LaunchApplication
95 [6.0.0+] #GetApplicationLaunchInfo
96 [6.0.0+] #AcquireApplicationLaunchInfo
97 [6.0.0+] GetMainApplicationProgramIndexByApplicationLaunchInfo
98 [6.0.0+] EnableApplicationAllThreadDumpOnCrash
99 [8.0.0+] #LaunchDevMenu
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
200 CalculateUserSaveDataStatistics
201 #DeleteUserSaveDataAll
210 #DeleteUserSystemSaveData
211 [6.0.0+] #DeleteSaveData
220 #UnregisterNetworkServiceAccount
221 [6.0.0+] #UnregisterNetworkServiceAccountWithUserSaveDataDeletion
300 GetApplicationShellEvent
301 PopApplicationShellEventInfo
302 #LaunchLibraryApplet
303 TerminateLibraryApplet
304 #LaunchSystemApplet
305 TerminateSystemApplet
306 #LaunchOverlayApplet
307 TerminateOverlayApplet
400 #GetApplicationControlData
401 InvalidateAllApplicationControlCache
402 #RequestDownloadApplicationControlData
403 GetMaxApplicationControlCacheCount
404 InvalidateApplicationControlCache
405 ListApplicationControlCacheEntryInfo
406 [6.0.0+] GetApplicationControlProperty
407 [8.0.0+] #ListApplicationTitle
408 [8.0.0+] #ListApplicationIcon
502 #RequestCheckGameCardRegistration
503 #RequestGameCardRegistrationGoldPoint
504 #RequestRegisterGameCard
505 [3.0.0+] #GetGameCardMountFailureEvent
506 [3.0.0+] #IsGameCardInserted
507 [3.0.0+] #EnsureGameCardAccess
508 [3.0.0+] #GetLastGameCardMountFailureResult
509 [5.0.0+] #ListApplicationIdOnGameCard
510 [9.0.0+] #GetGameCardPlatformRegion
600 #CountApplicationContentMeta
601 #ListApplicationContentMetaStatus
602 [2.0.0-5.1.0] ListAvailableAddOnContent
603 GetOwnedApplicationContentMetaStatus
604 RegisterContentsExternalKey
605 ListApplicationContentMetaStatusWithRightsCheck
606 [3.0.0+] GetContentMetaStorage
607 [6.0.0+] #ListAvailableAddOnContent
700 PushDownloadTaskList
701 #ClearTaskStatusList
702 #RequestDownloadTaskList
703 #RequestEnsureDownloadTask
704 #ListDownloadTaskStatus
705 #RequestDownloadTaskListData
800 RequestVersionList
801 ListVersionList
802 [3.0.0+] #RequestVersionListData
900 GetApplicationRecord
901 GetApplicationRecordProperty
902 EnableApplicationAutoUpdate
903 DisableApplicationAutoUpdate
904 #TouchApplication
905 RequestApplicationUpdate
906 #IsApplicationUpdateRequested
907 #WithdrawApplicationUpdateRequest
908 ListApplicationRecordInstalledContentMeta
909 [3.0.0+] WithdrawCleanupAddOnContentsWithNoRightsRecommendation
910 [5.0.0+] HasApplicationRecord
911 [5.1.0+] SetPreInstalledApplication
912 [5.1.0+] ClearPreInstalledApplicationFlag
913 [9.0.0+] ListAllApplicationRecord
914 [9.0.0+] HideApplicationRecord
915 [9.0.0+] ShowApplicationRecord
1000 #RequestVerifyApplicationDeprecated
1001 CorruptApplicationForDebug
1002 [3.0.0-9.2.0] #RequestVerifyAddOnContentsRights
1003 [5.0.0+] #RequestVerifyApplication
1004 [5.0.0+] CorruptContentForDebug
1200 #NeedsUpdateVulnerability
1300 #IsAnyApplicationEntityInstalled
1301 DeleteApplicationContentEntities
1302 CleanupUnrecordedApplicationEntity
1303 [3.0.0-9.2.0] CleanupAddOnContentsWithNoRights
1304 [3.0.0+] DeleteApplicationContentEntity
1308 [5.0.0+] DeleteApplicationCompletelyForDebug
1309 [6.0.0+] #CleanupUnavailableAddOnContents
1310 [10.0.0+] RequestMoveApplicationEntity
1311 [10.0.0+] EstimateSizeToMove
1312 [10.0.0+] HasMovableEntity
1400 PrepareShutdown
1500 #FormatSdCard
1501 #NeedsSystemUpdateToFormatSdCard
1502 #GetLastSdCardFormatUnexpectedResult
1504 [3.0.0+] InsertSdCard
1505 [3.0.0+] RemoveSdCard
1506 [9.0.0+] GetSdCardStartupStatus
1600 GetSystemSeedForPseudoDeviceId
1601 [3.0.0+] ResetSystemSeedForPseudoDeviceId
1700 ListApplicationDownloadingContentMeta
1701 [3.0.0+] #GetApplicationView
1702 [3.0.0+] GetApplicationDownloadTaskStatus
1703 [4.0.0+] #GetApplicationViewDownloadErrorContext
1704 [8.0.0+] #GetApplicationViewWithPromotionInfo
1800 IsNotificationSetupCompleted
1801 GetLastNotificationInfoCount
1802 ListLastNotificationInfo
1803 [3.0.0+] ListNotificationTask
1900 [3.0.0+] IsActiveAccount
1901 [4.0.0+] #RequestDownloadApplicationPrepurchasedRights
1902 [5.0.0+] GetApplicationTicketInfo
2000 [4.0.0+] #GetSystemDeliveryInfo
2001 [4.0.0+] #SelectLatestSystemDeliveryInfo
2002 [4.0.0+] #VerifyDeliveryProtocolVersion
2003 [4.0.0+] #GetApplicationDeliveryInfo
2004 [4.0.0+] #HasAllContentsToDeliver
2005 [4.0.0+] #CompareApplicationDeliveryInfo
2006 [4.0.0+] #CanDeliverApplication
2007 [4.0.0+] #ListContentMetaKeyToDeliverApplication
2008 [4.0.0+] #NeedsSystemUpdateToDeliverApplication
2009 [4.0.0+] #EstimateRequiredSize
2010 [4.0.0+] #RequestReceiveApplication
2011 [4.0.0+] #CommitReceiveApplication
2012 [4.0.0+] #GetReceiveApplicationProgress
2013 [4.0.0+] #RequestSendApplication
2014 [4.0.0+] #GetSendApplicationProgress
2015 [4.0.0+] #CompareSystemDeliveryInfo
2016 [4.0.0+] #ListNotCommittedContentMeta
2017 [4.0.0+] #RecoverDownloadTask
2018 [5.0.0+] #GetApplicationDeliveryInfoHash
2050 [6.0.0+] #GetApplicationRightsOnClient
2051 [9.0.0+] InvalidateRightsIdCache
2100 [6.0.0+] #GetApplicationTerminateResult
2101 [6.0.0+] GetRawApplicationTerminateResult
2150 [6.0.0+] CreateRightsEnvironment
2151 [6.0.0+] DestroyRightsEnvironment
2152 [6.0.0+] ActivateRightsEnvironment
2153 [6.0.0+] DeactivateRightsEnvironment
2154 [6.0.0+] ForceActivateRightsContextForExit
2155 [7.0.0+] UpdateRightsEnvironmentStatus
2156 [10.0.0+] CreateRightsEnvironmentForMicroApplication ([9.0.0-9.2.0] CreateRightsEnvironmentForPreomia)
2160 [6.0.0+] AddTargetApplicationToRightsEnvironment
2161 [6.0.0+] SetUsersToRightsEnvironment
2170 [6.0.0+] GetRightsEnvironmentStatus
2171 [6.0.0+] GetRightsEnvironmentStatusChangedEvent
2180 [6.0.0+] RequestExtendExpirationInRightsEnvironment
2181 [6.0.0+] GetResultOfExtendExpirationInRightsEnvironment
2182 [6.0.0+] SetActiveRightsContextUsingStateToRightsEnvironment
2190 [6.0.0+] #GetRightsEnvironmentHandleForApplication
2199 [6.0.0+] GetRightsEnvironmentCountForDebug
2200 [6.0.0-9.2.0] GetGameCardApplicationCopyIdentifier
2201 [6.0.0-9.2.0] GetInstalledApplicationCopyIdentifier
2250 [6.0.0-6.2.0] RequestReportActiveELicence
2300 [6.0.0-8.1.0] ListEventLog
2350 [7.0.0+] PerformAutoUpdateByApplicationId
2351 [9.0.0+] #RequestNoDownloadRightsErrorResolution
2352 [9.0.0+] #RequestResolveNoDownloadRightsError
2353 [10.0.0+] GetApplicationDownloadTaskInfo
2400 [8.0.0+] #GetPromotionInfo
2401 [8.0.0+] CountPromotionInfo
2402 [8.0.0+] ListPromotionInfo
2403 [8.0.0+] #ImportPromotionJsonForDebug
2404 [8.0.0+] #ClearPromotionInfoForDebug
2500 [8.0.0+] ConfirmAvailableTime
2510 [9.0.0+] #CreateApplicationResource
2511 [9.0.0+] #GetApplicationResource
2513 [10.0.0+] LaunchMicroApplication ([9.0.0-9.2.0] LaunchPreomia)
2514 [9.0.0+] ClearTaskOfAsyncTaskManager
2515 [10.0.0+] CleanupAllPlaceHolderAndFragmentsIfNoTask
2516 [10.0.0+] EnsureApplicationCertificate
2800 [9.0.0+] GetApplicationIdOfPreomia
9999 [10.0.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 ApplicationIds, no output.

On newer system-versions this is the same as #GetApplicationView, except this converts the output from the func called in the loop from #ApplicationView to #ApplicationViewDeprecated.

DeleteApplicationEntity

Takes an input ApplicationId, no output.

DeleteApplicationCompletely

Takes an input ApplicationId, no output.

DeleteRedundantApplicationEntity

No input/output.

IsApplicationEntityMovable

Takes an input u8 StorageId, an ApplicationId, returns an output u8 bool.

MoveApplicationEntity

Takes an input u8 StorageId, an ApplicationId, no output.

RequestApplicationUpdateInfo

Takes an input ApplicationId, returns an output Event handle and an #IAsyncValue.

The data that can be read from the #IAsyncValue is #ApplicationUpdateInfo.

Before using the cmd, official sw uses IsAnyInternetRequestAccepted with the output from GetClientId, throwing an error when the returned bool is false.

CancelApplicationDownload

Takes an input ApplicationId, no output.

ResumeApplicationDownload

Takes an input ApplicationId, no output.

CheckApplicationLaunchVersion

Takes an input ApplicationId, no output.

CalculateApplicationDownloadRequiredSize

Takes an input u8 StorageId, an ApplicationId, returns an output s64.

CleanupSdCard

No input/output.

GetSdCardMountStatusChangedEvent

No input, returns an output Event handle with EventClearMode=0.

GetGameCardUpdateDetectionEvent

No input, returns an output Event handle with EventClearMode=0.

DisableApplicationAutoDelete

Takes an input ApplicationId, no output.

EnableApplicationAutoDelete

Takes an input ApplicationId, no output.

SetApplicationTerminateResult

Takes an input u32 Result, an ApplicationId, no output.

ClearApplicationTerminateResult

Takes an input ApplicationId, no output.

GetLastSdCardMountUnexpectedResult

No input/output.

GetRequestServerStopper

No input, returns an output #IRequestServerStopper.

CancelApplicationApplyDelta

Takes an input ApplicationId, no output.

ResumeApplicationApplyDelta

Takes an input ApplicationId, no output.

CalculateApplicationApplyDeltaRequiredSize

Takes an input u8 StorageId, an ApplicationId, returns an output s64.

ResumeAll

No input/output.

GetStorageSize

Takes an input u8 StorageId, returns two output s64s.

This temporarily mounts the ContentStorage specified by the StorageId (must be BuiltInUser or SdCard). The two output s64s are the output from GetTotalSpaceSize and GetFreeSpaceSize with this ContentStorage, with it this being unmounted afterwards.

RequestUpdateApplication2

Takes an input ApplicationId, returns an output Event handle and an #IAsyncResult.

See #RequestApplicationUpdateInfo regarding nifm.

LaunchApplication

Takes an input u8 ProgramIndex, an input #ApplicationLaunchInfo, returns an output u64.

GetApplicationLaunchInfo

Takes an input ApplicationId, returns an output #ApplicationLaunchInfo.

AcquireApplicationLaunchInfo

Takes an input ApplicationId, returns an output #ApplicationLaunchInfo.

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.

LaunchDevMenu

No input/output.

This is used by AM cmd LaunchDevMenu.

This loads ProgramIds from system-settings ns.applet!devmenu_id and ns.applet!devoverlaydisp_id, which only exists on devunits. An error is thrown if loading these fail.

OpenContentMetaDatabase is used with StorageId = NandSystem, then IContentMetaDatabase GetLatestContentMetaKey is used with both of the above ProgramIds to verify that the cmd is successful.

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

DeleteUserSaveDataAll

Takes an input Uid, returns an output #IProgressMonitorForDeleteUserSaveDataAll.

On success, #IProgressMonitorForDeleteUserSaveDataAll GetProgress is used with the output being copied into object state.

DeleteUserSystemSaveData

Takes an input Uid, an u64 SystemSaveDataId, no output.

DeleteSaveData

Takes an input u8 SaveDataSpaceId, an u64 SaveDataId, no output.

UnregisterNetworkServiceAccount

Takes an input Uid, no output.

UnregisterNetworkServiceAccountWithUserSaveDataDeletion

Takes an input Uid, no output.

LaunchLibraryApplet

Takes an input u64 ProgramId, returns an output u64.

The specified program is launched with StorageId=BuiltInSystem via pmshell LaunchProgram ([10.0.0+] pgl with pgl_launch_flags=0). LaunchFlags value 0x9 is used here. The output u64 from here is written to the output for this cmd, on success.

This is used by AM.

LaunchSystemApplet

No input, returns an output u64.

A state flag must be 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-setting ns.applet!system_applet_id.

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

This is used by AM.

LaunchOverlayApplet

No input, returns an output u64.

A state flag must be zero, otherwise an error is thrown. The ProgramId is loaded from system-setting ns.applet!overlay_applet_id.

The OverlayApplet is launched with StorageId=BuiltInSystem via pmshell LaunchProgram ([10.0.0+] pgl with pgl_launch_flags=0). LaunchFlags value 0x9 is used here. The output u64 from here is written to the output for this cmd, on success.

This is used by AM.

RequestDownloadApplicationControlData

Takes an input ApplicationId, returns an output Event handle and an #IAsyncResult.

See #RequestApplicationUpdateInfo regarding nifm.

ListApplicationTitle

Takes an input TransferMemory handle, a type-0x5 input buffer containing an array of u64 ApplicationIds, an u8 #ApplicationControlSource, an u64 size, returns an output Event handle and an #IAsyncValue.

qlaunch uses value 0x1 for the u8.

The user-process creates the TransferMemory with permissions=R--.

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 title-entry for each specified ApplicationId.

The TransferMemory size must be at least: count*sizeof(title-entry) + count*sizeof(u64) + count*0x24000.

This is essentially an async wrapper for #GetApplicationControlData, with support for multiple ApplicationIds.

ListApplicationIcon

Takes an input TransferMemory handle, a type-0x5 input buffer containing an array of u64 ApplicationIds, an u8 #ApplicationControlSource, an u64 size, returns an output Event handle and an #IAsyncValue.

The user-process creates the TransferMemory with permissions=R--.

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.

The TransferMemory size must be at least: 0x4 + count*sizeof(u64) + count*0x20000 + count*sizeof(u64) + 0x24000.

This is essentially an async wrapper for #GetApplicationControlData, with support for multiple ApplicationIds.

RequestCheckGameCardRegistration

Takes an input ApplicationId, returns an output Event handle and an #IAsyncResult.

See #RequestApplicationUpdateInfo regarding nifm.

RequestGameCardRegistrationGoldPoint

Takes an input Uid, an ApplicationId, returns an output Event handle and an #IAsyncValue.

The data that can be read from the #IAsyncValue is 4-bytes.

See #RequestApplicationUpdateInfo regarding nifm.

RequestRegisterGameCard

Takes an input s32, an Uid, an ApplicationId, returns an output Event handle and an #IAsyncResult.

See #RequestApplicationUpdateInfo regarding nifm.

GetGameCardMountFailureEvent

No input, returns an output Event handle with EventClearMode=0.

IsGameCardInserted

No input, returns an output u8 bool.

EnsureGameCardAccess

No input/output.

GetLastGameCardMountFailureResult

No input/output.

ListApplicationIdOnGameCard

Takes a type-0x6 output buffer containing an array of u64 ApplicationIds, returns an output s32 for total output entries.

GetGameCardPlatformRegion

No input, returns an u8 GameCardPlatformRegion (0x00 = Global, 0x01 = China).

This calls fsp-srv IDeviceOperator GetGameCardCompatibilityType and returns the result.

ListAvailableAddOnContent

[10.0.0+] This now takes a total of 0x10-bytes of input instead of a total of 0x18-bytes of input.

RequestDownloadTaskListData

No input, returns an output Event handle and an #IAsyncValue.

TouchApplication

Takes an input ApplicationId, no output.

IsApplicationUpdateRequested

Takes an input ApplicationId, returns an output u8 bool and an u32.

The output u32 is only valid when the output bool is set.

WithdrawApplicationUpdateRequest

Takes an input ApplicationId, no output.

RequestVerifyApplicationDeprecated

Takes an input TransferMemory handle, an 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.

RequestVerifyAddOnContentsRights

Takes an input ApplicationId, returns an output Event handle and an #IProgressAsyncResult.

RequestVerifyApplication

Takes an input TransferMemory handle, an u32, an 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.

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.

IsAnyApplicationEntityInstalled

Takes an input ApplicationId, returns an output u8 bool.

CleanupUnavailableAddOnContents

Takes an input u64 ApplicationId, an Uid, no output.

FormatSdCard

No input/output.

NeedsSystemUpdateToFormatSdCard

No input, returns an output u8 bool.

GetLastSdCardFormatUnexpectedResult

No input/output.

GetApplicationView

Takes a type-0x6 output buffer containing an array of #ApplicationView, a type-0x5 input buffer containing an array of u64 ApplicationIds, no output.

GetApplicationViewDownloadErrorContext

Takes a type-0x16 output buffer containg an ErrorContext, an u64 ApplicationId, no output.

GetApplicationViewWithPromotionInfo

Takes a type-0x6 output buffer containing an array of #ApplicationViewWithPromotionInfo, a type-0x5 input buffer containing an array of u64 ApplicationIds, no output.

RequestDownloadApplicationPrepurchasedRights

Takes an input ApplicationId, returns an output Event handle and an #IAsyncResult.

See #RequestApplicationUpdateInfo regarding nifm.

GetSystemDeliveryInfo

Takes a type-0x16 output buffer containing a #SystemDeliveryInfo, no output.

This generates a #SystemDeliveryInfo using the currently installed SystemUpdate meta title.

SelectLatestSystemDeliveryInfo

Takes a type-0x15 input buffer containing a #SystemDeliveryInfo, a type-0x5 input buffer containing an array of #SystemDeliveryInfo, a type-0x5 input buffer containing an array of #ApplicationDeliveryInfo, and returns an output s32.

This determines the latest version from the input #ApplicationDeliveryInfo array, using value 0 if the array is empty. If this value is less than a state field, the state field value is used instead. Then this selects a #SystemDeliveryInfo with the latest version from the input array, where the minimum version is the previously mentioned value. The version must also be also be at least the version value from the type-0x15 #SystemDeliveryInfo buffer. This also does various validation, etc. The output s32 is an index in that array for the selected entry, -1 if none found.

VerifyDeliveryProtocolVersion

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.

GetApplicationDeliveryInfo

Takes a type-0x6 output buffer containing an array of #ApplicationDeliveryInfo, an input u32 bitmask nn::ns::ApplicationDeliveryAttributeTag, an ApplicationId, and returns an output s32 total_out.

An error is thrown if any bit is set in ApplicationDeliveryAttributeTag besides bit1. The output array-count must be at least 1: only 1 entry will be written to this array (hence on success total_out will also only be 1 on success).

HasAllContentsToDeliver

Takes a type-0x5 input buffer containing an array of #ApplicationDeliveryInfo, returns an output u8 bool.

The array-count must match 1. After validating the #ApplicationDeliveryInfo, the output bool is set to u32 #ApplicationDeliveryInfo+0x1C & 0x10000002 != 0x2, then this returns 0.

CompareApplicationDeliveryInfo

Takes two type-0x5 input buffers containing an array of #ApplicationDeliveryInfo, returns an output s32.

The array-count for both buffers must be 1, otherwise an error is returned.

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

CanDeliverApplication

Takes two type-0x5 input buffers containing an array of #ApplicationDeliveryInfo, returns an output u8 bool.

The array-count for the second buffer must be 1 and the array-count for the first buffer must be <=1, otherwise an error is returned. If the array-count for the first buffer is 0, this will return 0 with the output bool set to 0.

ListContentMetaKeyToDeliverApplication

Takes a type-0x6 output buffer containing an array of ContentMetaKey, a type-0x5 input buffer containing an array of #ApplicationDeliveryInfo, a s32, and returns an output s32 total_out.

The array-count for ContentMetaKey must be at least 1, and for ApplicationDeliveryInfo it must match 1.

This will only return 1 ContentMetaKey entry. This will not output the entry when the input s32 is larger than 0. This also does other validation, etc.

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.

The array-count must match 1.

After validation etc, this sets the output bool by comparing system-version fields in the #SystemDeliveryInfo/#ApplicationDeliveryInfo and with a state field.

EstimateRequiredSize

Takes a type-0x5 input buffer containing an array of ContentMetaKey, returns an output s64.

When the array-count is less than 1, this will return 0 with the s64 set to 0.

RequestReceiveApplication

Takes a type-0x5 input buffer containing an array of ContentMetaKey, a StorageId, an u16 port, an u32 Ipv4Address, an ApplicationId, returns an output Event handle and an #IAsyncResult.

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

An error is thrown if a state ref-count is zero. An error is thrown if nim ListApplicationApplyDeltaTask returns a task.

This loops through the input ContentMetaKey array, throwing an error if the ContentMetaType doesn't match Patch. The input array is copied into state which is used later by the thread for nim cmd53, max entries is 0x12.

This does various setup then creates the #IAsyncResult + the async thread which handles the #IAsyncResult operation. Then the thread does:

  • Calls a func which does:
    • Throws an error if a state flag is set.
    • Uses nim cmd53, returning the Result on failure.
    • Uses 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-setting "systemreport!enabled" is set.
    • The EventId is "receive_app_contents" with ApplicationId <NS ProgramId>.

CommitReceiveApplication

Takes an input ApplicationId, no output.

GetReceiveApplicationProgress

Takes an input ApplicationId, returns an output #ReceiveApplicationProgress.

An error is thrown if a state ref-count is zero. An error is thrown if nim ListApplicationApplyDeltaTask returns a task.

Uses nim cmd67, throwing an error if no task is returned. Then nim cmd57 is used, returning the error from there on failure. Lastly, this writes the 0x10-bytes from output+8 from the latter cmd to the output #ReceiveApplicationProgress, and returns 0.

RequestSendApplication

Takes a type-0x5 input buffer containing an array of ContentMetaKey, an u16 port, an u32 Ipv4Address, an ApplicationId, returns an output Event handle and an #IAsyncResult.

qlaunch uses value 55556 for the port.

An error is thrown if a state ref-count is zero. An error is thrown if nim ListApplicationApplyDeltaTask returns a task.

The ContentMetaType must match Patch.

This does various setup and selects a ContentMetaKey to use from the input, then creates the #IAsyncResult + the async thread which handles the #IAsyncResult operation. Then the thread does:

  • Calls a func which does:
    • Throws an error if a state flag is set.
    • Uses nim cmd60, returning the Result on failure.
    • Uses 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-setting "systemreport!enabled" is set.
    • The EventId is "send_app_contents" with ApplicationId <NS ProgramId>.

GetSendApplicationProgress

Takes an input ApplicationId, returns an output #SendApplicationProgress.

Same as #GetReceiveApplicationProgress except this is the Send version, and uses nim cmd68/cmd63 instead.

CompareSystemDeliveryInfo

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.

ListNotCommittedContentMeta

Takes a type-0x6 output buffer containing an array of ContentMetaKey, a s32, an ApplicationId, returns an output s32 total_out.

RecoverDownloadTask

Takes a type-0x5 input buffer containing an array of {unknown} and an input u64, no output.

GetApplicationDeliveryInfoHash

Takes a type-0x5 input buffer containing an array of #ApplicationDeliveryInfo, returns an output 0x20-byte SHA256 hash.

This extracts data from the input array for hashing with SHA256, with validation being done when handling each entry.

GetApplicationRightsOnClient

Takes a type-0x6 output buffer containing an array of #ApplicationRightsOnClient, an input u32 flags, an ApplicationId, an 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.

For the output array count, qlaunch uses value 3.

GetApplicationTerminateResult

Takes an input ApplicationId, returns an output u32 Result.

GetRightsEnvironmentHandleForApplication

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.

RequestNoDownloadRightsErrorResolution

Takes an input ApplicationId, returns an output Event handle and an #IAsyncValue.

The data that can be read from the #IAsyncValue is #NoDownloadRightsErrorResolution.

See #RequestApplicationUpdateInfo regarding nifm.

RequestResolveNoDownloadRightsError

Takes an input ApplicationId, returns an output Event handle and an #IAsyncValue.

The data that can be read from the #IAsyncValue is #NoDownloadRightsErrorResolution.

See #RequestApplicationUpdateInfo regarding nifm.

GetPromotionInfo

Takes a type-0x6 output buffer containing an array of #PromotionInfo, a type-0x5 input buffer containing an array of u64 ApplicationIds, a type-0x5 input buffer containing an array of Uids, no output.

Official sw uses hard-coded value 1 for the count with each of these arrays.

ImportPromotionJsonForDebug

Takes a type-0x5 input buffer, no output.

The output from Settings_services#GetDebugModeFlag must be 1, otherwise an error is returned.

ClearPromotionInfoForDebug

No input/output.

The output from Settings_services#GetDebugModeFlag must be 1, otherwise an error is returned.

This just clears 0xC-bytes in state.

CreateApplicationResource

Returns an #IApplicationResource.

GetApplicationResource

Returns an #IApplicationResource.

IGameCardStopper

This is "nn::ns::detail::IGameCardStopper".

This interface has no commands.

IRequestServerStopper

This is "nn::ns::detail::IRequestServerStopper".

This interface has no commands.

IProgressMonitorForDeleteUserSaveDataAll

This is "nn::ns::detail::IProgressMonitorForDeleteUserSaveDataAll".

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.

  • 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.

IProgressAsyncResult

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

Cmd Name
0 Get
1 Cancel
2 GetProgress
3 GetDetailResult
4 [4.0.0+] GetErrorContext

IApplicationVersionInterface

This is "nn::ns::detail::IApplicationVersionInterface".

This was added with [4.0.0+].

Cmd Name
0 GetLaunchRequiredVersion
1 UpgradeLaunchRequiredVersion
35 UpdateVersionList
36 PushLaunchVersion
37 ListRequiredVersion
800 RequestVersionList
801 ListVersionList
802 #RequestVersionListData
1000 PerformAutoUpdate

RequestVersionListData

No input, returns an output Event handle and an #IAsyncValue.

The data that can be read from the #IAsyncValue is #VersionListData.

IContentManagementInterface

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

Cmd Name
11 #CalculateApplicationOccupiedSize
43 #CheckSdCardMountStatus
47 #GetTotalSpaceSize
48 #GetFreeSpaceSize
600 #CountApplicationContentMeta
601 #ListApplicationContentMetaStatus
605 #ListApplicationContentMetaStatusWithRightsCheck
607 #IsAnyApplicationRunning

CalculateApplicationOccupiedSize

Takes an input ApplicationId, returns an output #ApplicationOccupiedSize.

CheckSdCardMountStatus

No input/output.

CountApplicationContentMeta

Takes an input ApplicationId, returns an output s32.

ListApplicationContentMetaStatusWithRightsCheck

Same input/output as #ListApplicationContentMetaStatus.

IsAnyApplicationRunning

No input, returns an output u8 bool.

IDocumentInterface

This is "nn::ns::detail::IDocumentInterface".

Cmd Name
21 GetApplicationContentPath
23 ResolveApplicationContentPath
92 [5.0.0+] GetRunningApplicationProgramId

IDownloadTaskInterface

This is "nn::ns::detail::IDownloadTaskInterface".

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

No input/output.

RequestDownloadTaskList

No input/output.

RequestEnsureDownloadTask

No input, returns an output Event handle and an #IAsyncResult.

ListDownloadTaskStatus

Takes a type-0x6 output buffer containing an array of #DownloadTaskStatus, returns an output s32 total_out.

A maximum of 0x100 tasks can be stored in state.

TryCommitCurrentApplicationDownloadTask

No input/output.

EnableAutoCommit

No input/output.

DisableAutoCommit

No input/output.

TriggerDynamicCommitEvent

No input/output.

IReadOnlyApplicationRecordInterface

This is "nn::ns::detail::IReadOnlyApplicationRecordInterface".

This was added with [5.0.0+].

Cmd Name Notes
0 HasApplicationRecord Same as #IApplicationManagerInterface cmd 910
1 [10.0.0+] NotifyApplicationFailure
2 [10.0.0+] IsDataCorruptedResult

IReadOnlyApplicationControlDataInterface

This is "nn::ns::detail::IReadOnlyApplicationControlDataInterface".

This was added with [5.1.0+].

Cmd Name Notes
0 #GetApplicationControlData Same as #IApplicationManagerInterface cmd 400
1 #GetApplicationDesiredLanguage Same as #IApplicationManagerInterface cmd 55
2 ConvertApplicationLanguageToLanguageCode Same as #IApplicationManagerInterface cmd 59
3 #ConvertLanguageCodeToApplicationLanguage Same as #IApplicationManagerInterface cmd 60
4 [9.0.0+] SelectApplicationDesiredLanguage

IDynamicRightsInterface

This is "nn::ns::detail::IDynamicRightsInterface".

This was added with [6.0.0+].

Cmd Name
0 #RequestApplicationRightsOnServer
1 #RequestAssignRights
4 #DeprecatedRequestAssignRightsToResume
5 #VerifyActivatedRightsOwners
6 #DeprecatedGetApplicationRightsStatus
7 #RequestPrefetchForDynamicRights
8 #GetDynamicRightsState
9 [7.0.0+] #RequestApplicationRightsOnServerToResume
10 [7.0.0+] #RequestAssignRightsToResume
11 [7.0.0+] #GetActivatedRightsUsers
12 [8.0.0+] #GetApplicationRightsStatus
13 [8.0.0+] #GetRunningApplicationStatus
14 [10.0.0+] SelectApplicationLicense

RequestApplicationRightsOnServer

Takes an input ApplicationId, an Uid and an u32. Returns an output Event handle and an #IAsyncValue.

RequestAssignRights

Takes a type-0x5 input buffer containing an array of "nn::ns::ApplicationRightsOnServer". Returns an output Event handle and an #IAsyncResult.

DeprecatedRequestAssignRightsToResume

Takes an input u64 "nn::ns::RightsEnvironmentHandle" and an Uid. Returns an output Event handle and an #IAsyncResult.

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 Uid. Returns an output Event handle and an #IAsyncResult.

GetDynamicRightsState

No input. Returns a bool "nn::ns::DynamicRightsState".

RequestApplicationRightsOnServerToResume

Takes an input u64 "nn::ns::RightsEnvironmentHandle". Returns an output Event handle and an #IAsyncValue.

RequestAssignRightsToResume

Takes an input u64 "nn::ns::RightsEnvironmentHandle". Returns an output Event handle and an #IAsyncResult.

GetActivatedRightsUsers

Takes an input u64 "nn::ns::RightsEnvironmentHandle". Returns a bool, an u32 and a type-0x6 output buffer containing an array of Uid.

GetApplicationRightsStatus

Takes an input "nn::ns::RightsEnvironmentHandle". Returns 2 bools "nn::ns::ApplicationRightsStatus" and "nn::ns::ApplicationLicenseType".

GetRunningApplicationStatus

Takes an input u64 "nn::ns::RightsEnvironmentHandle". Returns an u32 "nn::ns::RunningApplicationStatus".

IECommerceInterface

This is "nn::ns::detail::IECommerceInterface".

This was added with [4.0.0+].

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

RequestLinkDevice

Takes an input Uid, returns an output Event handle and an #IAsyncResult.

See #RequestApplicationUpdateInfo regarding nifm.

RequestCleanupAllPreInstalledApplications

No input, returns an output Event handle and an #IAsyncResult.

RequestCleanupPreInstalledApplication

Takes an input ApplicationId, returns an output Event handle and an #IAsyncResult.

RequestSyncRights

No input, returns an output Event handle and an #IAsyncResult.

RequestUnlinkDevice

Takes an input Uid, returns an output Event handle and an #IAsyncResult.

See #RequestApplicationUpdateInfo regarding nifm.

RequestRevokeAllELicense

Takes an input Uid, returns an output Event handle and an #IAsyncResult.

RequestSyncRightsBasedOnAssignedELicenses

No input, returns an output Event handle and an #IAsyncResult.

IFactoryResetInterface

This is "nn::ns::detail::IFactoryResetInterface".

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

ResetToFactorySettings

No input/output.

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

ResetToFactorySettingsWithoutUserSaveData

No input/output.

ResetToFactorySettingsForRefurbishment

No input/output.

ResetToFactorySettingsWithPlatformRegion

No input/output.

ResetToFactorySettingsWithPlatformRegionAuthentication

No input/output.

RequestResetToFactorySettingsSecurely

Takes a total of 8-bytes of input, a handle, returns an output #IAsyncValueAndProgress and a handle.

RequestResetToFactorySettingsWithPlatformRegionAuthenticationSecurely

Takes a total of 0x10-bytes of input, a handle, returns an output #IAsyncValueAndProgress and a handle.

IAsyncValueAndProgress

This is "nn::ns::detail::IAsyncValueAndProgress".

This was added with [10.0.0+].

Cmd Name
0 GetSize
1 Get
2 Cancel
3 GetErrorContext
4 GetProgress

IApplicationResource

This is "nn::ns::detail::IApplicationResource".

This was added with [9.0.0+].

Cmd Name
0 Attach
1 BoostSystemMemoryResourceLimit

ns:vm

This is "nn::ns::detail::IVulnerabilityManagerInterface".

Cmd Name
1200 [3.0.0+] #NeedsUpdateVulnerability
1201 [4.0.0+] #UpdateSafeSystemVersionForDebug
1202 [4.0.0+] #GetSafeSystemVersion

NeedsUpdateVulnerability

No input, returns an output u8 bool flag.

Web-applets use this command to check if the system needs an update.

UpdateSafeSystemVersionForDebug

Takes an input ApplicationId and an u32 version.

This command is not available for retail units. On a debug unit, if the system setting vulnerability!enable_debug is set, this mounts the system savegame 0x8000000000000049 as "ns_ssversion:/", opens the file "ns_ssversion:/entry" and writes the supplied ApplicationId and version in it.

Finally, it calls OpenContentMetaDatabase with StorageId 3, then calls GetLatestContentMetaKey with the supplied ApplicationId and compares the version field from the returned Content Meta Record with the supplied version.

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

GetSafeSystemVersion

No input, returns an output ContentMetaKey with the cached contents of "ns_ssversion:/entry" (ApplicationId, u32 version and u32 policy from vulnerability!needs_update_vulnerability_policy).

ns:su

This is "nn::ns::detail::ISystemUpdateInterface".

Cmd Name
0 #GetBackgroundNetworkUpdateState
1 #OpenSystemUpdateControl
2 #NotifyExFatDriverRequired
3 #ClearExFatDriverStatusForDebug
4 #RequestBackgroundNetworkUpdate
5 #NotifyBackgroundNetworkUpdate
6 #NotifyExFatDriverDownloadedForDebug
9 #GetSystemUpdateNotificationEventForContentDelivery
10 #NotifySystemUpdateForContentDelivery
11 [3.0.0+] #PrepareShutdown
12 [3.0.0-3.0.2]
13 [3.0.0-3.0.2]
14 [3.0.0-3.0.2]
15 [3.0.0-3.0.2]
16 [4.0.0+] #DestroySystemUpdateTask
17 [4.0.0+] #RequestSendSystemUpdate
18 [4.0.0+] #GetSendSystemUpdateProgress

GetBackgroundNetworkUpdateState

No input, returns an output #BackgroundNetworkUpdateState.

This is similar to #HasDownloaded, see #BackgroundNetworkUpdateState.

OpenSystemUpdateControl

No input, returns an #ISystemUpdateControl.

NotifyExFatDriverRequired

No input/output.

Only usable when an #ISystemUpdateControl isn't open.

This uses nim ListSystemUpdateTask, then when a task is returned uses it with DestroySystemUpdateTask.

Then this runs ExFat handling, updates state, and sets the same state flag as #RequestBackgroundNetworkUpdate.

ClearExFatDriverStatusForDebug

No input/output.

RequestBackgroundNetworkUpdate

No input/output.

Only usable when an #ISystemUpdateControl isn't open.

This sets a state flag to value 1.

NotifyBackgroundNetworkUpdate

Takes an input ContentMetaKey, no output.

This checks whether a sysupdate is needed with the input ContentMetaKey using NCM commands, if not this will just return 0. Otherwise, this will then run code which is identical to #RequestBackgroundNetworkUpdate.

NotifyExFatDriverDownloadedForDebug

No input/output.

GetSystemUpdateNotificationEventForContentDelivery

No input, returns an output Event handle with EventClearMode=0.

NotifySystemUpdateForContentDelivery

No input/output.

Signals the Event returned by #GetSystemUpdateNotificationEventForContentDelivery.

PrepareShutdown

No input/output.

This is used by 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.

Only usable when an #ISystemUpdateControl isn't open.

This uses 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 will use the input addr/port with bind(). During accept() handling the addr from there must match the input addr. Hence, addr must be the client addr. NIM will also eventually verify that the system is not Internet-connected.

This validates the #SystemDeliveryInfo and generates a 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 cmd76, returning the Result on failure.
    • Uses 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

Cmd Name
0 #HasDownloaded
1 #RequestCheckLatestUpdate
2 #RequestDownloadLatestUpdate
3 #GetDownloadProgress
4 #ApplyDownloadedUpdate
5 #RequestPrepareCardUpdate
6 #GetPrepareCardUpdateProgress
7 #HasPreparedCardUpdate
8 #ApplyCardUpdate
9 #GetDownloadedEulaDataSize
10 #GetDownloadedEulaData
11 #SetupCardUpdate
12 #GetPreparedCardUpdateEulaDataSize
13 #GetPreparedCardUpdateEulaData
14 [4.0.0+] #SetupCardUpdateViaSystemUpdater
15 [4.0.0+] #HasReceived
16 [4.0.0+] #RequestReceiveSystemUpdate
17 [4.0.0+] #GetReceiveProgress
18 [4.0.0+] #ApplyReceivedUpdate
19 [4.0.0+] #GetReceivedEulaDataSize
20 [4.0.0+] #GetReceivedEulaData
21 [4.0.0+] #SetupToReceiveSystemUpdate
22 [6.0.0+] #RequestCheckLatestUpdateIncludesRebootlessUpdate

Only 1 ISystemUpdateControl can be open at a time.

All Card cmds except SetupCardUpdate* require #SetupCardUpdate/#SetupCardUpdateViaSystemUpdater to be used previously. #GetPreparedCardUpdateEulaDataSize/#GetPreparedCardUpdateEulaData checks a different state flag.

HasDownloaded

No input, returns an output u8 bool flag.

Gets whether a network sysupdate was downloaded, with install pending.

Uses nim ListSystemUpdateTask and nim GetSystemUpdateTaskInfo. When ListSystemUpdateTask successfully returns a task and GetSystemUpdateTaskInfo is successful, the output flag is set to: *((u8*)(taskinfo+0) == 0x3. Otherwise, flag=0.

This always returns 0, however this will assert if GetSystemUpdateTaskInfo fails with ret!=0x3C89.

RequestCheckLatestUpdate

No input, returns an output Event handle and an #IAsyncValue.

The data that can be read from the #IAsyncValue is #LatestSystemUpdate.

RequestDownloadLatestUpdate

No input, returns an output Event handle and an #IAsyncResult.

GetDownloadProgress

No input, returns an output #SystemUpdateProgress.

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.

ApplyDownloadedUpdate

No input/output.

Runs code similar to #HasDownloaded, throwing an error if a network sysupdate isn't ready for install. Then the sysupdate is installed:

  • Uses ListSystemUpdateTask again, then nim IsExFatDriverIncluded. Runs ExFat handling when the output flag is set.
  • On newer system-versions, this uses nim GetSystemUpdateTaskInfo then on success uses data from there to save a SystemPlayReport when the cached 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 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 CommitSystemUpdateTask and 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 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.

GetPrepareCardUpdateProgress

No input, returns an output #SystemUpdateProgress.

HasPreparedCardUpdate

No input, returns an output u8 bool flag.

ApplyCardUpdate

No input/output.

GetDownloadedEulaDataSize

Takes a type-0x15 input buffer #EulaDataPath, returns an output u64 filesize.

Runs code similar to #HasDownloaded, throwing an error if a network sysupdate isn't ready for install.

Uses ListSystemUpdateTask again. Then nim GetDownloadedSystemDataPath, with the output ContentPath being used to mount the EULA title with FS.

Then "<mountname>:/<#EulaDataPath>" is opened, gets the filesize, then runs cleanup.

GetDownloadedEulaData

Takes a type-0x15 input buffer #EulaDataPath and a type-0x6 output buffer, returns an output u64 filesize.

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.

SetupCardUpdate

Takes an input u64 size and a TransferMemory handle, no output.

Official sw creates the TransferMemory with an user-specified buffer, with permissions=None.

qlaunch uses size 0x100000 for the TransferMemory buffer.

GetPreparedCardUpdateEulaDataSize

Takes a type-0x15 input buffer #EulaDataPath, returns an output u64 filesize.

This is similar to #GetDownloadedEulaDataSize.

GetPreparedCardUpdateEulaData

Takes a type-0x15 input buffer #EulaDataPath and a type-0x6 output buffer, returns an output u64 filesize.

This is similar to #GetDownloadedEulaData.

SetupCardUpdateViaSystemUpdater

Takes an input u64 size and a TransferMemory handle, no output.

The permissions for the TransferMemory is None.

Same as #SetupCardUpdate, except this doesn't have the code for GetGameCardHandle/GetGameCardUpdatePartitionInfo, and uses OpenRegisteredUpdatePartition instead of OpenGameCardFileSystem. This uses the same is_initialized bool state flag.

HasReceived

No input, returns an output u8 bool.

Same as #HasDownloaded except this uses nim cmd71 and cmd73.

RequestReceiveSystemUpdate

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 the same value for the port as #RequestSendSystemUpdate (see #RequestSendSystemUpdate for addr as well).

NIM will use the input addr/port with connect().

This validates the #SystemDeliveryInfo and generates a ContentMetaKey from that, and creates the #IAsyncResult + the async thread which handles the #IAsyncResult operation. Then the thread does:

  • Calls a func which does:
    • Throws an error if ListSystemUpdateTask returns any task.
    • Checks whether a sysupdate is actually required using the previously generated ContentMetaKey, throwing an error if not.
    • Uses nim cmd69, returning the Result on failure.
    • Uses 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.
    • Handles cleanup and returns.
  • On success, this loads various data which is then used for saving a SystemPlayReport when the cached system-setting "systemreport!enabled" is set.
    • The EventId is "receive_system_update" with ApplicationId <NS ProgramId>.
    • This report has the following fields:
      • "SourceSystemUpdateId"
      • "DestinationSystemUpdateId"
      • "SourceSystemUpdateVersion"
      • "DestinationSystemUpdateVersion"
      • "SenderFirmwareVariationId"
      • "ReceiverFirmwareVariationId"
      • "SenderPlatformRegion"
      • "ReceiverPlatformRegion"
      • "SenderHasExFat"
      • "ReceiverHasExFat"
      • "Size"
      • "ThroughputKBps"

GetReceiveProgress

No input, returns an output #SystemUpdateProgress.

Same as #GetDownloadProgress except this uses nim cmd71 and cmd73.

ApplyReceivedUpdate

No input/output.

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 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".

Cmd Name
0 GetSize
1 Get
2 Cancel
3 [4.0.0+] GetErrorContext

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.

  • GetSize: No input, returns an output u64.
  • 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 ErrorContext.

IAsyncResult

This is "nn::ns::detail::IAsyncResult".

Cmd Name
0 Get
1 Cancel
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 ErrorContext.

ns:dev

This is "nn::ns::detail::IDevelopInterface".

[10.0.0+] Some of these cmds were replaced by the pgl system module.

Cmd Name
0 [1.0.0-9.2.0] #LaunchProgram
1 #TerminateProcess
2 [1.0.0-9.2.0] #TerminateProgram
4 [1.0.0-9.2.0] #GetShellEvent
5 [1.0.0-9.2.0] #GetShellEventInfo
6 #TerminateApplication
7 [1.0.0-9.2.0] #PrepareLaunchProgramFromHost
8 [10.0.0+] #LaunchApplicationFromHost ([1.0.0-9.2.0] #LaunchApplicationForDevelop)
9 #LaunchApplicationWithStorageIdForDevelop
10 [6.0.0-8.1.0] #IsSystemMemoryResourceLimitBoosted
11 [6.0.0+] #GetRunningApplicationProcessIdForDevelop
12 [6.0.0+] #SetCurrentApplicationRightsEnvironmentCanBeActiveForDevelop
13 [9.0.0+] #CreateApplicationResourceForDevelop
14 [9.0.0+] #IsPreomiaForDevelop
15 [10.0.0+] #GetApplicationProgramIdFromHost

LaunchProgram

Wrapper for "pm:shell" LaunchProcess.

TerminateProcess

Wrapper for "pm:shell" TerminateProcess.

TerminateProgram

Wrapper for "pm:shell" TerminateProgram.

GetShellEvent

Wrapper for "pm:shell" GetProcessEventHandle.

GetShellEventInfo

Wrapper for "pm:shell" GetProcessEventInfo.

TerminateApplication

Calls "pm:shell" GetApplicationProcessIdForShell and sends the ProcessId to TerminateProcess.

PrepareLaunchProgramFromHost

Takes a type-0x5 input buffer containing the ContentPath, returns an output 0x10-byte struct.

Calls IPathResolverForStorage Set...NcaPath functions.

LaunchApplicationForDevelop

Takes an input u32 LaunchFlags and ApplicationId, returns an output u64 ProcessId.

Same as #LaunchApplicationWithStorageIdForDevelop except the last two params passed to the internal vtable funcptr call are value 0x6, instead of from the command input.

LaunchApplicationFromHost

Takes an input u32 LaunchFlags and a type-0x5 input buffer containing the ContentPath. Returns an output u64 ProcessId.

LaunchApplicationWithStorageIdForDevelop

Takes 2 input u8 StorageIds, an u32 LaunchFlags, and an ApplicationId. Returns an output u64 ProcessId.

Launches an application title which is registered with NS.

IsSystemMemoryResourceLimitBoosted

No input. Returns a bool.

GetRunningApplicationProcessIdForDevelop

Returns an output u64 ProcessId.

SetCurrentApplicationRightsEnvironmentCanBeActiveForDevelop

Takes an input bool. No output.

CreateApplicationResourceForDevelop

Takes an input u32 (1 = Preomia/MicroApplication). Returns an #IApplicationResource.

IsPreomiaForDevelop

Takes an input u64 ProgramId. Returns a bool.

GetApplicationProgramIdFromHost

Takes a type-0x5 input buffer containing the ContentPath. Returns an u64 ProgramId.

VersionListData

This is "nn::ns::VersionListData".

ApplicationUpdateInfo

This is "nn::ns::ApplicationUpdateInfo".

This is an u8. qlaunch just checks whether this is 0.

ApplicationOccupiedSize

This is "nn::ns::ApplicationOccupiedSize". This is a 0x80-byte struct.

ProgressForDeleteUserSaveDataAll

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

ApplicationViewDeprecated

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

This is converted from #ApplicationView by #GetApplicationViewDeprecated on newer system-versions as follows:

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.

ApplicationView

This is "nn::ns::ApplicationView". This is a 0x50-byte struct.

Offset Size Description
0x0 0x8 ApplicationId
0x8 0x4 ?
0xC 0x4 Flags
0x10 0x40 ?

ApplicationViewWithPromotionInfo

This is a 0x70-byte struct.

Offset Size Description
0x0 0x50 #ApplicationView
0x50 0x20 #PromotionInfo

PromotionInfo

This is a 0x20-byte struct.

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

NoDownloadRightsErrorResolution

This is "nn::ns::NoDownloadRightsErrorResolution".

BackgroundNetworkUpdateState

Value Description
0 No sysupdate task exists.
1 Sysupdate download in progress.
2 Sysupdate ready, pending install.

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

Similar to #HasDownloaded, #GetBackgroundNetworkUpdateState uses nim ListSystemUpdateTask and nim GetSystemUpdateTaskInfo. When ListSystemUpdateTask successfully returns a task and GetSystemUpdateTaskInfo is successful, the output value is set to: 1 + *((u8*)(taskinfo+0) == 0x3. Otherwise, value=0.

#GetBackgroundNetworkUpdateState always returns Result 0, however this will assert if GetSystemUpdateTaskInfo fails with ret!=0x3C89.

SystemUpdateProgress

Offset Size Description
0x0 0x8 s64 Current size. This value can be larger than total_size when the async operation is finishing. 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 s64 Total size, this field is only valid when >0.

This is "nn::ns::SystemUpdateProgress". This is a 0x10-byte struct.

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

Offset Size Description
0x0 0x4 SystemDeliveryProtocolVersion. Must be <= to and match system-setting contents_delivery!system_delivery_protocol_version.
0x4 0x4 ApplicationDeliveryProtocolVersion. Loaded from system-setting contents_delivery!application_delivery_protocol_version. Unused by #RequestSendSystemUpdate/#RequestReceiveSystemUpdate, besides HMAC validation.
0x8 0x1 HasExFat. Unused by #RequestSendSystemUpdate/#RequestReceiveSystemUpdate, besides HMAC validation.
0x9 0x3 Reserved.
0xC 0x4 SystemUpdateMetaVersion.
0x10 0x8 SystemUpdateMetaId.
0x18 0x1 FirmwareVariationId. Used by #RequestSendSystemUpdate.
0x19 0x1 UpdatableFirmwareGroupId. Unused by #RequestSendSystemUpdate/#RequestReceiveSystemUpdate, besides HMAC validation.
0x1A 0x1 PlatformRegion (0x00 = Unknown, 0x01 = Global, 0x02 = China).
0x1B 0xC5 Unused by #RequestSendSystemUpdate/#RequestReceiveSystemUpdate, besides HMAC validation.
0xE0 0x20 HMAC-SHA256 over the previous 0xE0-bytes.

This is "nn::ns::SystemDeliveryInfo". This is a 0x100-byte struct.

ApplicationDeliveryInfo

Offset Size Description
0x0 0x8 ?
0x8 0x8 ApplicationId.
0x10 0x4 ApplicationVersion.
0x14 0x4 ?
0x18 0x4 RequiredSystemVersion.
0x1C 0x4 ?
0x20 0xC0 ?
0xE0 0x20 HMAC-SHA256 over the previous 0xE0-bytes. Uses a different key than #SystemDeliveryInfo.

This is "nn::ns::ApplicationDeliveryInfo". This is a 0x100-byte struct.

LatestSystemUpdate

Value Description
1 Unknown.
2 Unknown.
Other values Unknown.

This is "nn::ns::LatestSystemUpdate". This is an u8.

ReceiveApplicationProgress

This is "nn::ns::ReceiveApplicationProgress". This is a 0x10-byte struct.

SendApplicationProgress

This is "nn::ns::SendApplicationProgress". This is a 0x10-byte struct.

ApplicationRightsOnClient

This is a 0x20-byte struct.

qlaunch only uses +0x18/+0x19 in this struct.

Offset Size Description
0x0 0x8 ApplicationId
0x8 0x10 Uid
0x18 0x1 Flags, qlaunch only uses bit0-bit4 and bit7.
0x19 0x1 Flags, qlaunch only uses bit0.
0x1A 0x6 Unknown

DownloadTaskStatus

This is "nn::ns::DownloadTaskStatus". This is a 0x20-byte struct.

ApplicationLaunchInfo

This is a 0x40-byte struct.

Offset Size Description
0x0 0x8 ApplicationId
0x8 0x4 Application version
0xC 0x4 LaunchFlags, set to hard-coded value 0xB by #GetApplicationLaunchInfo.
0x10 0x1 Application StorageId
0x11 0x1 Update StorageId
0x12 0x2E