Difference between revisions of "Applet Manager services"

From Nintendo Switch Brew
Jump to navigation Jump to search
Line 97: Line 97:
 
! Cmd || Name || Notes
 
! Cmd || Name || Notes
 
|-
 
|-
| 10 || RequestToGetForeground ||  
+
| 10 || [[#RequestToGetForeground]] ||  
 
|-
 
|-
| 11 || LockForeground ||
+
| 11 || [[#LockForeground]] ||
 
|-
 
|-
| 12 || UnlockForeground ||  
+
| 12 || [[#UnlockForeground]] ||  
 
|-
 
|-
 
| 20 || [[#PopFromGeneralChannel]] ||  
 
| 20 || [[#PopFromGeneralChannel]] ||  
Line 115: Line 115:
 
| 200 || [8.0.0+] [[#LaunchDevMenu]] ||
 
| 200 || [8.0.0+] [[#LaunchDevMenu]] ||
 
|}
 
|}
 +
 +
==== RequestToGetForeground ====
 +
No input/output.
 +
 +
==== LockForeground ====
 +
No input/output.
 +
 +
==== UnlockForeground ====
 +
No input/output.
  
 
==== PopFromGeneralChannel ====
 
==== PopFromGeneralChannel ====
Line 120: Line 129:
  
 
==== GetPopFromGeneralChannelEvent ====
 
==== GetPopFromGeneralChannelEvent ====
No input, returns an output handle.
+
No input, returns an output Event handle with autoclear=false.
  
 
==== GetHomeButtonWriterLockAccessor ====
 
==== GetHomeButtonWriterLockAccessor ====

Revision as of 21:17, 7 August 2019

AM (Applet Manager) provides services for interacting with system applets while abstracting several aspects of power and operation management.

Contains multiple raw images, with at least the following: "NN_OMM_CHARGING_BIN_{begin|end}"(charging icon), low-battery icon, and the Nintendo Switch logo displayed during system boot.

appletAE

This is "nn::am::service::IAllSystemAppletProxiesService".

Cmd Name Notes
100 OpenSystemAppletProxy Returns an #ISystemAppletProxy.
200 OpenLibraryAppletProxyOld ([1.0.0-2.3.0] OpenLibraryAppletProxy) Returns an #ILibraryAppletProxy.
201 [3.0.0+] #OpenLibraryAppletProxy Returns an #ILibraryAppletProxy.
300 OpenOverlayAppletProxy Returns an #IOverlayAppletProxy.
350 OpenSystemApplicationProxy Returns an #IApplicationProxy.
400 #CreateSelfLibraryAppletCreatorForDevelop
410 [6.0.0+] #GetSystemAppletControllerForDebug
1000 [6.0.0+] #GetDebugFunctions

All of these Open*Proxy commands except #OpenLibraryAppletProxy take the same input as #OpenApplicationProxy, with the same user-process retry-loop as #OpenApplicationProxy. These Open*Proxy commands (including appletOE) doesn't seem to usable from processes which aren't actual applets (such as sysmodules), at least for applet-types which aren't already in use.

This service is used by all system non-regular-applications.

The 01000000000010XX system titles use the following applet types(above Open{type}Proxy commands):

  • "qlaunch": SystemApplet
  • "overlay": OverlayApplet
  • "starter": SystemApplication
  • "maintenance": SystemApplet
  • All others: LibraryApplet

OpenLibraryAppletProxy

Returns an #ILibraryAppletProxy.

Takes a reserved input u64(official user-processes use hard-coded value 0), a PID,a process copy-handle(cur-proc handle alias), and an 0x80-byte type-0x15 input buffer AppletAttribute.

Official user-processes use the same retry loop with this as the other Open*Proxy commands.

CreateSelfLibraryAppletCreatorForDevelop

Takes a PID and an input u64 pid_placeholder, returns an #ILibraryAppletCreator.

The cached value loaded from Settings_services#GetDebugModeFlag must be 1, otherwise an error is returned.

The cached value loaded from system-setting am.debug!dev_function must be set to 0x1 with size 0x1, otherwise an error is returned.

GetSystemAppletControllerForDebug

No input, returns an #ISystemAppletControllerForDebug.

The cached value loaded from system-setting am.debug!dev_function must be set to 0x1 with size 0x1, and various state checks must pass, otherwise 0 is returned with no output interface.

GetDebugFunctions

No input, returns an #IDebugFunctions.

The cached value loaded from system-setting am.debug!dev_function must be set to 0x1 with size 0x1, otherwise 0 is returned with no output interface.

ISystemAppletProxy

Cmd Name Notes
0 GetCommonStateGetter Returns an #ICommonStateGetter.
1 GetSelfController Returns an #ISelfController.
2 GetWindowController Returns an #IWindowController.
3 GetAudioController Returns an #IAudioController.
4 GetDisplayController Returns an #IDisplayController.
10 GetProcessWindingController Returns an #IProcessWindingController.
11 GetLibraryAppletCreator Returns an #ILibraryAppletCreator.
20 GetHomeMenuFunctions Returns an #IHomeMenuFunctions.
21 GetGlobalStateController Returns an #IGlobalStateController.
22 GetApplicationCreator Returns an #IApplicationCreator.
23 [7.0.0+] GetAppletCommonFunctions Returns an #IAppletCommonFunctions.
1000 GetDebugFunctions Returns an #IDebugFunctions.

IHomeMenuFunctions

Cmd Name Notes
10 #RequestToGetForeground
11 #LockForeground
12 #UnlockForeground
20 #PopFromGeneralChannel
21 #GetPopFromGeneralChannelEvent
30 #GetHomeButtonWriterLockAccessor
31 [2.0.0+] #GetWriterLockAccessorEx
100 [6.0.0+] PopRequestLaunchApplicationForDebug
200 [8.0.0+] #LaunchDevMenu

RequestToGetForeground

No input/output.

LockForeground

No input/output.

UnlockForeground

No input/output.

PopFromGeneralChannel

No input, returns an output #IStorage.

GetPopFromGeneralChannelEvent

No input, returns an output Event handle with autoclear=false.

GetHomeButtonWriterLockAccessor

No input, returns an output #ILockAccessor.

Similar to using #GetWriterLockAccessorEx with inval=0.

GetWriterLockAccessorEx

Takes an input u32, returns an output #ILockAccessor.

The input value must be 0-3. 0 = HomeButton.

LaunchDevMenu

No input/output.

The cached value loaded from Settings_services#GetDebugModeFlag must be 1, otherwise an error is returned.

Uses NS_Services#IApplicationManagerInterface cmd99.

ILockAccessor

Cmd Name
1 #TryLock
2 #Unlock
3 #GetEvent
TryLock

Takes an input u8 bool flag, returns an output u8 bool flag and a handle.

Official sw waits on the previously loaded event from #GetEvent. The output flag indicates whether locking was successful, the user-process can try using this cmd again when flag=false.

Official sw only uses inflag=false. Official sw just closes the output handle. The input flag controls whether this returns the output handle.

Unlock

No input/output.

GetEvent

No input, returns an output Event handle with autoclear=false.

IGlobalStateController

Cmd Name Notes
0 RequestToEnterSleep
1 EnterSleep
2 StartSleepSequence
3 StartShutdownSequence
4 StartRebootSequence
9 [7.0.0+] #IsAutoPowerDownRequested
10 LoadAndApplyIdlePolicySettings
11 [2.0.0+] NotifyCecSettingsChanged
12 [3.0.0+] SetDefaultHomeButtonLongPressTime
13 [3.0.0+] UpdateDefaultDisplayResolution
14 [3.0.0+] #ShouldSleepOnBoot
15 [4.0.0+] GetHdcpAuthenticationFailedEvent

IsAutoPowerDownRequested

No input, returns an output u8 bool.

ShouldSleepOnBoot

No input, returns an output u8 bool.

IApplicationCreator

Cmd Name Notes
0 #CreateApplication
1 #PopLaunchRequestedApplication
10 #CreateSystemApplication
100 #PopFloatingApplicationForDevelopment

CreateApplication

Takes an input u64 nn::ncm::ApplicationId(titleID), returns an #IApplicationAccessor.

PopLaunchRequestedApplication

No input, returns an #IApplicationAccessor.

CreateSystemApplication

Takes an input u64 nn::ncm::SystemApplicationId, returns an #IApplicationAccessor.

PopFloatingApplicationForDevelopment

No input, returns an #IApplicationAccessor.

IApplicationAccessor

Cmd Name Notes
0 #GetAppletStateChangedEvent
1 #IsCompleted
10 Start
20 RequestExit
25 Terminate
30 GetResult
101 RequestForApplicationToGetForeground
110 TerminateAllLibraryApplets
111 AreAnyLibraryAppletsLeft
112 #GetCurrentLibraryApplet
120 GetApplicationId
121 #PushLaunchParameter
122 #GetApplicationControlProperty
123 [2.0.0+] GetApplicationLaunchProperty
124 [6.0.0+] GetApplicationLaunchRequestInfo
130 [6.0.0+] SetUsers
131 [6.0.0+] CheckRightsEnvironmentAvailable
132 [6.0.0+] GetNsRightsEnvironmentHandle
140 [6.0.0+] GetDesirableUids
150 [6.0.0+] ReportApplicationExitTimeout
160 [8.0.0+] #SetApplicationAttribute
170 [8.0.0+] HasSaveDataAccessPermission

Commands <=30 are inherited from #IAppletAccessor.

GetCurrentLibraryApplet

No input, returns an output #IAppletAccessor.

PushLaunchParameter

Takes an input u32 #LaunchParameterKind and an input #IStorage, no output.

GetApplicationControlProperty

No input, takes a type-0x6 output buffer.

This gets the application control.nacp.

SetApplicationAttribute

Takes a type-0x15 input buffer containing an #ApplicationAttribute, no output.

IAppletAccessor
Cmd Name
0 #GetAppletStateChangedEvent
1 #IsCompleted
10 #Start
20 #RequestExit
25 #Terminate
30 #GetResult

GetAppletStateChangedEvent

No input, returns an output event handle with autoclear=false.

IsCompleted

No input, returns an output u8 bool.

Start

No input/output.

RequestExit

No input/output.

Terminate

No input/output.

GetResult

No input/output.

IAppletCommonFunctions

Added with 7.0.0.

Cmd Name Notes
10 #ReadThemeStorage
11 #WriteThemeStorage
40 [8.0.0+] #GetDisplayLogicalResolution
42 [8.0.0+] #SetDisplayMagnification
50 [8.0.0+] #SetHomeButtonDoubleClickEnabled
51 [8.0.0+] #GetHomeButtonDoubleClickEnabled

ReadThemeStorage/WriteThemeStorage: these commands copy data from/to a state buffer and the user specified buffer. The size of the state buffer is 0x400-bytes. The default content of the ThemeStorage prior to using the WriteThemeStorage cmd, is: memset(statebuf, 0xAA, 0x400);

ReadThemeStorage

Takes an input u64 offset and a type-0x22 output buffer, returns an output u64 actual_transfer_size.

WriteThemeStorage

Takes an input u64 offset and a type-0x21 input buffer, no output.

GetDisplayLogicalResolution

No input, returns an output s32 width and s32 height.

SetDisplayMagnification

Takes an input float x, float y, float width, and float height, no output.

Sets the DisplayMagnification. This is essentially layer image crop, for everything non-Overlay.

x and width are multiplied with the same width value returned by #GetDisplayLogicalResolution, so these should be in the range 0.0f-1.0f. Likewise for y and height, except these are multipled with the height value.

SetHomeButtonDoubleClickEnabled

Takes an input u8 bool, no output.

GetHomeButtonDoubleClickEnabled

No input, returns an output u8 bool.

ILibraryAppletProxy

Cmd Name Notes
0 GetCommonStateGetter Returns an #ICommonStateGetter.
1 GetSelfController Returns an #ISelfController.
2 GetWindowController Returns an #IWindowController.
3 GetAudioController Returns an #IAudioController.
4 GetDisplayController Returns an #IDisplayController.
10 GetProcessWindingController Returns an #IProcessWindingController.
11 GetLibraryAppletCreator Returns an #ILibraryAppletCreator.
20 OpenLibraryAppletSelfAccessor Returns an #ILibraryAppletSelfAccessor.
21 [7.0.0+] GetAppletCommonFunctions No input, returns an #IAppletCommonFunctions.
1000 GetDebugFunctions Returns an #IDebugFunctions.

ILibraryAppletSelfAccessor

Cmd Name Notes
0 #PopInData
1 #PushOutData
2 #PopInteractiveInData
3 #PushInteractiveOutData
5 #GetPopInDataEvent
6 #GetPopInteractiveInDataEvent
10 #ExitProcessAndReturn
11 #GetLibraryAppletInfo
12 #GetMainAppletIdentityInfo
13 #CanUseApplicationCore
14 #GetCallerAppletIdentityInfo
15 [2.0.0+] #GetMainAppletApplicationControlProperty
16 [2.0.0+] #GetMainAppletStorageId
17 [3.0.0+] #GetCallerAppletIdentityInfoStack
18 [4.0.0+] #GetNextReturnDestinationAppletIdentityInfo
19 [4.0.0+] GetDesirableKeyboardLayout
20 #PopExtraStorage
25 #GetPopExtraStorageEvent
30 #UnpopInData
31 #UnpopExtraStorage
40 [2.0.0+] GetIndirectLayerProducerHandle
50 [3.0.0+] ReportVisibleError
51 [4.0.0+] ReportVisibleErrorWithErrorContext
60 [4.0.0+] #GetMainAppletApplicationDesiredLanguage
70 [8.0.0+] GetCurrentApplicationId
80 [6.0.0+] RequestExitToSelf
90 [5.0.0+] CreateApplicationAndPushAndRequestToLaunch
100 [4.0.0+] #CreateGameMovieTrimmer
101 [5.0.0+] ReserveResourceForMovieOperation
102 [5.0.0+] UnreserveResourceForMovieOperation
110 [6.0.0+] GetMainAppletAvailableUsers

PopInData

No input, returns an output #IStorage.

PushOutData

Takes an input #IStorage, no output.

PopInteractiveInData

No input, returns an output #IStorage.

PushInteractiveOutData

Takes an input #IStorage, no output.

GetPopInDataEvent

No input, returns an output handle.

GetPopInteractiveInDataEvent

No input, returns an output handle.

ExitProcessAndReturn

No input/output.

Exits the LibraryApplet and returns to running the title which launched this LibraryApplet (qlaunch for example).

GetLibraryAppletInfo

No input, returns an output #LibraryAppletInfo.

GetMainAppletIdentityInfo

No input, returns an output #AppletIdentityInfo.

CanUseApplicationCore

No input, returns an output u8 bool.

GetCallerAppletIdentityInfo

No input, returns an output #AppletIdentityInfo.

GetMainAppletApplicationControlProperty

No input, takes a type-0x16 output buffer.

This gets the control.nacp.

GetMainAppletStorageId

No input, returns an output u8 storageId.

GetCallerAppletIdentityInfoStack

Takes a type-0x6 output buffer containing an array of #AppletIdentityInfo, and returns an output s32 total_entries.

GetNextReturnDestinationAppletIdentityInfo

No input, returns an output #AppletIdentityInfo.

PopExtraStorage

No input, returns an output #IStorage.

GetPopExtraStorageEvent

No input, returns an output handle.

UnpopInData

Takes an input #IStorage, no output.

UnpopExtraStorage

Takes an input #IStorage, no output.

GetMainAppletApplicationDesiredLanguage

No input, returns an output LanguageCode.

CreateGameMovieTrimmer

Takes an input u64 and handle, returns a GRC IGameMovieTrimmer.

IOverlayAppletProxy

Cmd Name Notes
0 GetCommonStateGetter Returns an #ICommonStateGetter.
1 GetSelfController Returns an #ISelfController.
2 GetWindowController Returns an #IWindowController.
3 GetAudioController Returns an #IAudioController.
4 GetDisplayController Returns an #IDisplayController.
10 GetProcessWindingController Returns an #IProcessWindingController.
11 GetLibraryAppletCreator Returns an #ILibraryAppletCreator.
20 GetOverlayFunctions Returns an #IOverlayFunctions.
21 [7.0.0+] GetAppletCommonFunctions No input, returns an #IAppletCommonFunctions.
1000 GetDebugFunctions Returns an #IDebugFunctions.

IOverlayFunctions

Cmd Name
0 BeginToWatchShortHomeButtonMessage
1 EndToWatchShortHomeButtonMessage
2 GetApplicationIdForLogo
3 SetGpuTimeSliceBoost
4 [2.0.0+] SetAutoSleepTimeAndDimmingTimeEnabled
5 [2.0.0+] TerminateApplicationAndSetReason
6 [3.0.0+] SetScreenShotPermissionGlobally
10 [6.0.0+] StartShutdownSequenceForOverlay
11 [6.0.0+] StartRebootSequenceForOverlay
20 [8.0.0+] SetHandlingHomeButtonShortPressedEnabled
90 [7.0.0+] SetRequiresGpuResourceUse
101 [5.0.0+] BeginToObserveHidInputForDevelop

SetRequiresGpuResourceUse

Takes an input u8, no output.

IApplicationProxy

Cmd Name Notes
0 GetCommonStateGetter Returns an #ICommonStateGetter.
1 GetSelfController Returns an #ISelfController.
2 GetWindowController Returns an #IWindowController.
3 GetAudioController Returns an #IAudioController.
4 GetDisplayController Returns an #IDisplayController.
10 GetProcessWindingController Returns an #IProcessWindingController.
11 GetLibraryAppletCreator Returns an #ILibraryAppletCreator.
20 GetApplicationFunctions Returns an #IApplicationFunctions.
1000 GetDebugFunctions Returns an #IDebugFunctions.

IApplicationFunctions

Cmd Name Notes
1 #PopLaunchParameter
10 #CreateApplicationAndPushAndRequestToStart
11 [3.0.0+] #CreateApplicationAndPushAndRequestToStartForQuest
12 [4.0.0+] #CreateApplicationAndRequestToStart
13 [4.0.0+] #CreateApplicationAndRequestToStartForQuest
14 [7.0.0+] #CreateApplicationWithAttributeAndPushAndRequestToStartForQuest
15 [7.0.0+] #CreateApplicationWithAttributeAndRequestToStartForQuest
20 EnsureSaveData
21 #GetDesiredLanguage
22 #SetTerminateResult
23 #GetDisplayVersion
24 [2.0.0+] #GetLaunchStorageInfoForDebug
25 [3.0.0+] ExtendSaveData
26 [3.0.0+] GetSaveDataSize
27 [5.0.0+] CreateCacheStorage
30 #BeginBlockingHomeButtonShortAndLongPressed
31 #EndBlockingHomeButtonShortAndLongPressed
32 #BeginBlockingHomeButton
33 #EndBlockingHomeButton
40 #NotifyRunning
50 [2.0.0+] #GetPseudoDeviceId
60 [2.0.0+] #SetMediaPlaybackStateForApplication
65 [3.0.0+] #IsGamePlayRecordingSupported
66 [3.0.0+] #InitializeGamePlayRecording
67 [3.0.0+] #SetGamePlayRecordingState
68 [4.0.0+] #RequestFlushGamePlayingMovieForDebug
70 [3.0.0+] #RequestToShutdown
71 [3.0.0+] #RequestToReboot
80 [4.0.0+] #ExitAndRequestToShowThanksMessage
90 [4.0.0+] #EnableApplicationCrashReport
100 [5.0.0+] #InitializeApplicationCopyrightFrameBuffer
101 [5.0.0+] #SetApplicationCopyrightImage
102 [5.0.0+] #SetApplicationCopyrightVisibility
110 [5.0.0+] #QueryApplicationPlayStatistics
111 [6.0.0+] #QueryApplicationPlayStatisticsByUid
120 [5.0.0+] #ExecuteProgram
121 [5.0.0+] #ClearUserChannel
122 [5.0.0+] #UnpopToUserChannel
123 [5.0.0+] #GetPreviousProgramIndex
124 [6.0.0+] #EnableApplicationAllThreadDumpOnCrash
130 [8.0.0+] #GetGpuErrorDetectedSystemEvent
500 [5.0.0+] StartContinuousRecordingFlushForDebug
1000 [5.0.0+] #CreateMovieMaker
1001 [5.0.0+] #PrepareForJit

The BOTW game uses this GamePlayRecording functionality from the main-nso "nninitStartup" function, with size 0x6000000(96MiB). The official GamePlayRecording-enable code does the following(this will panic on any failure):

This GamePlayRecording functionality presumably enables the video-recording usable starting with 4.0.0.

PopLaunchParameter

Takes an input u32 #LaunchParameterKind, returns an output #IStorage.

Pops a LaunchParameter #IStorage, the storage will be removed from sysmodule state during this.

CreateApplicationAndPushAndRequestToStart

Takes an input u64 titleID and an input #IStorage, no output. titleID=0 can be used to relaunch the current application.

CreateApplicationAndPushAndRequestToStartForQuest

Takes 2 input u32s (loaded from struct #ApplicationAttributeForQuest), an input u64 titleID, and an input #IStorage, no output.

CreateApplicationAndRequestToStart

Takes an input u64 titleID, no output.

Same as #CreateApplicationAndPushAndRequestToStart except without the input storage, official sw uses this when no input storage is specified.

CreateApplicationAndRequestToStartForQuest

Takes 2 input u32s (loaded from struct #ApplicationAttributeForQuest) and an input u64 titleID, no output.

Same as #CreateApplicationAndPushAndRequestToStartForQuest except without the input storage, official sw uses this when no input storage is specified.

CreateApplicationWithAttributeAndPushAndRequestToStartForQuest

Takes an input u64 titleID, a type-0x15 input buffer containing an #ApplicationAttribute, an input #IStorage, no output.

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.

CreateApplicationWithAttributeAndRequestToStartForQuest

Takes an input u64 titleID and a type-0x15 input buffer containing an #ApplicationAttribute, no output.

Same as #CreateApplicationAndRequestToStartForQuest except the entire attributes structure is directly specified via the input buffer. This command replaces #CreateApplicationAndRequestToStartForQuest, official user-processes no longer use #CreateApplicationAndPushAndRequestToStartForQuest.

GetDesiredLanguage

No input, returns an output LanguageCode.

SetTerminateResult

Takes an input u32 Result, no output.

For example, in some cases official apps use this with error 0x2A2 then uses svcBreak.

GetDisplayVersion

No input, returns an output 0x10-byte struct.

The output struct is "nn::oe::DisplayVersion". This the DisplayVersion string copied from the application control.nacp, this is always NUL-terminated.

GetLaunchStorageInfoForDebug

No input, returns an output u8 StorageId and u8 StorageId.

Just returns two u8s loaded from state.

BeginBlockingHomeButtonShortAndLongPressed

Takes an input s64, no output.

Official user-processes use hard-coded value 0 for the s64.

Starts blocking the Home button.

EndBlockingHomeButtonShortAndLongPressed

No input/output.

Ends the blocking started by #BeginBlockingHomeButtonShortAndLongPressed.

BeginBlockingHomeButton

Takes an input s64 nanoseconds, no output. The input nanoseconds can be zero.

EndBlockingHomeButton

No input/output.

NotifyRunning

Takes no input. Returns an output u8 bool, which is ignored by official user-processes.

GetPseudoDeviceId

No input, returns an output 0x10-byte "nn::util::Uuid" struct.

The 0x20-byte output data from GetSystemSeedForPseudoDeviceId followed by the 8-byte SeedForPseudoDeviceId from the current control.nacp, is hashed with SHA1. Then "nn::util::GenerateUuidVersion5" is called with the final hash, the output from this is then returned for the Uuid.

SetMediaPlaybackStateForApplication

Takes an input u8 bool, no output.

IsGamePlayRecordingSupported

No input, returns an output u8 bool.

InitializeGamePlayRecording

Takes a TransferMemory handle and an u64 for the size of the TransferMemory. The size must match 0x6000000 otherwise an error is returned.

SetGamePlayRecordingState

Takes an input u32. 0 = disable/pause, 1 = enable/restart.

RequestFlushGamePlayingMovieForDebug

No input/output.

RequestToShutdown

No input/output.

RequestToReboot

No input/output.

ExitAndRequestToShowThanksMessage

No input/output.

Used to exit the application and return to the kiosk menu. Official sw uses #UnlockExit immediately before this.

This throws an error when the cached Settings_services#GetQuestFlag value is 0.

EnableApplicationCrashReport

Takes an input u8 bool, no output.

InitializeApplicationCopyrightFrameBuffer

Takes an input TransferMemory handle, an s32 width, an s32 height, an u64 tmem_size, and no output.

tmem_size must be 0x40000-byte aligned. width must be 1-1280, and height must be 1-720.

User-processes create the tmem with an user-specified buffer with permissions=0. width = 1280 and height = 720.

This is used as an overlay for screenshots.

SetApplicationCopyrightImage

Takes a type-0x45 input buffer, an s32 x, an s32 y, an s32 width, an s32 height, an s32 WindowOriginMode, and no output.

The last s32 is "nn::oe::WindowOriginMode". This should be at least 1.

x and y must not have the negative bit set. width and height must not be <1.

Sets the RGBA8 image for use with #InitializeApplicationCopyrightFrameBuffer. Overrides the current image, if this was already used previously.

SetApplicationCopyrightVisibility

Takes an input u8 bool, no output.

Sets the visibility for the image set by #SetApplicationCopyrightImage, in screenshots. By default it's visible.

QueryApplicationPlayStatistics

Takes a type-0x6 output buffer containing an array of ApplicationPlayStatistics and a type-0x5 input buffer containing an array of u64 titleIDs. Returns an output s32 for actual total output entries.

The number of entries in each array is the same.

See also PlayLogQueryCapability.

This uses pdm:qry QueryApplicationPlayStatisticsForSystem.

QueryApplicationPlayStatisticsByUid

Takes a u128 userID, a type-0x6 output buffer containing an array of ApplicationPlayStatistics and a type-0x5 input buffer containing an array of u64 titleIDs. Returns an output s32 for actual total output entries.

Same as #QueryApplicationPlayStatistics except this uses pdm:qry cmd16, to get playstats specific to userIDs.

ExecuteProgram

Takes an input u32 #ProgramSpecifyKind and an input u64, no output.

ClearUserChannel

No input/output.

Clears the UserChannel used by #UnpopToUserChannel.

UnpopToUserChannel

Takes an input #IStorage, no output.

The input storage is pushed to the UserChannel. This is the same channel used by #LaunchParameterKind value 1.

User-processes create a storage using data specified by the user (written to offset=0 size=inputsize), with max size 0x1000. This storage is then used with this cmd.

GetPreviousProgramIndex

No input, returns an output s32.

EnableApplicationAllThreadDumpOnCrash

Takes an input u8 bool, no output.

GetGpuErrorDetectedSystemEvent

No input, returns an output Event handle with autoclear=false.

This is used by sdknso during applet-application initialization. A seperate thread is setup where event-waiting is handled. When the Event is signaled, official sw will assert.

CreateMovieMaker

Takes an input u64 and handle, returns an #IMovieMaker.

PrepareForJit

Takes no input. Launches title 010000000000003B (currently not present on retail systems) if some context variable is not set, with that context variable being initialized afterwards.

IMovieMaker

Cmd Name
0 #GetGrcMovieMaker
1 #GetLayerHandle

GetGrcMovieMaker

No input, returns a GRC IMovieMaker.

GetLayerHandle

No input, returns an output u64.

ILibraryAppletCreator

Cmd Name Notes
0 #CreateLibraryApplet
1 #TerminateAllLibraryApplets
2 #AreAnyLibraryAppletsLeft
10 #CreateStorage
11 #CreateTransferMemoryStorage
12 [2.0.0+] #CreateHandleStorage

CreateLibraryApplet

Takes 2 input u32s #AppletId and #LibraryAppletMode, returns an #ILibraryAppletAccessor.

TerminateAllLibraryApplets

No input/output.

AreAnyLibraryAppletsLeft

No input, returns an output u8 bool.

CreateStorage

Takes an input s64 for the storage size, returns an #IStorage.

This allocates a buffer with the specified size which can then be accessed via #IStorageAccessor.

CreateTransferMemoryStorage

Takes an input TransferMemory copy-handle, an input u8 bool, and an s64 size, returns an #IStorage.

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

The TransferMemory is mapped, which can then be accessed via #IStorageAccessor. The input bool controls whether writing to the storage is allowed: #Write will throw an error if this flag is not set.

CreateHandleStorage

Takes an input copy-handle and an input s64, returns an #IStorage. In some cases the s64 must not have the negative bit set.

The input can be arbitrary, however official sw is only (?) known to use this for TransferMemory (with s64=size).

ILibraryAppletAccessor

Cmd Name Notes
0 #GetAppletStateChangedEvent
1 #IsCompleted
10 #Start
20 #RequestExit
25 #Terminate
30 #GetResult
50 #SetOutOfFocusApplicationSuspendingEnabled
100 #PushInData
101 #PopOutData
102 #PushExtraStorage
103 #PushInteractiveInData
104 #PopInteractiveOutData
105 #GetPopOutDataEvent
106 #GetPopInteractiveOutDataEvent
110 #NeedsToExitProcess
120 #GetLibraryAppletInfo
150 #RequestForAppletToGetForeground
160 [2.0.0+] #GetIndirectLayerConsumerHandle

Commands <=30 are inherited from #IAppletAccessor. GetLibraryAppletInfo is identical to the #ILibraryAppletSelfAccessor cmd.

SetOutOfFocusApplicationSuspendingEnabled

Takes an input u8 bool, no output.

Official sw will assert prior to using this if applet-service was not initialized as *Application.

PushInData

Takes an input #IStorage, no output.

PopOutData

No input, returns an output #IStorage.

PushExtraStorage

Takes an input #IStorage, no output.

PushInteractiveInData

Takes an input #IStorage, no output.

PopInteractiveOutData

No input, returns an output #IStorage.

GetPopOutDataEvent

No input, returns an output handle.

GetPopInteractiveOutDataEvent

No input, returns an output event handle with autoclear=false.

NeedsToExitProcess

No input, returns an output u8 bool.

Stubbed, just returns an error.

RequestForAppletToGetForeground

No input/output.

Stubbed, just returns an error.

GetIndirectLayerConsumerHandle

Takes an input PID and an input u64 AppletResourceUserId, returns an output u64 IndirectLayerConsumerHandle.

Official sw uses this during LibraryApplet creation when #LibraryAppletMode is 0x3.

ICommonStateGetter

Cmd Name Notes
0 #GetEventHandle
1 #ReceiveMessage
2 #GetThisAppletKind
3 #AllowToEnterSleep
4 #DisallowToEnterSleep
5 #GetOperationMode
6 #GetPerformanceMode
7 #GetCradleStatus
8 #GetBootMode
9 #GetCurrentFocusState
10 #RequestToAcquireSleepLock
11 #ReleaseSleepLock
12 #ReleaseSleepLockTransiently
13 #GetAcquiredSleepLockEvent
20 #PushToGeneralChannel
30 #GetHomeButtonReaderLockAccessor
31 [2.0.0+] #GetReaderLockAccessorEx
32 [7.0.0+] #GetWriterLockAccessorEx
40 [2.0.0+] #GetCradleFwVersion
50 [3.0.0+] #IsVrModeEnabled
51 [3.0.0+] #SetVrModeEnabled
52 [4.0.0+] #SetLcdBacklighOffEnabled
53 [7.0.0+] #BeginVrModeEx
54 [7.0.0+] #EndVrModeEx
55 [3.0.0+] #IsInControllerFirmwareUpdateSection
60 [3.0.0+] #GetDefaultDisplayResolution
61 [3.0.0+] #GetDefaultDisplayResolutionChangeEvent
62 [4.0.0+] #GetHdcpAuthenticationState
63 [4.0.0+] #GetHdcpAuthenticationStateChangeEvent
64 [5.0.0+] #SetTvPowerStateMatchingMode
65 [5.1.0+] #GetApplicationIdByContentActionName
66 [6.0.0+] #SetCpuBoostMode
80 [6.0.0+] #PerformSystemButtonPressingIfInFocus
90 [7.0.0+] #SetPerformanceConfigurationChangedNotification
91 [7.0.0+] #GetCurrentPerformanceConfiguration
200 [7.0.0+] #GetOperationModeSystemInfo

Officially notification messages are handled by the application itself, not sdk-nso in ExeFS. Official apps call code in sdk-nso which basically uses svcWaitSynchronization with the event from #GetEventHandle to check whether a message is available, then if so it uses #ReceiveMessage. The actual handling for message IDs is done in the app itself(see #NotificationMessage).

[7.0.0+] User-processes now use BeginVrModeEx/EndVrModeEx instead of #SetVrModeEnabled. Prior to using using BeginVrModeEx, pctl IsStereoVisionPermitted is used and error 0xD08E is thrown if not allowed by pctl.

GetEventHandle

No input. Returns an output event handle. This is signalled when a message is available with #ReceiveMessage.

ReceiveMessage

No input. Returns an output u32. Error 0x680 indicates no message is available.

GetThisAppletKind

No input, returns an output #AppletKind.

Stubbed, just returns an error.

AllowToEnterSleep

No input/output.

Stubbed, just returns an error.

DisallowToEnterSleep

No input/output.

Stubbed, just returns an error.

GetOperationMode

No input. Returns an output u8 for the current #OperationMode.

GetPerformanceMode

No input. Returns an output u32 for the current PerformanceMode.

GetCradleStatus

No input, returns an output u8.

This uses #omm GetCradleStatus.

GetBootMode

No input, returns an output u8.

Returns the value from pm:bm GetBootMode.

GetCurrentFocusState

No input. Returns an output u8:

  • 1: In focus.
  • 2/3: Out of focus(running in "background").

RequestToAcquireSleepLock

No input/output.

ReleaseSleepLock

No input/output.

ReleaseSleepLockTransiently

No input/output.

GetAcquiredSleepLockEvent

No input, returns an output Event handle with autoclear=false.

PushToGeneralChannel

Takes an input #IStorage, no output.

This is not usable under an Application, however it is usable under a LibraryApplet.

Used for sending requests to qlaunch. sdk-nso creates a 0x10-byte storage which is sent to this. The following are the functions which use this, with the data written to the storage:

  • RequestHomeMenu 5341 4d53 0100 0000 0200 0000 0100 0000 Returns to the main Home Menu, equivalent to pressing the HOME button.
  • RequestJumpToSystemUpdate 5341 4d53 0100 0000 0b00 0000 0100 0000 Equivalent to entering "System Update" under System Settings. When leaving this, it returns to the main Home Menu.

GetHomeButtonReaderLockAccessor

No input, returns an output #ILockAccessor.

Similar to using #GetReaderLockAccessorEx with inval=0.

GetReaderLockAccessorEx

Takes an input u32, returns an output #ILockAccessor.

The input value must be 0-3. 0 = HomeButton.

GetWriterLockAccessorEx

Takes an input u32, returns an output #ILockAccessor.

The input value must be 0-3. 0 = HomeButton.

GetCradleFwVersion

No input, returns 4 output u32s.

This uses #omm GetCradleFwVersion.

IsVrModeEnabled

No input, returns an output u8 bool.

SetVrModeEnabled

Takes an input u8 bool flag. No output.

Updates internal AM state fields. If the new state doesn't match the previous state, this uses the Backlight_services {Disable/Enable}VrMode command depending on whether flag={disable/enable}.

When the VrMode is set to true, the console shows a screen rendered like vr asking the user to move his face away and hit the 'close' button. When this button is pressed, the console resets the vrMode to false.

SetLcdBacklighOffEnabled

Takes an input u8 bool, no output.

Sets whether the LCD screen blacklight is turned off.

BeginVrModeEx

No input/output.

Identical to #SetVrModeEnabled except with hard-coded flag=1.

EndVrModeEx

No input/output.

Identical to #SetVrModeEnabled except with hard-coded flag=0.

IsInControllerFirmwareUpdateSection

No input, returns an output u8 bool.

GetDefaultDisplayResolution

No input, returns two output s32s width and height.

GetDefaultDisplayResolutionChangeEvent

No input, returns an output Event handle with autoclear=true.

GetHdcpAuthenticationState

No input, returns an output s32.

GetHdcpAuthenticationStateChangeEvent

No input, returns an output Event handle with autoclear=true.

SetTvPowerStateMatchingMode

Takes an input s32 #TvPowerStateMatchingMode, no output.

GetApplicationIdByContentActionName

Takes a type-0x5 input buffer containing a string, returns an output u64 titleID.

Gets the application titleID for the specified ContentActionName string. Returns an error when the current #AppletId isn't 0x04 (starter).

SetCpuBoostMode

Takes an input u32 CpuBoostMode (only modes 0 and 1 are valid) and passes it to SetCpuBoostMode.

PerformSystemButtonPressingIfInFocus

Takes an input #SystemButtonType, no output.

SetPerformanceConfigurationChangedNotification

Takes an input u8 bool, no output.

GetCurrentPerformanceConfiguration

No input, returns the result of calling GetCurrentPerformanceConfiguration.

GetOperationModeSystemInfo

No input, returns an output u32.

This returns the output from omm #Cmd26.

ISelfController

Cmd Name
0 #Exit
1 #LockExit
2 #UnlockExit
3 [2.0.0+] #EnterFatalSection
4 [2.0.0+] #LeaveFatalSection
9 #GetLibraryAppletLaunchableEvent
10 #SetScreenShotPermission
11 #SetOperationModeChangedNotification
12 #SetPerformanceModeChangedNotification
13 #SetFocusHandlingMode
14 #SetRestartMessageEnabled
15 [2.0.0+] #SetScreenShotAppletIdentityInfo
16 [2.0.0+] #SetOutOfFocusSuspendingEnabled
17 [3.0.0+] #SetControllerFirmwareUpdateSection
18 [3.0.0+] #SetRequiresCaptureButtonShortPressedMessage
19 [3.0.0+] #SetAlbumImageOrientation
20 [4.0.0+] #SetDesirableKeyboardLayout
40 #CreateManagedDisplayLayer
41 [4.0.0+] #IsSystemBufferSharingEnabled
42 [4.0.0+] #GetSystemSharedLayerHandle
43 [5.0.0+] #GetSystemSharedBufferHandle
50 #SetHandlesRequestToDisplay
51 #ApproveToDisplay
60 #OverrideAutoSleepTimeAndDimmingTime
61 #SetMediaPlaybackState
62 #SetIdleTimeDetectionExtension
63 #GetIdleTimeDetectionExtension
64 #SetInputDetectionSourceSet
65 [2.0.0+] #ReportUserIsActive
66 [3.0.0+] #GetCurrentIlluminance
67 [3.0.0+] #IsIlluminanceAvailable
68 [5.0.0+] #SetAutoSleepDisabled
69 [5.0.0+] #IsAutoSleepDisabled
70 [4.0.0+] #ReportMultimediaError
71 [5.0.0+] #GetCurrentIlluminanceEx
80 [4.0.0+] #SetWirelessPriorityMode
90 [6.0.0+] #GetAccumulatedSuspendedTickValue
91 [6.0.0+] #GetAccumulatedSuspendedTickChangedEvent
100 [7.0.0+] #SetAlbumImageTakenNotificationEnabled
110 [8.0.0+] #SetApplicationAlbumUserData
1000 [7.0.0+] #GetDebugStorageChannel

Exit

No input/output.

LockExit

No input/output.

Locks exit process of pressing X to close in HOME Menu for an application or HOME button for an applet. When locked, it will show the "waiting for software to be closed dialog" until UnlockExit is called or a 15 seconds timeout (when the latter occurs, the process is force-terminated).

UnlockExit

No input/output.

Unlocks exit process, if LockExit was previously used.

EnterFatalSection

No input/output.

LeaveFatalSection

No input/output.

#EnterFatalSection must be executed at least once before executing this command, otherwise error code 0x40080 will be returned. EnterFatalSection and LeaveFatalSection work in pairs, that is, N calls to EnterFatalSection must be performed first in order to perform N executions of LeaveFatalSection. Essentially, these two functions operate like how one would lock and unlock a recursive mutex.

GetLibraryAppletLaunchableEvent

No input, returns an output event handle with autoclear=false.

SetScreenShotPermission

Takes an input s32. No output.

Controls whether screenshot-capture is allowed.

Value Description
0 Inherit from parent applet
1 Enable
2 Disable

SetOperationModeChangedNotification

Takes an input u8 bool flag. No output.

SetPerformanceModeChangedNotification

Takes an input u8 bool flag. No output.

SetFocusHandlingMode

Takes 3 input u8s with each field located immediately after the previous u8, these are bool flags. No output.

SetRestartMessageEnabled

Takes an input u8 bool flag, no output.

See #NotificationMessage.

SetScreenShotAppletIdentityInfo

Takes an input #AppletIdentityInfo, no output.

SetOutOfFocusSuspendingEnabled

Takes an input u8 bool flag. No output.

SetControllerFirmwareUpdateSection

Takes an input u8 bool flag, no output.

This throws error 0x40280 when the internal state flag already matches the input value.

SetRequiresCaptureButtonShortPressedMessage

Takes an input u8 bool flag, no output.

See #NotificationMessage.

When enabled with a non-Overlay applet, Overlay applet will not be notified of capture button short-presses for screenshots.

SetAlbumImageOrientation

Takes an input u32 "nn::album::ImageOrientation". No output.

The input value must not be >3.

SetDesirableKeyboardLayout

Takes an input u32, no output.

The input u32 is "nn::settings::KeyboardLayout".

CreateManagedDisplayLayer

Returns an output u64 LayerId which is then used by the user-process with Display_services#OpenLayer.

IsSystemBufferSharingEnabled

No input/output.

Not available when the current applet is an Application (#AppletId == 0x01).

Checks whether SystemBufferSharing is enabled, throwing an error otherwise.

GetSystemSharedLayerHandle

No input, returns two output u64s "nn::vi::fbshare::SharedBufferHandle" and "nn::vi::fbshare::SharedLayerHandle".

Runs code similar to #IsSystemBufferSharingEnabled first.

GetSystemSharedBufferHandle

No input, returns an output u64 "nn::vi::fbshare::SharedBufferHandle".

Runs code similar to #IsSystemBufferSharingEnabled first.

Same as #GetSystemSharedLayerHandle except this just gets the SharedBufferHandle.

SetHandlesRequestToDisplay

Takes an input u8 bool, no output.

Sets an internal state flag. When the input flag is 0, this will in additional run the same code as #ApproveToDisplay.

See #NotificationMessage.

ApproveToDisplay

No input/output.

Used to handle the notification enabled by #SetHandlesRequestToDisplay.

OverrideAutoSleepTimeAndDimmingTime

Takes 4 input s32s, no output.

SetMediaPlaybackState

Takes an input u8 bool, no output.

SetIdleTimeDetectionExtension

Takes an input u32, no output.

The input value must be 0-2: 0 = disabled, 1 = Extended, and 2 = ExtendedUnsafe.

GetIdleTimeDetectionExtension

No input, returns an output u32.

Returns the value set by #SetIdleTimeDetectionExtension.

SetInputDetectionSourceSet

Takes an input u32, no output.

ReportUserIsActive

No input/output.

Uses idle:sys ReportUserIsActive.

Reports that the user is active, for idle detection (screen dimming / auto-sleep). This is equivalent to when the user uses HID input.

GetCurrentIlluminance

No input, returns an output float.

Uses lbl command GetAmbientLightSensorValue, where only the output float is used.

IsIlluminanceAvailable

No input, returns an output u8 bool.

Uses lbl command IsAmbientLightSensorAvailable.

User-processes can use this to determine whether to continue with using GetCurrentIlluminance(Ex).

SetAutoSleepDisabled

Takes an input u8 bool, no output.

IsAutoSleepDisabled

No input, returns an output u8 bool.

ReportMultimediaError

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

The buffer contains a 0x138-byte "movie::MultimediaTelemetryReport" struct.

GetCurrentIlluminanceEx

No input, returns an output u8 bool and float.

Uses lbl command GetAmbientLightSensorValue.

SetWirelessPriorityMode

Takes an input s32 enum WirelessPriorityMode, no output.

The input value must be 1 or 2.

GetAccumulatedSuspendedTickValue

No input, returns an output u64 tick value.

Gets the total time in ticks that the process was suspended, relative to when the applet-service was last initialized.

GetAccumulatedSuspendedTickChangedEvent

No input, returns an output Event handle with autoclear=true.

This is signaled when the output from #GetAccumulatedSuspendedTickValue is updated.

SetAlbumImageTakenNotificationEnabled

Takes an input u8 bool, no output.

See #NotificationMessage.

SetApplicationAlbumUserData

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

The buffer contains arbitrary UserData.

The size must be <=0x400. The input buffer is copied to a buffer loaded from a state ptr (throwing an error when the state ptr is not set), with the u32 size being written to statebuf+0x400 afterwards.

GetDebugStorageChannel

No input, returns an output #IStorageChannel.

The cached value loaded from system-setting am.debug!dev_function must be set to 0x1 with size 0x1, otherwise an error is returned.

IStorageChannel

Added with 7.0.0.

Cmd Name Notes
0 Push No input, returns an output #IStorage.
1 Unpop No input, returns an output #IStorage.
2 Pop No input, returns an output #IStorage.
3 GetPopEventHandle No input, returns an output handle.
4 Clear No input/output.

IWindowController

Cmd Name Notes
0 #CreateWindow
1 #GetAppletResourceUserId
2 [6.0.0+] #GetAppletResourceUserIdOfCallerApplet
10 #AcquireForegroundRights
11 #ReleaseForegroundRights
12 #RejectToChangeIntoBackground
20 [7.0.0+] #SetAppletWindowVisibility
21 [7.0.0+] #SetAppletGpuTimeSlice

CreateWindow

Takes an input u32, returns an output #IWindow.

Stubbed, just returns an error.

GetAppletResourceUserId

No input, returns an output u64 #AppletResourceUserId.

GetAppletResourceUserIdOfCallerApplet

No input, returns an output u64 #AppletResourceUserId.

AcquireForegroundRights

No input/output.

Just returns 0.

ReleaseForegroundRights

No input/output.

Just returns 0.

RejectToChangeIntoBackground

No input/output.

Just returns 0.

SetAppletWindowVisibility

Takes an input u8 bool, no output.

SetAppletGpuTimeSlice

Takes an input s64, no output.

The input s64 must not be negative.

IAudioController

Cmd Name
0 #SetExpectedMasterVolume
1 #GetMainAppletExpectedMasterVolume
2 #GetLibraryAppletExpectedMasterVolume
3 #ChangeMainAppletMasterVolume
4 #SetTransparentVolumeRate

GetMainAppletExpectedMasterVolume/SetExpectedMasterVolume are used for saving/restoring state for LibraryApplet launching, with SetExpectedMasterVolume being used with new state prior to launching a LibraryApplet. With official sw these applet funcs are used directly in the main-codebin.

SetExpectedMasterVolume

Takes two input floats, no output.

Writes the input floats to state: first one is used by #GetMainAppletExpectedMasterVolume, second one is used by #GetLibraryAppletExpectedMasterVolume.

GetMainAppletExpectedMasterVolume

No input, returns an output float.

GetLibraryAppletExpectedMasterVolume

No input, returns an output float.

ChangeMainAppletMasterVolume

Takes an input float and an input u64, no output.

SetTransparentVolumeRate

Takes an input float, no output.

IDisplayController

Cmd Name
0 #GetLastForegroundCaptureImage
1 #UpdateLastForegroundCaptureImage
2 #GetLastApplicationCaptureImage
3 #GetCallerAppletCaptureImage
4 #UpdateCallerAppletCaptureImage
5 #GetLastForegroundCaptureImageEx
6 #GetLastApplicationCaptureImageEx
7 #GetCallerAppletCaptureImageEx
8 [2.0.0+] #TakeScreenShotOfOwnLayer
9 [5.0.0+] #CopyBetweenCaptureBuffers
10 #AcquireLastApplicationCaptureBuffer
11 #ReleaseLastApplicationCaptureBuffer
12 #AcquireLastForegroundCaptureBuffer
13 #ReleaseLastForegroundCaptureBuffer
14 #AcquireCallerAppletCaptureBuffer
15 #ReleaseCallerAppletCaptureBuffer
16 #AcquireLastApplicationCaptureBufferEx
17 #AcquireLastForegroundCaptureBufferEx
18 #AcquireCallerAppletCaptureBufferEx
20 [3.0.0+] #ClearCaptureBuffer
21 [3.0.0+] #ClearAppletTransitionBuffer
22 [4.0.0+] #AcquireLastApplicationCaptureSharedBuffer
23 [4.0.0+] #ReleaseLastApplicationCaptureSharedBuffer
24 [4.0.0+] #AcquireLastForegroundCaptureSharedBuffer
25 [4.0.0+] #ReleaseLastForegroundCaptureSharedBuffer
26 [4.0.0+] #AcquireCallerAppletCaptureSharedBuffer
27 [4.0.0+] #ReleaseCallerAppletCaptureSharedBuffer
28 [6.0.0+] #TakeScreenShotOfOwnLayerEx

GetLastForegroundCaptureImage

Takes a type-0x6 output buffer.

Stubbed, just returns an error.

UpdateLastForegroundCaptureImage

No input/output.

GetLastApplicationCaptureImage

Takes a type-0x6 output buffer.

Stubbed, just returns an error.

GetCallerAppletCaptureImage

Takes a type-0x6 output buffer.

Stubbed, just returns an error.

UpdateCallerAppletCaptureImage

No input/output.

Calls the same func internally as #UpdateLastForegroundCaptureImage, except this passes param value 2 instead of 1.

GetLastForegroundCaptureImageEx

Takes a type-0x6 output buffer, returns an output u8 bool.

The buffer size must match 0x384000.

GetLastApplicationCaptureImageEx

Takes a type-0x6 output buffer, returns an output u8 bool.

The buffer size must match 0x384000.

Calls the same internal func as #GetLastForegroundCaptureImageEx, except that the last param is set to value 0 instead of 1.

GetCallerAppletCaptureImageEx

Takes a type-0x6 output buffer, returns an output u8 bool.

The buffer size must match 0x384000.

Calls the same internal func as #GetLastForegroundCaptureImageEx, except that the last param is set to value 2 instead of 1.

TakeScreenShotOfOwnLayer

Takes an input u8 bool and a s32, no output.

CopyBetweenCaptureBuffers

Takes two input s32s, no output.

AcquireLastApplicationCaptureBuffer

No input, returns an output handle.

Stubbed, just returns an error.

ReleaseLastApplicationCaptureBuffer

No input/output.

Clears a state field if it's not already 0, returning an error otherwise. On newer sysvers: then a func is called which just returns 0, then this cmd returns 0.

AcquireLastForegroundCaptureBuffer

No input, returns an output handle.

Stubbed, just returns an error.

ReleaseLastForegroundCaptureBuffer

No input/output.

Same as #ReleaseLastApplicationCaptureBuffer except with a different state field + different input param for the called func.

AcquireCallerAppletCaptureBuffer

No input, returns an output handle.

Stubbed, just returns an error.

ReleaseCallerAppletCaptureBuffer

No input/output.

Same as #ReleaseLastApplicationCaptureBuffer except with a different state field + different input param for the called func.

AcquireLastApplicationCaptureBufferEx

No input, returns an output TransferMemory handle and an output u8 bool.

The state field used by #ReleaseLastApplicationCaptureBuffer must be 0. Calls a func which just returns an error (this is only the case on newer sysvers), hence this cmd will just return that error. If that func would have returned successfully, the state field would be set to 1 and the cmd would return 0.

On old sysvers, the output TransferMemory is size 0x384000 with permissions=RW.

AcquireLastForegroundCaptureBufferEx

No input, returns an output TransferMemory handle and an output u8 bool.

Same as #AcquireLastApplicationCaptureBufferEx except this uses the #ReleaseLastForegroundCaptureBuffer state field, and uses a different input param value for the called func.

AcquireCallerAppletCaptureBufferEx

No input, returns an output TransferMemory handle and an output u8 bool.

Same as #AcquireLastApplicationCaptureBufferEx except this uses the #ReleaseCallerAppletCaptureBuffer state field, and uses a different input param value for the called func.

ClearCaptureBuffer

Takes an input u8 bool, an s32, and an u32, returns no output.

ClearAppletTransitionBuffer

Takes an input u32, no output.

AcquireLastApplicationCaptureSharedBuffer

No input, returns an output u8 bool and an s32.

This loads data from state.

ReleaseLastApplicationCaptureSharedBuffer

No input/output.

Depending on whether a state field is 0, this just returns an error or returns 0.

AcquireLastForegroundCaptureSharedBuffer

No input, returns an output u8 bool and an s32.

Calls the same func internally as #AcquireLastApplicationCaptureSharedBuffer, except this passes value 1 for the last param instead of 0.

ReleaseLastForegroundCaptureSharedBuffer

No input/output.

Calls the same func internally as #ReleaseLastApplicationCaptureSharedBuffer, except this passes value 1 for the last param instead of 0.

AcquireCallerAppletCaptureSharedBuffer

No input, returns an output u8 bool and an s32.

Calls the same func internally as #AcquireLastApplicationCaptureSharedBuffer, except this passes value 2 for the last param instead of 0.

ReleaseCallerAppletCaptureSharedBuffer

No input/output.

Calls the same func internally as #ReleaseLastApplicationCaptureSharedBuffer, except this passes value 2 for the last param instead of 0.

TakeScreenShotOfOwnLayerEx

Takes two input u8 bools and a s32, no output.

Calls the same func internally as #TakeScreenShotOfOwnLayer, except the last bool param is the last cmd param bool instead of hard-coded 0. This flag indicates whether the screenshot should be taken Immediately.

ISystemAppletControllerForDebug

Cmd Name Notes
1 RequestLaunchApplicationForDebug
2 [7.0.0+] GetDebugStorageChannel No input, returns an output #IStorageChannel.
3 [7.0.0+] CreateStorageForDebug Takes a total of 8-bytes of input, returns an #IStorage.

IProcessWindingController

Cmd Name Notes
0 #GetLaunchReason
11 #OpenCallingLibraryApplet
21 #PushContext
22 #PopContext
23 #CancelWindingReservation
30 #WindAndDoReserved
40 #ReserveToStartAndWaitAndUnwindThis
41 [4.0.0+] #ReserveToStartAndWait

GetLaunchReason

No input, returns an output u32 "nn::am::service::AppletProcessLaunchReason".

Used by LibraryApplets.

OpenCallingLibraryApplet

No input, returns an output #ILibraryAppletAccessor.

PushContext

Takes an input #IStorage, no output.

PopContext

No input, returns an output #IStorage.

CancelWindingReservation

No input/output.

WindAndDoReserved

No input/output.

ReserveToStartAndWaitAndUnwindThis

Takes an input #ILibraryAppletAccessor, no output.

ReserveToStartAndWait

Takes an input #ILibraryAppletAccessor, no output.

IDebugFunctions

Cmd Name Notes
0 NotifyMessageToHomeMenuForDebug
1 #OpenMainApplication
10 EmulateButtonEvent
20 InvalidateTransitionLayer
30 [6.0.0+] RequestLaunchApplicationWithUserAndArgumentForDebug
40 [6.0.0+] GetAppletResourceUsageInfo
100 [7.0.0+] #SetCpuBoostModeForApplet

OpenMainApplication

No input, returns an output #IApplicationAccessor.

SetCpuBoostModeForApplet

Takes an input u32 CpuBoostMode (only modes 0 and 1 are valid) and passes it to SetCpuBoostMode.

IStorage

Cmd Name Notes
0 Open No input. Returns an #IStorageAccessor.
1 [2.0.0+] OpenTransferStorage No input. Returns an #ITransferStorageAccessor.

Open can only be used when the IStorage was created by #CreateStorage or #CreateTransferMemoryStorage. OpenTransferStorage can only be used when the IStorage was created by #CreateHandleStorage.

Only 1 *Accessor session can be open for each IStorage at a time.

IStorageAccessor

Cmd Name Notes
0 GetSize No input. Returns an s64.
10 Write Takes an input s64 and a type-0x21 input buffer.
11 Read Takes an input s64 and a type-0x22 output buffer.

ITransferStorageAccessor

Cmd Name Notes
0 GetSize No input. Returns an output s64.
1 GetHandle No input. Returns an output s64 and handle.

These commands return the data originally from #CreateHandleStorage input, both return the same s64.

appletOE

This is "nn::am::service::IApplicationProxyService".

Cmd Name Notes
0 #OpenApplicationProxy

This is used by all regular-applications, including flog and "Retail Interactive Display Menu". Only one session can be open for this service at a time.

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

On failure, official user-processes will retry using this command in a loop while the retval is 0x19280, with svcSleepThread(10000000) being called first.

idle:sys

This is "nn::idle::detail::IPolicyManagerSystem"

Cmd Name
0 GetAutoPowerDownEvent
1 [1.0.0-3.0.2]
[7.0.0+]
2 [1.0.0-3.0.2]
3 SetHandlingContext
4 LoadAndApplySettings
5 ReportUserIsActive

[3.0.0+] SetHandlingContext now takes an additional 0x10-bytes of input.

omm

This is "nn::omm::detail::IOperationModeManager"

Operation Mode Manager (OMM) is a service responsible for arbitrating the operation changes between docked and handheld modes. Besides PTM_services, this is the only service that interacts with the Dock through usb:pd*.

Cmd Name Notes
0 GetOperationMode
1 GetOperationModeChangeEvent
2 EnableAudioVisual
3 DisableAudioVisual
4 EnterSleepAndWait
5 GetCradleStatus
6 FadeInDisplay
7 FadeOutDisplay
8 [2.0.0+] GetCradleFwVersion
9 [2.0.0+] NotifyCecSettingsChanged
10 [3.0.0+] SetOperationModePolicy
11 [3.0.0+] GetDefaultDisplayResolution
12 [3.0.0+] GetDefaultDisplayResolutionChangeEvent
13 [3.0.0+] UpdateDefaultDisplayResolution
14 [3.0.0+] ShouldSleepOnBoot
15 [4.0.0+] NotifyHdcpApplicationExecutionStarted
16 [4.0.0+] NotifyHdcpApplicationExecutionFinished
17 [4.0.0+] NotifyHdcpApplicationDrawingStarted
18 [4.0.0+] NotifyHdcpApplicationDrawingFinished
19 [4.0.0+] GetHdcpAuthenticationFailedEvent
20 [4.0.0+] GetHdcpAuthenticationFailedEmulationEnabled
21 [4.0.0+] SetHdcpAuthenticationFailedEmulation
22 [4.0.0+] GetHdcpStateChangeEvent
23 [4.0.0+] GetHdcpState
24 [5.0.0+] ShowCardUpdateProcessing
25 [5.0.0+] SetApplicationCecSettingsAndNotifyChanged
26 [7.0.0+]

Cmd26

No input, returns an output u32.

This is used by #GetOperationModeSystemInfo.

spsm

This is "nn::spsm::detail::IPowerStateInterface".

Cmd Name
0 GetState
1 SleepSystemAndWaitAwake
2
3
4 GetNotificationMessageEventHandle
5
6
7
8 AnalyzePerformanceLogForLastSleepWakeSequence
9 ChangeHomeButtonLongPressingTime
10
11 [1.0.0-3.0.2]

[3.0.0+] Cmd11 now takes a total of 8-bytes of input.

tcap

This is "nn::tcap::server::IManager".

Cmd Name
0 GetContinuousHighSkinTemperatureEvent
1 SetOperationMode
2 LoadAndApplySettings

caps:su

This is "nn::capsrv::sf::IScreenShotApplicationService".

This was added with 6.0.0.

This can be used by applications to save screenshots.

Cmd Name Notes
32 [7.0.0+] SetShimLibraryVersion Takes a total of 0x10-bytes of input and a PID, no output.
201 SaveScreenShot
203 SaveScreenShotEx0
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.

SetShimLibraryVersion is a wrapper for caps:c cmd33. Commands SaveScreenShot, SaveScreenShotEx0, SaveScreenShotEx1 and SaveScreenShotEx2 are wrappers for caps:sc cmd210.

SaveScreenShot

Takes two input u32s, an u64 AppletResourceUserId, a PID, and a type-0x45 input buffer. Returns a 0x20-byte struct ApplicationAlbumEntry.

Official user-processes doesn't use this, instead #SaveScreenShotEx0 is used: ScreenShotAttributeEx0 is all-zero except +0 is set to an input u32.

SaveScreenShotEx0

Takes an input 0x40-byte struct ScreenShotAttributeEx0, an input u32, an input u64 AppletResourceUserId, a PID, and a type-0x45 input buffer. Returns a 0x20-byte struct ApplicationAlbumEntry.

Library Applets

This section documents library applet launching.

Before starting the applet, #IStorages are created and written, then passed to #ILibraryAppletAccessor PushInData. The #IStorage session is closed afterwards. The first #IStorage is #CommonArguments, followed by any applet-specific #IStorages.

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 IStorage passed to applets should contain the common library applet arguments. This is populated by nn::la::CommonArgumentsWriter 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.

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 svcGetSystemTick)

Enums

AppletId

See also Category:Library Applets.

ID Title-id Description
0x01 Application. Not valid for use with LibraryApplets.
0x02 010000000000100C "overlayDisp"
0x03 0100000000001000 "qlaunch"
0x04 0100000000001012 "starter"
0x0A 0100000000001001 "auth"
0x0B 0100000000001002 "cabinet"
0x0C 0100000000001003 "controller"
0x0D 0100000000001004 "dataErase"
0x0E 0100000000001005 "error"
0x0F 0100000000001006 "netConnect"
0x10 0100000000001007 "playerSelect"
0x11 0100000000001008 "swkbd"
0x12 0100000000001009 "miiEdit"
0x13 010000000000100A "LibAppletWeb" WebApplet applet
0x14 010000000000100B "LibAppletShop" ShopN applet
0x15 010000000000100D "photoViewer"
0x16 010000000000100E "set"
0x17 010000000000100F "LibAppletOff" Offline applet
0x18 0100000000001010 "LibAppletLns" Whitelisted applet
0x19 0100000000001011 "LibAppletAuth" WifiWebAuth applet
0x1A 0100000000001013 "myPage"

LibraryAppletMode

ID Description
0x0 AllForeground
0x1 Background
0x2 No UI
0x3 Background with indirect display, see also #GetIndirectLayerConsumerHandle. Only used by swkbd InlineKeyboard.
0x4 AllForegroundInitiallyHidden. Can be used by [7.0.0+] WebSession.

NotificationMessage

ID Description
0x4 Exit requested
0xF FocusState changed
0x10 Current applet execution was resumed.
0x1E OperationMode changed
0x1F PerformanceMode changed
0x33 RequestToDisplay. Indicates that #ApproveToDisplay should be used.
0x5A Capture button was short-pressed.
0x5C Screenshot was taken.

OperationMode

Value Description
0 Handheld
1 Docked

TvPowerStateMatchingMode

Value Description
0 Unknown
1 Unknown

This is "nn::oe::TvPowerStateMatchingMode". This is used with #SetTvPowerStateMatchingMode.

SystemButtonType

Value Description
1 PerformHomeButtonShortPressing
2 PerformHomeButtonLongPressing
6 PerformCaptureButtonShortPressing
7 PerformCaptureButtonLongPressing

This is "nn::am::service::SystemButtonType". This is used with #PerformSystemButtonPressingIfInFocus.

LaunchParameterKind

Value Description
1 Application-specific LaunchParameter
2 account PreselectedUser
3 Unknown if used by anything?

LibraryAppletExitReason

Value Description
0 Normal
1 Canceled
2 Abnormal
10 Unexpected

ProgramSpecifyKind

Value Description
0 u8 ProgramIndex. "ExecuteProgram". User-process enters an infinite svcSleepThread loop afterwards.
1 u64 titleID. "JumpToSubApplicationProgramForDevelopment". Only available when DebugMode is 1.
2 u64 = value 0. "RestartProgram"

This is "nn::am::service::ProgramSpecifyKind". This controls the type of the u64 passed to #ExecuteProgram.

AppletResourceUserId

This u64 is officially called "nn::applet::AppletResourceUserId". Used by a number of non-AM services.

LibraryAppletInfo

Offset Size Description
0x0 0x4 #AppletId
0x4 0x4 #LibraryAppletMode

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

AppletKind

This is "nn::am::service::AppletKind". This is 8-bytes.

AppletIdentityInfo

Offset Size Description
0x0 0x4 #AppletId
0x4 0x4 Padding
0x8 0x8 titleID

This struct is "nn::am::service::AppletIdentityInfo". This struct is 0x10-bytes.

ApplicationAttributeForQuest

Offset Size Description
0x0 0x4 See #ApplicationAttribute.
0x4 0x4 See #ApplicationAttribute.
0x8 0x4 [7.0.0+] See #ApplicationAttribute.

This struct is "nn::applet::ApplicationAttributeForQuest".

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

Offset Size Description
0x0 0x4 Default is 0 for non-Quest. Only used when non-zero: unknown value in seconds.
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.
0xC 0x14 Unused. Default is 0.

This struct is "nn::am::ApplicationAttribute". This struct is 0x20-bytes.

Internally AM only uses the first 0xC-bytes from ApplicationAttribute, regardless of the cmd.

Notes

AM-sysmodule will only initialize pdm:ntfy / use pdm:ntfy service commands when the value from pm:bm GetBootMode is not 0x1.