libnx  v4.6.0
applet.h
Go to the documentation of this file.
1 /**
2  * @file applet.h
3  * @brief Applet (applet) service IPC wrapper.
4  * @note For wrappers which launch LibraryApplets etc, see switch/applets/.
5  * @author yellows8
6  * @copyright libnx Authors
7  */
8 #pragma once
9 #include "../types.h"
10 #include "../sf/service.h"
11 #include "../services/apm.h"
12 #include "../services/pdm.h"
13 #include "../services/caps.h"
14 #include "../services/pm.h"
15 #include "../services/ncm_types.h"
16 #include "../services/acc.h"
17 #include "../services/set.h"
18 #include "../kernel/tmem.h"
19 #include "../kernel/event.h"
20 #include "../nacp.h"
21 
22 /// AppletType
23 typedef enum {
24  AppletType_None = -2,
25  AppletType_Default = -1,
26  AppletType_Application = 0,
27  AppletType_SystemApplet = 1,
28  AppletType_LibraryApplet = 2,
29  AppletType_OverlayApplet = 3,
30  AppletType_SystemApplication = 4,
31 } AppletType;
32 
33 /// OperationMode
34 typedef enum {
35  AppletOperationMode_Handheld = 0, ///< Handheld
36  AppletOperationMode_Console = 1, ///< Console (Docked / TV-mode)
38 
39 /// applet hook types.
40 typedef enum {
41  AppletHookType_OnFocusState = 0, ///< ::AppletMessage_FocusStateChanged
42  AppletHookType_OnOperationMode, ///< ::AppletMessage_OperationModeChanged
43  AppletHookType_OnPerformanceMode, ///< ::AppletMessage_PerformanceModeChanged
44  AppletHookType_OnExitRequest, ///< ::AppletMessage_ExitRequested
45  AppletHookType_OnResume, ///< ::AppletMessage_Resume
46  AppletHookType_OnCaptureButtonShortPressed, ///< ::AppletMessage_CaptureButtonShortPressed
47  AppletHookType_OnAlbumScreenShotTaken, ///< ::AppletMessage_AlbumScreenShotTaken
48  AppletHookType_RequestToDisplay, ///< ::AppletMessage_RequestToDisplay
49 
50  AppletHookType_Max, ///< Number of applet hook types.
52 
53 /// AppletMessage, for \ref appletGetMessage. See also \ref AppletHookType.
54 typedef enum {
55  AppletMessage_ExitRequest = 4, ///< Exit request.
56  AppletMessage_FocusStateChanged = 15, ///< FocusState changed.
57  AppletMessage_Resume = 16, ///< Current applet execution was resumed.
58  AppletMessage_OperationModeChanged = 30, ///< OperationMode changed.
59  AppletMessage_PerformanceModeChanged = 31, ///< PerformanceMode changed.
60  AppletMessage_RequestToDisplay = 51, ///< Display requested, see \ref appletApproveToDisplay.
61  AppletMessage_CaptureButtonShortPressed = 90, ///< Capture button was short-pressed.
62  AppletMessage_AlbumScreenShotTaken = 92, ///< Screenshot was taken.
63  AppletMessage_AlbumRecordingSaved = 93, ///< AlbumRecordingSaved
65 
66 /// FocusState
67 typedef enum {
68  AppletFocusState_InFocus = 1, ///< Applet is focused.
69  AppletFocusState_OutOfFocus = 2, ///< Out of focus - LibraryApplet open.
70  AppletFocusState_Background = 3 ///< Out of focus - HOME menu open / console is sleeping.
72 
73 /// FocusHandlingMode
74 typedef enum {
75  AppletFocusHandlingMode_SuspendHomeSleep = 0, ///< Suspend only when HOME menu is open / console is sleeping (default).
76  AppletFocusHandlingMode_NoSuspend, ///< Don't suspend when out of focus.
77  AppletFocusHandlingMode_SuspendHomeSleepNotify, ///< Suspend only when HOME menu is open / console is sleeping but still receive OnFocusState hook.
78  AppletFocusHandlingMode_AlwaysSuspend, ///< Always suspend when out of focus, regardless of the reason.
79 
80  AppletFocusHandlingMode_Max, ///< Number of focus handling modes.
82 
83 /// LaunchParameterKind
84 typedef enum {
85  AppletLaunchParameterKind_UserChannel = 1, ///< UserChannel. Application-specific LaunchParameter.
86  AppletLaunchParameterKind_PreselectedUser = 2, ///< account PreselectedUser
87  AppletLaunchParameterKind_Unknown = 3, ///< Unknown if used by anything?
89 
90 /// AppletId
91 typedef enum {
92  AppletId_None = 0x00, ///< None
93  AppletId_application = 0x01, ///< Application. Not valid for use with LibraryApplets.
94  AppletId_OverlayApplet = 0x02, ///< 010000000000100C "overlayDisp"
95  AppletId_SystemAppletMenu = 0x03, ///< 0100000000001000 "qlaunch" (SystemAppletMenu)
96  AppletId_SystemApplication = 0x04, ///< 0100000000001012 "starter" SystemApplication.
97  AppletId_LibraryAppletAuth = 0x0A, ///< 0100000000001001 "auth"
98  AppletId_LibraryAppletCabinet = 0x0B, ///< 0100000000001002 "cabinet"
99  AppletId_LibraryAppletController = 0x0C, ///< 0100000000001003 "controller"
100  AppletId_LibraryAppletDataErase = 0x0D, ///< 0100000000001004 "dataErase"
101  AppletId_LibraryAppletError = 0x0E, ///< 0100000000001005 "error"
102  AppletId_LibraryAppletNetConnect = 0x0F, ///< 0100000000001006 "netConnect"
103  AppletId_LibraryAppletPlayerSelect = 0x10, ///< 0100000000001007 "playerSelect"
104  AppletId_LibraryAppletSwkbd = 0x11, ///< 0100000000001008 "swkbd"
105  AppletId_LibraryAppletMiiEdit = 0x12, ///< 0100000000001009 "miiEdit"
106  AppletId_LibraryAppletWeb = 0x13, ///< 010000000000100A "LibAppletWeb" WebApplet applet
107  AppletId_LibraryAppletShop = 0x14, ///< 010000000000100B "LibAppletShop" ShopN applet
108  AppletId_LibraryAppletPhotoViewer = 0x15, ///< 010000000000100D "photoViewer"
109  AppletId_LibraryAppletSet = 0x16, ///< 010000000000100E "set" (This applet is currently not present on retail devices.)
110  AppletId_LibraryAppletOfflineWeb = 0x17, ///< 010000000000100F "LibAppletOff" offlineWeb applet
111  AppletId_LibraryAppletLoginShare = 0x18, ///< 0100000000001010 "LibAppletLns" loginShare web-applet
112  AppletId_LibraryAppletWifiWebAuth = 0x19, ///< 0100000000001011 "LibAppletAuth" wifiWebAuth applet
113  AppletId_LibraryAppletMyPage = 0x1A, ///< 0100000000001013 "myPage"
114 } AppletId;
115 
116 /// LibraryAppletMode
117 typedef enum {
118  LibAppletMode_AllForeground = 0, ///< Foreground.
119  LibAppletMode_Background = 1, ///< Background.
120  LibAppletMode_NoUi = 2, ///< No UI.
121  LibAppletMode_BackgroundIndirect = 3, ///< Background with indirect display, see \ref appletHolderGetIndirectLayerConsumerHandle.
122  LibAppletMode_AllForegroundInitiallyHidden = 4, ///< Foreground except initially hidden.
123 } LibAppletMode;
124 
125 /// LibraryAppletExitReason
126 typedef enum {
127  LibAppletExitReason_Normal = 0,
128  LibAppletExitReason_Canceled = 1,
129  LibAppletExitReason_Abnormal = 2,
130  LibAppletExitReason_Unexpected = 10,
132 
133 /// AppletApplicationExitReason
134 typedef enum {
135  AppletApplicationExitReason_Normal = 0,
136  AppletApplicationExitReason_Unknown1 = 1,
137  AppletApplicationExitReason_Unknown2 = 2,
138  AppletApplicationExitReason_Unknown3 = 3,
139  AppletApplicationExitReason_Unknown4 = 4,
140  AppletApplicationExitReason_Unknown5 = 5,
141  AppletApplicationExitReason_Unexpected = 100,
143 
144 /// ThemeColorType
145 typedef enum {
146  AppletThemeColorType_Default = 0,
147  AppletThemeColorType_Unknown1 = 1,
148  AppletThemeColorType_Unknown2 = 2,
149  AppletThemeColorType_Unknown3 = 3,
151 
152 /// Mode values for \ref appletSetTvPowerStateMatchingMode.
153 typedef enum {
157 
158 /// Type values for \ref appletPerformSystemButtonPressingIfInFocus.
159 typedef enum {
160  AppletSystemButtonType_HomeButtonShortPressing = 1, ///< Short-pressing with the HOME-button.
161  AppletSystemButtonType_HomeButtonLongPressing = 2, ///< Long-pressing with the HOME-button.
162  AppletSystemButtonType_PowerButtonShortPressing = 3, ///< Short-pressing with the Power-button. Only available with \ref appletPerformSystemButtonPressing.
163  AppletSystemButtonType_PowerButtonLongPressing = 4, ///< Long-pressing with the Power-button. Only available with \ref appletPerformSystemButtonPressing.
164  AppletSystemButtonType_Shutdown = 5, ///< Shutdown the system, as if the Power-button was held for longer than ::AppletSystemButtonType_PowerButtonLongPressing. Only available with \ref appletPerformSystemButtonPressing.
165  AppletSystemButtonType_CaptureButtonShortPressing = 6, ///< Short-pressing with the Capture-button.
166  AppletSystemButtonType_CaptureButtonLongPressing = 7, ///< Long-pressing with the Capture-button.
168 
169 /// Permission values for \ref appletSetScreenShotPermission.
170 typedef enum {
171  AppletScreenShotPermission_Inherit = 0, ///< Inherit from parent applet.
175 
176 /// Extension values for \ref appletSetIdleTimeDetectionExtension / \ref appletGetIdleTimeDetectionExtension, for extending user inactivity detection.
177 typedef enum {
182 
183 /// Input policy values for \ref appletSetInputDetectionPolicy.
184 typedef enum {
188 
189 /// Input mode values for \ref appletSetWirelessPriorityMode.
190 typedef enum {
194 
195 /// CaptureSharedBuffer for the IDisplayController commands.
196 typedef enum {
201 
202 /// WindowOriginMode
203 typedef enum {
207 
208 /// ProgramSpecifyKind for the ExecuteProgram cmd. Controls the type of the u64 passed to the ExecuteProgram cmd.
209 typedef enum {
210  AppletProgramSpecifyKind_ExecuteProgram = 0, ///< u8 ProgramIndex.
211  AppletProgramSpecifyKind_JumpToSubApplicationProgramForDevelopment = 1, ///< u64 application_id. Only available when DebugMode is enabled.
214 
215 /// applet hook function.
216 typedef void (*AppletHookFn)(AppletHookType hook, void* param);
217 
218 /// applet hook cookie.
219 typedef struct AppletHookCookie AppletHookCookie;
220 
222 {
223  AppletHookCookie* next; ///< Next cookie.
224  AppletHookFn callback; ///< Hook callback.
225  void* param; ///< Callback parameter.
226 };
227 
228 /// LockAccessor
229 typedef struct {
230  Service s; ///< ILockAccessor
231  Event event; ///< Event from the GetEvent cmd, with autoclear=false.
233 
234 /// applet IStorage
235 typedef struct {
236  Service s; ///< IStorage
237  TransferMemory tmem; ///< TransferMemory
238 } AppletStorage;
239 
240 /// LibraryApplet state.
241 typedef struct {
242  Service s; ///< ILibraryAppletAccessor
243  Event StateChangedEvent; ///< Output from GetAppletStateChangedEvent, autoclear=false.
244  Event PopInteractiveOutDataEvent; ///< Output from GetPopInteractiveOutDataEvent, autoclear=false.
245  LibAppletMode mode; ///< See ref \ref LibAppletMode.
246  u64 layer_handle; ///< Output from GetIndirectLayerConsumerHandle on [2.0.0+].
247  bool creating_self; ///< When set, indicates that the LibraryApplet is creating itself.
248  LibAppletExitReason exitreason; ///< Set by \ref appletHolderJoin using the output from cmd GetResult, see \ref LibAppletExitReason.
249 } AppletHolder;
250 
251 /// IApplicationAccessor container.
252 typedef struct {
253  Service s; ///< IApplicationAccessor
254  Event StateChangedEvent; ///< Output from GetAppletStateChangedEvent, autoclear=false.
255  AppletApplicationExitReason exitreason; ///< Set by \ref appletApplicationJoin using the output from cmd GetResult, see \ref AppletApplicationExitReason.
257 
258 /// GpuErrorHandler
259 typedef struct {
260  Service s; ///< IGpuErrorHandler
262 
263 /// Used by \ref appletInitialize with __nx_applet_AppletAttribute for cmd OpenLibraryAppletProxy (AppletType_LibraryApplet), on [3.0.0+]. The default for this struct is all-zero.
264 typedef struct {
265  u8 flag; ///< Flag. When non-zero, two state fields are set to 1.
266  u8 reserved[0x7F]; ///< Unused.
268 
269 /// LibraryAppletInfo
270 typedef struct {
271  AppletId appletId; ///< \ref AppletId
272  LibAppletMode mode; ///< \ref LibAppletMode
273 } LibAppletInfo;
274 
275 /// AppletProcessLaunchReason, from GetLaunchReason.
276 typedef struct {
277  u8 flag; ///< When non-zero, indicates that OpenCallingLibraryApplet should be used.
278  u8 unk_x1[3]; ///< Always zero.
280 
281 /// Cached info for the current LibraryApplet, from \ref appletGetAppletInfo.
282 typedef struct {
283  LibAppletInfo info; ///< Output from \ref appletGetLibraryAppletInfo.
284  bool caller_flag; ///< Loaded from AppletProcessLaunchReason::flag, indicates that the below AppletHolder is initialized.
285  AppletHolder caller; ///< \ref AppletHolder for the CallingLibraryApplet, automatically closed by \ref appletExit when needed.
286 } AppletInfo;
287 
288 /// IdentityInfo
289 typedef struct {
290  AppletId appletId; ///< \ref AppletId
291  u32 pad; ///< Padding.
292  u64 application_id; ///< ApplicationId, only set with appletId == ::AppletId_application.
294 
295 /// Attributes for launching applications for Quest.
296 typedef struct {
297  u32 unk_x0; ///< See AppletApplicationAttribute::unk_x0.
298  u32 unk_x4; ///< See AppletApplicationAttribute::unk_x4.
299  float volume; ///< [7.0.0+] See AppletApplicationAttribute::volume.
301 
302 /// ApplicationAttribute
303 typedef struct {
304  u32 unk_x0; ///< Default is 0 for non-Quest. Only used when non-zero: unknown value in seconds.
305  u32 unk_x4; ///< Default is 0 for non-Quest. Only used when non-zero: unknown value in seconds.
306  float volume; ///< Audio volume. Must be in the range of 0.0f-1.0f. The default is 1.0f.
307  u8 unused[0x14]; ///< Unused. Default is 0.
309 
310 /// ApplicationLaunchProperty
311 typedef struct {
312  u64 application_id; ///< ApplicationId.
313  u32 version; ///< Application version.
314  u8 app_storageId; ///< \ref NcmStorageId for the Application.
315  u8 update_storageId; ///< \ref NcmStorageId for the Application update.
316  u8 unk_xa; ///< Unknown.
317  u8 pad; ///< Padding.
319 
320 /// ApplicationLaunchRequestInfo
321 typedef struct {
322  u32 unk_x0; ///< Unknown. The default is 0x0 with \ref appletCreateSystemApplication, 0x3 with \ref appletCreateApplication.
323  u32 unk_x4; ///< Unknown. The default is 0x0 with \ref appletCreateSystemApplication, 0x3 with \ref appletCreateApplication.
324  u8 unk_x8[0x8]; ///< Unknown. The default is 0x0.
326 
327 /// AppletResourceUsageInfo, from \ref appletGetAppletResourceUsageInfo.
328 typedef struct {
329  u32 counter0; ///< Unknown counter.
330  u32 counter1; ///< Unknown counter.
331  u32 counter2; ///< Output from ns cmd GetRightsEnvironmentCountForDebug.
332  u8 unused[0x14]; ///< Always zero.
334 
335 /// Initialize applet, called automatically during app startup.
337 
338 /// Exit applet, called automatically during app exit.
339 void appletExit(void);
340 
341 /// Gets the Service object for the actual "appletOE"/"appletAE" service session.
343 
344 /// Gets the Service object for IAppletCommonFunctions. Only initialized with AppletType_SystemApplet, AppletType_LibraryApplet, or AppletType_OverlayApplet, on [7.0.0+].
346 
347 /// Gets the Service object for I*Functions, specific to each AppletType (IApplicationFunctions for AppletType_*Application). Not initialized with AppletType_LibraryApplet pre-15.0.0. On [15.0.0+] with AppletType_LibraryApplet this returns the object for IHomeMenuFunctions.
349 
350 /// Gets the Service object for IGlobalStateController. Only initialized with AppletType_SystemApplet, or on [15.0.0+] with AppletType_LibraryApplet/AppletType_OverlayApplet.
352 
353 /// Gets the Service object for IApplicationCreator. Only initialized with AppletType_SystemApplet.
355 
356 /// Gets the Service object for ILibraryAppletSelfAccessor. Only initialized with AppletType_LibraryApplet.
358 
359 /// Gets the Service object for IProcessWindingController. Only initialized with AppletType_LibraryApplet.
361 
362 /// Gets the Service object for ILibraryAppletCreator.
364 
365 /// Gets the Service object for ICommonStateGetter.
367 
368 /// Gets the Service object for ISelfController.
370 
371 /// Gets the Service object for IWindowController.
373 
374 /// Gets the Service object for IAudioController.
376 
377 /// Gets the Service object for IDisplayController.
379 
380 /// Gets the Service object for IDebugFunctions.
382 
383 /// Get the cached AppletResourceUserId.
385 
386 /// Get the \ref AppletType.
388 
389 /// Sets the state field for \ref AppletThemeColorType.
391 
392 /// Gets the state field for \ref AppletThemeColorType. Used internally by \ref libappletArgsCreate.
394 
395 ///@name ICommonStateGetter
396 ///@{
397 
398 /**
399  * @brief Gets the CradleStatus.
400  * @param[out] status Output Dock status.
401  */
403 
404 /**
405  * @brief Gets the BootMode which originated from \ref pmbmGetBootMode.
406  * @param[out] mode \ref PmBootMode
407  */
409 
410 /**
411  * @brief Request to AcquireSleepLock.
412  * @note On success, this then uses cmd GetAcquiredSleepLockEvent and waits on that event.
413  */
415 
416 /**
417  * @brief Release the SleepLock.
418  */
420 
421 /**
422  * @brief Release the SleepLock transiently.
423  * @note On success, this then uses cmd GetAcquiredSleepLockEvent and waits on that event.
424  */
426 
427 /**
428  * @brief GetWakeupCount
429  * @note Only available with [11.0.0+].
430  * @param[out] out Output value.
431  */
433 
434 /**
435  * @brief Pushes a storage to the general channel. Used for sending requests to SystemApplet.
436  * @note This is not usable under an Application, however it is usable under a LibraryApplet.
437  * @note This uses \ref appletStorageClose automatically.
438  * @param[in] s Storage object.
439  */
441 
442 /**
443  * @brief Gets a \ref AppletLockAccessor for HomeButtonReader.
444  * @note Similar to using \ref appletGetReaderLockAccessorEx with inval=0.
445  * @param a LockAccessor object.
446  */
448 
449 /**
450  * @brief Gets a Reader \ref AppletLockAccessor.
451  * @note Only available with [2.0.0+].
452  * @param a LockAccessor object.
453  * @param[in] inval Input value, must be 0-3. 0 = HomeButton.
454  */
456 
457 /**
458  * @brief Gets a Writer \ref AppletLockAccessor.
459  * @note Only available with [7.0.0+]. On older sysvers, this is only available with AppletType_SystemApplet on [2.0.0+].
460  * @param a LockAccessor object.
461  * @param[in] inval Input value, must be 0-3. 0 = HomeButton.
462  */
464 
465 /**
466  * @brief Gets the Dock firmware version.
467  * @note Only available with [2.0.0+].
468  * @param[out] out0 First output value.
469  * @param[out] out1 Second output value.
470  * @param[out] out2 Third output value.
471  * @param[out] out3 Fourth output value.
472  */
473 Result appletGetCradleFwVersion(u32 *out0, u32 *out1, u32 *out2, u32 *out3);
474 
475 /**
476  * @brief Gets whether VrMode is enabled.
477  * @note Only available with [3.0.0+].
478  * @param out Output flag
479  */
481 
482 /**
483  * @brief Sets whether VrMode is enabled.
484  * @note This is only fully usable system-side with [6.0.0+].
485  * @note For checking Parental Controls, see \ref pctlIsStereoVisionPermitted.
486  * @note On pre-7.0.0 this uses cmd SetVrModeEnabled internally, while on [7.0.0+] this uses cmds BeginVrModeEx/EndVrModeEx.
487  * @param flag Flag
488  */
490 
491 /**
492  * @brief Sets whether the LCD screen backlight is turned off.
493  * @note Only available with [4.0.0+].
494  * @param[in] flag Flag
495  */
497 
498 /**
499  * @brief Gets the ControllerFirmwareUpdateSection flag.
500  * @note Only available with [3.0.0+].
501  * @param[out] out Output flag.
502  */
504 
505 /**
506  * @brief SetVrPositionForDebug
507  * @note The cached value loaded from \ref setsysGetDebugModeFlag must be 1, otherwise an error is returned.
508  * @note Only available with [11.0.0+].
509  * @param[in] x X, must not be negative. x+width must be <=1280.
510  * @param[in] y Y, must not be negative. y+height must be <=720.
511  * @param[in] width Width, must be 1-1280.
512  * @param[in] height Height, must be 1-720.
513  */
515 
516 /**
517  * @brief Gets the DefaultDisplayResolution.
518  * @note Only available with [3.0.0+].
519  * @param[out] width Output width.
520  * @param[out] height Output height.
521  */
523 
524 /**
525  * @brief Gets an Event which is signaled when the output from \ref appletGetDefaultDisplayResolution changes.
526  * @note Only available with [3.0.0+].
527  * @note The Event must be closed by the user once finished with it.
528  * @param[out] out_event Output Event with autoclear=true.
529  */
531 
532 /**
533  * @brief Gets the HdcpAuthenticationState.
534  * @note Only available with [4.0.0+].
535  * @param[out] state Output state.
536  */
538 
539 /**
540  * @brief Gets an Event which is signaled when the output from \ref appletGetHdcpAuthenticationState changes.
541  * @note Only available with [4.0.0+].
542  * @note The Event must be closed by the user once finished with it.
543  * @param[out] out_event Output Event with autoclear=true.
544  */
546 
547 /**
548  * @brief Sets the \ref AppletTvPowerStateMatchingMode.
549  * @note Only available with [5.0.0+].
550  * @param[in] mode \ref AppletTvPowerStateMatchingMode
551  */
553 
554 /**
555  * @brief Gets the ApplicationId for the specified ContentActionName string.
556  * @note Only available when the current applet is an AppletType_SystemApplication on [5.1.0+].
557  * @param[out] application_id ApplicationId.
558  * @param[in] name ContentActionName string.
559  */
560 Result appletGetApplicationIdByContentActionName(u64 *application_id, const char *name);
561 
562 /**
563  * @brief Sets the \ref ApmCpuBoostMode.
564  * @note Only available with [7.0.0+] (not fully usable system-side with 6.x).
565  * @param mode \ref ApmCpuBoostMode.
566  */
568 
569 /**
570  * @brief CancelCpuBoostMode
571  * @note Only available with [10.0.0+].
572  */
574 
575 /**
576  * @brief GetBuiltInDisplayType
577  * @note Only available with [11.0.0+].
578  * @param[out] out Output value.
579  */
581 
582 /**
583  * @brief Perform SystemButtonPressing with the specified \ref AppletSystemButtonType. Internally this cmd checks a state field, verifies that the type is allowed, then runs the same func as \ref appletPerformSystemButtonPressing internally.
584  * @note Only available with [6.0.0+].
585  * @param[in] type \ref AppletSystemButtonType
586  */
588 
589 /**
590  * @brief Sets whether PerformanceConfigurationChangedNotification is enabled.
591  * @note Only available with [7.0.0+].
592  * @param[in] flag Whether to enable the notification.
593  */
595 
596 /**
597  * @brief Gets the current PerformanceConfiguration.
598  * @note Only available with [7.0.0+].
599  * @param PerformanceConfiguration Output PerformanceConfiguration.
600  */
602 
603 /**
604  * @brief Opens an \ref AppletGpuErrorHandler.
605  * @note The cached value loaded from \ref setsysGetDebugModeFlag must be 1, otherwise an error is returned.
606  * @note Only available with [11.0.0+].
607  * @param[out] g \ref AppletGpuErrorHandler
608  */
610 
611 /**
612  * @brief Gets the OperationModeSystemInfo.
613  * @note Only available with [7.0.0+].
614  * @param[out] info Output info.
615  */
617 
618 /**
619  * @brief This uses \ref setsysGetPlatformRegion internally.
620  * @note Only available with [9.0.0+].
621  * @param[out] out \ref SetSysPlatformRegion
622  */
624 
625 /**
626  * @brief ActivateMigrationService
627  * @note Only available with [10.0.0+].
628  */
630 
631 /**
632  * @brief DeactivateMigrationService
633  * @note Only available with [10.0.0+].
634  */
636 
637 /**
638  * @brief DisableSleepTillShutdown
639  * @note Only available with [11.0.0+].
640  */
642 
643 /**
644  * @brief SuppressDisablingSleepTemporarily
645  * @param[in] val Nanoseconds value.
646  * @note Only available with [11.0.0+].
647  */
649 
650 /**
651  * @brief SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled
652  * @note Only available with [11.0.0+].
653  */
655 
656 ///@}
657 
658 ///@name IGpuErrorHandler
659 ///@{
660 
661 /**
662  * @brief Close an \ref AppletGpuErrorHandler.
663  * @param g \ref AppletGpuErrorHandler
664  */
666 
667 /**
668  * @brief Gets the size of the info available with \ref appletGpuErrorHandlerGetManualGpuErrorInfo.
669  * @param g \ref AppletGpuErrorHandler
670  * @param[out] out Output size.
671  */
673 
674 /**
675  * @brief GetManualGpuErrorInfo
676  * @param g \ref AppletGpuErrorHandler
677  * @param[out] buffer Output buffer.
678  * @param[in] size Output buffer size, must be >= the output size from \ref appletGpuErrorHandlerGetManualGpuErrorInfoSize.
679  * @param[out] out Output value.
680  */
682 
683 /**
684  * @brief GetManualGpuErrorDetectionSystemEvent
685  * @param g \ref AppletGpuErrorHandler
686  * @note The Event must be closed by the user once finished with it.
687  * @param[out] out_event Output Event with autoclear=false.
688  */
690 
691 /**
692  * @brief FinishManualGpuErrorHandling
693  * @param g \ref AppletGpuErrorHandler
694  */
696 
697 ///@}
698 
699 ///@name ISelfController
700 ///@{
701 
702 /**
703  * @brief Delay exiting until \ref appletUnlockExit is called, with a 15 second timeout once exit is requested.
704  * @note When exit is requested \ref appletMainLoop will return false, hence any main-loop using appletMainLoop will exit. This allows the app to handle cleanup post-main-loop instead of being force-terminated.
705  * @note If the above timeout occurs after exit was requested where \ref appletUnlockExit was not called, the process will be forced-terminated.
706  * @note \ref appletUnlockExit must be used before main() returns.
707  */
709 
710 /// Unlocks exiting, see \ref appletLockExit.
712 
713 /**
714  * @brief Enter FatalSection.
715  */
717 
718 /**
719  * @brief Leave FatalSection.
720  */
722 
723 /**
724  * @brief Controls whether screenshot-capture is allowed.
725  * @param permission \ref AppletScreenShotPermission
726  */
728 
729 /**
730  * @brief Sets whether ::AppletMessage_Resume is enabled.
731  * @param[in] flag Whether to enable the notification.
732  */
734 
735 /**
736  * @brief Sets the \ref AppletIdentityInfo for screenshots.
737  * @param[in] info \ref AppletIdentityInfo
738  */
740 
741 /**
742  * @brief Sets ControllerFirmwareUpdateSection.
743  * @note Only available with [3.0.0+].
744  * @note This throws error 0x40280 when the internal state flag already matches the input value.
745  * @param[in] flag Flag
746  */
748 
749 /**
750  * @brief Sets whether ::AppletMessage_CaptureButtonShortPressed is enabled.
751  * @note Only available with [3.0.0+].
752  * @note When enabled with a non-Overlay applet, Overlay applet will not be notified of capture button short-presses for screenshots.
753  * @param[in] flag Whether to enable the notification.
754  */
756 
757 /**
758  * @brief Sets the Album screenshot ImageOrientation.
759  * @note Only available with [3.0.0+].
760  * @param[in] orientation \ref AlbumImageOrientation
761  */
763 
764 /**
765  * @brief Sets the DesirableKeyboardLayout.
766  * @note Only available with [4.0.0+].
767  * @param[in] layout Input \ref SetKeyboardLayout.
768  */
770 
771 Result appletCreateManagedDisplayLayer(u64 *out);
772 
773 /**
774  * @brief Checks whether SystemBufferSharing is enabled, throwing an error otherwise.
775  * @note Only available with [4.0.0+]. Not usable with AppletType_*Application.
776  */
778 
779 /**
780  * @brief Gets the System SharedBufferHandle and SharedLayerHandle.
781  * @note Only available with [4.0.0+]. Not usable with AppletType_*Application.
782  * @param[out] SharedBufferHandle Output System SharedBufferHandle.
783  * @param[out] SharedLayerHandle Output System SharedLayerHandle.
784  */
785 Result appletGetSystemSharedLayerHandle(u64 *SharedBufferHandle, u64 *SharedLayerHandle);
786 
787 /**
788  * @brief Same as \ref appletGetSystemSharedLayerHandle except this just gets the SharedBufferHandle.
789  * @note Only available with [5.0.0+]. Not usable with AppletType_*Application.
790  * @param[out] SharedBufferHandle Output System SharedBufferHandle.
791  */
793 
794 /**
795  * @brief CreateManagedDisplaySeparableLayer
796  * @note Only available with [10.0.0+].
797  * @param[out] display_layer Output display_layer.
798  * @param[out] recording_layer Output recording_layer.
799  */
800 Result appletCreateManagedDisplaySeparableLayer(u64 *display_layer, u64 *recording_layer);
801 
802 /**
803  * @brief SetManagedDisplayLayerSeparationMode
804  * @note Only available with [10.0.0+].
805  * @param[in] mode Mode. Must be 0-1.
806  */
808 
809 /**
810  * @brief Sets whether ::AppletMessage_RequestToDisplay is enabled.
811  * @note Sets an internal state flag. When the input flag is 0, this will in additional run the same code as \ref appletApproveToDisplay.
812  * @param[in] flag Flag
813  */
815 
816 /**
817  * @brief Approve the display requested by ::AppletMessage_RequestToDisplay, see also \ref appletSetHandlesRequestToDisplay.
818  */
820 
821 /**
822  * @brief OverrideAutoSleepTimeAndDimmingTime
823  * @param[in] inval0 Unknown input value.
824  * @param[in] inval1 Unknown input value.
825  * @param[in] inval2 Unknown input value.
826  * @param[in] inval3 Unknown input value.
827  */
829 
830 /**
831  * @brief Sets the IdleTimeDetectionExtension.
832  * @param[in] ext \ref AppletIdleTimeDetectionExtension Must be 0-2: 0 = disabled, 1 = Extended, and 2 = ExtendedUnsafe.
833  */
835 
836 /**
837  * @brief Gets the value set by \ref appletSetIdleTimeDetectionExtension.
838  * @param[out] ext \ref AppletIdleTimeDetectionExtension
839  */
841 
842 /**
843  * @brief Sets the InputDetectionSourceSet.
844  * @param[in] val Input value.
845  */
847 
848 /**
849  * @brief Reports that the user is active, for idle detection (screen dimming / auto-sleep). This is equivalent to when the user uses HID input.
850  * @note Only available with [2.0.0+].
851  */
853 
854 /**
855  * @brief Gets the current Illuminance from the light sensor.
856  * @note Only available with [3.0.0+].
857  * @param fLux Output fLux
858  */
860 
861 /**
862  * @brief Gets whether Illuminance is available.
863  * @note Only available with [3.0.0+].
864  * @param out Output flag
865  */
867 
868 /**
869  * @brief Sets AutoSleepDisabled.
870  * @note Only available with [5.0.0+].
871  * @param[in] flag Flag
872  */
874 
875 /**
876  * @brief Gets AutoSleepDisabled.
877  * @note Only available with [5.0.0+].
878  * @param[out] out Output flag
879  */
881 
882 /**
883  * @brief Gets the current Illuminance from the light sensor. Same as \ref appletGetCurrentIlluminance except for the additional param.
884  * @note Only available with [5.0.0+].
885  * @param bOverLimit Output bOverLimit
886  * @param fLux Output fLux
887  */
888 Result appletGetCurrentIlluminanceEx(bool *bOverLimit, float *fLux);
889 
890 /**
891  * @brief Sets the \ref AppletInputDetectionPolicy.
892  * @note Only available with [9.0.0+].
893  * @param[in] policy \ref AppletInputDetectionPolicy
894  */
896 
897 /**
898  * @brief Sets the WirelessPriorityMode.
899  * @note Only available with [4.0.0+].
900  * @param[in] mode \ref AppletWirelessPriorityMode
901  */
903 
904 /**
905  * @brief Gets the total time in nanoseconds that the current process was actively running (not suspended), relative to when \ref appletInitialize was last used.
906  * @note Only available with [6.0.0+].
907  * @param[out] activeTime Output nanoseconds value.
908  */
910 
911 /**
912  * @brief Sets whether ::AppletMessage_AlbumScreenShotTaken is enabled.
913  * @note Only available with [7.0.0+].
914  * @param[in] flag Whether to enable the notification.
915  */
917 
918 /**
919  * @brief Sets the Application AlbumUserData.
920  * @note Only available with [8.0.0+].
921  * @param[in] buffer Buffer containing arbitrary UserData.
922  * @param[in] size Buffer size, must be <=0x400.
923  */
924 Result appletSetApplicationAlbumUserData(const void* buffer, size_t size);
925 
926 /**
927  * @brief SaveCurrentScreenshot
928  * @note Only available with [11.0.0+].
929  * @param[in] option \ref AlbumReportOption
930  */
932 
933 ///@}
934 
935 ///@name IWindowController
936 ///@{
937 
938 /**
939  * @brief Gets the AppletResourceUserId of the CallerApplet.
940  * @note Only available with [6.0.0+].
941  * @param[out] out AppletResourceUserId
942  */
944 
945 /**
946  * @brief Sets the current applet WindowVisibility.
947  * @note Only available with [7.0.0+].
948  * @param[in] flag Flag
949  */
951 
952 /**
953  * @brief Sets the AppletGpuTimeSlice.
954  * @note Only available with [7.0.0+].
955  * @param[in] val Input value, must not be negative.
956  */
958 
959 ///@}
960 
961 ///@name IAudioController
962 ///@{
963 
964 /**
965  * @brief Sets the ExpectedMasterVolume for MainApplet and LibraryApplet.
966  * @note Used by some official apps before/after launching LibraryApplets. Prior to changing the volume, the official app uses \ref appletGetExpectedMasterVolume, with the output being used to restore the volume after LibraryApplet handling.
967  * @param[in] mainAppletVolume MainApplet ExpectedMasterVolume.
968  * @param[in] libraryAppletVolume LibraryApplet ExpectedMasterVolume.
969  */
970 Result appletSetExpectedMasterVolume(float mainAppletVolume, float libraryAppletVolume);
971 
972 /**
973  * @brief Gets the ExpectedMasterVolume for MainApplet and LibraryApplet.
974  * @note See also \ref appletSetExpectedMasterVolume.
975  * @param[out] mainAppletVolume MainApplet ExpectedMasterVolume. Optional, can be NULL. Used with cmd GetMainAppletExpectedMasterVolume when not NULL.
976  * @param[out] libraryAppletVolume LibraryApplet ExpectedMasterVolume. Optional, can be NULL. Used with cmd GetLibraryAppletExpectedMasterVolume when not NULL.
977  */
978 Result appletGetExpectedMasterVolume(float *mainAppletVolume, float *libraryAppletVolume);
979 
980 /**
981  * @brief Change the MainApplet MasterVolume.
982  * @param[in] volume MainApplet MasterVolume.
983  * @param[in] unk Unknown.
984  */
986 
987 /**
988  * @brief Sets the TransparentVolumeRate.
989  * @param[in] val Input value.
990  */
992 
993 ///@}
994 
995 ///@name IDisplayController
996 ///@{
997 
998 /**
999  * @brief Update the LastForeground CaptureImage.
1000  */
1002 
1003 /**
1004  * @brief Update the CallerApplet CaptureImage.
1005  */
1007 
1008 /**
1009  * @brief Gets the LastForeground CaptureImage.
1010  * @param[out] buffer Output buffer containing the 1280x720 RGBA8 image.
1011  * @param[out] size Buffer size, must match 0x384000.
1012  * @param[out] flag Output flag.
1013  */
1014 Result appletGetLastForegroundCaptureImageEx(void* buffer, size_t size, bool *flag);
1015 
1016 /**
1017  * @brief Gets the LastApplication CaptureImage.
1018  * @param[out] buffer Output buffer containing the 1280x720 RGBA8 image.
1019  * @param[out] size Buffer size, must match 0x384000.
1020  * @param[out] flag Output flag.
1021  */
1022 Result appletGetLastApplicationCaptureImageEx(void* buffer, size_t size, bool *flag);
1023 
1024 /**
1025  * @brief Gets the CallerApplet CaptureImage.
1026  * @param[out] buffer Output buffer containing the 1280x720 RGBA8 image.
1027  * @param[out] size Buffer size, must match 0x384000.
1028  * @param[out] flag Output flag.
1029  */
1030 Result appletGetCallerAppletCaptureImageEx(void* buffer, size_t size, bool *flag);
1031 
1032 /**
1033  * @brief Takes a screenshot of the current applet Layer into the specified CaptureSharedBuffer.
1034  * @note Only available with [2.0.0+].
1035  * @param[in] flag Flag.
1036  * @param[in] captureBuf \ref AppletCaptureSharedBuffer
1037  */
1039 
1040 /**
1041  * @brief Copies image data from a CaptureSharedBuffer to another CaptureSharedBuffer.
1042  * @note Only available with [5.0.0+].
1043  * @param[in] dstCaptureBuf Destination \ref AppletCaptureSharedBuffer.
1044  * @param[in] srcCaptureBuf Source \ref AppletCaptureSharedBuffer.
1045  */
1047 
1048 /**
1049  * @brief Clear the input CaptureSharedBuffer with the specified color.
1050  * @note Only available with [3.0.0+].
1051  * @param[in] flag Flag.
1052  * @param[in] captureBuf \ref AppletCaptureSharedBuffer
1053  * @param[in] color RGBA8 color.
1054  */
1056 
1057 /**
1058  * @brief Clear the AppletTransitionBuffer with the specified color.
1059  * @note Only available with [3.0.0+].
1060  * @param[in] color RGBA8 color.
1061  */
1063 
1064 /**
1065  * @brief Acquire the LastApplication CaptureSharedBuffer.
1066  * @note Only available with [4.0.0+].
1067  * @param[out] flag Output flag.
1068  * @param[out] id Output ID.
1069  */
1071 
1072 /**
1073  * @brief Release the LastApplication CaptureSharedBuffer.
1074  * @note Only available with [4.0.0+].
1075  */
1077 
1078 /**
1079  * @brief Acquire the LastForeground CaptureSharedBuffer.
1080  * @note Only available with [4.0.0+].
1081  * @param[out] flag Output flag.
1082  * @param[out] id Output ID.
1083  */
1085 
1086 /**
1087  * @brief Release the LastForeground CaptureSharedBuffer.
1088  * @note Only available with [4.0.0+].
1089  */
1091 
1092 /**
1093  * @brief Acquire the CallerApplet CaptureSharedBuffer.
1094  * @note Only available with [4.0.0+].
1095  * @param[out] flag Output flag.
1096  * @param[out] id Output ID.
1097  */
1099 
1100 /**
1101  * @brief Release the CallerApplet CaptureSharedBuffer.
1102  * @note Only available with [4.0.0+].
1103  */
1105 
1106 /**
1107  * @brief Takes a screenshot of the current applet Layer into the specified CaptureSharedBuffer. Same as \ref appletTakeScreenShotOfOwnLayer except for the additional immediately param.
1108  * @note Only available with [6.0.0+].
1109  * @param[in] flag0 Flag0.
1110  * @param[in] immediately Whether the screenshot should be taken immediately.
1111  * @param[in] captureBuf \ref AppletCaptureSharedBuffer
1112  */
1113 Result appletTakeScreenShotOfOwnLayerEx(bool flag0, bool immediately, AppletCaptureSharedBuffer captureBuf);
1114 
1115 ///@}
1116 
1117 ///@name IProcessWindingController
1118 ///@{
1119 
1120 /**
1121  * @brief Pushes a storage to the ContextStack. Normally this should only be used when AppletInfo::caller_flag is true.
1122  * @note Only available with AppletType_LibraryApplet.
1123  * @note This uses \ref appletStorageClose automatically.
1124  * @param[in] s Storage object.
1125  */
1127 
1128 /**
1129  * @brief Pops a storage from the ContextStack. Normally this should only be used when AppletInfo::caller_flag is true.
1130  * @note Only available with AppletType_LibraryApplet.
1131  * @param[out] s Storage object.
1132  */
1134 
1135 // LockAccessor
1136 
1137 /**
1138  * @brief Closes a LockAccessor.
1139  * @param a LockAccessor object.
1140  */
1142 
1143 /**
1144  * @brief TryLock a LockAccessor.
1145  * @param a LockAccessor object.
1146  * @param[out] flag Whether locking was successful, when false this indicates that this func should be called again.
1147  */
1149 
1150 /**
1151  * @brief Lock a LockAccessor.
1152  * @note Similar to \ref appletLockAccessorTryLock, except this uses timeout UINT64_MAX with the eventWait call, and this uses TryLock repeatedly until the output flag value is true.
1153  * @param a LockAccessor object.
1154  */
1156 
1157 /**
1158  * @brief Unlock a LockAccessor.
1159  * @param a LockAccessor object.
1160  */
1162 
1163 ///@}
1164 
1165 ///@name ILibraryAppletCreator
1166 ///@{
1167 
1168 /**
1169  * @brief Creates a LibraryApplet.
1170  * @param h AppletHolder object.
1171  * @param id See \ref AppletId.
1172  * @param mode See \ref LibAppletMode.
1173  */
1175 
1176 /**
1177  * @brief Creates a LibraryApplet. This is for when a LibraryApplet creates itself.
1178  * @note Identical to \ref appletCreateLibraryApplet except this sets the creating_self flag to true.
1179  * @param h AppletHolder object.
1180  * @param id See \ref AppletId.
1181  * @param mode See \ref LibAppletMode.
1182  */
1184 
1185 /**
1186  * @brief TerminateAllLibraryApplets which were created by the current applet.
1187  * @note Normally LibraryApplet cleanup should be handled via \ref AppletHolder.
1188  */
1190 
1191 /**
1192  * @brief AreAnyLibraryAppletsLeft which were created by the current applet.
1193  * @param[out] out Output flag.
1194  */
1196 
1197 ///@}
1198 
1199 ///@name ILibraryAppletAccessor
1200 ///@{
1201 
1202 /// Closes an AppletHolder object.
1204 
1205 /// Returns whether the AppletHolder object was initialized.
1207 
1208 /**
1209  * @brief Gets the IndirectLayerConsumerHandle loaded during \ref appletCreateLibraryApplet, on [2.0.0+].
1210  * @note Only available when \ref LibAppletMode is ::LibAppletMode_BackgroundIndirect.
1211  * @param h AppletHolder object.
1212  * @param out Output IndirectLayerConsumerHandle.
1213  */
1215 
1216 /**
1217  * @brief Starts the LibraryApplet.
1218  * @param h AppletHolder object.
1219  */
1221 
1222 /**
1223  * @brief Jumps to the LibraryApplet, with the current-LibraryApplet being terminated. This will enter an infinite-sleep-loop on success.
1224  * @note Only available with AppletType_LibraryApplet.
1225  * @param h AppletHolder object.
1226  */
1228 
1229 /**
1230  * @brief Requests the LibraryApplet to exit. The command is only used if \ref appletHolderCheckFinished returns false.
1231  * @param h AppletHolder object.
1232  */
1234 
1235 /**
1236  * @brief Terminate the LibraryApplet.
1237  * @param h AppletHolder object.
1238  */
1240 
1241 /**
1242  * @brief Uses cmds GetAppletStateChangedEvent and RequestExit, then waits for the LibraryApplet to exit with the specified timeout. If a timeout occurs, the Terminate cmd is used.
1243  * @param h AppletHolder object.
1244  * @param[in] timeout Timeout in nanoseconds. UINT64_MAX for no timeout.
1245  */
1247 
1248 /**
1249  * @brief Waits for the LibraryApplet to exit.
1250  * @param h AppletHolder object.
1251  */
1253 
1254 /**
1255  * @brief Gets the LibraryApplet StateChangedEvent.
1256  * @param h AppletHolder object.
1257  */
1259  return &h->StateChangedEvent;
1260 }
1261 
1262 /**
1263  * @brief Waits on the LibraryApplet StateChangedEvent with timeout=0, and returns whether it was successful.
1264  * @param h AppletHolder object.
1265  */
1267 
1268 /**
1269  * @brief Gets the \ref LibAppletExitReason set by \ref appletHolderJoin.
1270  * @param h AppletHolder object.
1271  */
1273 
1274 /**
1275  * @brief Sets OutOfFocusApplicationSuspendingEnabled.
1276  * @note Only available with AppletType_*Application.
1277  * @param h AppletHolder object.
1278  * @param[in] flag Flag
1279  */
1281 
1282 /**
1283  * @brief PresetLibraryAppletGpuTimeSliceZero
1284  * @note Only available with [10.0.0+].
1285  * @param h AppletHolder object.
1286  */
1288 
1289 /**
1290  * @brief Gets the PopInteractiveOutDataEvent.
1291  * @param h AppletHolder object.
1292  * @param[out] out_event Output Event.
1293  */
1295 
1296 /**
1297  * @brief Waits for the PopInteractiveOutDataEvent and StateChangedEvent.
1298  * @return false for error / when StateChangedEvent was signaled, and true when PopInteractiveOutDataEvent was signaled. The latter is signaled when a new storage is available with \ref appletHolderPopInteractiveOutData where previously no storage was available (this willl not clear the event), this event is automatically cleared by the system once the last storage is popped.
1299  * @param h AppletHolder object.
1300  */
1302 
1303 /**
1304  * @brief Pushes a storage for LibraryApplet input.
1305  * @note This uses \ref appletStorageClose automatically.
1306  * @param h AppletHolder object.
1307  * @param[in] s Storage object.
1308  */
1310 
1311 /**
1312  * @brief Pops a storage from LibraryApplet output.
1313  * @param h AppletHolder object.
1314  * @param[out] s Storage object.
1315  */
1317 
1318 /**
1319  * @brief Pushes a storage for LibraryApplet Extra storage input.
1320  * @note This uses \ref appletStorageClose automatically.
1321  * @param h AppletHolder object.
1322  * @param[in] s Storage object.
1323  */
1325 
1326 /**
1327  * @brief Pushes a storage for LibraryApplet Interactive input.
1328  * @note This uses \ref appletStorageClose automatically.
1329  * @param h AppletHolder object.
1330  * @param[in] s Storage object.
1331  */
1333 
1334 /**
1335  * @brief Pops a storage from LibraryApplet Interactive output.
1336  * @param h AppletHolder object.
1337  * @param[out] s Storage object.
1338  */
1340 
1341 /**
1342  * @brief Gets the \ref LibAppletInfo for the specified LibraryApplet.
1343  * @param h AppletHolder object.
1344  * @param[out] info \ref LibAppletInfo
1345  */
1347 
1348 ///@}
1349 
1350 ///@name (ILibraryAppletCreator ->) IStorage
1351 ///@{
1352 
1353 /**
1354  * @brief Creates a storage.
1355  * @param s Storage object.
1356  * @param size Size of storage.
1357  */
1359 
1360 /**
1361  * @brief Creates a TransferMemory storage.
1362  * @param s Storage object.
1363  * @param buffer TransferMemory buffer, will be automatically allocated if NULL.
1364  * @param size Size of storage.
1365  * @param writable Controls whether writing to the storage is allowed with \ref appletStorageWrite.
1366  */
1367 Result appletCreateTransferMemoryStorage(AppletStorage *s, void* buffer, s64 size, bool writable);
1368 
1369 /**
1370  * @brief Creates a HandleStorage.
1371  * @note Only available on [2.0.0+].
1372  * @param s Storage object.
1373  * @param inval Arbitrary input value.
1374  * @param handle Arbitrary input handle.
1375  */
1377 
1378 /**
1379  * @brief Creates a HandleStorage using TransferMemory. Wrapper for \ref appletCreateHandleStorage.
1380  * @param s Storage object.
1381  * @param buffer TransferMemory buffer, will be automatically allocated if NULL.
1382  * @param size Size of storage.
1383  */
1385 
1386 /// Closes the storage object. TransferMemory closing is seperate, see \ref appletStorageCloseTmem.
1387 /// Other applet functions which push an input storage will automatically call this.
1389 
1390 /// Closes the TransferMemory in the storage object. For TransferMemory storage created by the current process, this must be called after the LibraryApplet finishes using it (if sent to one).
1392 
1393 /// Gets the size of the storage. This is not usable with HandleStorage, use \ref appletStorageGetHandle or \ref appletStorageMap instead for that.
1395 
1396 /**
1397  * @brief Writes to a storage. offset(+size) must be within the actual storage size.
1398  * @note This is not usable with HandleStorage.
1399  * @param s Storage object.
1400  * @param offset Offset in storage.
1401  * @param buffer Input data.
1402  * @param size Data size.
1403  */
1404 Result appletStorageWrite(AppletStorage *s, s64 offset, const void* buffer, size_t size);
1405 
1406 /**
1407  * @brief Reads from a storage. offset(+size) must be within the actual storage size.
1408  * @note This is not usable with HandleStorage.
1409  * @param s Storage object.
1410  * @param offset Offset in storage.
1411  * @param buffer Input data.
1412  * @param size Data size.
1413  */
1414 Result appletStorageRead(AppletStorage *s, s64 offset, void* buffer, size_t size);
1415 
1416 /**
1417  * @brief Gets data for a HandleStorage originally from \ref appletCreateHandleStorage input.
1418  * @note Only available on [2.0.0+].
1419  * @param s Storage object.
1420  * @param out Output value.
1421  * @param handle Output handle.
1422  */
1424 
1425 /**
1426  * @brief Maps TransferMemory for a HandleStorage. Wrapper for \ref appletCreateHandleStorage.
1427  * @note The TransferMemory can be unmapped with \ref appletStorageCloseTmem.
1428  * @note Do not use this if the AppletStorage already contains initialized TransferMemory state.
1429  * @param s Storage object.
1430  * @param addr Output mapped address (optional).
1431  * @param size Output size (optional).
1432  */
1433 Result appletStorageMap(AppletStorage *s, void** addr, size_t *size);
1434 
1435 ///@}
1436 
1437 ///@name IApplicationFunctions: IFunctions for AppletType_*Application.
1438 ///@{
1439 
1440 /**
1441  * @brief Pops a LaunchParameter AppletStorage, the storage will be removed from sysmodule state during this.
1442  * @param[out] s Output storage.
1443  * @param kind See \ref AppletLaunchParameterKind.
1444  * @note Only available with AppletType_*Application.
1445  * @note See also acc.h \ref accountGetPreselectedUser (wrapper for appletPopLaunchParameter etc).
1446  */
1448 
1449 /**
1450  * @brief Requests to launch the specified application.
1451  * @note Only available with AppletType_*Application, or AppletType_LibraryApplet on [5.0.0+].
1452  * @param[in] application_id ApplicationId. Value 0 can be used to relaunch the current application.
1453  * @param[in] s Optional AppletStorage object, can be NULL. This is automatically closed. When NULL on pre-4.0.0 (or with AppletType_LibraryApplet), this will internally create a tmp storage with size 0 for use with the cmd. This is the storage available to the launched application via \ref appletPopLaunchParameter with ::AppletLaunchParameterKind_UserChannel.
1454  */
1456 
1457 /**
1458  * @brief Requests to launch the specified application, for kiosk systems.
1459  * @note Only available with AppletType_*Application on [3.0.0+].
1460  * @note Identical to \ref appletRequestLaunchApplication, except this allows the user to specify the attribute fields instead of the defaults being used.
1461  * @param[in] application_id ApplicationId
1462  * @param[in] s Optional AppletStorage object, can be NULL. This is automatically closed. When NULL on pre-4.0.0, this will internally create a tmp storage with size 0 for use with the cmd. This is the storage available to the launched application via \ref appletPopLaunchParameter with ::AppletLaunchParameterKind_UserChannel.
1463  * @param[in] attr Kiosk application attributes.
1464  */
1466 
1467 /**
1468  * @brief Gets the DesiredLanguage for the current host application control.nacp.
1469  * @note Only available with AppletType_*Application.
1470  * @param[out] LanguageCode Output LanguageCode, see set.h.
1471  */
1473 
1474 /**
1475  * @brief Gets the DisplayVersion for the current host application control.nacp.
1476  * @note Only available with AppletType_*Application.
1477  * @param[out] displayVersion Output DisplayVersion string, must be at least 0x10-bytes. This is always NUL-terminated.
1478  */
1479 Result appletGetDisplayVersion(char *displayVersion);
1480 
1481 /**
1482  * @brief Blocks the usage of the home button, for short (Home Menu) and long (Overlay) presses.
1483  * @note Only available with AppletType_*Application.
1484  * @param val Unknown. Official sw only uses hard-coded value 0 for this.
1485  */
1487 
1488 /**
1489  * @brief Ends the blocking started by \ref appletBeginBlockingHomeButtonShortAndLongPressed.
1490  * @note Only available with AppletType_*Application.
1491  */
1493 
1494 /**
1495  * @brief Blocks the usage of the home button, for short presses (Home Menu).
1496  * @note Only available with AppletType_*Application.
1497  * @param val Unknown nanoseconds. Value 0 can be used.
1498  */
1500 
1501 /**
1502  * @brief Ends the blocking started by \ref appletBeginBlockingHomeButton.
1503  * @note Only available with AppletType_*Application.
1504  */
1506 
1507 /**
1508  * @brief Notify that the app is now running, for the Application logo screen. This throws a fatal-error on failure.
1509  * @note This will just return when applet-type isn't AppletType_Application, or when this was already used previously. Used automatically by \ref appletInitialize when __nx_applet_auto_notifyrunning is set to true (the default value).
1510  */
1511 void appletNotifyRunning(bool *out);
1512 
1513 /**
1514  * @brief Gets the PseudoDeviceId. This is derived from the output of a ns command, and from data in the host application control.nacp.
1515  * @note Only available with AppletType_*Application on [2.0.0+].
1516  * @param[out] out Output PseudoDeviceId.
1517  */
1519 
1520 /// Set media playback state.
1521 /// If state is set to true, screen dimming and auto sleep is disabled.
1522 /// For *Application, this uses cmd SetMediaPlaybackStateForApplication, otherwise cmd SetMediaPlaybackState is used.
1524 
1525 /// Gets whether video recording is supported.
1526 /// See also \ref appletInitializeGamePlayRecording.
1528 
1529 /// Disable/enable video recording. Only available after \ref appletInitializeGamePlayRecording was used.
1530 /// See also \ref appletInitializeGamePlayRecording.
1532 
1533 /// Initializes video recording. This allocates a 0x6000000-byte buffer for the TransferMemory, cleanup is handled automatically during app exit in \ref appletExit.
1534 /// Only available with AppletType_Application on [3.0.0+], hence errors from this can be ignored.
1535 /// Video recording is only fully available system-side with [4.0.0+].
1536 /// Only usable when running under an application which supports video recording. Using this is only needed when the host application control.nacp has VideoCaptureMode set to Enabled, with Automatic appletInitializeGamePlayRecording is not needed.
1538 
1539 /**
1540  * @brief Requests to save the video recording, as if the Capture-button was held.
1541  * @note Only available with AppletType_*Application on [4.0.0+].
1542  */
1544 
1545 /**
1546  * @brief Requests a system shutdown. This will enter an infinite-sleep-loop on success.
1547  * @note Only available with AppletType_*Application on [3.0.0+].
1548  */
1550 
1551 /**
1552  * @brief Requests a system reboot. This will enter an infinite-sleep-loop on success.
1553  * @note Only available with AppletType_*Application on [3.0.0+].
1554  */
1556 
1557 /**
1558  * @brief RequestToSleep
1559  * @note Only available with AppletType_*Application on [10.0.0+].
1560  */
1562 
1563 /**
1564  * @brief Exit the application and return to the kiosk demo menu. This terminates the current process. This will enter an infinite-sleep-loop on success.
1565  * @note Only available with AppletType_*Application on [4.0.0+], on kiosk systems (QuestFlag set).
1566  */
1568 
1569 /**
1570  * @brief Initializes the ApplicationCopyrightFrameBuffer, with dimensions 1280x720 + the tmem for it. This is used as an overlay for screenshots.
1571  * @note Only available with AppletType_*Application on [5.0.0+].
1572  * @note Cleanup for this is handled automatically during app exit in \ref appletExit.
1573  */
1575 
1576 /**
1577  * @brief Sets the RGBA8 image for use with \ref appletInitializeApplicationCopyrightFrameBuffer. Overrides the current image, if this was already used previously.
1578  * @note Only available with AppletType_*Application on [5.0.0+].
1579  * @note The specified coordinates and width/height must be within the bounds of the framebuffer setup by \ref appletInitializeApplicationCopyrightFrameBuffer.
1580  * @param[in] buffer Input image buffer.
1581  * @param[in] size Input image buffer size.
1582  * @param[in] x X coordinate. Must not be negative.
1583  * @param[in] y Y coordinate. Must not be negative.
1584  * @param[in] width Image width. Must be >=1.
1585  * @param[in] height Image height. Must be >=1.
1586  * @param[in] mode \ref AppletWindowOriginMode
1587  */
1588 Result appletSetApplicationCopyrightImage(const void* buffer, size_t size, s32 x, s32 y, s32 width, s32 height, AppletWindowOriginMode mode);
1589 
1590 /**
1591  * @brief Sets the visibility for the image set by \ref appletSetApplicationCopyrightImage, in screenshots.
1592  * @note Only available with AppletType_*Application on [5.0.0+].
1593  * @param[in] visible Whether the image is visible. The default is true.
1594  */
1596 
1597 /**
1598  * @brief Gets ApplicationPlayStatistics.
1599  * @note Only available with AppletType_*Application on [5.0.0+].
1600  * @note The input ApplicationIds must be allowed via control.nacp with the current host application. The minimum allowed ApplicationId is the ApplicationId for the current application.
1601  * @param stats Output \ref PdmApplicationPlayStatistics array.
1602  * @param application_ids Input ApplicationIds array.
1603  * @param count Total entries in the input/output arrays.
1604  * @param total_out Total output entries.
1605  */
1606 Result appletQueryApplicationPlayStatistics(PdmApplicationPlayStatistics *stats, const u64 *application_ids, s32 count, s32 *total_out);
1607 
1608 /**
1609  * @brief Same as \ref appletQueryApplicationPlayStatistics except this gets playstats specific to the input userId.
1610  * @note Only available with AppletType_*Application on [6.0.0+].
1611  * @param[in] uid \ref AccountUid
1612  * @param[out] stats Output \ref PdmApplicationPlayStatistics array.
1613  * @param[in] application_ids Input ApplicationIds array.
1614  * @param[in] count Total entries in the input/output arrays.
1615  * @param[out] total_out Total output entries.
1616  */
1618 
1619 /**
1620  * @brief Launches Application {current_ApplicationId}+programIndex. This will enter an infinite-sleep-loop on success.
1621  * @note Only available with AppletType_*Application on [5.0.0+].
1622  * @note Creates the storage if needed. Uses cmd ClearUserChannel. Uses cmd UnpopToUserChannel when the storage was created. Lastly cmd ExecuteProgramCmd is used.
1623  * @param[in] programIndex ProgramIndex, must be 0x0-0xFF. 0 is the same as the current application. ProgramIndex values where the application is not installed should not be used.
1624  * @param[in] buffer Optional buffer containing the storage data which will be used for ::AppletLaunchParameterKind_UserChannel with the launched Application, can be NULL.
1625  * @param[in] size Size of the above buffer, 0 to not use the storage. Must be <=0x1000.
1626  */
1627 Result appletExecuteProgram(s32 programIndex, const void* buffer, size_t size);
1628 
1629 /**
1630  * @brief Launches the specified ApplicationId.
1631  * @note Only available with AppletType_*Application on [5.0.0+], with DebugMode enabled.
1632  * @note Creates the storage if needed. Uses cmd ClearUserChannel. Uses cmd UnpopToUserChannel when the storage was created. Lastly cmd ExecuteProgramCmd is used.
1633  * @param[in] application_id ApplicationId.
1634  * @param[in] buffer Optional buffer containing the storage data which will be used for ::AppletLaunchParameterKind_UserChannel with the launched Application, can be NULL.
1635  * @param[in] size Size of the above buffer, 0 to not use the storage. Must be <=0x1000.
1636  */
1637 Result appletJumpToSubApplicationProgramForDevelopment(u64 application_id, const void* buffer, size_t size);
1638 
1639 /**
1640  * @brief Relaunches the current Application.
1641  * @note Only available with AppletType_*Application on [5.0.0+].
1642  * @note Creates the storage if needed. Uses cmd ClearUserChannel. Uses cmd UnpopToUserChannel when the storage was created. Lastly cmd ExecuteProgramCmd is used.
1643  * @param[in] buffer Optional buffer containing the storage data which will be used for ::AppletLaunchParameterKind_UserChannel with the launched Application, can be NULL.
1644  * @param[in] size Size of the above buffer, 0 to not use the storage. Must be <=0x1000.
1645  */
1646 Result appletRestartProgram(const void* buffer, size_t size);
1647 
1648 /**
1649  * @brief Gets the ProgramIndex of the program which launched this program.
1650  * @note Only available with AppletType_*Application on [5.0.0+].
1651  * @param[out] programIndex ProgramIndex, -1 when there was no previous program.
1652  */
1654 
1655 /**
1656  * @brief SetDelayTimeToAbortOnGpuError
1657  * @note Only available with AppletType_*Application on [11.0.0+].
1658  * @param[in] val Input nanoseconds value.
1659  */
1661 
1662 /**
1663  * @brief Gets an Event which is signaled when a new storage is available with \ref appletTryPopFromFriendInvitationStorageChannel where previously no storage was available, this event is automatically cleared by the system once the last storage is popped.
1664  * @note This is used by \ref friendsGetFriendInvitationNotificationEvent.
1665  * @note Only available with AppletType_*Application on [9.0.0+].
1666  * @note The Event must be closed by the user once finished with it.
1667  * @param[out] out_event Output Event with autoclear=false.
1668  */
1670 
1671 /**
1672  * @brief Pops a storage from the FriendInvitation StorageChannel.
1673  * @note This is used by \ref friendsTryPopFriendInvitationNotificationInfo.
1674  * @note Only available with AppletType_*Application on [9.0.0+].
1675  * @param[out] s Storage object.
1676  */
1678 
1679 /**
1680  * @brief Gets an Event which is signaled when a new storage is available with \ref appletTryPopFromNotificationStorageChannel where previously no storage was available, this event is automatically cleared by the system once the last storage is popped.
1681  * @note This is used by \ref notifGetNotificationSystemEvent.
1682  * @note Only available with AppletType_*Application on [9.0.0+].
1683  * @note The Event must be closed by the user once finished with it.
1684  * @param[out] out_event Output Event with autoclear=false.
1685  */
1687 
1688 /**
1689  * @brief Pops a storage from the Notification StorageChannel.
1690  * @note This is used by \ref notifTryPopNotifiedApplicationParameter.
1691  * @note Only available with AppletType_*Application on [9.0.0+].
1692  * @param[out] s Storage object.
1693  */
1695 
1696 /**
1697  * @brief GetHealthWarningDisappearedSystemEvent
1698  * @note Only available with AppletType_*Application on [9.0.0+].
1699  * @note The Event must be closed by the user once finished with it.
1700  * @param[out] out_event Output Event with autoclear=false.
1701  */
1703 
1704 /**
1705  * @brief SetHdcpAuthenticationActivated
1706  * @note Only available with AppletType_*Application on [9.0.0+].
1707  * @param[in] flag Whether HdcpAuthentication is activated.
1708  */
1710 
1711 /**
1712  * @brief GetLastApplicationExitReason
1713  * @note Only available with AppletType_*Application on [11.0.0+].
1714  * @param[out] out Output value.
1715  */
1717 
1718 /**
1719  * @brief CreateMovieMaker. Do not use this directly, use \ref grcCreateMovieMaker instead.
1720  * @note Only available with AppletType_*Application on [5.0.0+].
1721  * @param[out] srv_out Output Service for applet IMovieMaker.
1722  * @param[in] tmem TransferMemory
1723  */
1725 
1726 /**
1727  * @brief Launches the jit-sysmodule when it was not previously launched by this cmd. Returns 0 when it was previously launched.
1728  * @note Only available with AppletType_*Application on [5.0.0+].
1729  * @note Requires the jit-sysmodule to actually be installed.
1730  */
1732 
1733 ///@}
1734 
1735 ///@name IHomeMenuFunctions: IFunctions for AppletType_SystemApplet and on [15.0.0+] for AppletType_LibraryApplet.
1736 ///@{
1737 
1738 /**
1739  * @brief RequestToGetForeground
1740  * @note Only available with AppletType_SystemApplet, or on [15.0.0+] with AppletType_LibraryApplet.
1741  */
1743 
1744 /**
1745  * @brief LockForeground
1746  * @note Only available with AppletType_SystemApplet, or on [15.0.0+] with AppletType_LibraryApplet.
1747  */
1749 
1750 /**
1751  * @brief UnlockForeground
1752  * @note Only available with AppletType_SystemApplet, or on [15.0.0+] with AppletType_LibraryApplet.
1753  */
1755 
1756 /**
1757  * @brief Pops a storage from the general channel.
1758  * @note Only available with AppletType_SystemApplet, or on [15.0.0+] with AppletType_LibraryApplet.
1759  * @param[out] s Storage object.
1760  */
1762 
1763 /**
1764  * @brief Gets an Event which is signaled when a new storage is available with \ref appletPopFromGeneralChannel where previously no storage was available, this event is automatically cleared by the system once the last storage is popped.
1765  * @note Only available with AppletType_SystemApplet, or on [15.0.0+] with AppletType_LibraryApplet.
1766  * @note The Event must be closed by the user once finished with it.
1767  * @param[out] out_event Output Event with autoclear=false.
1768  */
1770 
1771 /**
1772  * @brief Gets a \ref AppletLockAccessor for HomeButtonWriter.
1773  * @note Only available with AppletType_SystemApplet, or on [15.0.0+] with AppletType_LibraryApplet.
1774  * @note Similar to using \ref appletGetWriterLockAccessorEx with inval=0.
1775  * @param a LockAccessor object.
1776  */
1778 
1779 /**
1780  * @brief IsSleepEnabled
1781  * @note Only available with AppletType_SystemApplet on [11.0.0+], or on [15.0.0+] with AppletType_LibraryApplet.
1782  * @param[out] out Output flag.
1783  */
1785 
1786 /**
1787  * @brief PopRequestLaunchApplicationForDebug
1788  * @note Only available with AppletType_SystemApplet on [6.0.0+], or on [15.0.0+] with AppletType_LibraryApplet.
1789  * @param[out] uids Output array of \ref AccountUid.
1790  * @param[in] count Size of the uids array in entries, must be at least the size stored in state.
1791  * @param[out] application_id Output ApplicationId.
1792  * @param[out] total_out Total output userID entries.
1793  */
1794 Result appletPopRequestLaunchApplicationForDebug(AccountUid *uids, s32 count, u64 *application_id, s32 *total_out);
1795 
1796 /**
1797  * @brief IsForceTerminateApplicationDisabledForDebug
1798  * @note Only available with AppletType_SystemApplet on [9.0.0+], or on [15.0.0+] with AppletType_LibraryApplet.
1799  * @param[out] out Output flag. 0 when DebugMode is not enabled, otherwise this is loaded from a system-setting.
1800  */
1802 
1803 /**
1804  * @brief Launches DevMenu and the dev Overlay-applet. This will enter an infinite-sleep-loop on success.
1805  * @note Only available with AppletType_SystemApplet on [8.0.0+], or on [15.0.0+] with AppletType_LibraryApplet.
1806  * @note This verifies that DebugMode is enabled, then uses a ns cmd. That cmd then loads the system-settings for these two ProgramIds (which normally only exist on devunits), and verifies that these programs are installed + launches them.
1807  */
1809 
1810 /**
1811  * @brief SetLastApplicationExitReason
1812  * @note Only available with AppletType_SystemApplet on [11.0.0+], or on [15.0.0+] with AppletType_LibraryApplet.
1813  * @param[in] reason Reason
1814  */
1816 
1817 ///@}
1818 
1819 ///@name IGlobalStateController
1820 ///@{
1821 
1822 /**
1823  * @brief Start the sequence for entering sleep-mode.
1824  * @note Only available with AppletType_SystemApplet, or on [15.0.0+] with AppletType_LibraryApplet/AppletType_OverlayApplet.
1825  * @param[in] flag Flag, official sw uses hard-coded value = true.
1826  */
1828 
1829 /**
1830  * @brief Start the system-shutdown sequence.
1831  * @note Only available with AppletType_SystemApplet, or on [15.0.0+] with AppletType_LibraryApplet/AppletType_OverlayApplet.
1832  */
1834 
1835 /**
1836  * @brief Start the system-reboot sequence.
1837  * @note Only available with AppletType_SystemApplet, or on [15.0.0+] with AppletType_LibraryApplet/AppletType_OverlayApplet.
1838  */
1840 
1841 /**
1842  * @brief IsAutoPowerDownRequested. Uses an idle:sys cmd internally.
1843  * @note Only available with AppletType_SystemApplet on [7.0.0+], or on [15.0.0+] with AppletType_LibraryApplet/AppletType_OverlayApplet.
1844  * @param[out] out Output flag.
1845  */
1847 
1848 /**
1849  * @brief LoadAndApplyIdlePolicySettings. Uses an idle:sys cmd internally.
1850  * @note Only available with AppletType_SystemApplet, or on [15.0.0+] with AppletType_LibraryApplet/AppletType_OverlayApplet.
1851  */
1853 
1854 /**
1855  * @brief NotifyCecSettingsChanged. Uses an omm cmd internally.
1856  * @note Only available with AppletType_SystemApplet on [2.0.0+], or on [15.0.0+] with AppletType_LibraryApplet/AppletType_OverlayApplet.
1857  */
1859 
1860 /**
1861  * @brief Sets the DefaultHomeButtonLongPressTime.
1862  * @note Only available with AppletType_SystemApplet on [3.0.0+], or on [15.0.0+] with AppletType_LibraryApplet/AppletType_OverlayApplet.
1863  * @param[in] val Input value.
1864  */
1866 
1867 /**
1868  * @brief UpdateDefaultDisplayResolution. Uses an omm cmd internally.
1869  * @note Only available with AppletType_SystemApplet on [3.0.0+], or on [15.0.0+] with AppletType_LibraryApplet/AppletType_OverlayApplet.
1870  */
1872 
1873 /**
1874  * @brief ShouldSleepOnBoot. Uses an omm cmd internally.
1875  * @note Only available with AppletType_SystemApplet on [3.0.0+], or on [15.0.0+] with AppletType_LibraryApplet/AppletType_OverlayApplet.
1876  * @param[out] out Output flag.
1877  */
1879 
1880 /**
1881  * @brief Gets an Event which is signaled for HdcpAuthenticationFailed.
1882  * @note Only available with AppletType_SystemApplet on [4.0.0+], or on [15.0.0+] with AppletType_LibraryApplet/AppletType_OverlayApplet.
1883  * @note The Event must be closed by the user once finished with it.
1884  * @param[out] out_event Output Event with autoclear=false.
1885  */
1887 
1888 ///@}
1889 
1890 ///@name IApplicationCreator
1891 ///@{
1892 
1893 /**
1894  * @brief Creates an Application.
1895  * @note Only available with AppletType_SystemApplet.
1896  * @param[out] a \ref AppletApplication
1897  * @param[in] application_id ApplicationId.
1898  */
1900 
1901 /**
1902  * @brief Pops a \ref AppletApplication for a requested Application launch.
1903  * @note Only available with AppletType_SystemApplet.
1904  * @param[out] a \ref AppletApplication
1905  */
1907 
1908 /**
1909  * @brief Creates a SystemApplication.
1910  * @note Only available with AppletType_SystemApplet.
1911  * @param[out] a \ref AppletApplication
1912  * @param[in] system_application_id SystemApplicationId.
1913  */
1915 
1916 /**
1917  * @brief PopFloatingApplicationForDevelopment.
1918  * @note Only available with AppletType_SystemApplet. Should not be used if no FloatingApplication is available.
1919  * @param[out] a \ref AppletApplication
1920  */
1922 
1923 ///@}
1924 
1925 ///@name IApplicationAccessor
1926 ///@{
1927 
1928 /**
1929  * @brief Close an \ref AppletApplication.
1930  * @param a \ref AppletApplication
1931  */
1933 
1934 /**
1935  * @brief Returns whether the AppletApplication object was initialized.
1936  * @param a \ref AppletApplication
1937  */
1939 
1940 /**
1941  * @brief Starts the Application.
1942  * @param a \ref AppletApplication
1943  */
1945 
1946 /**
1947  * @brief Requests the Application to exit.
1948  * @param a \ref AppletApplication
1949  */
1951 
1952 /**
1953  * @brief Terminate the Application.
1954  * @param a \ref AppletApplication
1955  */
1957 
1958 /**
1959  * @brief Waits for the Application to exit.
1960  * @param a \ref AppletApplication
1961  */
1963 
1964 /**
1965  * @brief Waits on the Application StateChangedEvent with timeout=0, and returns whether it was successful.
1966  * @param a \ref AppletApplication
1967  */
1969 
1970 /**
1971  * @brief Gets the \ref AppletApplicationExitReason set by \ref appletApplicationJoin.
1972  * @param a \ref AppletApplication
1973  */
1975 
1976 /**
1977  * @brief RequestForApplicationToGetForeground.
1978  * @param a \ref AppletApplication
1979  */
1981 
1982 /**
1983  * @brief TerminateAllLibraryApplets which were created by the Application.
1984  */
1986 
1987 /**
1988  * @brief AreAnyLibraryAppletsLeft which were created by the Application.
1989  * @param a \ref AppletApplication
1990  * @param[out] out Output flag.
1991  */
1993 
1994 /**
1995  * @brief Calls the same func as \ref appletHolderRequestExitOrTerminate with the output IAppletAccessor from the GetCurrentLibraryApplet cmd.
1996  * @param a \ref AppletApplication
1997  * @param[in] timeout Timeout in nanoseconds. UINT64_MAX for no timeout.
1998  */
2000 
2001 /**
2002  * @brief Gets the ApplicationId for the Application.
2003  * @param a \ref AppletApplication
2004  * @param[out] application_id Output ApplicationId.
2005  */
2007 
2008 /**
2009  * @brief Pushes a LaunchParameter AppletStorage to the Application.
2010  * @note This uses \ref appletStorageClose automatically.
2011  * @param a \ref AppletApplication
2012  * @param[in] kind \ref AppletLaunchParameterKind
2013  * @param[in] s Input storage.
2014  */
2016 
2017 /**
2018  * @brief Gets the \ref NacpStruct for the Application.
2019  * @note Not usable when the \ref AppletApplication is for an AppletType_SystemApplication.
2020  * @param a \ref AppletApplication
2021  * @param[out] nacp \ref NacpStruct
2022  */
2024 
2025 /**
2026  * @brief Gets the \ref AppletApplicationLaunchProperty for the Application.
2027  * @note Only available on [2.0.0+]. Not usable when the \ref AppletApplication is for an AppletType_SystemApplication.
2028  * @param a \ref AppletApplication
2029  * @param[out] out \ref AppletApplicationLaunchProperty
2030  */
2032 
2033 /**
2034  * @brief Gets the \ref AppletApplicationLaunchRequestInfo for the Application.
2035  * @note Only available on [6.0.0+].
2036  * @param a \ref AppletApplication
2037  * @param[out] out \ref AppletApplicationLaunchRequestInfo
2038  */
2040 
2041 /**
2042  * @brief SetUsers for the Application.
2043  * @note Only available on [6.0.0+].
2044  * @param a \ref AppletApplication
2045  * @param[in] uids Input array of \ref AccountUid.
2046  * @param[in] count Size of the uids array in entries, must be <=ACC_USER_LIST_SIZE.
2047  * @param[in] flag When this flag is true, this just clears the users_available state flag to 0 and returns.
2048  */
2050 
2051 /**
2052  * @brief CheckRightsEnvironmentAvailable.
2053  * @note Only available on [6.0.0+].
2054  * @param a \ref AppletApplication
2055  * @param[out] out Output flag.
2056  */
2058 
2059 /**
2060  * @brief GetNsRightsEnvironmentHandle.
2061  * @note Only available on [6.0.0+].
2062  * @param a \ref AppletApplication
2063  * @param[out] handle Output NsRightsEnvironmentHandle.
2064  */
2066 
2067 /**
2068  * @brief Gets an array of userIds for the Application DesirableUids.
2069  * @note Only available on [6.0.0+].
2070  * @note qlaunch only uses 1 userId with this.
2071  * @param a \ref AppletApplication
2072  * @param[out] uids Output array of \ref AccountUid.
2073  * @param[in] count Size of the uids array in entries, must be at least the size stored in state.
2074  * @param[out] total_out Total output entries.
2075  */
2077 
2078 /**
2079  * @brief ReportApplicationExitTimeout.
2080  * @note Only available on [6.0.0+].
2081  * @param a \ref AppletApplication
2082  */
2084 
2085 /**
2086  * @brief Sets the \ref AppletApplicationAttribute for the Application.
2087  * @note Only available on [8.0.0+].
2088  * @param a \ref AppletApplication
2089  * @param[in] attr \ref AppletApplicationAttribute
2090  */
2092 
2093 /**
2094  * @brief Gets whether the savedata specified by the input ApplicationId is accessible.
2095  * @note Only available on [8.0.0+].
2096  * @param a \ref AppletApplication
2097  * @param[in] application_id ApplicationId for the savedata.
2098  * @param[out] out Output flag.
2099  */
2101 
2102 /**
2103  * @brief Creates a storage using the specified input then pushes it to the FriendInvitation StorageChannel.
2104  * @note The system will clear the StorageChannel before pushing the storage.
2105  * @note Only available on [9.0.0+].
2106  * @param a \ref AppletApplication
2107  * @param[in] uid \ref AccountUid
2108  * @param[in] buffer Input buffer.
2109  * @param[in] size Input buffer size.
2110  */
2112 
2113 /**
2114  * @brief Creates a storage using the specified input then pushes it to the Notification StorageChannel.
2115  * @note The system will clear the StorageChannel before pushing the storage.
2116  * @note Only available on [9.0.0+].
2117  * @param a \ref AppletApplication
2118  * @param[in] buffer Input buffer.
2119  * @param[in] size Input buffer size.
2120  */
2122 
2123 /**
2124  * @brief RequestApplicationSoftReset
2125  * @note Only available on [10.0.0+].
2126  * @param a \ref AppletApplication
2127  */
2129 
2130 /**
2131  * @brief RestartApplicationTimer
2132  * @note Only available on [10.0.0+].
2133  * @param a \ref AppletApplication
2134  */
2136 
2137 ///@}
2138 
2139 ///@name ILibraryAppletSelfAccessor
2140 ///@{
2141 
2142 /**
2143  * @brief Pops a storage from current-LibraryApplet input.
2144  * @note Only available with AppletType_LibraryApplet.
2145  * @param[out] s Storage object.
2146  */
2148 
2149 /**
2150  * @brief Pushes a storage for current-LibraryApplet output.
2151  * @note Only available with AppletType_LibraryApplet.
2152  * @note This uses \ref appletStorageClose automatically.
2153  * @param[in] s Storage object.
2154  */
2156 
2157 /**
2158  * @brief Pops a storage from current-LibraryApplet Interactive input.
2159  * @note Only available with AppletType_LibraryApplet.
2160  * @param[out] s Storage object.
2161  */
2163 
2164 /**
2165  * @brief Pushes a storage for current-LibraryApplet Interactive output.
2166  * @note Only available with AppletType_LibraryApplet.
2167  * @note This uses \ref appletStorageClose automatically.
2168  * @param[in] s Storage object.
2169  */
2171 
2172 /**
2173  * @brief Gets an Event which is signaled when a new storage is available with \ref appletPopInData where previously no storage was available, this event is automatically cleared by the system once the last storage is popped.
2174  * @note Only available with AppletType_LibraryApplet.
2175  * @note The Event must be closed by the user once finished with it.
2176  * @param[out] out_event Output Event with autoclear=false.
2177  */
2179 
2180 /**
2181  * @brief Gets an Event which is signaled when a new storage is available with \ref appletPopInteractiveInData where previously no storage was available, this event is automatically cleared by the system once the last storage is popped.
2182  * @note Only available with AppletType_LibraryApplet.
2183  * @note The Event must be closed by the user once finished with it.
2184  * @param[out] out_event Output Event with autoclear=false.
2185  */
2187 
2188 /**
2189  * @brief Gets the \ref LibAppletInfo for the current LibraryApplet.
2190  * @note Only available with AppletType_LibraryApplet.
2191  * @param[out] info \ref LibAppletInfo
2192  */
2194 
2195 /**
2196  * @brief Gets the \ref AppletIdentityInfo for the MainApplet.
2197  * @note Only available with AppletType_LibraryApplet.
2198  * @param[out] info \ref AppletIdentityInfo
2199  */
2201 
2202 /**
2203  * @brief CanUseApplicationCore
2204  * @note Only available with AppletType_LibraryApplet.
2205  * @param[out] out Output flag.
2206  */
2208 
2209 /**
2210  * @brief Gets the \ref AppletIdentityInfo for the CallerApplet.
2211  * @note Only available with AppletType_LibraryApplet.
2212  * @param[out] info \ref AppletIdentityInfo
2213  */
2215 
2216 /**
2217  * @brief Gets the \ref NacpStruct for the MainApplet.
2218  * @note Only available with AppletType_LibraryApplet on [2.0.0+].
2219  * @param[out] nacp \ref NacpStruct
2220  */
2222 
2223 /**
2224  * @brief Gets the NcmStorageId for the MainApplet.
2225  * @note Only available with AppletType_LibraryApplet on [2.0.0+].
2226  * @param[out] storageId \ref NcmStorageId
2227  */
2229 
2230 /**
2231  * @brief Gets an array of \ref AppletIdentityInfo for the CallerStack.
2232  * @note Only available with AppletType_LibraryApplet on [3.0.0+].
2233  * @param[out] stack Output array of \ref AppletIdentityInfo.
2234  * @param[in] count Size of the stack array.
2235  * @param[out] total_out Total output entries.
2236  */
2238 
2239 /**
2240  * @brief Gets the \ref AppletIdentityInfo for the NextReturnDestinationApplet.
2241  * @note Only available with AppletType_LibraryApplet on [4.0.0+].
2242  * @param[out] info \ref AppletIdentityInfo
2243  */
2245 
2246 /**
2247  * @brief Gets the DesirableKeyboardLayout previously set by \ref appletSetDesirableKeyboardLayout. An error is returned when it's not set.
2248  * @note Only available with AppletType_LibraryApplet on [4.0.0+].
2249  * @param[out] layout Output \ref SetKeyboardLayout.
2250  */
2252 
2253 /**
2254  * @brief Pops a storage from current-LibraryApplet Extra input.
2255  * @note Only available with AppletType_LibraryApplet.
2256  * @param[out] s Storage object.
2257  */
2259 
2260 /**
2261  * @brief Gets an Event which is signaled when a new storage is available with \ref appletPopExtraStorage where previously no storage was available, this event is automatically cleared by the system once the last storage is popped.
2262  * @note Only available with AppletType_LibraryApplet.
2263  * @note The Event must be closed by the user once finished with it.
2264  * @param[out] out_event Output Event with autoclear=false.
2265  */
2267 
2268 /**
2269  * @brief Unpop a storage for current-LibraryApplet input.
2270  * @note Only available with AppletType_LibraryApplet.
2271  * @note This uses \ref appletStorageClose automatically.
2272  * @param[in] s Storage object.
2273  */
2275 
2276 /**
2277  * @brief Unpop a storage for current-LibraryApplet Extra input.
2278  * @note Only available with AppletType_LibraryApplet.
2279  * @note This uses \ref appletStorageClose automatically.
2280  * @param[in] s Storage object.
2281  */
2283 
2284 /**
2285  * @brief Gets the IndirectLayerProducerHandle.
2286  * @note Only available with AppletType_LibraryApplet on [2.0.0+].
2287  * @param[out] out Output IndirectLayerProducerHandle.
2288  */
2290 
2291 /**
2292  * @brief Gets the DesiredLanguage for the MainApplet.
2293  * @note Only available with AppletType_LibraryApplet on [4.0.0+].
2294  * @param[out] LanguageCode Output LanguageCode, see set.h.
2295  */
2297 
2298 /**
2299  * @brief Gets the ApplicationId for the currently running Application.
2300  * @note Only available with AppletType_LibraryApplet on [8.0.0+].
2301  * @param[out] application_id Output ApplicationId, 0 when no Application is running.
2302  */
2304 
2305 /**
2306  * @brief Exits the current applet. Same as \ref appletHolderRequestExit except this is for the current applet.
2307  * @note Only available with AppletType_LibraryApplet on [6.0.0+].
2308  */
2310 
2311 /**
2312  * @brief CreateGameMovieTrimmer. Do not use this directly, use \ref grcTrimGameMovie instead.
2313  * @note Only available with AppletType_LibraryApplet on [4.0.0+].
2314  * @note See also \ref appletReserveResourceForMovieOperation and \ref appletUnreserveResourceForMovieOperation.
2315  * @param[out] srv_out Output Service for grc IGameMovieTrimmer.
2316  * @param[in] tmem TransferMemory
2317  */
2319 
2320 /**
2321  * @brief ReserveResourceForMovieOperation. Must be used at some point prior to \ref appletCreateGameMovieTrimmer.
2322  * @note Only available with AppletType_LibraryApplet on [5.0.0+].
2323  */
2325 
2326 /**
2327  * @brief UnreserveResourceForMovieOperation. Must be used at some point after all finished with GameMovieTrimmer usage (\ref appletCreateGameMovieTrimmer).
2328  * @note Only available with AppletType_LibraryApplet on [5.0.0+].
2329  */
2331 
2332 /**
2333  * @brief Gets an array of userIds for the MainApplet AvailableUsers.
2334  * @note Only available with AppletType_LibraryApplet on [6.0.0+].
2335  * @param[out] uids Output array of \ref AccountUid.
2336  * @param[in] count Size of the uids array in entries, must be at least ACC_USER_LIST_SIZE.
2337  * @param[out] flag When true, this indicates that no users are available.
2338  * @param[out] total_out Total output entries. This is -1 when flag is true.
2339  */
2340 Result appletGetMainAppletAvailableUsers(AccountUid *uids, s32 count, bool *flag, s32 *total_out);
2341 
2342 /**
2343  * @brief SetApplicationMemoryReservation
2344  * @note Only available with AppletType_LibraryApplet on [10.0.0+].
2345  * @note An Application must be currently running.
2346  * @param[in] val Input value.
2347  */
2349 
2350 /**
2351  * @brief ShouldSetGpuTimeSliceManually
2352  * @note Only available with AppletType_LibraryApplet on [10.0.0+].
2353  * @param[out] out Output flag.
2354  */
2356 
2357 ///@}
2358 
2359 ///@name IOverlayFunctions: IFunctions for AppletType_OverlayApplet.
2360 ///@{
2361 
2362 /**
2363  * @brief Stops forwarding the input to the foreground app.
2364  * @note Only available with AppletType_OverlayApplet.
2365  * @note You have to call this to receive inputs through the hid service when running as the overlay applet.
2366  */
2368 
2369 /**
2370  * @brief Forwards input to the foreground app.
2371  * @note Only available with AppletType_OverlayApplet.
2372  * @note After calling this the overlay applet won't receive any input until \ref appletBeginToWatchShortHomeButtonMessage is called again.
2373  */
2375 
2376 /**
2377  * @brief Gets the ApplicationId for displaying the logo screen during application launch.
2378  * @note Only available with AppletType_OverlayApplet.
2379  * @param[out] application_id Output ApplicationId, 0 when no application is running.
2380  */
2382 
2383 /**
2384  * @brief Sets the GpuTimeSliceBoost.
2385  * @note Only available with AppletType_OverlayApplet.
2386  * @param[in] val Input value.
2387  */
2389 
2390 /**
2391  * @brief Sets AutoSleepTimeAndDimmingTimeEnabled.
2392  * @note Only available with AppletType_OverlayApplet on [2.0.0+].
2393  * @param[in] flag Flag
2394  */
2396 
2397 /**
2398  * @brief TerminateApplicationAndSetReason
2399  * @note Only available with AppletType_OverlayApplet on [2.0.0+].
2400  * @param[in] reason Result reason.
2401  */
2403 
2404 /**
2405  * @brief Sets ScreenShotPermissionGlobally.
2406  * @note Only available with AppletType_OverlayApplet on [3.0.0+].
2407  * @param[in] flag Flag
2408  */
2410 
2411 /**
2412  * @brief Start the system-shutdown sequence. This will enter an infinite-sleep-loop on success.
2413  * @note Only available with AppletType_OverlayApplet on [6.0.0+].
2414  */
2416 
2417 /**
2418  * @brief Start the system-reboot sequence. This will enter an infinite-sleep-loop on success.
2419  * @note Only available with AppletType_OverlayApplet on [6.0.0+].
2420  */
2422 
2423 /**
2424  * @brief SetHealthWarningShowingState
2425  * @note Only available with AppletType_OverlayApplet on [9.0.0+].
2426  * @param[in] flag Flag
2427  */
2429 
2430 /**
2431  * @brief IsHealthWarningRequired
2432  * @note Only available with AppletType_OverlayApplet on [10.0.0+].
2433  * @param[out] out Output flag.
2434  */
2436 
2437 /**
2438  * @brief Enables HID input for the OverlayApplet, without disabling input for the foreground applet. Generally \ref appletBeginToWatchShortHomeButtonMessage / appletEndToWatchShortHomeButtonMessage should be used instead.
2439  * @note Only available with AppletType_OverlayApplet on [5.0.0+].
2440  */
2442 
2443 ///@}
2444 
2445 ///@name IAppletCommonFunctions
2446 ///@{
2447 
2448 /**
2449  * @brief Reads the ThemeStorage for the current applet.
2450  * @note Only available with AppletType_SystemApplet, AppletType_LibraryApplet, or AppletType_OverlayApplet, on [7.0.0+].
2451  * @note offset(+size) must be <=0x400.
2452  * @param[out] buffer Output buffer data.
2453  * @param[in] size Size to read.
2454  * @param[in] offset Offset within the ThemeStorage.
2455  * @param[out] transfer_size Actual read size.
2456  */
2457 Result appletReadThemeStorage(void* buffer, size_t size, u64 offset, u64 *transfer_size);
2458 
2459 /**
2460  * @brief Writes the ThemeStorage for the current applet.
2461  * @note Only available with AppletType_SystemApplet, AppletType_LibraryApplet, or AppletType_OverlayApplet, on [7.0.0+].
2462  * @note offset(+size) must be <=0x400.
2463  * @param[in] buffer Input buffer data.
2464  * @param[in] size Size to write.
2465  * @param[in] offset Offset within the ThemeStorage.
2466  */
2467 Result appletWriteThemeStorage(const void* buffer, size_t size, u64 offset);
2468 
2469 /**
2470  * @brief This is similar to \ref appletPushToAppletBoundChannelForDebug (no DebugMode check), except the used channel is loaded from elsewhere and must be in the range 31-32.
2471  * @note Only available with AppletType_SystemApplet, AppletType_LibraryApplet, or AppletType_OverlayApplet, on [9.0.0+].
2472  * @note This uses \ref appletStorageClose automatically.
2473  * @param[in] s Storage object.
2474  */
2476 
2477 /**
2478  * @brief This is similar to \ref appletTryPopFromAppletBoundChannelForDebug (no DebugMode check), except the used channel is loaded from elsewhere and must be in the range 31-32.
2479  * @note Only available with AppletType_SystemApplet, AppletType_LibraryApplet, or AppletType_OverlayApplet, on [9.0.0+].
2480  * @param[out] s Storage object.
2481  */
2483 
2484 /**
2485  * @brief Gets the DisplayLogicalResolution.
2486  * @note Only available with AppletType_SystemApplet, AppletType_LibraryApplet, or AppletType_OverlayApplet, on [8.0.0+].
2487  * @param[out] width Output width.
2488  * @param[out] height Output height.
2489  */
2491 
2492 /**
2493  * @brief Sets the DisplayMagnification. This is essentially layer image crop, for everything non-Overlay.
2494  * @note Only available with AppletType_SystemApplet, AppletType_LibraryApplet, or AppletType_OverlayApplet, on [8.0.0+].
2495  * @note x and width are multiplied with the same width value returned by \ref appletGetDisplayLogicalResolution, so these should be in the range 0.0f-1.0f. Likewise for y and height, except these are multipled with the height value.
2496  * @param[in] x X position.
2497  * @param[in] y Y position.
2498  * @param[in] width Width.
2499  * @param[in] height Height.
2500  */
2501 Result appletSetDisplayMagnification(float x, float y, float width, float height);
2502 
2503 /**
2504  * @brief Sets whether HomeButtonDoubleClick is enabled.
2505  * @note Only available with AppletType_SystemApplet, AppletType_LibraryApplet, or AppletType_OverlayApplet, on [8.0.0+].
2506  * @param[in] flag Flag
2507  */
2509 
2510 /**
2511  * @brief Gets whether HomeButtonDoubleClick is enabled.
2512  * @note Only available with AppletType_SystemApplet, AppletType_LibraryApplet, or AppletType_OverlayApplet, on [8.0.0+].
2513  * @param[out] out Output flag.
2514  */
2516 
2517 /**
2518  * @brief IsHomeButtonShortPressedBlocked
2519  * @note Only available with AppletType_SystemApplet, AppletType_LibraryApplet, or AppletType_OverlayApplet, on [10.0.0+].
2520  * @param[out] out Output flag.
2521  */
2523 
2524 /**
2525  * @brief IsVrModeCurtainRequired
2526  * @note Only available with AppletType_SystemApplet, AppletType_LibraryApplet, or AppletType_OverlayApplet, on [11.0.0+].
2527  * @param[out] out Output flag.
2528  */
2530 
2531 /**
2532  * @brief SetCpuBoostRequestPriority
2533  * @note Only available with AppletType_SystemApplet, AppletType_LibraryApplet, or AppletType_OverlayApplet, on [11.0.0+].
2534  * @param[in] priority Priority
2535  */
2537 
2538 ///@}
2539 
2540 ///@name IDebugFunctions
2541 ///@{
2542 
2543 /**
2544  * @brief Open an \ref AppletApplication for the currently running Application.
2545  * @note Should not be used when no Application is running.
2546  * @note Only available on [1.0.0-9.2.0].
2547  * @param[out] a \ref AppletApplication
2548  */
2550 
2551 /**
2552  * @brief Perform SystemButtonPressing with the specified \ref AppletSystemButtonType.
2553  * @param[in] type \ref AppletSystemButtonType
2554  */
2556 
2557 /**
2558  * @brief InvalidateTransitionLayer.
2559  */
2561 
2562 /**
2563  * @brief Requests to launch the specified Application, with the specified users.
2564  * @note Only available on [6.0.0+].
2565  * @param[in] application_id ApplicationId.
2566  * @param[in] uids Input array of \ref AccountUid.
2567  * @param[in] total_uids Total input uids, must be <=ACC_USER_LIST_SIZE.
2568  * @param[in] flag Whether to use the specified buffer to create a storage which will be pushed for ::AppletLaunchParameterKind_UserChannel.
2569  * @param[in] buffer Buffer containing the above storage data.
2570  * @param[in] size Size of the storage buffer.
2571  */
2572 Result appletRequestLaunchApplicationWithUserAndArgumentForDebug(u64 application_id, const AccountUid *uids, s32 total_uids, bool flag, const void* buffer, size_t size);
2573 
2574 /**
2575  * @brief Gets the \ref AppletResourceUsageInfo.
2576  * @note Only available on [6.0.0+].
2577  * @param[out] info \ref AppletResourceUsageInfo
2578  */
2580 
2581 /**
2582  * @brief The channel must match the value already stored in state when the state value is non-zero, otherwise an error is returned. When the state value is 0, the channel is written into state. Then the input storage is pushed to the StorageChannel.
2583  * @note Only available on [9.0.0+]. DebugMode must be enabled.
2584  * @note This uses \ref appletStorageClose automatically.
2585  * @param[in] s Storage object.
2586  * @param[in] channel Channel.
2587  */
2589 
2590 /**
2591  * @brief The channel must not be 0 and must match the value previously saved by \ref appletPushToAppletBoundChannelForDebug, otherwise errors are returned. Then the output storage is popped from the StorageChannel.
2592  * @note Only available on [9.0.0+]. DebugMode must be enabled.
2593  * @param[out] s Storage object.
2594  * @param[in] channel Channel.
2595  */
2597 
2598 /**
2599  * @brief Clears a StorageChannel, pushes the input storage there, and writes the ApplicationId into state.
2600  * @note Only available on [9.0.0+].
2601  * @note This uses \ref appletStorageClose automatically.
2602  * @param[in] s Storage object.
2603  * @param[in] application_id ApplicationId
2604  */
2606 
2607 /**
2608  * @brief Clears the StorageChannel/saved-ApplicationId used by \ref appletAlarmSettingNotificationEnableAppEventReserve.
2609  * @note Only available on [9.0.0+].
2610  */
2612 
2613 /**
2614  * @brief Same as \ref appletApplicationPushToNotificationStorageChannel except this uses the MainApplication.
2615  * @note Only available on [9.0.0+].
2616  * @param[in] buffer Input buffer.
2617  * @param[in] size Input buffer size.
2618  */
2620 
2621 /**
2622  * @brief Clears a StorageChannel, pushes the input storage there, and writes the ApplicationId into state.
2623  * @note Only available on [9.0.0+].
2624  * @note This uses \ref appletStorageClose automatically.
2625  * @param[in] s Storage object.
2626  * @param[in] application_id ApplicationId
2627  */
2629 
2630 /**
2631  * @brief Clears the StorageChannel/saved-ApplicationId used by \ref appletFriendInvitationSetApplicationParameter.
2632  * @note Only available on [9.0.0+].
2633  */
2635 
2636 /**
2637  * @brief Same as \ref appletApplicationPushToFriendInvitationStorageChannel except this uses the MainApplication.
2638  * @note Only available on [9.0.0+].
2639  * @param[in] uid \ref AccountUid
2640  * @param[in] buffer Input buffer.
2641  * @param[in] size Input buffer size.
2642  */
2644 
2645 ///@}
2646 
2647 ///@name Common cmds
2648 ///@{
2649 
2650 /**
2651  * @brief SetTerminateResult
2652  * @note Only available with AppletType_*Application. Or with AppletType_SystemApplet, AppletType_LibraryApplet, or AppletType_OverlayApplet, on [9.0.0+].
2653  * @param[in] res Result
2654  */
2656 
2657 /**
2658  * @brief Gets the LaunchStorageInfo.
2659  * @note Only available with AppletType_*Application on [2.0.0+], or with AppletType_LibraryApplet on [9.0.0+].
2660  * @param[out] app_storageId Same as AppletApplicationLaunchProperty::app_storageId.
2661  * @param[out] update_storageId Same as AppletApplicationLaunchProperty::update_storageId.
2662  */
2664 
2665 /**
2666  * @brief Gets an Event which is signaled for GpuErrorDetected.
2667  * @note Only available with AppletType_*Application on [8.0.0+], or with AppletType_LibraryApplet on [9.0.0+].
2668  * @note The Event must be closed by the user once finished with it.
2669  * @note Official sw waits on this Event from a seperate thread, triggering an abort when it's signaled.
2670  * @param[out] out_event Output Event with autoclear=false.
2671  */
2673 
2674 /**
2675  * @brief Sets HandlingHomeButtonShortPressedEnabled.
2676  * @note Only available with AppletType_OverlayApplet on [8.0.0+]. Or with non-AppletType_OverlayApplet on [9.1.0+].
2677  * @param[in] flag Flag
2678  */
2680 
2681 ///@}
2682 
2683 ///@name State / other
2684 ///@{
2685 
2686 /**
2687  * @brief Gets the cached \ref AppletInfo loaded during \ref appletInitialize. This will return NULL when the info is not initialized, due to not running as AppletType_LibraryApplet, or when any of the used cmds fail.
2688  * @note Only available with AppletType_LibraryApplet.
2689  */
2691 
2692 /**
2693  * @brief Gets the event associated with notification messages.
2694  */
2696 
2697 /**
2698  * @brief Gets a notification message, see \ref AppletMessage.
2699  */
2701 
2702 /**
2703  * @brief Processes the current applet status using the specified msg.
2704  * @param msg Notification message, normally from \ref appletGetMessage.
2705  * @return Whether the application should continue running.
2706  */
2708 
2709 /**
2710  * @brief Processes the current applet status. Generally used within a main loop.
2711  * @note Uses \ref appletGetMessage and \ref appletProcessMessage internally.
2712  * @return Whether the application should continue running.
2713  */
2714 bool appletMainLoop(void);
2715 
2716 
2717 /**
2718  * @brief Sets up an applet status hook.
2719  * @param cookie Hook cookie to use.
2720  * @param callback Function to call when applet's status changes.
2721  * @param param User-defined parameter to pass to the callback.
2722  */
2723 void appletHook(AppletHookCookie* cookie, AppletHookFn callback, void* param);
2724 
2725 /**
2726  * @brief Removes an applet status hook.
2727  * @param cookie Hook cookie to remove.
2728  */
2730 
2731 /// These return state which is updated by appletMainLoop() when notifications are received.
2733 ApmPerformanceMode appletGetPerformanceMode(void);
2734 AppletFocusState appletGetFocusState(void);
2735 
2736 /**
2737  * @brief Sets the current \ref AppletFocusHandlingMode.
2738  * @note Should only be called with AppletType_Application.
2739  */
2741 
2742 ///@}
ApmPerformanceMode
PerformanceMode.
Definition: apm.h:12
ApmCpuBoostMode
CpuBoostMode. With appletSetCpuBoostMode, only values 0/1 are available. This allows using higher clo...
Definition: apm.h:19
Service * appletGetServiceSession_ApplicationCreator(void)
Gets the Service object for IApplicationCreator. Only initialized with AppletType_SystemApplet.
Result appletGetIdleTimeDetectionExtension(AppletIdleTimeDetectionExtension *ext)
Gets the value set by appletSetIdleTimeDetectionExtension.
Result appletGetCallerAppletIdentityInfoStack(AppletIdentityInfo *stack, s32 count, s32 *total_out)
Gets an array of AppletIdentityInfo for the CallerStack.
Result appletGetAppletResourceUsageInfo(AppletResourceUsageInfo *info)
Gets the AppletResourceUsageInfo.
Result appletRequestToSleep(void)
RequestToSleep.
Result appletDeactivateMigrationService(void)
DeactivateMigrationService.
Result appletRequestLaunchApplicationForQuest(u64 application_id, AppletStorage *s, const AppletApplicationAttributeForQuest *attr)
Requests to launch the specified application, for kiosk systems.
Result appletSetScreenShotAppletIdentityInfo(AppletIdentityInfo *info)
Sets the AppletIdentityInfo for screenshots.
Result appletPopRequestLaunchApplicationForDebug(AccountUid *uids, s32 count, u64 *application_id, s32 *total_out)
PopRequestLaunchApplicationForDebug.
Result appletInitializeGamePlayRecording(void)
Initializes video recording.
Result appletApplicationRequestForApplicationToGetForeground(AppletApplication *a)
RequestForApplicationToGetForeground.
Result appletCreateManagedDisplaySeparableLayer(u64 *display_layer, u64 *recording_layer)
CreateManagedDisplaySeparableLayer.
Service * appletGetServiceSession_Functions(void)
Gets the Service object for I*Functions, specific to each AppletType (IApplicationFunctions for Apple...
Result appletGetDesirableKeyboardLayout(SetKeyboardLayout *layout)
Gets the DesirableKeyboardLayout previously set by appletSetDesirableKeyboardLayout.
Result appletGetMainAppletApplicationDesiredLanguage(u64 *LanguageCode)
Gets the DesiredLanguage for the MainApplet.
Service * appletGetServiceSession_ProcessWindingController(void)
Gets the Service object for IProcessWindingController. Only initialized with AppletType_LibraryApplet...
Service * appletGetServiceSession_GlobalStateController(void)
Gets the Service object for IGlobalStateController. Only initialized with AppletType_SystemApplet,...
Result appletInitializeApplicationCopyrightFrameBuffer(void)
Initializes the ApplicationCopyrightFrameBuffer, with dimensions 1280x720 + the tmem for it.
Result appletGetHdcpAuthenticationStateChangeEvent(Event *out_event)
Gets an Event which is signaled when the output from appletGetHdcpAuthenticationState changes.
Result appletSetControllerFirmwareUpdateSection(bool flag)
Sets ControllerFirmwareUpdateSection.
LibAppletExitReason
LibraryAppletExitReason.
Definition: applet.h:126
Result appletEndBlockingHomeButtonShortAndLongPressed(void)
Ends the blocking started by appletBeginBlockingHomeButtonShortAndLongPressed.
Result appletSetHealthWarningShowingState(bool flag)
SetHealthWarningShowingState.
Result appletQueryApplicationPlayStatistics(PdmApplicationPlayStatistics *stats, const u64 *application_ids, s32 count, s32 *total_out)
Gets ApplicationPlayStatistics.
Result appletGetProgramTotalActiveTime(u64 *activeTime)
Gets the total time in nanoseconds that the current process was actively running (not suspended),...
Result appletGetPopExtraStorageEvent(Event *out_event)
Gets an Event which is signaled when a new storage is available with appletPopExtraStorage where prev...
Result appletIsSleepEnabled(bool *out)
IsSleepEnabled.
Result appletFriendInvitationPushApplicationParameter(AccountUid uid, const void *buffer, u64 size)
Same as appletApplicationPushToFriendInvitationStorageChannel except this uses the MainApplication.
Result appletSetFocusHandlingMode(AppletFocusHandlingMode mode)
Sets the current AppletFocusHandlingMode.
Result appletSetMediaPlaybackState(bool state)
Set media playback state.
Result appletReadThemeStorage(void *buffer, size_t size, u64 offset, u64 *transfer_size)
Reads the ThemeStorage for the current applet.
Result appletGetWriterLockAccessorEx(AppletLockAccessor *a, u32 inval)
Gets a Writer AppletLockAccessor.
bool appletApplicationCheckFinished(AppletApplication *a)
Waits on the Application StateChangedEvent with timeout=0, and returns whether it was successful.
Result appletSetApplicationCopyrightImage(const void *buffer, size_t size, s32 x, s32 y, s32 width, s32 height, AppletWindowOriginMode mode)
Sets the RGBA8 image for use with appletInitializeApplicationCopyrightFrameBuffer.
Result appletIsHealthWarningRequired(bool *out)
IsHealthWarningRequired.
Result appletCanUseApplicationCore(bool *out)
CanUseApplicationCore.
Result appletPopInteractiveInData(AppletStorage *s)
Pops a storage from current-LibraryApplet Interactive input.
Result appletSetGpuTimeSliceBoost(u64 val)
Sets the GpuTimeSliceBoost.
Result appletHolderGetPopInteractiveOutDataEvent(AppletHolder *h, Event **out_event)
Gets the PopInteractiveOutDataEvent.
Result appletGetBuiltInDisplayType(s32 *out)
GetBuiltInDisplayType.
Result appletUnpopExtraStorage(AppletStorage *s)
Unpop a storage for current-LibraryApplet Extra input.
Result appletSetRequestExitToLibraryAppletAtExecuteNextProgramEnabled(void)
SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled.
Result appletCreateApplication(AppletApplication *a, u64 application_id)
Creates an Application.
Result appletSetExpectedMasterVolume(float mainAppletVolume, float libraryAppletVolume)
Sets the ExpectedMasterVolume for MainApplet and LibraryApplet.
Result appletGpuErrorHandlerGetManualGpuErrorDetectionSystemEvent(AppletGpuErrorHandler *g, Event *out_event)
GetManualGpuErrorDetectionSystemEvent.
static Event * appletHolderGetExitEvent(AppletHolder *h)
Gets the LibraryApplet StateChangedEvent.
Definition: applet.h:1258
Result appletPushContext(AppletStorage *s)
Pushes a storage to the ContextStack.
Result appletIsInControllerFirmwareUpdateSection(bool *out)
Gets the ControllerFirmwareUpdateSection flag.
Result appletIsAutoSleepDisabled(bool *out)
Gets AutoSleepDisabled.
Result appletGetPseudoDeviceId(Uuid *out)
Gets the PseudoDeviceId.
Result appletGetCradleFwVersion(u32 *out0, u32 *out1, u32 *out2, u32 *out3)
Gets the Dock firmware version.
Result appletSetVrModeEnabled(bool flag)
Sets whether VrMode is enabled.
Result appletEndToWatchShortHomeButtonMessage(void)
Forwards input to the foreground app.
Result appletSetVrPositionForDebug(s32 x, s32 y, s32 width, s32 height)
SetVrPositionForDebug.
AppletWirelessPriorityMode
Input mode values for appletSetWirelessPriorityMode.
Definition: applet.h:190
@ AppletWirelessPriorityMode_OptimizedForWlan
OptimizedForWlan.
Definition: applet.h:192
@ AppletWirelessPriorityMode_Default
Default.
Definition: applet.h:191
Result appletPopInData(AppletStorage *s)
Pops a storage from current-LibraryApplet input.
Result appletAcquireLastApplicationCaptureSharedBuffer(bool *flag, s32 *id)
Acquire the LastApplication CaptureSharedBuffer.
Result appletPushToAppletBoundChannel(AppletStorage *s)
This is similar to appletPushToAppletBoundChannelForDebug (no DebugMode check), except the used chann...
bool appletProcessMessage(u32 msg)
Processes the current applet status using the specified msg.
Result appletGetWakeupCount(u64 *out)
GetWakeupCount.
void appletHolderJoin(AppletHolder *h)
Waits for the LibraryApplet to exit.
Result appletIsSystemBufferSharingEnabled(void)
Checks whether SystemBufferSharing is enabled, throwing an error otherwise.
Result appletHolderJump(AppletHolder *h)
Jumps to the LibraryApplet, with the current-LibraryApplet being terminated.
AppletTvPowerStateMatchingMode
Mode values for appletSetTvPowerStateMatchingMode.
Definition: applet.h:153
@ AppletTvPowerStateMatchingMode_Unknown0
Unknown.
Definition: applet.h:154
@ AppletTvPowerStateMatchingMode_Unknown1
Unknown.
Definition: applet.h:155
void appletApplicationJoin(AppletApplication *a)
Waits for the Application to exit.
void appletStorageClose(AppletStorage *s)
Closes the storage object.
Result appletUnreserveResourceForMovieOperation(void)
UnreserveResourceForMovieOperation.
Result appletGetMessage(u32 *msg)
Gets a notification message, see AppletMessage.
Result appletHolderSetOutOfFocusApplicationSuspendingEnabled(AppletHolder *h, bool flag)
Sets OutOfFocusApplicationSuspendingEnabled.
Result appletPopLaunchRequestedApplication(AppletApplication *a)
Pops a AppletApplication for a requested Application launch.
Result appletHolderPushExtraStorage(AppletHolder *h, AppletStorage *s)
Pushes a storage for LibraryApplet Extra storage input.
AppletApplicationExitReason
AppletApplicationExitReason.
Definition: applet.h:134
Result appletSetHomeButtonDoubleClickEnabled(bool flag)
Sets whether HomeButtonDoubleClick is enabled.
Result appletApplicationGetApplicationId(AppletApplication *a, u64 *application_id)
Gets the ApplicationId for the Application.
Result appletAlarmSettingNotificationEnableAppEventReserve(AppletStorage *s, u64 application_id)
Clears a StorageChannel, pushes the input storage there, and writes the ApplicationId into state.
Result appletIsGamePlayRecordingSupported(bool *flag)
Gets whether video recording is supported.
Result appletApplicationTerminate(AppletApplication *a)
Terminate the Application.
Result appletPopFloatingApplicationForDevelopment(AppletApplication *a)
PopFloatingApplicationForDevelopment.
Result appletSetLcdBacklightOffEnabled(bool flag)
Sets whether the LCD screen backlight is turned off.
Result appletGetPopFromGeneralChannelEvent(Event *out_event)
Gets an Event which is signaled when a new storage is available with appletPopFromGeneralChannel wher...
Result appletIsHomeButtonShortPressedBlocked(bool *out)
IsHomeButtonShortPressedBlocked.
Result appletStartRebootSequence(void)
Start the system-reboot sequence.
Result appletSetApplicationAlbumUserData(const void *buffer, size_t size)
Sets the Application AlbumUserData.
Result appletGetLastApplicationExitReason(s32 *out)
GetLastApplicationExitReason.
Result appletRequestToReboot(void)
Requests a system reboot.
Service * appletGetServiceSession_Proxy(void)
Gets the Service object for the actual "appletOE"/"appletAE" service session.
AppletHookType
applet hook types.
Definition: applet.h:40
@ AppletHookType_OnPerformanceMode
AppletMessage_PerformanceModeChanged
Definition: applet.h:43
@ AppletHookType_Max
Number of applet hook types.
Definition: applet.h:50
@ AppletHookType_OnAlbumScreenShotTaken
AppletMessage_AlbumScreenShotTaken
Definition: applet.h:47
@ AppletHookType_OnResume
AppletMessage_Resume
Definition: applet.h:45
@ AppletHookType_OnCaptureButtonShortPressed
AppletMessage_CaptureButtonShortPressed
Definition: applet.h:46
@ AppletHookType_OnOperationMode
AppletMessage_OperationModeChanged
Definition: applet.h:42
@ AppletHookType_OnExitRequest
::AppletMessage_ExitRequested
Definition: applet.h:44
@ AppletHookType_RequestToDisplay
AppletMessage_RequestToDisplay
Definition: applet.h:48
@ AppletHookType_OnFocusState
AppletMessage_FocusStateChanged
Definition: applet.h:41
Result appletGpuErrorHandlerFinishManualGpuErrorHandling(AppletGpuErrorHandler *g)
FinishManualGpuErrorHandling.
Result appletClearAppletTransitionBuffer(u32 color)
Clear the AppletTransitionBuffer with the specified color.
Result appletActivateMigrationService(void)
ActivateMigrationService.
Result appletGetDisplayLogicalResolution(s32 *width, s32 *height)
Gets the DisplayLogicalResolution.
Result appletUpdateLastForegroundCaptureImage(void)
Update the LastForeground CaptureImage.
Result appletGetHomeButtonWriterLockAccessor(AppletLockAccessor *a)
Gets a AppletLockAccessor for HomeButtonWriter.
Result appletSetHandlesRequestToDisplay(bool flag)
Sets whether AppletMessage_RequestToDisplay is enabled.
Result appletPopLaunchParameter(AppletStorage *s, AppletLaunchParameterKind kind)
Pops a LaunchParameter AppletStorage, the storage will be removed from sysmodule state during this.
bool appletHolderActive(AppletHolder *h)
Returns whether the AppletHolder object was initialized.
Service * appletGetServiceSession_AppletCommonFunctions(void)
Gets the Service object for IAppletCommonFunctions. Only initialized with AppletType_SystemApplet,...
Result appletSetGamePlayRecordingState(bool state)
Disable/enable video recording.
Result appletGetMainAppletIdentityInfo(AppletIdentityInfo *info)
Gets the AppletIdentityInfo for the MainApplet.
Result appletReserveResourceForMovieOperation(void)
ReserveResourceForMovieOperation.
Result appletRequestToGetForeground(void)
RequestToGetForeground.
Result appletGetSettingsPlatformRegion(SetSysPlatformRegion *out)
This uses setsysGetPlatformRegion internally.
Result appletGetExpectedMasterVolume(float *mainAppletVolume, float *libraryAppletVolume)
Gets the ExpectedMasterVolume for MainApplet and LibraryApplet.
Result appletShouldSetGpuTimeSliceManually(bool *out)
ShouldSetGpuTimeSliceManually.
Result appletSetTerminateResult(Result res)
SetTerminateResult.
Result appletApplicationPushToNotificationStorageChannel(AppletApplication *a, const void *buffer, u64 size)
Creates a storage using the specified input then pushes it to the Notification StorageChannel.
AppletFocusState
FocusState.
Definition: applet.h:67
@ AppletFocusState_OutOfFocus
Out of focus - LibraryApplet open.
Definition: applet.h:69
@ AppletFocusState_Background
Out of focus - HOME menu open / console is sleeping.
Definition: applet.h:70
@ AppletFocusState_InFocus
Applet is focused.
Definition: applet.h:68
Result appletGetDisplayVersion(char *displayVersion)
Gets the DisplayVersion for the current host application control.nacp.
Result appletPerformSystemButtonPressing(AppletSystemButtonType type)
Perform SystemButtonPressing with the specified AppletSystemButtonType.
Result appletGetSystemSharedBufferHandle(u64 *SharedBufferHandle)
Same as appletGetSystemSharedLayerHandle except this just gets the SharedBufferHandle.
Result appletHolderGetIndirectLayerConsumerHandle(AppletHolder *h, u64 *out)
Gets the IndirectLayerConsumerHandle loaded during appletCreateLibraryApplet, on [2....
Result appletSetInputDetectionPolicy(AppletInputDetectionPolicy policy)
Sets the AppletInputDetectionPolicy.
Result appletCreateHandleStorageTmem(AppletStorage *s, void *buffer, s64 size)
Creates a HandleStorage using TransferMemory.
Result appletOpenMainApplication(AppletApplication *a)
Open an AppletApplication for the currently running Application.
Result appletCreateMovieMaker(Service *srv_out, TransferMemory *tmem)
CreateMovieMaker.
Result appletGetPopInteractiveInDataEvent(Event *out_event)
Gets an Event which is signaled when a new storage is available with appletPopInteractiveInData where...
Result appletApplicationReportApplicationExitTimeout(AppletApplication *a)
ReportApplicationExitTimeout.
Result appletGetMainAppletStorageId(NcmStorageId *storageId)
Gets the NcmStorageId for the MainApplet.
Result appletHolderGetLibraryAppletInfo(AppletHolder *h, LibAppletInfo *info)
Gets the LibAppletInfo for the specified LibraryApplet.
Result appletApplicationSetApplicationAttribute(AppletApplication *a, const AppletApplicationAttribute *attr)
Sets the AppletApplicationAttribute for the Application.
Result appletGetDefaultDisplayResolutionChangeEvent(Event *out_event)
Gets an Event which is signaled when the output from appletGetDefaultDisplayResolution changes.
Result appletAlarmSettingNotificationPushAppEventNotify(const void *buffer, u64 size)
Same as appletApplicationPushToNotificationStorageChannel except this uses the MainApplication.
Result appletIsIlluminanceAvailable(bool *out)
Gets whether Illuminance is available.
Result appletHolderPresetLibraryAppletGpuTimeSliceZero(AppletHolder *h)
PresetLibraryAppletGpuTimeSliceZero.
Result appletCreateSystemApplication(AppletApplication *a, u64 system_application_id)
Creates a SystemApplication.
Result appletApplicationHasSaveDataAccessPermission(AppletApplication *a, u64 application_id, bool *out)
Gets whether the savedata specified by the input ApplicationId is accessible.
Result appletGetLibraryAppletInfo(LibAppletInfo *info)
Gets the LibAppletInfo for the current LibraryApplet.
void appletHolderClose(AppletHolder *h)
Closes an AppletHolder object.
Result appletGetHealthWarningDisappearedSystemEvent(Event *out_event)
GetHealthWarningDisappearedSystemEvent.
Result appletInitialize(void)
Initialize applet, called automatically during app startup.
bool appletHolderWaitInteractiveOut(AppletHolder *h)
Waits for the PopInteractiveOutDataEvent and StateChangedEvent.
Result appletSetInputDetectionSourceSet(u32 val)
Sets the InputDetectionSourceSet.
Result appletTerminateAllLibraryApplets(void)
TerminateAllLibraryApplets which were created by the current applet.
Result appletHolderStart(AppletHolder *h)
Starts the LibraryApplet.
bool appletHolderCheckFinished(AppletHolder *h)
Waits on the LibraryApplet StateChangedEvent with timeout=0, and returns whether it was successful.
Result appletCreateTransferMemoryStorage(AppletStorage *s, void *buffer, s64 size, bool writable)
Creates a TransferMemory storage.
void(* AppletHookFn)(AppletHookType hook, void *param)
applet hook function.
Definition: applet.h:216
Result appletGetBootMode(PmBootMode *mode)
Gets the BootMode which originated from pmbmGetBootMode.
Result appletApplicationRequestExit(AppletApplication *a)
Requests the Application to exit.
Result appletGetHdcpAuthenticationState(s32 *state)
Gets the HdcpAuthenticationState.
Result appletGetApplicationIdByContentActionName(u64 *application_id, const char *name)
Gets the ApplicationId for the specified ContentActionName string.
Result appletSetDefaultHomeButtonLongPressTime(s64 val)
Sets the DefaultHomeButtonLongPressTime.
Result appletIsVrModeCurtainRequired(bool *out)
IsVrModeCurtainRequired.
Result appletReleaseSleepLock(void)
Release the SleepLock.
Result appletSetAppletWindowVisibility(bool flag)
Sets the current applet WindowVisibility.
AppletLaunchParameterKind
LaunchParameterKind.
Definition: applet.h:84
@ AppletLaunchParameterKind_UserChannel
UserChannel. Application-specific LaunchParameter.
Definition: applet.h:85
@ AppletLaunchParameterKind_PreselectedUser
account PreselectedUser
Definition: applet.h:86
@ AppletLaunchParameterKind_Unknown
Unknown if used by anything?
Definition: applet.h:87
void appletNotifyRunning(bool *out)
Notify that the app is now running, for the Application logo screen.
Result appletUnpopInData(AppletStorage *s)
Unpop a storage for current-LibraryApplet input.
Result appletGetPopInDataEvent(Event *out_event)
Gets an Event which is signaled when a new storage is available with appletPopInData where previously...
AppletScreenShotPermission
Permission values for appletSetScreenShotPermission.
Definition: applet.h:170
@ AppletScreenShotPermission_Enable
Enable.
Definition: applet.h:172
@ AppletScreenShotPermission_Disable
Disable.
Definition: applet.h:173
@ AppletScreenShotPermission_Inherit
Inherit from parent applet.
Definition: applet.h:171
Result appletAreAnyLibraryAppletsLeft(bool *out)
AreAnyLibraryAppletsLeft which were created by the current applet.
Result appletSetLastApplicationExitReason(s32 reason)
SetLastApplicationExitReason.
Result appletStorageGetHandle(AppletStorage *s, s64 *out, Handle *handle)
Gets data for a HandleStorage originally from appletCreateHandleStorage input.
Result appletExitAndRequestToShowThanksMessage(void)
Exit the application and return to the kiosk demo menu.
Result appletUnlockExit(void)
Unlocks exiting, see appletLockExit.
Result appletGetNotificationStorageChannelEvent(Event *out_event)
Gets an Event which is signaled when a new storage is available with appletTryPopFromNotificationStor...
Service * appletGetServiceSession_SelfController(void)
Gets the Service object for ISelfController.
AppletType appletGetAppletType(void)
Get the AppletType.
Service * appletGetServiceSession_WindowController(void)
Gets the Service object for IWindowController.
u64 appletGetAppletResourceUserId(void)
Get the cached AppletResourceUserId.
Result appletGetFriendInvitationStorageChannelEvent(Event *out_event)
Gets an Event which is signaled when a new storage is available with appletTryPopFromFriendInvitation...
Result appletTryPopFromAppletBoundChannelForDebug(AppletStorage *s, s32 channel)
The channel must not be 0 and must match the value previously saved by appletPushToAppletBoundChannel...
Result appletLockAccessorTryLock(AppletLockAccessor *a, bool *flag)
TryLock a LockAccessor.
Result appletLockAccessorLock(AppletLockAccessor *a)
Lock a LockAccessor.
Result appletGetCurrentIlluminance(float *fLux)
Gets the current Illuminance from the light sensor.
Result appletStartSleepSequence(bool flag)
Start the sequence for entering sleep-mode.
Result appletApplicationPushToFriendInvitationStorageChannel(AppletApplication *a, AccountUid uid, const void *buffer, u64 size)
Creates a storage using the specified input then pushes it to the FriendInvitation StorageChannel.
LibAppletExitReason appletHolderGetExitReason(AppletHolder *h)
Gets the LibAppletExitReason set by appletHolderJoin.
Result appletGetPreviousProgramIndex(s32 *programIndex)
Gets the ProgramIndex of the program which launched this program.
Result appletHolderRequestExit(AppletHolder *h)
Requests the LibraryApplet to exit.
Result appletAcquireLastForegroundCaptureSharedBuffer(bool *flag, s32 *id)
Acquire the LastForeground CaptureSharedBuffer.
Result appletBeginBlockingHomeButton(s64 val)
Blocks the usage of the home button, for short presses (Home Menu).
Result appletGetDefaultDisplayResolution(s32 *width, s32 *height)
Gets the DefaultDisplayResolution.
Result appletCreateLibraryAppletSelf(AppletHolder *h, AppletId id, LibAppletMode mode)
Creates a LibraryApplet.
Result appletSetAlbumImageTakenNotificationEnabled(bool flag)
Sets whether AppletMessage_AlbumScreenShotTaken is enabled.
Result appletSetHdcpAuthenticationActivated(bool flag)
SetHdcpAuthenticationActivated.
Result appletSetDisplayMagnification(float x, float y, float width, float height)
Sets the DisplayMagnification.
Service * appletGetServiceSession_DebugFunctions(void)
Gets the Service object for IDebugFunctions.
Result appletStorageMap(AppletStorage *s, void **addr, size_t *size)
Maps TransferMemory for a HandleStorage.
Result appletStartRebootSequenceForOverlay(void)
Start the system-reboot sequence.
Result appletEndBlockingHomeButton(void)
Ends the blocking started by appletBeginBlockingHomeButton.
bool appletMainLoop(void)
Processes the current applet status.
Result appletSetIdleTimeDetectionExtension(AppletIdleTimeDetectionExtension ext)
Sets the IdleTimeDetectionExtension.
Result appletSetAlbumImageOrientation(AlbumImageOrientation orientation)
Sets the Album screenshot ImageOrientation.
Result appletApplicationPushLaunchParameter(AppletApplication *a, AppletLaunchParameterKind kind, AppletStorage *s)
Pushes a LaunchParameter AppletStorage to the Application.
Result appletGetIndirectLayerProducerHandle(u64 *out)
Gets the IndirectLayerProducerHandle.
AppletOperationMode appletGetOperationMode(void)
These return state which is updated by appletMainLoop() when notifications are received.
Result appletGetMainAppletApplicationControlProperty(NacpStruct *nacp)
Gets the NacpStruct for the MainApplet.
Result appletReleaseLastApplicationCaptureSharedBuffer(void)
Release the LastApplication CaptureSharedBuffer.
Result appletRequestToShutdown(void)
Requests a system shutdown.
Result appletEnterFatalSection(void)
Enter FatalSection.
Result appletApplicationRequestApplicationSoftReset(AppletApplication *a)
RequestApplicationSoftReset.
Result appletGpuErrorHandlerGetManualGpuErrorInfoSize(AppletGpuErrorHandler *g, u64 *out)
Gets the size of the info available with appletGpuErrorHandlerGetManualGpuErrorInfo.
Result appletGetLastForegroundCaptureImageEx(void *buffer, size_t size, bool *flag)
Gets the LastForeground CaptureImage.
LibAppletMode
LibraryAppletMode.
Definition: applet.h:117
@ LibAppletMode_BackgroundIndirect
Background with indirect display, see appletHolderGetIndirectLayerConsumerHandle.
Definition: applet.h:121
@ LibAppletMode_AllForegroundInitiallyHidden
Foreground except initially hidden.
Definition: applet.h:122
@ LibAppletMode_NoUi
No UI.
Definition: applet.h:120
@ LibAppletMode_AllForeground
Foreground.
Definition: applet.h:118
@ LibAppletMode_Background
Background.
Definition: applet.h:119
Result appletBeginBlockingHomeButtonShortAndLongPressed(s64 val)
Blocks the usage of the home button, for short (Home Menu) and long (Overlay) presses.
AppletInfo * appletGetAppletInfo(void)
Gets the cached AppletInfo loaded during appletInitialize.
Result appletPushToAppletBoundChannelForDebug(AppletStorage *s, s32 channel)
The channel must match the value already stored in state when the state value is non-zero,...
Result appletTryPopFromAppletBoundChannel(AppletStorage *s)
This is similar to appletTryPopFromAppletBoundChannelForDebug (no DebugMode check),...
Result appletSaveCurrentScreenshot(AlbumReportOption option)
SaveCurrentScreenshot.
Result appletTryPopFromFriendInvitationStorageChannel(AppletStorage *s)
Pops a storage from the FriendInvitation StorageChannel.
Service * appletGetServiceSession_LibraryAppletCreator(void)
Gets the Service object for ILibraryAppletCreator.
Result appletReportUserIsActive(void)
Reports that the user is active, for idle detection (screen dimming / auto-sleep).
Result appletRequestFlushGamePlayingMovieForDebug(void)
Requests to save the video recording, as if the Capture-button was held.
Result appletLockForeground(void)
LockForeground.
void appletGpuErrorHandlerClose(AppletGpuErrorHandler *g)
Close an AppletGpuErrorHandler.
Result appletRequestToAcquireSleepLock(void)
Request to AcquireSleepLock.
Result appletSetApplicationCopyrightVisibility(bool visible)
Sets the visibility for the image set by appletSetApplicationCopyrightImage, in screenshots.
Result appletGetCurrentPerformanceConfiguration(u32 *PerformanceConfiguration)
Gets the current PerformanceConfiguration.
Result appletLockExit(void)
Delay exiting until appletUnlockExit is called, with a 15 second timeout once exit is requested.
Result appletSetPerformanceConfigurationChangedNotification(bool flag)
Sets whether PerformanceConfigurationChangedNotification is enabled.
Result appletIsAutoPowerDownRequested(bool *out)
IsAutoPowerDownRequested.
Result appletNotifyCecSettingsChanged(void)
NotifyCecSettingsChanged.
Result appletTryPopFromNotificationStorageChannel(AppletStorage *s)
Pops a storage from the Notification StorageChannel.
Result appletLoadAndApplyIdlePolicySettings(void)
LoadAndApplyIdlePolicySettings.
AppletThemeColorType appletGetThemeColorType(void)
Gets the state field for AppletThemeColorType. Used internally by libappletArgsCreate.
Result appletSetCpuBoostRequestPriority(s32 priority)
SetCpuBoostRequestPriority.
Result appletSuppressDisablingSleepTemporarily(u64 val)
SuppressDisablingSleepTemporarily.
Result appletPushOutData(AppletStorage *s)
Pushes a storage for current-LibraryApplet output.
Result appletGetCurrentApplicationId(u64 *application_id)
Gets the ApplicationId for the currently running Application.
Result appletTerminateApplicationAndSetReason(Result reason)
TerminateApplicationAndSetReason.
Result appletPopContext(AppletStorage *s)
Pops a storage from the ContextStack.
Result appletStartShutdownSequenceForOverlay(void)
Start the system-shutdown sequence.
Result appletCreateGameMovieTrimmer(Service *srv_out, TransferMemory *tmem)
CreateGameMovieTrimmer.
AppletApplicationExitReason appletApplicationGetExitReason(AppletApplication *a)
Gets the AppletApplicationExitReason set by appletApplicationJoin.
Result appletSetAutoSleepTimeAndDimmingTimeEnabled(bool flag)
Sets AutoSleepTimeAndDimmingTimeEnabled.
Result appletClearCaptureBuffer(bool flag, AppletCaptureSharedBuffer captureBuf, u32 color)
Clear the input CaptureSharedBuffer with the specified color.
Service * appletGetServiceSession_DisplayController(void)
Gets the Service object for IDisplayController.
Result appletApplicationGetApplicationControlProperty(AppletApplication *a, NacpStruct *nacp)
Gets the NacpStruct for the Application.
Result appletSetRequiresCaptureButtonShortPressedMessage(bool flag)
Sets whether AppletMessage_CaptureButtonShortPressed is enabled.
Result appletHolderPushInData(AppletHolder *h, AppletStorage *s)
Pushes a storage for LibraryApplet input.
Result appletHolderRequestExitOrTerminate(AppletHolder *h, u64 timeout)
Uses cmds GetAppletStateChangedEvent and RequestExit, then waits for the LibraryApplet to exit with t...
Result appletReleaseSleepLockTransiently(void)
Release the SleepLock transiently.
Result appletSetAutoSleepDisabled(bool flag)
Sets AutoSleepDisabled.
Result appletGetHomeButtonDoubleClickEnabled(bool *out)
Gets whether HomeButtonDoubleClick is enabled.
Result appletLaunchDevMenu(void)
Launches DevMenu and the dev Overlay-applet.
Result appletGetMainAppletAvailableUsers(AccountUid *uids, s32 count, bool *flag, s32 *total_out)
Gets an array of userIds for the MainApplet AvailableUsers.
Result appletSetDesirableKeyboardLayout(SetKeyboardLayout layout)
Sets the DesirableKeyboardLayout.
Result appletAlarmSettingNotificationDisableAppEventReserve(void)
Clears the StorageChannel/saved-ApplicationId used by appletAlarmSettingNotificationEnableAppEventRes...
AppletInputDetectionPolicy
Input policy values for appletSetInputDetectionPolicy.
Definition: applet.h:184
@ AppletInputDetectionPolicy_Unknown1
Unknown.
Definition: applet.h:186
@ AppletInputDetectionPolicy_Unknown0
Unknown.
Definition: applet.h:185
Service * appletGetServiceSession_LibraryAppletSelfAccessor(void)
Gets the Service object for ILibraryAppletSelfAccessor. Only initialized with AppletType_LibraryApple...
Result appletApplicationGetNsRightsEnvironmentHandle(AppletApplication *a, u64 *handle)
GetNsRightsEnvironmentHandle.
Result appletHolderTerminate(AppletHolder *h)
Terminate the LibraryApplet.
Result appletAcquireCallerAppletCaptureSharedBuffer(bool *flag, s32 *id)
Acquire the CallerApplet CaptureSharedBuffer.
Result appletCopyBetweenCaptureBuffers(AppletCaptureSharedBuffer dstCaptureBuf, AppletCaptureSharedBuffer srcCaptureBuf)
Copies image data from a CaptureSharedBuffer to another CaptureSharedBuffer.
Result appletGetCradleStatus(u8 *status)
Gets the CradleStatus.
Result appletGetHomeButtonReaderLockAccessor(AppletLockAccessor *a)
Gets a AppletLockAccessor for HomeButtonReader.
Result appletGetCurrentIlluminanceEx(bool *bOverLimit, float *fLux)
Gets the current Illuminance from the light sensor.
Result appletShouldSleepOnBoot(bool *out)
ShouldSleepOnBoot.
Result appletApplicationStart(AppletApplication *a)
Starts the Application.
Result appletGetHdcpAuthenticationFailedEvent(Event *out_event)
Gets an Event which is signaled for HdcpAuthenticationFailed.
Result appletTakeScreenShotOfOwnLayerEx(bool flag0, bool immediately, AppletCaptureSharedBuffer captureBuf)
Takes a screenshot of the current applet Layer into the specified CaptureSharedBuffer.
Result appletSetScreenShotPermission(AppletScreenShotPermission permission)
Controls whether screenshot-capture is allowed.
void appletSetThemeColorType(AppletThemeColorType theme)
Sets the state field for AppletThemeColorType.
Result appletStartShutdownSequence(void)
Start the system-shutdown sequence.
Result appletRequestLaunchApplication(u64 application_id, AppletStorage *s)
Requests to launch the specified application.
Result appletSetScreenShotPermissionGlobally(bool flag)
Sets ScreenShotPermissionGlobally.
Result appletChangeMainAppletMasterVolume(float volume, u64 unk)
Change the MainApplet MasterVolume.
void appletApplicationClose(AppletApplication *a)
Close an AppletApplication.
Result appletHolderPopOutData(AppletHolder *h, AppletStorage *s)
Pops a storage from LibraryApplet output.
AppletSystemButtonType
Type values for appletPerformSystemButtonPressingIfInFocus.
Definition: applet.h:159
@ AppletSystemButtonType_CaptureButtonShortPressing
Short-pressing with the Capture-button.
Definition: applet.h:165
@ AppletSystemButtonType_HomeButtonLongPressing
Long-pressing with the HOME-button.
Definition: applet.h:161
@ AppletSystemButtonType_Shutdown
Shutdown the system, as if the Power-button was held for longer than AppletSystemButtonType_PowerButt...
Definition: applet.h:164
@ AppletSystemButtonType_HomeButtonShortPressing
Short-pressing with the HOME-button.
Definition: applet.h:160
@ AppletSystemButtonType_CaptureButtonLongPressing
Long-pressing with the Capture-button.
Definition: applet.h:166
@ AppletSystemButtonType_PowerButtonShortPressing
Short-pressing with the Power-button. Only available with appletPerformSystemButtonPressing.
Definition: applet.h:162
@ AppletSystemButtonType_PowerButtonLongPressing
Long-pressing with the Power-button. Only available with appletPerformSystemButtonPressing.
Definition: applet.h:163
void appletStorageCloseTmem(AppletStorage *s)
Closes the TransferMemory in the storage object. For TransferMemory storage created by the current pr...
AppletIdleTimeDetectionExtension
Extension values for appletSetIdleTimeDetectionExtension / appletGetIdleTimeDetectionExtension,...
Definition: applet.h:177
@ AppletIdleTimeDetectionExtension_Extended
Extended.
Definition: applet.h:179
@ AppletIdleTimeDetectionExtension_ExtendedUnsafe
ExtendedUnsafe.
Definition: applet.h:180
@ AppletIdleTimeDetectionExtension_None
No extension.
Definition: applet.h:178
Result appletApplicationGetDesirableUids(AppletApplication *a, AccountUid *uids, s32 count, s32 *total_out)
Gets an array of userIds for the Application DesirableUids.
Result appletWriteThemeStorage(const void *buffer, size_t size, u64 offset)
Writes the ThemeStorage for the current applet.
Result appletPushInteractiveOutData(AppletStorage *s)
Pushes a storage for current-LibraryApplet Interactive output.
Result appletCreateHandleStorage(AppletStorage *s, s64 inval, Handle handle)
Creates a HandleStorage.
Result appletSetHandlingHomeButtonShortPressedEnabled(bool flag)
Sets HandlingHomeButtonShortPressedEnabled.
Result appletTakeScreenShotOfOwnLayer(bool flag, AppletCaptureSharedBuffer captureBuf)
Takes a screenshot of the current applet Layer into the specified CaptureSharedBuffer.
AppletType
AppletType.
Definition: applet.h:23
AppletCaptureSharedBuffer
CaptureSharedBuffer for the IDisplayController commands.
Definition: applet.h:196
@ AppletCaptureSharedBuffer_LastForeground
LastForeground.
Definition: applet.h:198
@ AppletCaptureSharedBuffer_CallerApplet
CallerApplet.
Definition: applet.h:199
@ AppletCaptureSharedBuffer_LastApplication
LastApplication.
Definition: applet.h:197
Result appletQueryApplicationPlayStatisticsByUid(AccountUid uid, PdmApplicationPlayStatistics *stats, const u64 *application_ids, s32 count, s32 *total_out)
Same as appletQueryApplicationPlayStatistics except this gets playstats specific to the input userId.
Result appletStorageWrite(AppletStorage *s, s64 offset, const void *buffer, size_t size)
Writes to a storage.
Result appletSetTvPowerStateMatchingMode(AppletTvPowerStateMatchingMode mode)
Sets the AppletTvPowerStateMatchingMode.
Result appletJumpToSubApplicationProgramForDevelopment(u64 application_id, const void *buffer, size_t size)
Launches the specified ApplicationId.
Result appletDisableSleepTillShutdown(void)
DisableSleepTillShutdown.
Result appletApplicationAreAnyLibraryAppletsLeft(AppletApplication *a, bool *out)
AreAnyLibraryAppletsLeft which were created by the Application.
Result appletSetCpuBoostMode(ApmCpuBoostMode mode)
Sets the ApmCpuBoostMode.
Result appletCancelCpuBoostMode(void)
CancelCpuBoostMode.
Result appletIsForceTerminateApplicationDisabledForDebug(bool *out)
IsForceTerminateApplicationDisabledForDebug.
void appletHook(AppletHookCookie *cookie, AppletHookFn callback, void *param)
Sets up an applet status hook.
AppletWindowOriginMode
WindowOriginMode.
Definition: applet.h:203
@ AppletWindowOriginMode_UpperLeft
UpperLeft.
Definition: applet.h:205
@ AppletWindowOriginMode_LowerLeft
LowerLeft.
Definition: applet.h:204
Result appletHolderPopInteractiveOutData(AppletHolder *h, AppletStorage *s)
Pops a storage from LibraryApplet Interactive output.
Result appletPerformSystemButtonPressingIfInFocus(AppletSystemButtonType type)
Perform SystemButtonPressing with the specified AppletSystemButtonType.
Result appletGetDesiredLanguage(u64 *LanguageCode)
Gets the DesiredLanguage for the current host application control.nacp.
Result appletPushToGeneralChannel(AppletStorage *s)
Pushes a storage to the general channel.
Result appletUnlockForeground(void)
UnlockForeground.
Result appletGetGpuErrorDetectedSystemEvent(Event *out_event)
Gets an Event which is signaled for GpuErrorDetected.
Result appletGetCallerAppletCaptureImageEx(void *buffer, size_t size, bool *flag)
Gets the CallerApplet CaptureImage.
AppletFocusHandlingMode
FocusHandlingMode.
Definition: applet.h:74
@ AppletFocusHandlingMode_AlwaysSuspend
Always suspend when out of focus, regardless of the reason.
Definition: applet.h:78
@ AppletFocusHandlingMode_SuspendHomeSleepNotify
Suspend only when HOME menu is open / console is sleeping but still receive OnFocusState hook.
Definition: applet.h:77
@ AppletFocusHandlingMode_NoSuspend
Don't suspend when out of focus.
Definition: applet.h:76
@ AppletFocusHandlingMode_Max
Number of focus handling modes.
Definition: applet.h:80
@ AppletFocusHandlingMode_SuspendHomeSleep
Suspend only when HOME menu is open / console is sleeping (default).
Definition: applet.h:75
Result appletApplicationCheckRightsEnvironmentAvailable(AppletApplication *a, bool *out)
CheckRightsEnvironmentAvailable.
Result appletFriendInvitationClearApplicationParameter(void)
Clears the StorageChannel/saved-ApplicationId used by appletFriendInvitationSetApplicationParameter.
Result appletCreateStorage(AppletStorage *s, s64 size)
Creates a storage.
Result appletSetApplicationMemoryReservation(u64 val)
SetApplicationMemoryReservation.
Result appletGetApplicationIdForLogo(u64 *application_id)
Gets the ApplicationId for displaying the logo screen during application launch.
Result appletSetRestartMessageEnabled(bool flag)
Sets whether AppletMessage_Resume is enabled.
Result appletUpdateCallerAppletCaptureImage(void)
Update the CallerApplet CaptureImage.
Result appletPrepareForJit(void)
Launches the jit-sysmodule when it was not previously launched by this cmd.
Result appletIsVrModeEnabled(bool *out)
Gets whether VrMode is enabled.
Result appletGetLastApplicationCaptureImageEx(void *buffer, size_t size, bool *flag)
Gets the LastApplication CaptureImage.
Result appletApplicationRestartApplicationTimer(AppletApplication *a)
RestartApplicationTimer.
AppletId
AppletId.
Definition: applet.h:91
@ AppletId_LibraryAppletAuth
0100000000001001 "auth"
Definition: applet.h:97
@ AppletId_LibraryAppletDataErase
0100000000001004 "dataErase"
Definition: applet.h:100
@ AppletId_LibraryAppletShop
010000000000100B "LibAppletShop" ShopN applet
Definition: applet.h:107
@ AppletId_SystemAppletMenu
0100000000001000 "qlaunch" (SystemAppletMenu)
Definition: applet.h:95
@ AppletId_None
None.
Definition: applet.h:92
@ AppletId_LibraryAppletPhotoViewer
010000000000100D "photoViewer"
Definition: applet.h:108
@ AppletId_LibraryAppletMyPage
0100000000001013 "myPage"
Definition: applet.h:113
@ AppletId_LibraryAppletSwkbd
0100000000001008 "swkbd"
Definition: applet.h:104
@ AppletId_LibraryAppletCabinet
0100000000001002 "cabinet"
Definition: applet.h:98
@ AppletId_LibraryAppletNetConnect
0100000000001006 "netConnect"
Definition: applet.h:102
@ AppletId_LibraryAppletPlayerSelect
0100000000001007 "playerSelect"
Definition: applet.h:103
@ AppletId_OverlayApplet
010000000000100C "overlayDisp"
Definition: applet.h:94
@ AppletId_LibraryAppletSet
010000000000100E "set" (This applet is currently not present on retail devices.)
Definition: applet.h:109
@ AppletId_LibraryAppletError
0100000000001005 "error"
Definition: applet.h:101
@ AppletId_LibraryAppletOfflineWeb
010000000000100F "LibAppletOff" offlineWeb applet
Definition: applet.h:110
@ AppletId_LibraryAppletWifiWebAuth
0100000000001011 "LibAppletAuth" wifiWebAuth applet
Definition: applet.h:112
@ AppletId_LibraryAppletMiiEdit
0100000000001009 "miiEdit"
Definition: applet.h:105
@ AppletId_LibraryAppletController
0100000000001003 "controller"
Definition: applet.h:99
@ AppletId_LibraryAppletLoginShare
0100000000001010 "LibAppletLns" loginShare web-applet
Definition: applet.h:111
@ AppletId_application
Application. Not valid for use with LibraryApplets.
Definition: applet.h:93
@ AppletId_SystemApplication
0100000000001012 "starter" SystemApplication.
Definition: applet.h:96
@ AppletId_LibraryAppletWeb
010000000000100A "LibAppletWeb" WebApplet applet
Definition: applet.h:106
Service * appletGetServiceSession_CommonStateGetter(void)
Gets the Service object for ICommonStateGetter.
Result appletApplicationTerminateAllLibraryApplets(AppletApplication *a)
TerminateAllLibraryApplets which were created by the Application.
Result appletHolderPushInteractiveInData(AppletHolder *h, AppletStorage *s)
Pushes a storage for LibraryApplet Interactive input.
Result appletBeginToObserveHidInputForDevelop(void)
Enables HID input for the OverlayApplet, without disabling input for the foreground applet.
Result appletStorageGetSize(AppletStorage *s, s64 *size)
Gets the size of the storage. This is not usable with HandleStorage, use appletStorageGetHandle or ap...
Result appletGetCallerAppletIdentityInfo(AppletIdentityInfo *info)
Gets the AppletIdentityInfo for the CallerApplet.
Result appletSetDelayTimeToAbortOnGpuError(u64 val)
SetDelayTimeToAbortOnGpuError.
Result appletSetTransparentVolumeRate(float val)
Sets the TransparentVolumeRate.
Result appletGetAppletResourceUserIdOfCallerApplet(u64 *out)
Gets the AppletResourceUserId of the CallerApplet.
AppletOperationMode
OperationMode.
Definition: applet.h:34
@ AppletOperationMode_Handheld
Handheld.
Definition: applet.h:35
@ AppletOperationMode_Console
Console (Docked / TV-mode)
Definition: applet.h:36
Result appletGetSystemSharedLayerHandle(u64 *SharedBufferHandle, u64 *SharedLayerHandle)
Gets the System SharedBufferHandle and SharedLayerHandle.
Result appletExecuteProgram(s32 programIndex, const void *buffer, size_t size)
Launches Application {current_ApplicationId}+programIndex.
Result appletSetManagedDisplayLayerSeparationMode(u32 mode)
SetManagedDisplayLayerSeparationMode.
Result appletInvalidateTransitionLayer(void)
InvalidateTransitionLayer.
Result appletApplicationSetUsers(AppletApplication *a, const AccountUid *uids, s32 count, bool flag)
SetUsers for the Application.
Result appletCreateLibraryApplet(AppletHolder *h, AppletId id, LibAppletMode mode)
Creates a LibraryApplet.
Result appletGetOperationModeSystemInfo(u32 *info)
Gets the OperationModeSystemInfo.
Result appletUpdateDefaultDisplayResolution(void)
UpdateDefaultDisplayResolution.
void appletExit(void)
Exit applet, called automatically during app exit.
Result appletGpuErrorHandlerGetManualGpuErrorInfo(AppletGpuErrorHandler *g, void *buffer, size_t size, u64 *out)
GetManualGpuErrorInfo.
void appletUnhook(AppletHookCookie *cookie)
Removes an applet status hook.
AppletProgramSpecifyKind
ProgramSpecifyKind for the ExecuteProgram cmd. Controls the type of the u64 passed to the ExecuteProg...
Definition: applet.h:209
@ AppletProgramSpecifyKind_ExecuteProgram
u8 ProgramIndex.
Definition: applet.h:210
@ AppletProgramSpecifyKind_RestartProgram
u64 = value 0.
Definition: applet.h:212
@ AppletProgramSpecifyKind_JumpToSubApplicationProgramForDevelopment
u64 application_id. Only available when DebugMode is enabled.
Definition: applet.h:211
Event * appletGetMessageEvent(void)
Gets the event associated with notification messages.
Service * appletGetServiceSession_AudioController(void)
Gets the Service object for IAudioController.
Result appletApplicationGetApplicationLaunchRequestInfo(AppletApplication *a, AppletApplicationLaunchRequestInfo *out)
Gets the AppletApplicationLaunchRequestInfo for the Application.
Result appletApproveToDisplay(void)
Approve the display requested by AppletMessage_RequestToDisplay, see also appletSetHandlesRequestToDi...
Result appletApplicationGetApplicationLaunchProperty(AppletApplication *a, AppletApplicationLaunchProperty *out)
Gets the AppletApplicationLaunchProperty for the Application.
Result appletOpenMyGpuErrorHandler(AppletGpuErrorHandler *g)
Opens an AppletGpuErrorHandler.
Result appletReleaseLastForegroundCaptureSharedBuffer(void)
Release the LastForeground CaptureSharedBuffer.
Result appletGetReaderLockAccessorEx(AppletLockAccessor *a, u32 inval)
Gets a Reader AppletLockAccessor.
void appletLockAccessorClose(AppletLockAccessor *a)
Closes a LockAccessor.
Result appletRequestExitToSelf(void)
Exits the current applet.
Result appletGetLaunchStorageInfoForDebug(NcmStorageId *app_storageId, NcmStorageId *update_storageId)
Gets the LaunchStorageInfo.
Result appletRequestLaunchApplicationWithUserAndArgumentForDebug(u64 application_id, const AccountUid *uids, s32 total_uids, bool flag, const void *buffer, size_t size)
Requests to launch the specified Application, with the specified users.
bool appletApplicationActive(AppletApplication *a)
Returns whether the AppletApplication object was initialized.
Result appletPopFromGeneralChannel(AppletStorage *s)
Pops a storage from the general channel.
Result appletFriendInvitationSetApplicationParameter(AppletStorage *s, u64 application_id)
Clears a StorageChannel, pushes the input storage there, and writes the ApplicationId into state.
Result appletStorageRead(AppletStorage *s, s64 offset, void *buffer, size_t size)
Reads from a storage.
Result appletSetWirelessPriorityMode(AppletWirelessPriorityMode mode)
Sets the WirelessPriorityMode.
Result appletLeaveFatalSection(void)
Leave FatalSection.
AppletMessage
AppletMessage, for appletGetMessage. See also AppletHookType.
Definition: applet.h:54
@ AppletMessage_PerformanceModeChanged
PerformanceMode changed.
Definition: applet.h:59
@ AppletMessage_AlbumRecordingSaved
AlbumRecordingSaved.
Definition: applet.h:63
@ AppletMessage_Resume
Current applet execution was resumed.
Definition: applet.h:57
@ AppletMessage_OperationModeChanged
OperationMode changed.
Definition: applet.h:58
@ AppletMessage_AlbumScreenShotTaken
Screenshot was taken.
Definition: applet.h:62
@ AppletMessage_RequestToDisplay
Display requested, see appletApproveToDisplay.
Definition: applet.h:60
@ AppletMessage_CaptureButtonShortPressed
Capture button was short-pressed.
Definition: applet.h:61
@ AppletMessage_FocusStateChanged
FocusState changed.
Definition: applet.h:56
@ AppletMessage_ExitRequest
Exit request.
Definition: applet.h:55
Result appletPopExtraStorage(AppletStorage *s)
Pops a storage from current-LibraryApplet Extra input.
Result appletRestartProgram(const void *buffer, size_t size)
Relaunches the current Application.
Result appletGetNextReturnDestinationAppletIdentityInfo(AppletIdentityInfo *info)
Gets the AppletIdentityInfo for the NextReturnDestinationApplet.
Result appletOverrideAutoSleepTimeAndDimmingTime(s32 inval0, s32 inval1, s32 inval2, s32 inval3)
OverrideAutoSleepTimeAndDimmingTime.
Result appletLockAccessorUnlock(AppletLockAccessor *a)
Unlock a LockAccessor.
AppletThemeColorType
ThemeColorType.
Definition: applet.h:145
Result appletApplicationRequestExitLibraryAppletOrTerminate(AppletApplication *a, u64 timeout)
Calls the same func as appletHolderRequestExitOrTerminate with the output IAppletAccessor from the Ge...
Result appletReleaseCallerAppletCaptureSharedBuffer(void)
Release the CallerApplet CaptureSharedBuffer.
Result appletBeginToWatchShortHomeButtonMessage(void)
Stops forwarding the input to the foreground app.
Result appletSetAppletGpuTimeSlice(s64 val)
Sets the AppletGpuTimeSlice.
AlbumImageOrientation
ImageOrientation.
Definition: caps.h:12
AlbumReportOption
AlbumReportOption.
Definition: caps.h:20
NcmStorageId
StorageId.
Definition: ncm_types.h:12
PmBootMode
BootMode.
Definition: pm.h:54
SetKeyboardLayout
KeyboardLayout.
Definition: set.h:189
SetSysPlatformRegion
PlatformRegion. Other values not listed here should be handled as "Unknown".
Definition: set.h:220
Account UserId.
Definition: acc.h:25
Attributes for launching applications for Quest.
Definition: applet.h:296
u32 unk_x4
See AppletApplicationAttribute::unk_x4.
Definition: applet.h:298
float volume
[7.0.0+] See AppletApplicationAttribute::volume.
Definition: applet.h:299
u32 unk_x0
See AppletApplicationAttribute::unk_x0.
Definition: applet.h:297
ApplicationAttribute.
Definition: applet.h:303
u32 unk_x0
Default is 0 for non-Quest. Only used when non-zero: unknown value in seconds.
Definition: applet.h:304
u32 unk_x4
Default is 0 for non-Quest. Only used when non-zero: unknown value in seconds.
Definition: applet.h:305
float volume
Audio volume. Must be in the range of 0.0f-1.0f. The default is 1.0f.
Definition: applet.h:306
ApplicationLaunchProperty.
Definition: applet.h:311
u8 app_storageId
NcmStorageId for the Application.
Definition: applet.h:314
u8 update_storageId
NcmStorageId for the Application update.
Definition: applet.h:315
u32 version
Application version.
Definition: applet.h:313
u8 unk_xa
Unknown.
Definition: applet.h:316
u64 application_id
ApplicationId.
Definition: applet.h:312
u8 pad
Padding.
Definition: applet.h:317
ApplicationLaunchRequestInfo.
Definition: applet.h:321
u32 unk_x0
Unknown. The default is 0x0 with appletCreateSystemApplication, 0x3 with appletCreateApplication.
Definition: applet.h:322
u32 unk_x4
Unknown. The default is 0x0 with appletCreateSystemApplication, 0x3 with appletCreateApplication.
Definition: applet.h:323
IApplicationAccessor container.
Definition: applet.h:252
AppletApplicationExitReason exitreason
Set by appletApplicationJoin using the output from cmd GetResult, see AppletApplicationExitReason.
Definition: applet.h:255
Event StateChangedEvent
Output from GetAppletStateChangedEvent, autoclear=false.
Definition: applet.h:254
Service s
IApplicationAccessor.
Definition: applet.h:253
Used by appletInitialize with __nx_applet_AppletAttribute for cmd OpenLibraryAppletProxy (AppletType_...
Definition: applet.h:264
u8 flag
Flag. When non-zero, two state fields are set to 1.
Definition: applet.h:265
GpuErrorHandler.
Definition: applet.h:259
Service s
IGpuErrorHandler.
Definition: applet.h:260
LibraryApplet state.
Definition: applet.h:241
u64 layer_handle
Output from GetIndirectLayerConsumerHandle on [2.0.0+].
Definition: applet.h:246
LibAppletExitReason exitreason
Set by appletHolderJoin using the output from cmd GetResult, see LibAppletExitReason.
Definition: applet.h:248
bool creating_self
When set, indicates that the LibraryApplet is creating itself.
Definition: applet.h:247
Event StateChangedEvent
Output from GetAppletStateChangedEvent, autoclear=false.
Definition: applet.h:243
Event PopInteractiveOutDataEvent
Output from GetPopInteractiveOutDataEvent, autoclear=false.
Definition: applet.h:244
LibAppletMode mode
See ref LibAppletMode.
Definition: applet.h:245
Service s
ILibraryAppletAccessor.
Definition: applet.h:242
applet hook cookie.
Definition: applet.h:222
void * param
Callback parameter.
Definition: applet.h:225
AppletHookCookie * next
Next cookie.
Definition: applet.h:223
AppletHookFn callback
Hook callback.
Definition: applet.h:224
IdentityInfo.
Definition: applet.h:289
u64 application_id
ApplicationId, only set with appletId == AppletId_application.
Definition: applet.h:292
u32 pad
Padding.
Definition: applet.h:291
AppletId appletId
AppletId
Definition: applet.h:290
Cached info for the current LibraryApplet, from appletGetAppletInfo.
Definition: applet.h:282
LibAppletInfo info
Output from appletGetLibraryAppletInfo.
Definition: applet.h:283
bool caller_flag
Loaded from AppletProcessLaunchReason::flag, indicates that the below AppletHolder is initialized.
Definition: applet.h:284
AppletHolder caller
AppletHolder for the CallingLibraryApplet, automatically closed by appletExit when needed.
Definition: applet.h:285
LockAccessor.
Definition: applet.h:229
Event event
Event from the GetEvent cmd, with autoclear=false.
Definition: applet.h:231
Service s
ILockAccessor.
Definition: applet.h:230
AppletProcessLaunchReason, from GetLaunchReason.
Definition: applet.h:276
u8 flag
When non-zero, indicates that OpenCallingLibraryApplet should be used.
Definition: applet.h:277
AppletResourceUsageInfo, from appletGetAppletResourceUsageInfo.
Definition: applet.h:328
u32 counter2
Output from ns cmd GetRightsEnvironmentCountForDebug.
Definition: applet.h:331
u32 counter1
Unknown counter.
Definition: applet.h:330
u32 counter0
Unknown counter.
Definition: applet.h:329
applet IStorage
Definition: applet.h:235
Service s
IStorage.
Definition: applet.h:236
TransferMemory tmem
TransferMemory.
Definition: applet.h:237
Kernel-mode event structure.
Definition: event.h:13
LibraryAppletInfo.
Definition: applet.h:270
AppletId appletId
AppletId
Definition: applet.h:271
LibAppletMode mode
LibAppletMode
Definition: applet.h:272
ns ApplicationControlProperty
Definition: nacp.h:34
ApplicationPlayStatistics.
Definition: pdm.h:213
Service object structure.
Definition: service.h:14
Transfer memory information structure.
Definition: tmem.h:13
Definition: types.h:48
int64_t s64
64-bit signed integer.
Definition: types.h:28
uint64_t u64
64-bit unsigned integer.
Definition: types.h:22
uint8_t u8
8-bit unsigned integer.
Definition: types.h:19
u32 Handle
Kernel object handle.
Definition: types.h:43
u32 Result
Function error code result type.
Definition: types.h:44
#define NX_CONSTEXPR
Flags a function as constexpr in C++14 and above; or as (always) inline otherwise.
Definition: types.h:92
int32_t s32
32-bit signed integer.
Definition: types.h:27
uint32_t u32
32-bit unsigned integer.
Definition: types.h:21