Applet Manager services: Difference between revisions

Add PerformanceConfigurationChanged (thanks liamwhite)
No edit summary
 
(45 intermediate revisions by 3 users not shown)
Line 11: Line 11:
|-
|-
| 100 || OpenSystemAppletProxy || Returns an [[#ISystemAppletProxy]].
| 100 || OpenSystemAppletProxy || Returns an [[#ISystemAppletProxy]].
|-
| 110 || [20.0.0+] ||
|-
|-
| 200 || OpenLibraryAppletProxyOld ([1.0.0-2.3.0] OpenLibraryAppletProxy) || Returns an [[#ILibraryAppletProxy]].
| 200 || OpenLibraryAppletProxyOld ([1.0.0-2.3.0] OpenLibraryAppletProxy) || Returns an [[#ILibraryAppletProxy]].
Line 23: Line 25:
|-
|-
| 410 || [6.0.0+] [[#GetSystemAppletControllerForDebug]] ||  
| 410 || [6.0.0+] [[#GetSystemAppletControllerForDebug]] ||  
|-
| 450 || [19.0.0+] [[#GetSystemProcessCommonFunctions]] ||
|-
| 460 || [20.0.0+] || Returns an [[#IAppletAlternativeFunctions]].
|-
|-
| 1000 || [6.0.0+] [[#GetDebugFunctions]] ||  
| 1000 || [6.0.0+] [[#GetDebugFunctions]] ||  
Line 58: Line 64:


The cached value loaded from [[System_Settings|system-setting]] <code>am.debug!dev_function</code> must be set to 0x1 with size 0x1, and various state checks must pass, otherwise 0 is returned with no output interface.
The cached value loaded from [[System_Settings|system-setting]] <code>am.debug!dev_function</code> must be set to 0x1 with size 0x1, and various state checks must pass, otherwise 0 is returned with no output interface.
== GetSystemProcessCommonFunctions ==
No input. Returns an [[#ISystemProcessCommonFunctions]].


== GetDebugFunctions ==
== GetDebugFunctions ==
Line 124: Line 133:
|-
|-
| 51 || [16.0.0+] [[#LaunchStarter]]
| 51 || [16.0.0+] [[#LaunchStarter]]
|-
| 60 || [19.0.0+]
|-
| 61 || [19.0.0+]
|-
|-
| 100 || [6.0.0+] [[#PopRequestLaunchApplicationForDebug]]
| 100 || [6.0.0+] [[#PopRequestLaunchApplicationForDebug]]
Line 388: Line 401:
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Cmd || Name || Notes
! Cmd || Name
|-
| 0 || [[#GetAppletStateChangedEvent]]
|-
| 1 || [[#IsCompleted]]
|-
| 10 || [[#Start]]
|-
|-
| 0 || [[#GetAppletStateChangedEvent]] ||
| 20 || [[#RequestExit]]
|-
|-
| 1 || [[#IsCompleted]] ||
| 25 || [[#Terminate]]
|-
|-
| 10 || [[#Start]] ||
| 30 || [[#GetResult]]
|-
|-
| 20 || [[#RequestExit]] ||
| 101 || [[#RequestForApplicationToGetForeground]]  
|-
|-
| 25 || [[#Terminate]] ||
| 110 || [[#TerminateAllLibraryApplets]]
|-
|-
| 30 || [[#GetResult]] ||
| 111 || [[#AreAnyLibraryAppletsLeft]]  
|-
|-
| 101 || [[#RequestForApplicationToGetForeground]] ||
| 112 || [[#GetCurrentLibraryApplet]]  
|-
|-
| 110 || [[#TerminateAllLibraryApplets]] ||
| 120 || [[#GetApplicationId]]
|-
|-
| 111 || [[#AreAnyLibraryAppletsLeft]] ||
| 121 || [[#PushLaunchParameter]]  
|-
|-
| 112 || [[#GetCurrentLibraryApplet]] ||
| 122 || [[#GetApplicationControlProperty]]  
|-
|-
| 120 || [[#GetApplicationId]] ||
| 123 || [2.0.0+] [[#GetApplicationLaunchProperty]]  
|-
|-
| 121 || [[#PushLaunchParameter]] ||
| 124 || [6.0.0+] [[#GetApplicationLaunchRequestInfo]]  
|-
|-
| 122 || [[#GetApplicationControlProperty]] ||
| 130 || [6.0.0+] [[#SetUsers]]
|-
|-
| 123 || [2.0.0+] [[#GetApplicationLaunchProperty]] ||
| 131 || [6.0.0+] [[#CheckRightsEnvironmentAvailable]]
|-
|-
| 124 || [6.0.0+] [[#GetApplicationLaunchRequestInfo]] ||
| 132 || [6.0.0+] [[#GetNsRightsEnvironmentHandle]]  
|-
|-
| 130 || [6.0.0+] [[#SetUsers]] ||
| 140 || [6.0.0+] [[#GetDesirableUids]]
|-
|-
| 131 || [6.0.0+] [[#CheckRightsEnvironmentAvailable]] ||
| 150 || [6.0.0+] [[#ReportApplicationExitTimeout]]  
|-
|-
| 132 || [6.0.0+] [[#GetNsRightsEnvironmentHandle]] ||
| 160 || [8.0.0+] [[#SetApplicationAttribute]]
|-
|-
| 140 || [6.0.0+] [[#GetDesirableUids]] ||
| 170 || [8.0.0+] [[#HasSaveDataAccessPermission]]
|-
|-
| 150 || [6.0.0+] [[#ReportApplicationExitTimeout]] ||
| 180 || [9.0.0+] [[#PushToFriendInvitationStorageChannel]]
|-
|-
| 160 || [8.0.0+] [[#SetApplicationAttribute]] ||
| 190 || [9.0.0+] [[#PushToNotificationStorageChannel]]
|-
|-
| 170 || [8.0.0+] [[#HasSaveDataAccessPermission]] ||
| 200 || [10.0.0+] [[#RequestApplicationSoftReset]]
|-
|-
| 180 || [9.0.0+] [[#PushToFriendInvitationStorageChannel]] ||
| 201 || [10.0.0+] [[#RestartApplicationTimer]]
|-
|-
| 190 || [9.0.0+] [[#PushToNotificationStorageChannel]] ||
| 300 || [20.0.0+]
|-
|-
| 200 || [10.0.0+] [[#RequestApplicationSoftReset]] ||
| 301 || [20.0.0+]
|-
|-
| 201 || [10.0.0+] [[#RestartApplicationTimer]] ||
| 310 || [21.0.0+]
|}
|}


Line 605: Line 624:
|-
|-
| 81 || [14.0.0+] SetHandlingCaptureButtonLongPressedMessageEnabledForApplet
| 81 || [14.0.0+] SetHandlingCaptureButtonLongPressedMessageEnabledForApplet
|-
| 82 || [18.0.0+] SetBlockingCaptureButtonInEntireSystem
|-
|-
| 90 || [15.0.0+] OpenNamedChannelAsParent
| 90 || [15.0.0+] OpenNamedChannelAsParent
Line 612: Line 633:
| 100 || [15.0.0+] SetApplicationCoreUsageMode
| 100 || [15.0.0+] SetApplicationCoreUsageMode
|-
|-
| 300 || [17.0.0+]  
| 160 || [18.0.0+] GetNotificationReceiverService
|-
| 161 || [18.0.0+] GetNotificationSenderService
|-
| 300 || [17.0.0+] GetCurrentApplicationId
|-
| 310 || [19.0.0+] IsSystemAppletHomeMenu
|-
| 311 || [20.0.0+]
|-
| 320 || [19.0.0+] SetGpuTimeSliceBoost
|-
| 321 || [19.0.0+] SetGpuTimeSliceBoostDueToApplication
|-
| 322 || [20.0.0+]
|-
| 330 || [19.0.0+]
|-
| 340 || [20.0.0+]
|-
| 341 || [20.0.0+]
|-
| 342 || [20.0.0+]
|-
| 350 || [20.0.0+]
|-
| 360 || [20.0.0+]
|}
|}


Line 767: Line 814:
| 150 || [10.0.0+] [[#ShouldSetGpuTimeSliceManually]] ||
| 150 || [10.0.0+] [[#ShouldSetGpuTimeSliceManually]] ||
|-
|-
| 160 || [17.0.0+] [[#Cmd160]] ||  
| 160 || [17.0.0+] [[#GetLibraryAppletInfoEx]] ||  
|}
|}


Line 901: Line 948:
No input, returns an output u8 bool.
No input, returns an output u8 bool.


==== Cmd160 ====
==== GetLibraryAppletInfoEx ====
No input, returns an output u64. Currently always returns 0.
No input, returns an output u64. Currently always returns 0.


Line 966: Line 1,013:
|-
|-
| 31 || [10.0.0+] [[#IsHealthWarningRequired]]
| 31 || [10.0.0+] [[#IsHealthWarningRequired]]
|-
| 40 || [18.0.0+] GetApplicationNintendoLogo
|-
| 41 || [18.0.0+] GetApplicationStartupMovie
|-
| 50 || [19.0.0+] SetGpuTimeSliceBoostForApplication
|-
| 60 || [19.0.0+]
|-
| 70 || [21.0.0+]
|-
| 71 || [21.0.0+]
|-
| 75 || [21.0.0+]
|-
|-
| 90 || [7.0.0+] [[#SetRequiresGpuResourceUse]]
| 90 || [7.0.0+] [[#SetRequiresGpuResourceUse]]
Line 1,146: Line 1,207:
|-
|-
| 111 || [6.0.0+] [[#QueryApplicationPlayStatisticsByUid]]
| 111 || [6.0.0+] [[#QueryApplicationPlayStatisticsByUid]]
|-
| 112 || [20.0.0+]
|-
| 113 || [20.0.0+]
|-
|-
| 120 || [5.0.0+] [[#ExecuteProgram]]
| 120 || [5.0.0+] [[#ExecuteProgram]]
Line 1,180: Line 1,245:
|-
|-
| 200 || [11.0.0+] [[#GetLastApplicationExitReason]]
| 200 || [11.0.0+] [[#GetLastApplicationExitReason]]
|-
| 210 || [20.0.0+]
|-
| 220 || [20.0.0+]
|-
| 300 || [19.0.0+] [[#CreateMovieWriter]]
|-
| 310 || [20.0.0+]
|-
| 320 || [20.0.0+]
|-
| 330 || [20.2.0+]
|-
|-
| 500 || [5.0.0+] [[#StartContinuousRecordingFlushForDebug]]
| 500 || [5.0.0+] [[#StartContinuousRecordingFlushForDebug]]
Line 1,218: Line 1,295:
==== CreateApplicationWithAttributeAndPushAndRequestToStartForQuest ====
==== CreateApplicationWithAttributeAndPushAndRequestToStartForQuest ====
Takes an input [[NCM_services#ApplicationId|ApplicationId]], a type-0x15 input buffer containing an [[#ApplicationAttribute]], an input [[#IStorage]], no output.
Takes an input [[NCM_services#ApplicationId|ApplicationId]], a type-0x15 input buffer containing an [[#ApplicationAttribute]], an input [[#IStorage]], no output.
[21.0.0+] Now returns an output [[#IStorage]].


Same as [[#CreateApplicationAndPushAndRequestToStartForQuest]] except the entire attributes structure is directly specified via the input buffer. This command replaces [[#CreateApplicationAndPushAndRequestToStartForQuest]], official user-processes no longer use [[#CreateApplicationAndPushAndRequestToStartForQuest]].
Same as [[#CreateApplicationAndPushAndRequestToStartForQuest]] except the entire attributes structure is directly specified via the input buffer. This command replaces [[#CreateApplicationAndPushAndRequestToStartForQuest]], official user-processes no longer use [[#CreateApplicationAndPushAndRequestToStartForQuest]].
Line 1,448: Line 1,527:
==== GetLastApplicationExitReason ====
==== GetLastApplicationExitReason ====
No input, returns an output s32.
No input, returns an output s32.
==== Cmd220 ====
Takes an input u8, no output.
The input must be <=1.
==== CreateMovieWriter ====
Takes 8-bytes of input and a handle. Returns an [[#IMovieWriter]].
This internally uses the GRC cmd to open an [[GRC_services|IMovieWriter]]. This is therefore not usable on NX since that cmd is stubbed.
==== Cmd310 ====
[21.0.0+] Now takes a total of 0x18-bytes of input.
==== Cmd330 ====
No input, returns 1-byte of output.
On NX this just writes 0 to output and returns 0.


==== StartContinuousRecordingFlushForDebug ====
==== StartContinuousRecordingFlushForDebug ====
Line 1,474: Line 1,571:


AM can also optionally launch jit-sysmodule automatically if the [[NACP]] enables it.
AM can also optionally launch jit-sysmodule automatically if the [[NACP]] enables it.
=== IMovieWriter ===
This is "nn::am::service::IMovieWriter".
This was added with [19.0.0+].
{| class="wikitable" border="1"
|-
! Cmd || Name
|-
| 0 ||
|}
==== Cmd0 ====
No input. Returns a GRC [[GRC_services|IMovieWriter]].


=== IMovieMaker ===
=== IMovieMaker ===
Line 1,505: Line 1,617:
|-
|-
| 2 || [[#AreAnyLibraryAppletsLeft]] ||
| 2 || [[#AreAnyLibraryAppletsLeft]] ||
|-
| 3 || [20.0.0+] ||
|-
|-
| 10 || [[#CreateStorage]] ||  
| 10 || [[#CreateStorage]] ||  
Line 1,569: Line 1,683:
|-
|-
| 60 || [10.0.0+] [[#PresetLibraryAppletGpuTimeSliceZero]] ||
| 60 || [10.0.0+] [[#PresetLibraryAppletGpuTimeSliceZero]] ||
|-
| 80 || [19.0.0+] RequestForLibraryAppletToGetForeground ||
|-
| 81 || [19.0.0+] GetCurrentChildLibraryApplet ||
|-
| 90 || [20.0.0+] ||
|-
|-
| 100 || [[#PushInData]] ||  
| 100 || [[#PushInData]] ||  
Line 1,677: Line 1,797:
|-
|-
| 14 || [11.0.0+] [[#GetWakeupCount]]
| 14 || [11.0.0+] [[#GetWakeupCount]]
|-
| 15 || [19.0.0+]
|-
|-
| 20 || [[#PushToGeneralChannel]]
| 20 || [[#PushToGeneralChannel]]
Line 1,731: Line 1,853:
|-
|-
| 120 || [13.0.0+] GetAppletLaunchedHistory
| 120 || [13.0.0+] GetAppletLaunchedHistory
|-
| 130 || [21.0.0+]
|-
|-
| 200 || [7.0.0+] [[#GetOperationModeSystemInfo]]
| 200 || [7.0.0+] [[#GetOperationModeSystemInfo]]
Line 1,748: Line 1,872:
| 503 || [12.0.0+] IsDisablingSleepSuppressed
| 503 || [12.0.0+] IsDisablingSleepSuppressed
|-
|-
| 600 || [17.0.0+] OpenNamedChannelAsChild
| 600 || [20.0.0+] ([17.0.0-18.1.0] OpenNamedChannelAsChild)
|-
| 610 || [21.0.0+]
|-
|-
| 900 || [11.0.0+] [[#SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled]]
| 900 || [11.0.0+] [[#SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled]]
|-
|-
| 910 || [17.0.0+] GetLaunchRequiredTick
| 910 || [17.0.0+] GetLaunchRequiredTick
|-
| 1000 || [19.0.0+] BeginVrMode3d
|-
| 1001 || [19.0.0+] EndVrMode3d
|-
| 1002 || [19.0.0+] IsVrModeEnabled3d
|-
| 1003 || [21.0.0+]
|-
| 1004 || [21.0.0+]
|-
| 1005 || [21.0.0+]
|}
|}


Line 2,036: Line 2,174:
|-
|-
| 21 || [13.0.0+] GetScreenShotProgramId
| 21 || [13.0.0+] GetScreenShotProgramId
|-
| 22 || [19.0.0+] GetScreenShotAcdIndex
|-
| 23 || [19.0.0+] GetScreenShotApparentPlatform
|-
| 24 || [19.0.0+] GetScreenShotApplicationProperty
|-
|-
| 40 || [[#CreateManagedDisplayLayer]]
| 40 || [[#CreateManagedDisplayLayer]]
Line 2,080: Line 2,224:
|-
|-
| 72 || [9.0.0+] [[#SetInputDetectionPolicy]]
| 72 || [9.0.0+] [[#SetInputDetectionPolicy]]
|-
| 73 || [21.0.0+]
|-
|-
| 80 || [4.0.0+] [[#SetWirelessPriorityMode]]
| 80 || [4.0.0+] [[#SetWirelessPriorityMode]]
Line 2,094: Line 2,240:
|-
|-
| 130 || [13.0.0+] [[#SetRecordVolumeMuted]]
| 130 || [13.0.0+] [[#SetRecordVolumeMuted]]
|-
| 200 || [20.0.0+]
|-
| 210 || [20.0.0+]
|-
| 211 || [20.0.0+]
|-
| 220 || [20.0.0+]
|-
| 221 || [20.0.0+]
|-
| 230 || [20.0.0+]
|-
|-
| 1000 || [7.0.0+] [[#GetDebugStorageChannel]]
| 1000 || [7.0.0+] [[#GetDebugStorageChannel]]
|-
| 2000 || [S2] [[#GetGraphicsInterface]]
|-
| 2100 || [S2]
|}
|}


Line 2,326: Line 2,488:


The cached value loaded from [[System_Settings|system-setting]] <code>am.debug!dev_function</code> must be set to 0x1 with size 0x1, otherwise an error is returned.
The cached value loaded from [[System_Settings|system-setting]] <code>am.debug!dev_function</code> must be set to 0x1 with size 0x1, otherwise an error is returned.
=== GetGraphicsInterface ===
Unofficial name. This is exclusive to S2.
No input. Returns an output TIPC handle to [[#(S2) GraphicsInterface|GraphicsInterface]].


== IStorageChannel ==
== IStorageChannel ==
Line 2,421: Line 2,588:
|-
|-
| 4 || [[#SetTransparentVolumeRate]]
| 4 || [[#SetTransparentVolumeRate]]
|-
| 5 || [20.0.0+]
|}
|}


Line 2,723: Line 2,892:
Takes an input [[#ILibraryAppletAccessor]], no output.
Takes an input [[#ILibraryAppletAccessor]], no output.


== IDebugFunctions ==
== ISystemProcessCommonFunctions ==
This is "nn::am::service::IDebugFunctions".
This is "nn::am::service::ISystemProcessCommonFunctions".
 
This was added with [19.0.0+].


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 2,730: Line 2,901:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 || [[#NotifyMessageToHomeMenuForDebug]]
| 0 ||  
|}
 
=== Cmd0 ===
No input. Returns an [[#IApplicationObserver]].
 
=== IApplicationObserver ===
This is "nn::am::service::IApplicationObserver".
 
This was added with [19.0.0+].
 
{| class="wikitable" border="1"
|-
|-
| 1 || [1.0.0-9.2.0] [[#OpenMainApplication]]
! Cmd || Name
|-
|-
| 10 || [[#PerformSystemButtonPressing]]
| 1 ||  
|-
|-
| 20 || [[#InvalidateTransitionLayer]]
| 2 ||  
|-
|-
| 30 || [6.0.0+] [[#RequestLaunchApplicationWithUserAndArgumentForDebug]]
| 10 ||  
|-
|-
| 31 || [12.0.0+] RequestLaunchApplicationByApplicationLaunchInfoForDebug
| 20 ||  
|-
|-
| 40 || [6.0.0+] [[#GetAppletResourceUsageInfo]]
| 30 ||  
|}
 
== IAppletAlternativeFunctions ==
This is "nn::am::service::IAppletAlternativeFunctions".
 
This was added with [20.0.0+].
 
{| class="wikitable" border="1"
|-
|-
| 50 || [15.0.0+] AddSystemProgramIdAndAppletIdForDebug
! Cmd || Name
|-
| 51 || [16.0.0+] AddOperationConfirmedLibraryAppletIdForDebug
|-
|-
| 52 || [17.0.0+] GetProgramIdFromAppletIdForDebug
| 0 ||  
|-
|-
| 100 || [7.0.0+] [[#SetCpuBoostModeForApplet]]
| 1 ||
|-
| 2 ||
|}
 
== IDebugFunctions ==
This is "nn::am::service::IDebugFunctions".
 
{| class="wikitable" border="1"
|-
! Cmd || Name
|-
| 0 || [[#NotifyMessageToHomeMenuForDebug]]
|-
| 1 || [1.0.0-9.2.0] [[#OpenMainApplication]]
|-
| 10 || [[#PerformSystemButtonPressing]]
|-
| 20 || [[#InvalidateTransitionLayer]]
|-
| 30 || [6.0.0+] [[#RequestLaunchApplicationWithUserAndArgumentForDebug]]
|-
| 31 || [12.0.0+] [[#RequestLaunchApplicationByApplicationLaunchInfoForDebug]]
|-
| 40 || [6.0.0+] [[#GetAppletResourceUsageInfo]]
|-
| 50 || [15.0.0+] AddSystemProgramIdAndAppletIdForDebug
|-
| 51 || [16.0.0+] AddOperationConfirmedLibraryAppletIdForDebug
|-
| 52 || [17.0.0+] GetProgramIdFromAppletIdForDebug
|-
| 53 || [18.0.0+] GetProgramIdFromAppletIdAndLibraryAppletModeForDebug
|-
| 100 || [7.0.0+] [[#SetCpuBoostModeForApplet]]
|-
|-
| 101 || [10.0.0+] [[#CancelCpuBoostModeForApplet]]
| 101 || [10.0.0+] [[#CancelCpuBoostModeForApplet]]
Line 2,771: Line 2,993:
|-
|-
| 140 || [14.0.0+] RestrictPowerOperationForSecureLaunchModeForDebug
| 140 || [14.0.0+] RestrictPowerOperationForSecureLaunchModeForDebug
|-
| 150 || [21.0.0+]
|-
|-
| 200 || [15.0.0+] CreateFloatingLibraryAppletAccepterForDebug
| 200 || [15.0.0+] CreateFloatingLibraryAppletAccepterForDebug
|-
|-
| 300 || [16.0.0+] TerminateAllRunningApplicationsForDebug
| 300 || [16.0.0+] TerminateAllRunningApplicationsForDebug
|-
| 410 || [18.0.0+] CreateGeneralStorageForDebug
|-
| 411 || [18.0.0+] ReadGeneralStorageForDebug
|-
| 412 || [18.0.0+] WriteGeneralStorageForDebug
|-
| 430 || [20.0.0+]
|-
| 431 || [20.0.0+]
|-
|-
| 900 || [12.0.0+] GetGrcProcessLaunchedSystemEvent
| 900 || [12.0.0+] GetGrcProcessLaunchedSystemEvent
|-
| 910 || [20.0.0+]
|}
|}


Line 2,799: Line 3,035:


Requests to launch the specified Application, with the specified users. When the bool flag is true, the content of the second input buffer is used to create a storage which is pushed to the UserChannel for this Application (see [[#LaunchParameterKind]]).
Requests to launch the specified Application, with the specified users. When the bool flag is true, the content of the second input buffer is used to create a storage which is pushed to the UserChannel for this Application (see [[#LaunchParameterKind]]).
=== RequestLaunchApplicationByApplicationLaunchInfoForDebug ===
Takes a total of 0x58-bytes of input, a type-0x5 input buffer containing an array of 0x10-byte entries, and a type-0x5 input buffer. No output.
[19.0.0+] Takes a total of 0x88-bytes of input, a type-0x5 input buffer containing an array of 0x10-byte entries, and a type-0x5 input buffer. No output.


=== GetAppletResourceUsageInfo ===
=== GetAppletResourceUsageInfo ===
Line 2,904: Line 3,145:
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Cmd || Name || Notes
! Cmd || Name
|-
|-
| 0 || [[#OpenApplicationProxy]] ||
| 0 || [[#OpenApplicationProxy]]
|}
|}


Line 2,912: Line 3,153:


== OpenApplicationProxy ==
== OpenApplicationProxy ==
Returns an [[#IApplicationProxy]]. See [[#appletAE]].
Takes a reserved input u64 (official user-processes use hard-coded value 0), a PID, and a process copy-handle (cur-proc handle alias). Returns an [[#IApplicationProxy]].
 
Takes a [[IPC_Marshalling|reserved]] input u64 (official user-processes use hard-coded value 0), a PID, and a process copy-handle (cur-proc handle alias).


On failure, official user-processes will retry using this command in a loop while the retval is 0x19280, with svcSleepThread(10000000) being called first.
On failure, official user-processes will retry using this command in a loop while the retval is 0x19280, with svcSleepThread(10000000) being called first.
Line 3,107: Line 3,346:
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Cmd || Name || Notes
! Cmd || Name
|-
|-
| 32 || [7.0.0+] SetShimLibraryVersion || Takes a total of 0x10-bytes of input and a PID, no output.
| 32 || [7.0.0+] [[#SetShimLibraryVersion]]
|-
|-
| 201 || SaveScreenShot ||
| 201 || [[#SaveScreenShot]]
|-
|-
| 203 || SaveScreenShotEx0 ||
| 203 || [[#SaveScreenShotEx0]]
|-
|-
| 205 || [8.0.0+] SaveScreenShotEx1 ||
| 205 || [8.0.0+] [[#SaveScreenShotEx1]]
|-
|-
| 210 || SaveScreenShotEx2 || Takes a total of 0x50-bytes of input, a type-0x15 input buffer, and a type-0x45 input buffer.  Returns a total of 0x20-bytes of output.
| 210 || [[#SaveScreenShotEx2]]
|}
|}


'''SetShimLibraryVersion''' is a wrapper for [[Capture_services|caps:c]] cmd33. Commands '''SaveScreenShot''', '''SaveScreenShotEx0''', '''SaveScreenShotEx1''' and '''SaveScreenShotEx2''' are wrappers for [[Display_services|caps:sc]] cmd210.
== SetShimLibraryVersion ==
Takes a total of 0x10-bytes of input and a PID, no output.
 
This is a wrapper for [[Capture_services|caps:c]] cmd33. Commands '''SaveScreenShot''', '''SaveScreenShotEx0''', '''SaveScreenShotEx1''' and '''SaveScreenShotEx2''' are wrappers for [[Display_services|caps:sc]] cmd210.


== SaveScreenShot ==
== SaveScreenShot ==
Line 3,174: Line 3,416:
|}
|}


= Library Applets =
= (S2) adraw:a =
This section documents library applet launching.
This is "nn::appletdraw::sfif::IAppletRoot".
 
{| class="wikitable" border="1"
|-
! Cmd || Name
|-
| 1 || [[#OpenResourceSession]]
|-
| 2 || [[#OpenAppletSession]]
|}


Before starting the applet, [[#IStorage]]s are [[#ILibraryAppletCreator|created]] and written, then passed to [[#ILibraryAppletAccessor]] PushInData. The [[#IStorage]] session is closed afterwards. The first [[#IStorage]] is [[#CommonArguments]], followed by any applet-specific [[#IStorage]]s.
== OpenResourceSession ==
Unofficial name.  


Once the applet finishes running successfully, [[#ILibraryAppletAccessor]] PopOutData can be used to get the applet-specific [[#IStorage]] containing the applet output data.
Takes a PID and an input [[#AppletResourceUserId|AppletResourceUserId]]. Returns a [[#IResourceSession]].


== CommonArguments ==
== OpenAppletSession ==
The first [[#CreateStorage|IStorage]] passed to applets should contain the common library applet arguments. This is populated by <code>nn::la::CommonArgumentsWriter</code> and has the following format.
Unofficial name.


This struct is 0x20-bytes.
Takes a PID and an input [[#AppletResourceUserId|AppletResourceUserId]]. Returns a [[#IAppletSession]].


Official sw handles the first 8-bytes separately, which is a header. With CommonArguments version 0x0, the header is 4-bytes, while starting with version 0x1 it's 8-bytes.
== IResourceSession ==
This is "nn::appletdraw::sfif::IResourceSession".


{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Offset || Size || Typical Value || Notes
! Cmd || Name
|-
|-
| 0x0 || 4 || 1 || Common Arguments version
| 1 || [[#Ping|Ping]]
|-
|-
| 0x4 || 4 || 0x20 || Common Arguments size
| 10 ||
|-
| 0x8 || 4 || || Library applet version (API version)
|-
| 0xC || 4 || 0 || Theme color
|-
| 0x10 || 1 || 0 || Play startup sound
|-
| 0x18 || 8 || N/A || System tick (see [[SVC#svcGetSystemTick|svcGetSystemTick]])
|-
|-
| 11 || 
|}
|}


= AppletId =
=== Ping ===
This is "nn::applet::AppletId". See also [[:Category:Library Applets]].
Unofficial name.
 
Takes an input u64. Returns an output u64.
 
The output u64 should match the input u64. Official software sends the current system tick value.
 
=== Cmd10 ===
Takes a handle, a u64 and an int. Returns a handle.
 
=== Cmd11 ===
No input/output.
 
== IAppletSession ==
This is "nn::appletdraw::sfif::IAppletSession".


{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Value
! Cmd || Name
! ProgramId
|-
! Description
| 1 || [[#Ping|Ping]]
|-
|-
| 0x00
| 2 || [[#GetEvent|GetEvent]]
|  
| None
|-
|-
| 0x01
| 3 || [20.1.1+]
|  
| Application (not valid for use with LibraryApplets)
|-
|-
| 0x02
| 10 ||
| 010000000000100C
| OverlayApplet (overlayDisp)
|-
|-
| 0x03
| 11 ||
| 0100000000001000
| SystemAppletMenu (qlaunch)
|-
|-
| 0x04
| 12 ||
| 0100000000001012
| SystemApplication (starter)
|-
|-
| 0x0A
| 13 ||
| 0100000000001001
| [[Auth_Applet|LibraryAppletAuth (auth)]]
|-
|-
| 0x0B
| 15 ||
| 0100000000001002
| [[Cabinet_Applet|LibraryAppletCabinet (cabinet)]]
|-
|-
| 0x0C
| 16 || [20.1.1+]
| 0100000000001003
| [[Controller_Applet|LibraryAppletController (controller)]]
|-
|-
| 0x0D
| 17 || [20.1.1+]
| 0100000000001004
| LibraryAppletDataErase (dataErase)
|-
|-
| 0x0E
| 18 || [20.1.1+]
| 0100000000001005
| [[Error_Applet|LibraryAppletError (error)]]
|-
|-
| 0x0F
| 19 || [20.1.1+]
| 0100000000001006
| LibraryAppletNetConnect (netConnect)
|-
|-
| 0x10
| 21 ||
| 0100000000001007
| [[Profile_Selector|LibraryAppletPlayerSelect (playerSelect)]]
|-
|-
| 0x11
| 22 ||
| 0100000000001008
| [[Software_Keyboard|LibraryAppletSwkbd (swkbd)]]
|-
|-
| 0x12
| 23 || [20.1.1+]
| 0100000000001009
| [[MiiEdit_Applet|LibraryAppletMiiEdit (miiEdit)]]
|-
|-
| 0x13
| 24 || [20.1.1+]
| 010000000000100A
| [[Internet_Browser#010000000000100A|LibraryAppletWeb (web)]]
|-
|-
| 0x14
| 31 || [[#GetFrameBufferInfo|GetFrameBufferInfo]]
| 010000000000100B
| [[Internet_Browser#ShopN|LibraryAppletShop (shop)]]
|-
|-
| 0x15
| 8001 || [[#GetFrameBufferInfoForDebug|GetFrameBufferInfoForDebug]]
| 010000000000100D
| [[Album_Applet|LibraryAppletPhotoViewer (photoViewer)]]
|-
|-
| 0x16
| 8003 || [19.0.0-19.1.0]
| 010000000000100E
| LibraryAppletSet (set)
|-
|-
| 0x17
| 8004 || 
| 010000000000100F
|}
| [[Internet_Browser#Offline_Applet|LibraryAppletOfflineWeb (offlineWeb)]]
 
|-
=== GetEvent ===
| 0x18
Unofficial name.
| 0100000000001010
 
| [[Internet_Browser#Whitelisted_Applets|LibraryAppletLoginShare (loginShare)]]
No input. Returns an output Event handle.
|-
 
| 0x19
=== Cmd3 ===
| 0100000000001011
Takes a handle. No output.
| [[Internet_Browser#WifiWebAuthApplet|LibraryAppletWifiWebAuth (wifiWebAuth)]]
 
|-
=== Cmd10 ===
| 0x1A
Takes an input u32. No output.
| 0100000000001013
 
| [[MyPage_Applet|LibraryAppletMyPage (myPage)]]
=== Cmd11 ===
|-
Takes an input u32. No output.
| 0x1B
 
| 010000000000101A
=== Cmd12 ===
| LibraryAppletGift (gift)
Takes an input u64. Returns an output u32.
|-
 
| 0x1C
=== Cmd13 ===
| 010000000000101C
Takes an input u32. Returns an output u32.
| LibraryAppletUserMigration (userMigration)
 
=== Cmd15 ===
Takes an input u32. Returns three output u32s.
 
=== Cmd16 ===
No input. Returns an output u32.
 
=== Cmd17 ===
Takes an input u32. Returns an output u32 and an output u16.
 
=== Cmd18 ===
Takes an input u32. Returns three output u32s and an output u16.
 
=== Cmd19 ===
Takes an input u32. Returns an output u32 and an output u16.
 
=== Cmd21 ===
Takes an input u32. Returns a struct of size 0x40.
 
=== Cmd22 ===
Takes a struct of size 0x20. Returns a struct of size 0x40.
 
=== Cmd23 ===
No input. Returns a struct of size 0xC8.
 
=== Cmd24 ===
Takes an ipc-buf with size 0xD8. No output.
 
=== GetFrameBufferInfo ===
Unofficial name.
 
No input. Returns an [[#(S2)_AdrawFrameBufferInfo|AdrawFrameBufferInfo]].
 
[[#(S2)_AdrawFrameBufferInfo|Id]] is "adrawfb".
 
=== GetFrameBufferInfoForDebug ===
Unofficial name.
 
No input. Returns an [[#(S2)_AdrawFrameBufferInfo|AdrawFrameBufferInfo]].
 
=== Cmd8003 ===
Takes an input u64. Returns a struct with size 0x18.
 
=== Cmd8004 ===
Takes an input u32. Returns an output u64.
 
= (S2) appletOE =
This is "nn::am::service::IApplicationProxyServiceForNxCompat".
 
{| class="wikitable" border="1"
|-
|-
| 0x1D
! Cmd || Name
| 010000000000101D
| [9.0.0+] LibraryAppletPreomiaSys (EncounterSys)
|-
|-
| 0x1E
| 0 || [[#OpenApplicationProxy]]
| 0100000000001020
| [9.0.0+] LibraryAppletStory (story)
|-
|-
| 0x1F
| 2000 || [[#OpenCompatApplicationFunctions]]
| 010070000E3C0000
|}
| [9.0.0+] LibraryAppletPreomiaUsr (EncounterUsr)
 
== OpenCompatApplicationFunctions ==
No input. Returns an [[#INxCompatApplicationFunctions]].
 
== INxCompatApplicationFunctions ==
This is "nn::am::service::INxCompatApplicationFunctions".
 
{| class="wikitable" border="1"
|-
|-
| 0x20
! Cmd || Name
| 010086000E49C000
| [9.0.0+] LibraryAppletPreomiaUsrDummy (EncounterUsrDummy)
|-
| 0x21
| 0100000000001038
| [10.0.0+] LibraryAppletSample (sample)
|-
|-
| 0x22
| 2000 || [[#GetGraphicsInterfaceForNxCompat]]
| 0100000000001007
| [13.0.0+] LibraryAppletPromoteQualification (playerSelect)
|-
|-
| 0x32
| 2001 ||  
| 010000000000100F
| [17.0.0+] [[Internet_Browser#Offline_Applet|LibraryAppletOfflineWeb (offlineWeb)]]
|-
|-
| 0x33
| 2002 ||
| 010000000000100F
| [17.0.0+] [[Internet_Browser#Offline_Applet|LibraryAppletOfflineWeb (offlineWeb)]]
|-
|-
| 0x35
| 2003 || [[#SetCopyright]]
| [17.0.0+] 0100000000001010 ([16.0.0-16.1.0] 0100000000001042)
| [17.0.0+] [[Internet_Browser#Whitelisted_Applets|LibraryAppletLoginShare (loginShare)]] ([16.0.0-16.1.0] )
|-
|-
| 0x36
| 2004 ||
| [17.0.0+] 0100000000001010 ([16.0.0-16.1.0] 0100000000001042)
| [17.0.0+] [[Internet_Browser#Whitelisted_Applets|LibraryAppletLoginShare (loginShare)]] ([16.0.0-16.1.0] )
|-
|-
| 0x37
| 2010 ||
| [17.0.0+] 0100000000001010 ([16.0.0-16.1.0] 0100000000001042)
| [17.0.0+] [[Internet_Browser#Whitelisted_Applets|LibraryAppletLoginShare (loginShare)]] ([16.0.0-16.1.0] )
|-
|-
| 0x38
| 2020 || [[#Initialize]]
| 0100000000001043
| [16.0.0-16.1.0]
|-
|-
| 0x3E8
| 2030 || [[#GetVsyncEvent]]
|  
| [10.0.0-16.1.0] DevlopmentTool
|-
|-
| 0x3F1
| 2040 || [[#GetVsyncTimestamp]]
| 010000000000D619
| [10.0.0-16.1.0] CombinationLA
|-
|-
| 0x3F2
| 2050 ||  
| 010000000000D610
| [10.0.0-16.1.0] AeSystemApplet
|-
|-
| 0x3F3
| 2060 ||  
| 010000000000D611
| [10.0.0-16.1.0] AeOverlayApplet
|-
|-
| 0x3F4
| 2070 || [[#CreateMovieMaker]]
| 010000000000D612
|}
| [10.0.0-16.1.0] AeStarter
 
=== GetGraphicsInterfaceForNxCompat ===
Unofficial name.
 
No input. Returns an output TIPC handle to [[#(S2) GraphicsInterface|GraphicsInterface]].
 
Same as [[#GetGraphicsInterface]] but for compat mode.
 
=== SetCopyright ===
Unofficial name.
 
Takes an input bool. No output.
 
Called directly after "nn::vi::WriteToCopyrightFramebuffer".
 
=== Initialize ===
Unofficial name.
 
No input/output.
 
Called during init.
 
=== GetVsyncEvent ===
Unofficial name.
 
No input. Returns an Event handle.
 
=== GetVsyncTimestamp ===
Unofficial name.
 
No input. Returns an output u64.
 
When event from [[#GetVsyncEvent]] triggers, this returns a timestamp.
 
= (S2) GraphicsInterface =
Unofficial name. This is a TIPC interface so the command numbers are subtracted by 16.
 
{| class="wikitable" border="1"
|-
! Cmd || Name
|-
|-
| 0x3F5
| 1 || [[#InitializeGraphicsWithTransferMemory]]  
| 010000000000D613
| [10.0.0-16.1.0] AeLibraryAppletAlone
|-
|-
| 0x3F6
| 4 || [[#InitializeGraphics]]  
| 010000000000D614
| [10.0.0-16.1.0] AeLibraryApplet1
|-
|-
| 0x3F7
| 11 || [[#SetCurrentProcessHandle]]
| 010000000000D615
| [10.0.0-16.1.0] AeLibraryApplet2
|-
|-
| 0x3F8
| 12 ||  
| 010000000000D616
| [10.0.0-16.1.0] AeLibraryApplet3
|-
|-
| 0x3F9
| 101 || [[#StartGraphics]]
| 010000000000D617
| [10.0.0-16.1.0] AeLibraryApplet4
|-
|-
| 0x3FA
| 111 ||  
| 010000000000D60A
| [10.0.0-16.1.0] AppletISA
|-
|-
| 0x3FB
| 112 ||  
| 010000000000D60B
| [10.0.0-16.1.0] AppletIOA
|-
|-
| 0x3FC
| 114 ||  
| 010000000000D60C
| [10.0.0-16.1.0] AppletISTA
|-
|-
| 0x3FD
| 115 ||  
| 010000000000D60D
| [10.0.0-16.1.0] AppletILA1
|-
|-
| 0x3FE
| 187 ||  
| 010000000000D60E
| [10.0.0-16.1.0] AppletILA2
|-
|-
| 0x700000DC
| 201 ||  
| 010000000000D619
| [17.0.0+] CombinationLA
|-
|-
| 0x700000E6
| 301 ||  
| 010000000000D610
| [17.0.0+] AeSystemApplet
|-
|-
| 0x700000E7
| 303 ||  
| 010000000000D611
| [17.0.0+] AeOverlayApplet
|-
|-
| 0x700000E8
| 311 ||  
| 010000000000D612
| [17.0.0+] AeStarter
|-
|-
| 0x700000E9
| 312 ||  
| 010000000000D613
| [17.0.0+] AeLibraryAppletAlone
|-
|-
| 0x700000EA
| 314 ||  
| 010000000000D614
| [17.0.0+] AeLibraryApplet1
|-
|-
| 0x700000EB
| 315 ||
| 010000000000D615
|-
| [17.0.0+] AeLibraryApplet2
| 321 ||
|-
|-
| 0x700000EC
| 327 ||  
| 010000000000D616
| [17.0.0+] AeLibraryApplet3
|-
|-
| 0x700000ED
| 391 ||  
| 010000000000D617
| [17.0.0+] AeLibraryApplet4
|-
|-
| 0x700000F0
| 401 || [[#PrepareGpuManagerSession]]
| 010000000000D60A
| [17.0.0+] AppletISA
|-
|-
| 0x700000F1
| 402 || [[#StartGpuManagerSession]]
| 010000000000D60B
| [17.0.0+] AppletIOA
|-
|-
| 0x700000F2
| 423 ||  
| 010000000000D60C
| [17.0.0+] AppletISTA
|-
|-
| 0x700000F3
| 428 || [[#GetImageInfo]]
| 010000000000D60D
| [17.0.0+] AppletILA1
|-
|-
| 0x700000F4
| 434 ||  
| 010000000000D60E
| [17.0.0+] AppletILA2
|}
 
= LibraryAppletMode =
This is "nn::applet::LibraryAppletMode".
 
{| class="wikitable" border="1"
|-
|-
! Value
| 494 ||
! Description
|-
|-
| 0x0
| 496 || [[#CreateGpuManagerSessionWithTransferMemory]]
| AllForeground
|-
|-
| 0x1
| 497 || [[#CreateGpuManagerSession]]
| PartialForeground
|-
|-
| 0x2
| 901 ||  
| NoUi
|-
|-
| 0x3
| 902 ||  
| PartialForegroundWithIndirectDisplay (see also [[#GetIndirectLayerConsumerHandle]], only used by swkbd [[Software_Keyboard|InlineKeyboard]])
|-
|-
| 0x4
| 903 ||  
| AllForegroundInitiallyHidden (can be used by [7.0.0+] [[Internet_Browser|WebSession]])
|}
 
= AppletMessage =
This is "nn::am::AppletMessage".
 
{| class="wikitable" border="1"
|-
|-
! Value
| 905 ||
! Description
|-
| 911 ||
|-
| 912 ||
|-
| 922 ||
|-
| 961 ||
|-
| 991 ||
|-
| 1001 ||
|-
| 1002 ||
|-
| 1003 ||
|-
| 1101 ||
|-
| 1102 ||
|-
| 1301 || [[#InitializeAdraw]]
|-
| 1302 || [[#StartAdraw]]
|-
| 1325 || [[#GetAdrawFrameBufferHandle]]
|-
| 1326 || [[#GetAdrawImageHandle]]
|-
| 1401 || [[#CreateNvDrv2UserSessionWithTransferMemory]]
|-
| 1402 || [[#CreateNvDrv2UserSession]]
|-
| 1411 || [[#GetNvDrv2UserTransferMemoryUsage]]
|-
| 1501 || 
|-
| 1502 ||
|-
| 1601 ||
|-
| 1602 ||
|-
| 1603 ||
|-
| 1611 ||
|-
| 1612 ||
|-
| 1691 ||
|}
 
== InitializeGraphicsWithTransferMemory ==
Unofficial name.
 
Takes a TransferMemory handle, an input [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]] and an input u64 '''TransferMemorySize'''. No output.
 
== InitializeGraphics ==
Unofficial name.
 
Takes a Process handle, an input [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]] and five input u64s. No output.
 
The first u64 appears to be a version ([19.0.0] 0x8000000000000001, [20.1.1] 0x8000000000000005), the last u64 is the output from new [[SVC#InfoType|InfoType]] 31 or 32 and the remaining u64s are all 0.
 
== SetCurrentProcessHandle ==
Unofficial name.
 
Takes a Process handle. No output.
 
Called directly after [[#InitializeGraphicsWithTransferMemory]] or [[#InitializeGraphics]].
 
== StartGraphics ==
Unofficial name.
 
No input/output.
 
Called directly after [[#SetCurrentProcessHandle]].
 
== PrepareGpuManagerSession ==
Unofficial name.
 
No input/output.
 
Called directly after [[#CreateGpuManagerSessionWithTransferMemory]] or [[#CreateGpuManagerSession]].
 
== StartGpuManagerSession ==
Unofficial name.
 
No input/output.
 
Called directly after [[#PrepareGpuManagerSession]].
 
== GetImageInfo ==
Unofficial name.
 
Takes an input u32 '''ImageHandle'''. Returns an [[#(S2)_ImageInfo|ImageInfo]].
 
== CreateGpuManagerSessionWithTransferMemory ==
Unofficial name.
 
Takes a TransferMemory handle and two input u64s '''Version''' and '''TransferMemorySize'''. Returns a [[#GpuManagerSession]].
 
[19.0.0] '''Version''' must be 2.
 
== CreateGpuManagerSession ==
Unofficial name.
 
Takes an input u64 '''Version'''. Returns a [[#GpuManagerSession]].
 
[19.0.0] '''Version''' must be 2.
 
== InitializeAdraw ==
Unofficial name.
 
No input/output.
 
== StartAdraw ==
Unofficial name.
 
No input/output.
 
Called directly after [[#InitializeAdraw]].
 
== GetAdrawFrameBufferHandle ==
Unofficial name.
 
Takes an input u64. Returns an output u32 '''FrameBufferHandle'''.
 
Official software sends the [[#(S2)_AdrawFrameBufferInfo|Id]] obtained with [[#GetFrameBufferInfo|GetFrameBufferInfo]] from [[#(S2)_adraw:a|adraw]].
 
== GetAdrawImageHandle ==
Unofficial name.
 
Takes seven input u64s, two input u16s and two input u32s. Returns an output u32 '''ImageHandle'''.
 
Official software sends 0x100000000 in the first u64, 0 in all remaining u64s, [[#(S2)_AdrawFrameBufferInfo|Width]] and [[#(S2)_AdrawFrameBufferInfo|Height]] in the two u16s, [[#(S2)_AdrawFrameBufferInfo|BlockCount]] int the first u32 and the '''FrameBufferHandle''' from [[#GetAdrawFrameBufferHandle|GetAdrawFrameBufferHandle]] in the last u32.
 
== CreateNvDrv2UserSessionWithTransferMemory ==
Unofficial name.
 
Takes a TransferMemory handle, an input u64 '''TransferMemorySize''' and an input u8. Returns an [[NV_services#(S2)_INvDrv2User|INvDrv2User]].
 
== CreateNvDrv2UserSession ==
Unofficial name.
 
No input. Returns an [[NV_services#(S2)_INvDrv2User|INvDrv2User]].
 
== GetNvDrv2UserTransferMemoryUsage ==
Unofficial name.
 
No input. Returns three u64s '''TotalTransferMemorySize''', '''UsedTransferMemorySize''' and '''MaxTransferMemorySize'''.
 
== GpuManagerSession ==
Unofficial name. This is a TIPC interface so the command numbers are subtracted by 16.
 
{| class="wikitable" border="1"
|-
! Cmd || Name
|-
| 11 || [[#GetEventIdRange]]
|-
| 12 || [[#CreateEvent]]
|-
| 21 || [[#RequestGpuSession]]
|-
| 22 || [[#GetGpuSession]]
|-
| 33 ||
|-
| 41 ||
|-
| 42 ||
|-
| 102 ||
|-
| 200 ||
|-
| 201 ||
|-
| 202 ||
|}
 
=== GetEventIdRange ===
Unofficial name.
 
No input. Returns two u32s '''EventIdMin''' and '''EventIdMax'''.
 
=== CreateEvent ===
Unofficial name.
 
Takes an input u32 '''EventId'''. Returns an output Event handle.
 
=== RequestGpuSession ===
Unofficial name.
 
Takes an input u32 '''EventId'''. No output.
 
'''EventId''' must have been previously passed to [[#CreateEvent]] and the returned Event handle will be signalled when the session is ready.
 
=== GetGpuSession ===
Unofficial name.
 
No input. Returns a [[#GpuSession]].
 
Called after [[#RequestGpuSession]] and the Event handle has been signalled.
 
=== GpuSession ===
Unofficial name. This is a TIPC interface so the command numbers are subtracted by 16.
 
{| class="wikitable" border="1"
|-
! Cmd || Name
|-
| 101 || [[#CreateGpuMemory]]
|-
| 102 || [[#DestroyGpuMemory]]
|-
| 201 || [19.0.0-19.1.0] MapMemory
|-
| 202 || [19.0.0-19.1.0] UnmapMemory
|-
| 203 || [19.0.0-19.1.0] AllocateAddressSpace
|-
| 204 || [19.0.0-19.1.0] FreeAddressSpace
|-
| 205 || [19.0.0-19.1.0] RemapMemory
|-
| 207 || [19.0.0-19.1.0] ModifyMemoryMapping
|-
| 211 || [20.1.1+] MapMemoryV2
|-
| 212 || [20.1.1+] ModifyMemoryMappingV2
|-
| 213 || [20.1.1+] UnmapMemoryV2
|-
| 214 || [20.1.1+] AllocateAddressSpaceV2
|-
| 215 || [20.1.1+] FreeAddressSpaceV2
|-
| 216 || [20.1.1+] RemapMemoryV2
|}
 
==== CreateGpuMemory ====
Unofficial name.
 
Takes two input u64s '''MemoryAddressStart''' and '''MemoryAddressEnd''' and two u8s. Returns an output u32 '''GpuMemoryHandle'''.
 
The memory region between '''MemoryAddressStart''' and '''MemoryAddressEnd''' must have been passed to [[#SVC|SVC]] 0x80 with attribute 0x20.
 
==== DestroyGpuMemory ====
Unofficial name.
 
Takes two input u32s '''GpuMemoryHandle''' and '''EventId'''. No output.
 
The Event handle associated with '''EventId''' will be signalled when the memory is released.
 
= Library Applets =
This section documents library applet launching.
 
Before starting the applet, [[#IStorage]]s are [[#ILibraryAppletCreator|created]] and written, then passed to [[#ILibraryAppletAccessor]] PushInData. The [[#IStorage]] session is closed afterwards. The first [[#IStorage]] is [[#CommonArguments]], followed by any applet-specific [[#IStorage]]s.
 
Once the applet finishes running successfully, [[#ILibraryAppletAccessor]] PopOutData can be used to get the applet-specific [[#IStorage]] containing the applet output data.
 
== CommonArguments ==
The first [[#CreateStorage|IStorage]] passed to applets should contain the common library applet arguments. This is populated by <code>nn::la::CommonArgumentsWriter</code> and has the following format.
 
This struct is 0x20-bytes.
 
Official sw handles the first 8-bytes separately, which is a header. With CommonArguments version 0x0, the header is 4-bytes, while starting with version 0x1 it's 8-bytes.
 
{| class="wikitable" border="1"
|-
! Offset || Size || Typical Value || Notes
|-
| 0x0 || 4 || 1 || Common Arguments version
|-
| 0x4 || 4 || 0x20 || Common Arguments size
|-
| 0x8 || 4 || || Library applet version (API version)
|-
| 0xC || 4 || 0 || Theme color
|-
| 0x10 || 1 || 0 || Play startup sound
|-
| 0x18 || 8 || N/A || System tick (see [[SVC#svcGetSystemTick|svcGetSystemTick]])
|-
|}
 
= AppletId =
This is "nn::applet::AppletId". See also [[:Category:Library Applets]].
 
{| class="wikitable" border="1"
|-
! Value
! ProgramId
! Description
|-
| 0x00000000
|
| None
|-
| 0x00000001
|
| Application (not valid for use with LibraryApplets)
|-
| 0x00000002
| 0x010000000000100C
| OverlayApplet (overlayDisp)
|-
| 0x00000003
| 0x0100000000001000
| SystemAppletMenu (qlaunch)
|-
| 0x00000004
| 0x0100000000001012
| SystemApplication (starter)
|-
| 0x0000000A
| 0x0100000000001001
| [[Auth_Applet|LibraryAppletAuth (auth)]]
|-
| 0x0000000B
| 0x0100000000001002
| [[Cabinet_Applet|LibraryAppletCabinet (cabinet)]]
|-
| 0x0000000C
| 0x0100000000001003
| [[Controller_Applet|LibraryAppletController (controller)]]
|-
| 0x0000000D
| 0x0100000000001004
| LibraryAppletDataErase (dataErase)
|-
| 0x0000000E
| 0x0100000000001005
| [[Error_Applet|LibraryAppletError (error)]]
|-
| 0x0000000F
| 0x0100000000001006
| LibraryAppletNetConnect (netConnect)
|-
| 0x00000010
| 0x0100000000001007
| [[Profile_Selector|LibraryAppletPlayerSelect (playerSelect)]]
|-
| 0x00000011
| 0x0100000000001008
| [[Software_Keyboard|LibraryAppletSwkbd (swkbd)]]
|-
| 0x00000012
| 0x0100000000001009
| [[MiiEdit_Applet|LibraryAppletMiiEdit (miiEdit)]]
|-
| 0x00000013
| 0x010000000000100A
| [[Internet_Browser#010000000000100A|LibraryAppletWeb (web)]]
|-
| 0x00000014
| 0x010000000000100B
| [[Internet_Browser#ShopN|LibraryAppletShop (shop)]]
|-
| 0x00000015
| 0x010000000000100D
| [[Album_Applet|LibraryAppletPhotoViewer (photoViewer)]]
|-
| 0x00000016
| 0x010000000000100E
| LibraryAppletSet (set)
|-
| 0x00000017
| 0x010000000000100F
| [[Internet_Browser#Offline_Applet|LibraryAppletOfflineWeb (offlineWeb)]] (LibraryAppletOfflineWebApp_0 in Ounce)
|-
| 0x00000018
| 0x0100000000001010
| [[Internet_Browser#Whitelisted_Applets|LibraryAppletLoginShare (loginShare)]]
|-
| 0x00000019
| 0x0100000000001011
| [[Internet_Browser#WifiWebAuthApplet|LibraryAppletWifiWebAuth (wifiWebAuth)]]
|-
| 0x0000001A
| 0x0100000000001013
| [[MyPage_Applet|LibraryAppletMyPage (myPage)]]
|-
| 0x0000001B
| 0x010000000000101A
| LibraryAppletGift (gift)
|-
| 0x0000001C
| 0x010000000000101C
| LibraryAppletUserMigration (userMigration)
|-
| 0x0000001D
| 0x010000000000101D
| [9.0.0+] LibraryAppletPreomiaSys (EncounterSys)
|-
| 0x0000001E
| 0x0100000000001020
| [9.0.0+] LibraryAppletStory (story)
|-
| 0x0000001F
| 0x010070000E3C0000
| [9.0.0+] LibraryAppletPreomiaUsr (EncounterUsr)
|-
| 0x00000020
| 0x010086000E49C000
| [9.0.0+] LibraryAppletPreomiaUsrDummy (EncounterUsrDummy)
|-
| 0x00000021
| 0x0100000000001038
| [10.0.0+] LibraryAppletSample (sample)
|-
| 0x00000022
| 0x0100000000001007
| [13.0.0+] LibraryAppletPromoteQualification (playerSelect)
|-
| 0x00000032
| 0x010000000000100F
| [17.0.0+] LibraryAppletOfflineWebApp_3 ([[Internet_Browser#Offline_Applet|LibraryAppletOfflineWeb (offlineWeb)]] in NX)
|-
| 0x00000033
| 0x010000000000100F
| [17.0.0+] LibraryAppletOfflineWebSystem ([[Internet_Browser#Offline_Applet|LibraryAppletOfflineWeb (offlineWeb)]] in NX)
|-
| 0x00000035
| [17.0.0+] 0x0100000000001010 ([16.0.0-16.1.0] 0x0100000000001042)
| [17.0.0+] LibraryAppletLhub ([16.0.0-16.1.0] ) ([[Internet_Browser#Whitelisted_Applets|LibraryAppletLoginShare (loginShare)]] in NX)
|-
| 0x00000036
| [17.0.0+] 0x0100000000001010 ([16.0.0-16.1.0] 0x0100000000001042)
| [17.0.0+] LibraryAppletLogin ([16.0.0-16.1.0] ) ([[Internet_Browser#Whitelisted_Applets|LibraryAppletLoginShare (loginShare)]] in NX)
|-
| 0x00000037
| [17.0.0+] 0x0100000000001010 ([16.0.0-16.1.0] 0x0100000000001042)
| [17.0.0+] LibraryAppletShare ([16.0.0-16.1.0] ) ([[Internet_Browser#Whitelisted_Applets|LibraryAppletLoginShare (loginShare)]] in NX)
|-
| 0x00000038
| 0x0100000000001043
| [16.0.0-16.1.0]
|-
| 0x00000050
| 0x0100000000001007
| [18.0.0+]
|-
| 0x00000051
| 0x0100000000001007
| [18.0.0+]
|-
| 0x00000064
| 0x0100000000001048
| [20.0.0+] [[Splay_Applet|splay]]
|-
| 0x000003E8
|
| [10.0.0-16.1.0] DevlopmentTool
|-
| 0x000003F1
| 0x010000000000D619
| [10.0.0-16.1.0] CombinationLA
|-
| 0x000003F2
| 0x010000000000D610
| [10.0.0-16.1.0] AeSystemApplet
|-
| 0x000003F3
| 0x010000000000D611
| [10.0.0-16.1.0] AeOverlayApplet
|-
| 0x000003F4
| 0x010000000000D612
| [10.0.0-16.1.0] AeStarter
|-
| 0x000003F5
| 0x010000000000D613
| [10.0.0-16.1.0] AeLibraryAppletAlone
|-
| 0x000003F6
| 0x010000000000D614
| [10.0.0-16.1.0] AeLibraryApplet1
|-
| 0x000003F7
| 0x010000000000D615
| [10.0.0-16.1.0] AeLibraryApplet2
|-
| 0x000003F8
| 0x010000000000D616
| [10.0.0-16.1.0] AeLibraryApplet3
|-
| 0x000003F9
| 0x010000000000D617
| [10.0.0-16.1.0] AeLibraryApplet4
|-
| 0x000003FA
| 0x010000000000D60A
| [10.0.0-16.1.0] AppletISA
|-
| 0x000003FB
| 0x010000000000D60B
| [10.0.0-16.1.0] AppletIOA
|-
| 0x000003FC
| 0x010000000000D60C
| [10.0.0-16.1.0] AppletISTA
|-
| 0x000003FD
| 0x010000000000D60D
| [10.0.0-16.1.0] AppletILA1
|-
| 0x000003FE
| 0x010000000000D60E
| [10.0.0-16.1.0] AppletILA2
|-
| 0x0100000E
|
| [S2] LibraryAppletError
|-
| 0x01000010
|
| [S2] LibraryAppletPlayerSelect
|-
| 0x01010011
|
| [S2] SwkbdModeless
|-
| 0x01020011
|
| [S2] Swkbd
|-
| 0x01000013
|
| [S2] OpenWeb
|-
| 0x01000014
|
| [S2] LibraryAppletShop
|-
| 0x01000022
|
| [S2] LibraryAppletPromoteQualification
|-
| 0x01010025
|
| [S2] SaveDataBackup
|-
| 0x01020025
|
| [S2] SaveDataBackup
|-
| 0x01000032
|
| [S2] LibraryAppletOfflineWebApp_3
|-
| 0x01000033
|
| [S2] LibraryAppletOfflineWebSystem
|-
| 0x01000035
|
| [S2] LibraryAppletLhub
|-
| 0x01000036
|
| [S2] LibraryAppletLogin
|-
| 0x01000037
|
| [S2] LibraryAppletShare
|-
| 0x01000050
|
| [S2] PlayerSelect
|-
| 0x01000051
|
| [S2] PlayerSelect
|-
| 0x01000052
|
| [S2] PlayerSelect
|-
| 0x700000C8
| 0x010000000000D65B
| [18.0.0+]
|-
| 0x700000C9
| 0x010000000000D65C
| [18.0.0+]
|-
| 0x700000DC
| 0x010000000000D619
| [17.0.0+] CombinationLA
|-
| 0x700000E6
| 0x010000000000D610
| [17.0.0+] AeSystemApplet
|-
| 0x700000E7
| 0x010000000000D611
| [17.0.0+] AeOverlayApplet
|-
| 0x700000E8
| 0x010000000000D612
| [17.0.0+] AeStarter
|-
| 0x700000E9
| 0x010000000000D613
| [17.0.0+] AeLibraryAppletAlone
|-
| 0x700000EA
| 0x010000000000D614
| [17.0.0+] AeLibraryApplet1
|-
| 0x700000EB
| 0x010000000000D615
| [17.0.0+] AeLibraryApplet2
|-
| 0x700000EC
| 0x010000000000D616
| [17.0.0+] AeLibraryApplet3
|-
| 0x700000ED
| 0x010000000000D617
| [17.0.0+] AeLibraryApplet4
|-
| 0x700000F0
| 0x010000000000D60A
| [17.0.0+] AppletISA
|-
| 0x700000F1
| 0x010000000000D60B
| [17.0.0+] AppletIOA
|-
| 0x700000F2
| 0x010000000000D60C
| [17.0.0+] AppletISTA
|-
| 0x700000F3
| 0x010000000000D60D
| [17.0.0+] AppletILA1
|-
| 0x700000F4
| 0x010000000000D60E
| [17.0.0+] AppletILA2
|-
| 0x700000FA
| 0x010000000000D677
| [20.1.0+]
|}
 
= LibraryAppletMode =
This is "nn::applet::LibraryAppletMode".
 
{| class="wikitable" border="1"
|-
! Value
! Description
|-
| 0x0
| AllForeground
|-
| 0x1
| PartialForeground
|-
| 0x2
| NoUi
|-
| 0x3
| PartialForegroundWithIndirectDisplay (see also [[#GetIndirectLayerConsumerHandle]], only used by swkbd [[Software_Keyboard|InlineKeyboard]])
|-
| 0x4
| AllForegroundInitiallyHidden (can be used by [7.0.0+] [[Internet_Browser|WebSession]])
|}
 
= AppletMessage =
This is "nn::am::AppletMessage".
 
{| class="wikitable" border="1"
|-
! Value
! Description
|-
| 0 || None
|-
| 1 || ChangeIntoForeground
|-
| 2 || ChangeIntoBackground
|-
| 4 || Exit
|-
| 6 || ApplicationExited
|-
| 7 ||
|-
| 15 || [[#FocusState|FocusStateChanged]]
|-
| 16 || [[#SetRestartMessageEnabled|Resume]]
|-
| 20 || DetectShortPressingHomeButton
|-
| 21 || DetectLongPressingHomeButton
|-
| 22 || DetectShortPressingPowerButton
|-
| 23 || DetectMiddlePressingPowerButton
|-
| 24 || DetectLongPressingPowerButton
|-
| 25 || RequestToPrepareSleep
|-
| 26 || FinishedSleepSequence
|-
| 27 || SleepRequiredByHighTemperature
|-
| 28 || SleepRequiredByLowBattery
|-
| 29 || AutoPowerDown
|-
| 30 || [[#OperationMode|OperationModeChanged]]
|-
| 31 || [[#PerformanceMode|PerformanceModeChanged]]
|-
| 32 || DetectReceivingCecSystemStandby
|-
| 33 || SdCardRemoved
|-
| 34 ||
|-
| 50 || LaunchApplicationRequested
|-
| 51 || [[#SetHandlesRequestToDisplay|RequestToDisplay]]
|-
| 55 || ShowApplicationLogo
|-
| 56 || HideApplicationLogo
|-
| 57 || ForceHideApplicationLogo
|-
| 58 ||
|-
| 59 ||
|-
| 60 || FloatingApplicationDetected
|-
| 61 || [7.0.0+] PerformanceConfigurationChanged
|-
| 70 ||
|-
| 71 ||
|-
| 72 ||
|-
| 73 ||
|-
| 75 ||
|-
| 80 ||
|-
|-
| 0 || None
| 81 ||  
|-
|-
| 1 || ChangeIntoForeground
| 82 ||  
|-
|-
| 2 || ChangeIntoBackground
| 83 ||  
|-
|-
| 4 || Exit
| 85 ||  
|-
|-
| 6 || ApplicationExited
| 86 ||  
|-
|-
| 7 ||  
| 90 || [[#SetRequiresCaptureButtonShortPressedMessage|DetectShortPressingCaptureButton]]
|-
|-
| 15 || [[#FocusState|FocusStateChanged]]
| 92 || [[#SetAlbumImageTakenNotificationEnabled|AlbumScreenShotTaken]]
|-
|-
| 16 || [[#SetRestartMessageEnabled|Resume]]
| 93 || AlbumRecordingSaved
|-
|-
| 20 || DetectShortPressingHomeButton
| 94 ||  
|-
|-
| 21 || DetectLongPressingHomeButton
| 100 ||  
|-
|-
| 22 || DetectShortPressingPowerButton
| 101 ||  
|-
|-
| 23 || DetectMiddlePressingPowerButton
| 110 || [14.0.0+] DetectShortPressingCaptureButtonForApplet
|-
|-
| 24 || DetectLongPressingPowerButton
| 111 || [14.0.0+] DetectLongPressingCaptureButtonForApplet
|-
|-
| 25 || RequestToPrepareSleep
| 1000 ||  
|}
 
= OperationMode =
This is "nn::oe::OperationMode".
 
{| class="wikitable" border="1"
|-
|-
| 26 || FinishedSleepSequence
! Value
! Description
|-
|-
| 27 || SleepRequiredByHighTemperature
| 0 || Handheld
|-
|-
| 28 || SleepRequiredByLowBattery
| 1 || Console
|}
 
= PerformanceMode =
This is "nn::oe::PerformanceMode".
 
{| class="wikitable" border="1"
|-
|-
| 29 || AutoPowerDown
! Value
! Description
|-
|-
| 30 || [[#OperationMode|OperationModeChanged]]
| -1 || Invalid
|-
|-
| 31 || [[#PerformanceMode|PerformanceModeChanged]]
| 0 || Normal
|-
|-
| 32 || DetectReceivingCecSystemStandby
| 1 || Boost
|}
 
= FocusState =
This is "nn::oe::FocusState".
 
{| class="wikitable" border="1"
|-
|-
| 33 || SdCardRemoved
! Value
! Description
|-
|-
| 34 ||  
| 1 || InFocus
|-
|-
| 50 || LaunchApplicationRequested
| 2 || OutOfFocus
|-
|-
| 51 || [[#SetHandlesRequestToDisplay|RequestToDisplay]]
| 3 || Background
|}
 
= CpuBoostMode =
This is "nn::oe::CpuBoostMode".
 
{| class="wikitable" border="1"
|-
|-
| 55 || ShowApplicationLogo
! Value
! Description
|-
|-
| 56 || HideApplicationLogo
| 0 || Normal
|-
|-
| 57 || ForceHideApplicationLogo
| 1 || FastLoad
|}
 
= WindowOriginMode =
This is "nn::oe::WindowOriginMode".
 
{| class="wikitable" border="1"
|-
|-
| 58 ||
! Value
! Description
|-
|-
| 59 ||  
| 0 || LowerLeft
|-
|-
| 60 || FloatingApplicationDetected
| 1 || UpperLeft
|}
 
= WirelessPriorityMode =
This is "nn::oe::WirelessPriorityMode".
 
{| class="wikitable" border="1"
|-
|-
| 61 || [7.0.0+] PerformanceConfigurationChanged
! Value
! Description
|-
|-
| 70 ||  
| 0 || Default
|-
|-
| 71 ||  
| 1 || OptimizedForWlan
|}
 
= TvPowerStateMatchingMode =
This is "nn::oe::TvPowerStateMatchingMode". This is used with [[#SetTvPowerStateMatchingMode]].
 
{| class="wikitable" border="1"
|-
|-
| 72 ||
! Value
! Description
|-
|-
| 73 ||  
| 0 || Unknown
|-
|-
| 75 ||  
| 1 || Unknown
|}
 
= SystemButtonType =
This is "nn::am::service::SystemButtonType". This is used with [[#PerformSystemButtonPressingIfInFocus]]/[[#PerformSystemButtonPressing]].
 
{| class="wikitable" border="1"
|-
|-
| 80 ||
! Value
! Description
|-
|-
| 81 ||  
| 1 || PerformHomeButtonShortPressing
|-
|-
| 82 ||  
| 2 || PerformHomeButtonLongPressing
|-
|-
| 83 ||  
| 3 || Short-pressing with the Power-button. Only available with [[#PerformSystemButtonPressing]].
|-
|-
| 85 ||  
| 4 || Long-pressing with the Power-button. Only available with [[#PerformSystemButtonPressing]].
|-
|-
| 86 ||  
| 5 || Shutdown the system. Only available with [[#PerformSystemButtonPressing]].
|-
|-
| 90 || [[#SetRequiresCaptureButtonShortPressedMessage|DetectShortPressingCaptureButton]]
| 6 || PerformCaptureButtonShortPressing
|-
|-
| 92 || [[#SetAlbumImageTakenNotificationEnabled|AlbumScreenShotTaken]]
| 7 || PerformCaptureButtonLongPressing
|}
 
= LaunchParameterKind =
{| class="wikitable" border="1"
|-
|-
| 93 || AlbumRecordingSaved
! Value
! Description
|-
|-
| 94 ||  
| 1 || UserChannel. Application-specific LaunchParameter.
|-
|-
| 100 ||  
| 2 || account PreselectedUser
|-
|-
| 101 ||
| 3 || Unknown if used by anything?
|-
|}
| 110 || [14.0.0+] DetectShortPressingCaptureButtonForApplet
 
|-
= LibraryAppletExitReason =
| 111 || [14.0.0+] DetectLongPressingCaptureButtonForApplet
|-
| 1000 ||  
|}
 
= OperationMode =
This is "nn::oe::OperationMode".
 
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
Line 3,621: Line 4,652:
! Description
! Description
|-
|-
| 0 || Handheld
| 0 || Normal
|-
| 1 || Canceled
|-
| 2 || Abnormal
|-
|-
| 1 || Console
| 10 || Unexpected
|}
|}


= PerformanceMode =
= ProgramSpecifyKind =
This is "nn::oe::PerformanceMode".
This is "nn::am::service::ProgramSpecifyKind". This controls the type of the u64 passed to [[#ExecuteProgram]].


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 3,634: Line 4,669:
! Description
! Description
|-
|-
| -1 || Invalid
| 0 || u8 ProgramIndex. "ExecuteProgram". [[NS_Services|NS]] handles ProgramIndex by launching ApplicationId+ProgramIndex. After using [[#ExecuteProgram]] with this successfully, official user-processes will enter an infinite loop with sleep-thread value 86400000000000.
|-
|-
| 0 || Normal
| 1 || [[NCM_services#ApplicationId|ApplicationId]]. "JumpToSubApplicationProgramForDevelopment". Only available when [[Settings_services#GetDebugModeFlag|DebugMode]] is 1.
|-
|-
| 1 || Boost
| 2 || u64 = value 0. "RestartProgram"
|}
|}


= FocusState =
ProgramIndex values where the title is not installed should not be used: [[qlaunch]] will display an error message and the current title will become "corrupted", however Home Menu will have an option to repair it.
This is "nn::oe::FocusState".
 
= InputDetectionPolicy =
This is u32 enum "nn::applet::InputDetectionPolicy".


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 3,649: Line 4,686:
! Description
! Description
|-
|-
| 1 || InFocus
| 0 || Unknown
|-
|-
| 2 || OutOfFocus
| 1 || Unknown
|-
| 3 || Background
|}
|}


= CpuBoostMode =
= AppletResourceUserId =
This is "nn::oe::CpuBoostMode".
This is "nn::applet::AppletResourceUserId". Used by a number of non-AM services.
 
= AppletAttribute =
This is "nn::am::AppletAttribute". This struct is 0x80 bytes.


{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Value
! Offset || Size || Description
! Description
|-
|-
| 0 || Normal
| 0x0 || 0x1 || Flag. When non-zero, two state fields are set to 1.
|-
|-
| 1 || FastLoad
| 0x1 || 0x7F || Unused
|}
|}


= WindowOriginMode =
This is used by [[#OpenLibraryAppletProxy]].
This is "nn::oe::WindowOriginMode".
 
= AppletProcessLaunchReason =
This is "nn::am::service::AppletProcessLaunchReason". This struct is 0x4-bytes.


{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Value
! Offset || Size || Description
! Description
|-
| 0x0 || 0x1 || Flag. When non-zero, LibraryApplets then use [[#OpenCallingLibraryApplet]].
|-
|-
| 0 || LowerLeft
| 0x1 || 0x2 || Always 0.
|-
|-
| 1 || UpperLeft
| 0x3 || 0x1 || Always 0.
|}
|}


= WirelessPriorityMode =
= LibraryAppletInfo =
This is "nn::oe::WirelessPriorityMode".
This is "nn::am::service::LibraryAppletInfo". This struct is 0x8-bytes.


{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Value
! Offset || Size || Description
! Description
|-
|-
| 0 || Default
| 0x0 || 0x4 || [[#AppletId]]
|-
|-
| 1 || OptimizedForWlan
| 0x4 || 0x4 || [[#LibraryAppletMode]]
|}
|}


= TvPowerStateMatchingMode =
= AppletKind =
This is "nn::oe::TvPowerStateMatchingMode". This is used with [[#SetTvPowerStateMatchingMode]].
This is "nn::am::service::AppletKind". This is 8-bytes.
 
= AppletIdentityInfo =
This struct is "nn::am::service::AppletIdentityInfo". This struct is 0x10-bytes.


{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Value
! Offset || Size || Description
! Description
|-
| 0x0 || 0x4 || [[#AppletId]]
|-
|-
| 0 || Unknown
| 0x4 || 0x4 || Padding
|-
|-
| 1 || Unknown
| 0x8 || 0x8 || [[NCM_services#ApplicationId|ApplicationId]]
|}
|}


= SystemButtonType =
= ApplicationAttributeForQuest =
This is "nn::am::service::SystemButtonType". This is used with [[#PerformSystemButtonPressingIfInFocus]]/[[#PerformSystemButtonPressing]].
This struct is "nn::applet::ApplicationAttributeForQuest".


{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Value
! Offset || Size || Description
! Description
|-
|-
| 1 || PerformHomeButtonShortPressing
| 0x0 || 0x4 || See [[#ApplicationAttribute]].
|-
|-
| 2 || PerformHomeButtonLongPressing
| 0x4 || 0x4 || See [[#ApplicationAttribute]].
|-
|-
| 3 || Short-pressing with the Power-button. Only available with [[#PerformSystemButtonPressing]].
| 0x8 || 0x4 || [7.0.0+] See [[#ApplicationAttribute]].
|}
 
User-processes copy the first 0x8-bytes (0xC-bytes with [[#CreateApplicationWithAttributeAndPushAndRequestToStartForQuest]]/[[#CreateApplicationWithAttributeAndRequestToStartForQuest]]) to a [[#ApplicationAttribute]] with the rest of the struct being cleared, which is then passed to the actual cmd (CreateApplication*ToStartForQuest).
 
= ApplicationAttribute =
This struct is "nn::am::ApplicationAttribute". This struct is 0x20-bytes.
 
{| class="wikitable" border="1"
|-
|-
| 4 || Long-pressing with the Power-button. Only available with [[#PerformSystemButtonPressing]].
! Offset || Size || Description
|-
|-
| 5 || Shutdown the system. Only available with [[#PerformSystemButtonPressing]].
| 0x0 || 0x4 || Default is 0 for non-Quest. Only used when non-zero: unknown value in seconds.
|-
|-
| 6 || PerformCaptureButtonShortPressing
| 0x4 || 0x4 || Default is 0 for non-Quest. Only used when non-zero: unknown value in seconds.
|-
| 0x8 || 0x4 || float audio volume. Must be in the range of 0.0f-1.0f. The default is 1.0f.
|-
|-
| 7 || PerformCaptureButtonLongPressing
| 0xC || 0x14 || Unused. Default is 0.
|}
|}


= LaunchParameterKind =
Internally AM only uses the first 0xC-bytes from ApplicationAttribute, regardless of the cmd.
 
= ApplicationLaunchProperty =
This struct is 0x10-bytes.
 
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Value
! Offset || Size || Description
! Description
|-
| 0x0 || 0x8 || [[NCM_services#ApplicationId|ApplicationId]]
|-
| 0x8 || 0x4 || Application title-version.
|-
| 0xC || 0x1 || [[Filesystem_services#StorageId|StorageId]] for the Application base title.
|-
|-
| 1 || UserChannel. Application-specific LaunchParameter.
| 0xD || 0x1 || [[Filesystem_services#StorageId|StorageId]] for the Application update title.
|-
|-
| 2 || account PreselectedUser
| 0xE || 0x1 || Unknown.
|-
|-
| 3 || Unknown if used by anything?
| 0xF || 0x1 || Padding.
|}
|}


= LibraryAppletExitReason =
= ApplicationLaunchRequestInfo =
This is "nn::applet::ApplicationLaunchRequestInfo". This struct is 0x10-bytes.
 
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Value
! Offset || Size || Description
! Description
|-
|-
| 0 || Normal
| 0x0 || 0x4 || Unknown. The default is 0x0 with [[#CreateSystemApplication]], 0x3 with [[#CreateApplication]].
|-
|-
| 1 || Canceled
| 0x4 || 0x4 || Unknown. The default is 0x0 with [[#CreateSystemApplication]], 0x3 with [[#CreateApplication]].
|-
|-
| 2 || Abnormal
| 0x8 || 0x8 || Unknown. The default is 0x0.
|-
| 10 || Unexpected
|}
|}


= ProgramSpecifyKind =
= AppletResourceUsageInfo =
This is "nn::am::service::ProgramSpecifyKind". This controls the type of the u64 passed to [[#ExecuteProgram]].
This is "nn::am::service::AppletResourceUsageInfo". This struct is 0x20-bytes.


{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Value
! Offset || Size || Description
! Description
|-
| 0x0 || 0x4 || Unknown counter.
|-
|-
| 0 || u8 ProgramIndex. "ExecuteProgram". [[NS_Services|NS]] handles ProgramIndex by launching ApplicationId+ProgramIndex. After using [[#ExecuteProgram]] with this successfully, official user-processes will enter an infinite loop with sleep-thread value 86400000000000.
| 0x4 || 0x4 || Unknown counter.
|-
|-
| 1 || [[NCM_services#ApplicationId|ApplicationId]]. "JumpToSubApplicationProgramForDevelopment". Only available when [[Settings_services#GetDebugModeFlag|DebugMode]] is 1.
| 0x8 || 0x4 || Output from [[NS_Services|NS GetRightsEnvironmentCountForDebug]].
|-
|-
| 2 || u64 = value 0. "RestartProgram"
| 0xC || 0x14 || Always zero.
|}
|}


ProgramIndex values where the title is not installed should not be used: [[qlaunch]] will display an error message and the current title will become "corrupted", however Home Menu will have an option to repair it.
= ApplicationLicenseType =
This is "nn::oe::ApplicationLicenseType". This is 1-byte.
 
= LaunchRequiredVersion =
This is "nn::oe::LaunchRequiredVersion". This is a 0x40-byte struct with 1-byte alignment.


= InputDetectionPolicy =
= ServerEnvironmentType =
This is u32 enum "nn::applet::InputDetectionPolicy".
This is "nn::oe::ServerEnvironmentType".


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 3,784: Line 4,849:
! Description
! Description
|-
|-
| 0 || Unknown
| 0 || dd
|-
|-
| 1 || Unknown
| 1 || lp
|}
 
= AppletResourceUserId =
This is "nn::applet::AppletResourceUserId". Used by a number of non-AM services.
 
= AppletAttribute =
This is "nn::am::AppletAttribute". This struct is 0x80 bytes.
 
{| class="wikitable" border="1"
|-
|-
! Offset || Size || Description
| 2 || sd
|-
|-
| 0x0 || 0x1 || Flag. When non-zero, two state fields are set to 1.
| 3 || sp
|-
|-
| 0x1 || 0x7F || Unused
| 4 || dp
|}
 
This is used by [[#OpenLibraryAppletProxy]].
 
= AppletProcessLaunchReason =
This is "nn::am::service::AppletProcessLaunchReason". This struct is 0x4-bytes.
 
{| class="wikitable" border="1"
|-
! Offset || Size || Description
|-
| 0x0 || 0x1 || Flag. When non-zero, LibraryApplets then use [[#OpenCallingLibraryApplet]].
|-
| 0x1 || 0x2 || Always 0.
|-
| 0x3 || 0x1 || Always 0.
|}
 
= LibraryAppletInfo =
This is "nn::am::service::LibraryAppletInfo". This struct is 0x8-bytes.
 
{| class="wikitable" border="1"
|-
! Offset || Size || Description
|-
| 0x0 || 0x4 || [[#AppletId]]
|-
| 0x4 || 0x4 || [[#LibraryAppletMode]]
|}
 
= AppletKind =
This is "nn::am::service::AppletKind". This is 8-bytes.
 
= AppletIdentityInfo =
This struct is "nn::am::service::AppletIdentityInfo". This struct is 0x10-bytes.
 
{| class="wikitable" border="1"
|-
! Offset || Size || Description
|-
| 0x0 || 0x4 || [[#AppletId]]
|-
| 0x4 || 0x4 || Padding
|-
| 0x8 || 0x8 || [[NCM_services#ApplicationId|ApplicationId]]
|}
|}


= ApplicationAttributeForQuest =
= (S2) AdrawFrameBufferInfo =
This struct is "nn::applet::ApplicationAttributeForQuest".
 
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Offset || Size || Description
! Offset || Size || Description
|-
|-
| 0x0 || 0x4 || See [[#ApplicationAttribute]].
| 0x0 || 0x8 || Id
|-
|-
| 0x4 || 0x4 || See [[#ApplicationAttribute]].
| 0x8 || 0x2 || Width
|-
|-
| 0x8 || 0x4 || [7.0.0+] See [[#ApplicationAttribute]].
| 0xA || 0x2 || Height
|}
 
User-processes copy the first 0x8-bytes (0xC-bytes with [[#CreateApplicationWithAttributeAndPushAndRequestToStartForQuest]]/[[#CreateApplicationWithAttributeAndRequestToStartForQuest]]) to a [[#ApplicationAttribute]] with the rest of the struct being cleared, which is then passed to the actual cmd (CreateApplication*ToStartForQuest).
 
= ApplicationAttribute =
This struct is "nn::am::ApplicationAttribute". This struct is 0x20-bytes.
 
{| class="wikitable" border="1"
|-
! Offset || Size || Description
|-
|-
| 0x0 || 0x4 || Default is 0 for non-Quest. Only used when non-zero: unknown value in seconds.
| 0xC || 0x4 || BlockCount
|-
|-
| 0x4 || 0x4 || Default is 0 for non-Quest. Only used when non-zero: unknown value in seconds.
| 0x10 || 0x8 ||  
|-
|-
| 0x8 || 0x4 || float audio volume. Must be in the range of 0.0f-1.0f. The default is 1.0f.
| 0x18 || 0x8 ||  
|-
|-
| 0xC || 0x14 || Unused. Default is 0.
| 0x20 || 0x8 ||  
|}
|}


Internally AM only uses the first 0xC-bytes from ApplicationAttribute, regardless of the cmd.
= (S2) ImageInfo =
 
= ApplicationLaunchProperty =
This struct is 0x10-bytes.
 
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Offset || Size || Description
! Offset || Size || Description
|-
|-
| 0x0 || 0x8 || [[NCM_services#ApplicationId|ApplicationId]]
| 0x0 || 0x8 ||  
|-
| 0x8 || 0x4 || Application title-version.
|-
|-
| 0xC || 0x1 || [[Filesystem_services#StorageId|StorageId]] for the Application base title.
| 0x8 || 0x8 || Address
|-
|-
| 0xD || 0x1 || [[Filesystem_services#StorageId|StorageId]] for the Application update title.
| 0x10 || 0x8 ||  
|-
|-
| 0xE || 0x1 || Unknown.
| 0x18 || 0x8 ||  
|-
|-
| 0xF || 0x1 || Padding.
| 0x20 || 0x8 ||  
|}
 
= ApplicationLaunchRequestInfo =
This is "nn::applet::ApplicationLaunchRequestInfo". This struct is 0x10-bytes.
 
{| class="wikitable" border="1"
|-
|-
! Offset || Size || Description
| 0x28 || 0x8 ||  
|-
|-
| 0x0 || 0x4 || Unknown. The default is 0x0 with [[#CreateSystemApplication]], 0x3 with [[#CreateApplication]].
| 0x30 || 0x8 ||  
|-
|-
| 0x4 || 0x4 || Unknown. The default is 0x0 with [[#CreateSystemApplication]], 0x3 with [[#CreateApplication]].
| 0x38 || 0x4 || Offset
|-
|-
| 0x8 || 0x8 || Unknown. The default is 0x0.
| 0x3C || 0x4 || Size
|}
 
= AppletResourceUsageInfo =
This is "nn::am::service::AppletResourceUsageInfo". This struct is 0x20-bytes.
 
{| class="wikitable" border="1"
|-
|-
! Offset || Size || Description
| 0x40 || 0x8 ||  
|-
|-
| 0x0 || 0x4 || Unknown counter.
| 0x48 || 0x8 ||  
|-
|-
| 0x4 || 0x4 || Unknown counter.
| 0x50 || 0x8 ||  
|-
|-
| 0x8 || 0x4 || Output from [[NS_Services|NS GetRightsEnvironmentCountForDebug]].
| 0x58 || 0x8 ||  
|-
|-
| 0xC || 0x14 || Always zero.
| 0x60 || 0x8 ||  
|}
 
= ApplicationLicenseType =
This is "nn::oe::ApplicationLicenseType". This is 1-byte.
 
= LaunchRequiredVersion =
This is "nn::oe::LaunchRequiredVersion". This is a 0x40-byte struct with 1-byte alignment.
 
= ServerEnvironmentType =
This is "nn::oe::ServerEnvironmentType".
 
{| class="wikitable" border="1"
|-
|-
! Value
| 0x68 || 0x8 ||
! Description
|-
|-
| 0 || dd
| 0x70 || 0x8 ||  
|-
|-
| 1 || lp
| 0x78 || 0x8 ||  
|-
|-
| 2 || sd
| 0x80 || 0x8 ||  
|-
|-
| 3 || sp
| 0x88 || 0x8 ||  
|-
|-
| 4 || dp
| 0x90 || 0x4 || Flags
|}
|}