Applet Manager services: Difference between revisions

(16 intermediate revisions by the same user not shown)
Line 113: Line 113:
| 31 || [2.0.0+] [[#GetWriterLockAccessorEx]] ||  
| 31 || [2.0.0+] [[#GetWriterLockAccessorEx]] ||  
|-
|-
| 100 || [6.0.0+] PopRequestLaunchApplicationForDebug ||
| 100 || [6.0.0+] [[#PopRequestLaunchApplicationForDebug]] ||
|-
|-
| 200 || [8.0.0+] [[#LaunchDevMenu]] ||
| 200 || [8.0.0+] [[#LaunchDevMenu]] ||
Line 142: Line 142:


The input value must be 0-3. 0 = HomeButton.
The input value must be 0-3. 0 = HomeButton.
==== PopRequestLaunchApplicationForDebug ====
Takes a type-0x6 output buffer containing an array of u128 userIDs, returns an output u64 titleID (<code>nn::ncm::ApplicationId</code>) and an output s32 '''total_userIDs'''.
The total entries in the userID buffer must be >= {total userIDs in state}.


==== LaunchDevMenu ====
==== LaunchDevMenu ====
Line 150: Line 155:
Uses [[NS_Services#IApplicationManagerInterface]] cmd99.
Uses [[NS_Services#IApplicationManagerInterface]] cmd99.


On success, official sw will enter an infinite loop with sleep-thread value 86400000000000.
This is used by [[qlaunch]]. On success, official sw will enter an infinite loop with sleep-thread value 86400000000000.


==== ILockAccessor ====
==== ILockAccessor ====
Line 274: Line 279:
| 100 || [[#PopFloatingApplicationForDevelopment]] ||  
| 100 || [[#PopFloatingApplicationForDevelopment]] ||  
|}
|}
[[#CreateApplication]]/[[#CreateSystemApplication]] eventually call the same internal func. With [[#CreateApplication]], two ptrs passed to the internal func are NULL, while with [[#CreateSystemApplication]] these are loaded from state. The initial content of [[#ApplicationLaunchRequestInfo]] is all-zero with [[#CreateSystemApplication]], while with [[#CreateApplication]] the first two u32s are value 0x3 with the rest all-zero. The [[#AppletId]] is set to 0x01 with [[#CreateApplication]], while with [[#CreateSystemApplication]] it's 0x04.


==== CreateApplication ====
==== CreateApplication ====
Line 359: Line 366:
===== 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 365: Line 374:
Takes a type-0x6 output buffer.
Takes a type-0x6 output buffer.


The output buffer size must be at least 0x10-bytes. Returns an error when the [[#AppletId]] is 0x04 (starter).  
The output buffer size must be at least 0x10-bytes. Returns an error when the [[#AppletId]] is 0x04, aka when the IApplicationAccessor is for a SystemApplication.


This gets the [[#ApplicationLaunchProperty]].
This gets the [[#ApplicationLaunchProperty]].
Line 805: Line 814:
==== BeginToObserveHidInputForDevelop ====
==== BeginToObserveHidInputForDevelop ====
No input/output.
No input/output.
Sets various state fields and signals an userspace-event.
Enables HID input for the OverlayApplet, without disabling input for the foreground applet.


== IApplicationProxy ==
== IApplicationProxy ==
Line 849: Line 862:
| 15 || [7.0.0+] [[#CreateApplicationWithAttributeAndRequestToStartForQuest]] ||  
| 15 || [7.0.0+] [[#CreateApplicationWithAttributeAndRequestToStartForQuest]] ||  
|-
|-
| 20 || EnsureSaveData ||
| 20 || [[#EnsureSaveData]] ||
|-
|-
| 21 || [[#GetDesiredLanguage]] ||
| 21 || [[#GetDesiredLanguage]] ||
Line 917: Line 930:
| 130 || [8.0.0+] [[#GetGpuErrorDetectedSystemEvent]] ||  
| 130 || [8.0.0+] [[#GetGpuErrorDetectedSystemEvent]] ||  
|-
|-
| 500 || [5.0.0+] StartContinuousRecordingFlushForDebug ||  
| 500 || [5.0.0+] [[#StartContinuousRecordingFlushForDebug]] ||  
|-
|-
| 1000 || [5.0.0+] [[#CreateMovieMaker]] ||  
| 1000 || [5.0.0+] [[#CreateMovieMaker]] ||  
Line 961: Line 974:


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 978: Line 1,000:
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,020: Line 1,042:
==== 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,097: Line 1,121:
==== 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,105: Line 1,131:


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.


==== PrepareForJit ====
==== PrepareForJit ====
Line 1,153: Line 1,188:


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,158: Line 1,195:


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,473: Line 1,512:
Takes a type-0x5 input buffer containing a string, returns an output u64 titleID.
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).
Gets the application titleID for the specified ContentActionName string. Returns an error when the current [[#AppletId]] isn't 0x04 (when the current applet isn't a SystemApplication).


=== SetCpuBoostMode ===
=== SetCpuBoostMode ===
Line 2,492: Line 2,531:
| 0x04
| 0x04
| 0100000000001012
| 0100000000001012
| "starter"
| "starter" SystemApplication.
|-
|-
| 0x0A
| 0x0A
Line 2,692: Line 2,731:
!  Description
!  Description
|-
|-
| 0 || u8 ProgramIndex. "ExecuteProgram". After using [[#ExecutProgram]] 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,701: Line 2,740:


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 =
Line 2,821: Line 2,862:
! Offset || Size || Description
! Offset || Size || Description
|-
|-
| 0x0 || 0x4 || Unknown.
| 0x0 || 0x4 || Unknown. The default is 0x0 with [[#CreateSystemApplication]], 0x3 with [[#CreateApplication]].
|-
|-
| 0x4 || 0x4 || Unknown.
| 0x4 || 0x4 || Unknown. The default is 0x0 with [[#CreateSystemApplication]], 0x3 with [[#CreateApplication]].
|-
|-
| 0x8 || 0x8 || Unknown.
| 0x8 || 0x8 || Unknown. The default is 0x0.
|}
|}