Applet Manager services: Difference between revisions

(24 intermediate revisions by 3 users not shown)
Line 114: Line 114:
|-
|-
| 100 || [6.0.0+] [[#PopRequestLaunchApplicationForDebug]] ||
| 100 || [6.0.0+] [[#PopRequestLaunchApplicationForDebug]] ||
|-
| 110 || [9.0.0+] [[#IsForceTerminateApplicationDisabledForDebug]] ||
|-
|-
| 200 || [8.0.0+] [[#LaunchDevMenu]] ||
| 200 || [8.0.0+] [[#LaunchDevMenu]] ||
Line 147: Line 149:


The total entries in the userID buffer must be >= {total userIDs in state}.
The total entries in the userID buffer must be >= {total userIDs in state}.
==== IsForceTerminateApplicationDisabledForDebug ====
No input, returns a total of 1-byte of output.


==== LaunchDevMenu ====
==== LaunchDevMenu ====
Line 346: Line 351:
|-
|-
| 170 || [8.0.0+] [[#HasSaveDataAccessPermission]] ||
| 170 || [8.0.0+] [[#HasSaveDataAccessPermission]] ||
|-
| 180 || [9.0.0+] PushToFriendInvitationStorageChannel ||
|-
| 190 || [9.0.0+] PushToNotificationStorageChannel ||
|}
|}


Line 366: Line 375:
===== GetApplicationControlProperty =====
===== GetApplicationControlProperty =====
No input, takes a type-0x6 output buffer.
No input, takes a type-0x6 output buffer.
The output buffer must be at least 0x4000-bytes. Returns an error when the [[#AppletId]] is 0x04, aka when the IApplicationAccessor is for a SystemApplication.


This gets the application [[NACP_Format|control.nacp]].
This gets the application [[NACP_Format|control.nacp]].
Line 456: Line 467:
|-
|-
! Cmd || Name || Notes
! Cmd || Name || Notes
|-
| 0 || [9.0.0+] SetTerminateResult ||
|-
|-
| 10 || [[#ReadThemeStorage]] ||  
| 10 || [[#ReadThemeStorage]] ||  
|-
|-
| 11 || [[#WriteThemeStorage]] ||  
| 11 || [[#WriteThemeStorage]] ||  
|-
| 20 || [9.0.0+] [[#PushToAppletBoundChannel]] ||
|-
| 21 || [9.0.0+] [[#TryPopFromAppletBoundChannel]] ||
|-
|-
| 40 || [8.0.0+] [[#GetDisplayLogicalResolution]] ||  
| 40 || [8.0.0+] [[#GetDisplayLogicalResolution]] ||  
Line 477: Line 494:
=== WriteThemeStorage ===
=== WriteThemeStorage ===
Takes an input u64 '''offset''' and a type-0x21 input buffer, no output.
Takes an input u64 '''offset''' and a type-0x21 input buffer, no output.
=== PushToAppletBoundChannel ===
Takes an input [[#IStorage]], no output.
=== TryPopFromAppletBoundChannel ===
No input, returns an output [[#IStorage]].


=== GetDisplayLogicalResolution ===
=== GetDisplayLogicalResolution ===
Line 586: Line 609:
|-
|-
| 110 || [6.0.0+] [[#GetMainAppletAvailableUsers]] ||
| 110 || [6.0.0+] [[#GetMainAppletAvailableUsers]] ||
|-
| 120 || [9.0.0+] GetLaunchStorageInfoForDebug ||
|-
| 130 || [9.0.0+] GetGpuErrorDetectedSystemEvent ||
|}
|}


Line 761: Line 788:
|-
|-
| 20 || [8.0.0+] [[#SetHandlingHomeButtonShortPressedEnabled]]
| 20 || [8.0.0+] [[#SetHandlingHomeButtonShortPressedEnabled]]
|-
| 30 || [9.0.0+] SetHealthWarningShowingState
|-
|-
| 90 || [7.0.0+] [[#SetRequiresGpuResourceUse]]
| 90 || [7.0.0+] [[#SetRequiresGpuResourceUse]]
Line 860: Line 889:
| 15 || [7.0.0+] [[#CreateApplicationWithAttributeAndRequestToStartForQuest]] ||  
| 15 || [7.0.0+] [[#CreateApplicationWithAttributeAndRequestToStartForQuest]] ||  
|-
|-
| 20 || EnsureSaveData ||
| 20 || [[#EnsureSaveData]] ||
|-
|-
| 21 || [[#GetDesiredLanguage]] ||
| 21 || [[#GetDesiredLanguage]] ||
Line 928: Line 957:
| 130 || [8.0.0+] [[#GetGpuErrorDetectedSystemEvent]] ||  
| 130 || [8.0.0+] [[#GetGpuErrorDetectedSystemEvent]] ||  
|-
|-
| 500 || [5.0.0+] StartContinuousRecordingFlushForDebug ||  
| 140 || [9.0.0+] GetFriendInvitationStorageChannelEvent ||
|-
| 141 || [9.0.0+] TryPopFromFriendInvitationStorageChannel ||
|-
| 150 || [9.0.0+] GetNotificationStorageChannelEvent ||
|-
| 151 || [9.0.0+] TryPopFromNotificationStorageChannel ||
|-
| 160 || [9.0.0+] GetHealthWarningDisappearedSystemEvent ||
|-
| 170 || [9.0.0+] SetHdcpAuthenticationActivated ||
|-
| 500 || [5.0.0+] [[#StartContinuousRecordingFlushForDebug]] ||  
|-
|-
| 1000 || [5.0.0+] [[#CreateMovieMaker]] ||  
| 1000 || [5.0.0+] [[#CreateMovieMaker]] ||  
Line 972: Line 1,013:


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]].
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]].
==== EnsureSaveData ====
Takes an input u128 userID, returns an output u64 size.
Calls sdk func <code>nn::fs::EnsureApplicationSaveData</code>. [[qlaunch]] also calls this same sdk func directly.
Creates the various savedata as specified by the application [[NACP_Format|control.nacp]] when the savedata doesn't exist.
Official user-processes launch the dataErase LibraryApplet depending on the Result, the above output size is used with this.


==== GetDesiredLanguage ====
==== GetDesiredLanguage ====
Line 989: Line 1,039:
No input, returns an output u8 [[Filesystem_services#StorageId|StorageId]] and u8 [[Filesystem_services#StorageId|StorageId]].
No input, returns an output u8 [[Filesystem_services#StorageId|StorageId]] and u8 [[Filesystem_services#StorageId|StorageId]].


Just returns two u8s loaded from state.
This returns two u8s loaded from state, these are the same StorageIds from [[#ApplicationLaunchProperty]].


==== BeginBlockingHomeButtonShortAndLongPressed ====
==== BeginBlockingHomeButtonShortAndLongPressed ====
Line 1,031: Line 1,081:
==== RequestFlushGamePlayingMovieForDebug ====
==== RequestFlushGamePlayingMovieForDebug ====
No input/output.
No input/output.
Requests to save the video recording, as if the Capture-button was held.


==== RequestToShutdown ====
==== RequestToShutdown ====
Line 1,108: Line 1,160:
==== GetPreviousProgramIndex ====
==== GetPreviousProgramIndex ====
No input, returns an output s32.
No input, returns an output s32.
Gets the ProgramIndex of the Application which launched this title. The output ProgramIndex is -1 when there was no previous title.


==== EnableApplicationAllThreadDumpOnCrash ====
==== EnableApplicationAllThreadDumpOnCrash ====
Line 1,116: Line 1,170:


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.
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.
==== StartContinuousRecordingFlushForDebug ====
Takes an input s64 nanoseconds-value, returns an output Event handle with autoclear=false.
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.


==== CreateMovieMaker ====
==== CreateMovieMaker ====
Takes an input u64 and handle, returns an [[#IMovieMaker]].
Takes an input u64 size and a TransferMemory handle, returns an [[#IMovieMaker]].
 
Official sw retries using the cmd in a loop on error 0x8D4 with svcSleepThread(100000000) being used first.
 
Official sw uses permissions=None for the TransferMemory, with an user-specified buffer. The size of the buffer used by official sw is 0x6000000.


==== PrepareForJit ====
==== PrepareForJit ====
Line 1,164: Line 1,227:


Stubbed with an ILibraryAppletCreator from [[#CreateSelfLibraryAppletCreatorForDevelop]], just returns an error.
Stubbed with an ILibraryAppletCreator from [[#CreateSelfLibraryAppletCreatorForDevelop]], just returns an error.
Terminates all LibraryApplets which were created by the current applet (or by the Application when used from the [[#IApplicationAccessor]] cmd).


=== AreAnyLibraryAppletsLeft ===
=== AreAnyLibraryAppletsLeft ===
Line 1,169: Line 1,234:


Stubbed with an ILibraryAppletCreator from [[#CreateSelfLibraryAppletCreatorForDevelop]], just returns an error.
Stubbed with an ILibraryAppletCreator from [[#CreateSelfLibraryAppletCreatorForDevelop]], just returns an error.
Gets whether any LibraryApplets ([[#ILibraryAppletAccessor]]) which were created by the current applet are still open (or by the Application when used from the [[#IApplicationAccessor]] cmd).


=== CreateStorage ===
=== CreateStorage ===
Line 1,348: Line 1,415:
|-
|-
| 200 || [7.0.0+] [[#GetOperationModeSystemInfo]] ||
| 200 || [7.0.0+] [[#GetOperationModeSystemInfo]] ||
|-
| 300 || [9.0.0+] GetSettingsPlatformRegion ||
|}
|}


Line 1,503: Line 1,572:
No input, returns an output u32.
No input, returns an output u32.


This returns the output from omm [[#Cmd26]].
This returns the output from [[#GetOperationModeSystemInfo_2|omm GetOperationModeSystemInfo]].


== ISelfController ==
== ISelfController ==
Line 1,579: Line 1,648:
|-
|-
| 71 || [5.0.0+] [[#GetCurrentIlluminanceEx]]
| 71 || [5.0.0+] [[#GetCurrentIlluminanceEx]]
|-
| 72 || [9.0.0+] SetInputDetectionPolicy
|-
|-
| 80 || [4.0.0+] [[#SetWirelessPriorityMode]]
| 80 || [4.0.0+] [[#SetWirelessPriorityMode]]
Line 2,185: Line 2,256:
|-
|-
| 100 || [7.0.0+] [[#SetCpuBoostModeForApplet]] ||
| 100 || [7.0.0+] [[#SetCpuBoostModeForApplet]] ||
|-
| 110 || [9.0.0+] PushToAppletBoundChannelForDebug ||
|-
| 111 || [9.0.0+] TryPopFromAppletBoundChannelForDebug ||
|-
| 120 || [9.0.0+] AlarmSettingNotificationEnableAppEventReserve ||
|-
| 121 || [9.0.0+] AlarmSettingNotificationDisableAppEventReserve ||
|-
| 122 || [9.0.0+] AlarmSettingNotificationPushAppEventNotify ||
|-
| 130 || [9.0.0+] FriendInvitationSetApplicationParameter ||
|-
| 131 || [9.0.0+] FriendInvitationClearApplicationParameter ||
|-
| 132 || [9.0.0+] FriendInvitationPushApplicationParameter ||
|}
|}


Line 2,284: Line 2,371:
|rowspan="2"| 1 || [1.0.0-3.0.2]
|rowspan="2"| 1 || [1.0.0-3.0.2]
|-
|-
| [7.0.0+]
| [7.0.0+] IsAutoPowerDownRequested
|-
|-
| 2 || [1.0.0-3.0.2]
| 2 || [1.0.0-3.0.2]
|-
|-
| 3 || SetHandlingContext
| 3 || [[#SetHandlingContext]]
|-
|-
| 4 || LoadAndApplySettings
| 4 || LoadAndApplySettings
Line 2,295: Line 2,382:
|}
|}


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


= omm =
= omm =
Line 2,301: Line 2,389:


Operation Mode Manager (OMM) is a service responsible for arbitrating the operation changes between docked and handheld modes.
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_services|usb:pd*]].
Besides [[PTM_services|PTM]], this is the only service that interacts with the [[Dock]] through [[USB_services|usb:pd*]].


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


== Cmd26 ==
== GetOperationModeSystemInfo ==
No input, returns an output u32.
No input, returns an output u32.


This is used by [[#GetOperationModeSystemInfo]].
This is used by [[#GetOperationModeSystemInfo|ICommonStateGetter GetOperationModeSystemInfo]].


= spsm =
= spsm =
Line 2,374: Line 2,464:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 || GetState
| 0 || GetCurrentState
|-
|-
| 1 || SleepSystemAndWaitAwake
| 1 || EnterSleep
|-
|-
| 2 ||  
| 2 || GetLastWakeReason
|-
|-
| 3 ||  
| 3 || Shutdown
|-
|-
| 4 || GetNotificationMessageEventHandle
| 4 || GetNotificationMessageEventHandle
|-
|-
| 5 ||  
| 5 || ReceiveNotificationMessage
|-
|-
| 6 ||  
| 6 || AnalyzeLogForLastSleepWakeSequence
|-
|-
| 7 ||  
| 7 || ResetEventLog
|-
|-
| 8 || AnalyzePerformanceLogForLastSleepWakeSequence
| 8 || AnalyzePerformanceLogForLastSleepWakeSequence
Line 2,394: Line 2,484:
| 9 || ChangeHomeButtonLongPressingTime
| 9 || ChangeHomeButtonLongPressingTime
|-
|-
| 10 ||  
| 10 || PutErrorState
|-
|-
| 11 || [1.0.0-3.0.2]
| 11 || [1.0.0-3.0.2] InvalidateCurrentHomeButtonPressing
|}
|}


Line 2,440: Line 2,530:


== SaveScreenShot ==
== SaveScreenShot ==
Takes two input u32s, an u64 AppletResourceUserId, a PID, and a type-0x45 input buffer. Returns a 0x20-byte struct '''ApplicationAlbumEntry'''.
Takes two input u32s, an u64 AppletResourceUserId, a PID, and a type-0x45 input buffer containing image data. Returns an [[Capture_services|ApplicationAlbumEntry]].
 
Official user-processes doesn't use this, instead [[#SaveScreenShotEx0]] is used: ScreenShotAttributeEx0 is all-zero, except +4 is set to an input u32 and u32 +0xC = 0x1.


Official user-processes doesn't use this, instead [[#SaveScreenShotEx0]] is used: ScreenShotAttributeEx0 is all-zero except +0 is set to an input u32.
This cmd internally uses an all-zero ScreenShotAttributeEx0, with u32 +0 = input u32 and u32 +0x8 = 0x3.


== SaveScreenShotEx0 ==
== 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'''.
Takes an input 0x40-byte struct '''ScreenShotAttributeEx0''', an input u32, an input u64 AppletResourceUserId, a PID, and a type-0x45 input buffer containing image data. Returns an [[Capture_services|ApplicationAlbumEntry]].
 
== SaveScreenShotEx1 ==
Takes an input 0x40-byte struct '''ScreenShotAttributeEx0''', an input u32, an input u64 AppletResourceUserId, a PID, a type-0x15 input buffer containing an [[Capture_services|ApplicationData]], and a type-0x45 input buffer containing image data. Returns an [[Capture_services|ApplicationAlbumEntry]].
 
== SaveScreenShotEx2 ==
Takes an input 0x40-byte struct '''ScreenShotAttributeEx0''', an input u32, an input u64 AppletResourceUserId, a type-0x15 input buffer containing an [[Capture_services|UserIdList]], and a type-0x45 input buffer containing image data. Returns an [[Capture_services|ApplicationAlbumEntry]].


= Library Applets =
= Library Applets =
Line 2,551: Line 2,649:
| 0x15
| 0x15
| 010000000000100D
| 010000000000100D
| "photoViewer"
| [[Album_Applet|"photoViewer"]]
|-
|-
| 0x16
| 0x16
Line 2,571: Line 2,669:
| 0x1A
| 0x1A
| 0100000000001013
| 0100000000001013
| "myPage"
| [[MyPage_Applet|"myPage"]]
|}
|}


Line 2,703: Line 2,801:
!  Description
!  Description
|-
|-
| 0 || u8 ProgramIndex. "ExecuteProgram". After using [[#ExecuteProgram]] with this successfully, official user-processes will enter an infinite loop with sleep-thread value 86400000000000.
| 0 || u8 ProgramIndex. "ExecuteProgram". [[NS_Services|NS]] handles ProgramIndex by launching titleID {application_titleID}+ProgramIndex. After using [[#ExecuteProgram]] with this successfully, official user-processes will enter an infinite loop with sleep-thread value 86400000000000.
|-
|-
| 1 || u64 titleID. "JumpToSubApplicationProgramForDevelopment". Only available when [[Settings_services#GetDebugModeFlag|DebugMode]] is 1.
| 1 || u64 titleID. "JumpToSubApplicationProgramForDevelopment". Only available when [[Settings_services#GetDebugModeFlag|DebugMode]] is 1.
Line 2,712: Line 2,810:


This is "nn::am::service::ProgramSpecifyKind". This controls the type of the u64 passed to [[#ExecuteProgram]].
This is "nn::am::service::ProgramSpecifyKind". This controls the type of the u64 passed to [[#ExecuteProgram]].
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.


= AppletResourceUserId =
= AppletResourceUserId =