diff --git a/nx/include/switch/services/applet.h b/nx/include/switch/services/applet.h index 419edf7c..f72c37d9 100644 --- a/nx/include/switch/services/applet.h +++ b/nx/include/switch/services/applet.h @@ -1372,17 +1372,73 @@ Result appletGetNextReturnDestinationAppletIdentityInfo(AppletIdentityInfo *info // IFunctions for AppletType_OverlayApplet (IOverlayFunctions). /** - * @brief Stops forwarding the input to the foreground app, works only in the Overlay applet context. + * @brief Stops forwarding the input to the foreground app. + * @note Only available with AppletType_OverlayApplet. * @note You have to call this to receive inputs through the hid service when running as the overlay applet. */ Result appletBeginToWatchShortHomeButtonMessage(void); /** - * @brief Forwards input to the foreground app, works only in the Overlay applet context. + * @brief Forwards input to the foreground app. + * @note Only available with AppletType_OverlayApplet. * @note After calling this the overlay applet won't receive any input until \ref appletBeginToWatchShortHomeButtonMessage is called again. */ Result appletEndToWatchShortHomeButtonMessage(void); +/** + * @brief Gets the application titleID for displaying the logo screen during application launch. + * @note Only available with AppletType_OverlayApplet. + * @param[out] titleID Output application titleID, 0 when no application is running. + */ +Result appletGetApplicationIdForLogo(u64 *titleID); + +/** + * @brief Sets the GpuTimeSliceBoost. + * @note Only available with AppletType_OverlayApplet. + * @param[in] val Input value. + */ +Result appletSetGpuTimeSliceBoost(u64 val); + +/** + * @brief Sets AutoSleepTimeAndDimmingTimeEnabled. + * @note Only available with AppletType_OverlayApplet on [2.0.0+]. + * @param[in] flag Flag + */ +Result appletSetAutoSleepTimeAndDimmingTimeEnabled(bool flag); + +/** + * @brief TerminateApplicationAndSetReason + * @note Only available with AppletType_OverlayApplet on [2.0.0+]. + * @param[in] reason Result reason. + */ +Result appletTerminateApplicationAndSetReason(Result reason); + +/** + * @brief Sets ScreenShotPermissionGlobally. + * @note Only available with AppletType_OverlayApplet on [3.0.0+]. + * @param[in] flag Flag + */ +Result appletSetScreenShotPermissionGlobally(bool flag); + +/** + * @brief Start the system-shutdown sequence. + * @note Only available with AppletType_SystemApplet on [6.0.0+]. + */ +Result appletStartShutdownSequenceForOverlay(void); + +/** + * @brief Start the system-reboot sequence. + * @note Only available with AppletType_SystemApplet on [6.0.0+]. + */ +Result appletStartRebootSequenceForOverlay(void); + +/** + * @brief Sets HandlingHomeButtonShortPressedEnabled. + * @note Only available with AppletType_OverlayApplet on [8.0.0+]. + * @param[in] flag Flag + */ +Result appletSetHandlingHomeButtonShortPressedEnabled(bool flag); + // IAppletCommonFunctions /** diff --git a/nx/source/services/applet.c b/nx/source/services/applet.c index ba7e93c7..ba471f24 100644 --- a/nx/source/services/applet.c +++ b/nx/source/services/applet.c @@ -4154,6 +4154,74 @@ Result appletEndToWatchShortHomeButtonMessage(void) { return _appletCmdNoIO(&g_appletIFunctions, 1); } +Result appletGetApplicationIdForLogo(u64 *titleID) { + if (__nx_applet_type != AppletType_OverlayApplet) + return MAKERESULT(Module_Libnx, LibnxError_NotInitialized); + + return _appletCmdNoInOut64(&g_appletIFunctions, titleID, 2); +} + +Result appletSetGpuTimeSliceBoost(u64 val) { + if (__nx_applet_type != AppletType_OverlayApplet) + return MAKERESULT(Module_Libnx, LibnxError_NotInitialized); + + return _appletCmdInU64(&g_appletIFunctions, val, 3); +} + +Result appletSetAutoSleepTimeAndDimmingTimeEnabled(bool flag) { + if (__nx_applet_type != AppletType_OverlayApplet) + return MAKERESULT(Module_Libnx, LibnxError_NotInitialized); + if (hosversionBefore(2,0,0)) + return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); + + return _appletCmdInBool(&g_appletIFunctions, flag, 4); +} + +Result appletTerminateApplicationAndSetReason(Result reason) { + if (__nx_applet_type != AppletType_OverlayApplet) + return MAKERESULT(Module_Libnx, LibnxError_NotInitialized); + if (hosversionBefore(2,0,0)) + return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); + + return _appletCmdInU32(&g_appletIFunctions, reason, 5); +} + +Result appletSetScreenShotPermissionGlobally(bool flag) { + if (__nx_applet_type != AppletType_OverlayApplet) + return MAKERESULT(Module_Libnx, LibnxError_NotInitialized); + if (hosversionBefore(3,0,0)) + return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); + + return _appletCmdInBool(&g_appletIFunctions, flag, 6); +} + +Result appletStartShutdownSequenceForOverlay(void) { + if (__nx_applet_type != AppletType_OverlayApplet) + return MAKERESULT(Module_Libnx, LibnxError_NotInitialized); + if (hosversionBefore(6,0,0)) + return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); + + return _appletCmdNoIO(&g_appletIFunctions, 10); +} + +Result appletStartRebootSequenceForOverlay(void) { + if (__nx_applet_type != AppletType_OverlayApplet) + return MAKERESULT(Module_Libnx, LibnxError_NotInitialized); + if (hosversionBefore(6,0,0)) + return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); + + return _appletCmdNoIO(&g_appletIFunctions, 11); +} + +Result appletSetHandlingHomeButtonShortPressedEnabled(bool flag) { + if (__nx_applet_type != AppletType_OverlayApplet) + return MAKERESULT(Module_Libnx, LibnxError_NotInitialized); + if (hosversionBefore(8,0,0)) + return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); + + return _appletCmdInBool(&g_appletIFunctions, flag, 20); +} + // IAppletCommonFunctions Result appletReadThemeStorage(void* buffer, size_t size, u64 offset, size_t *transfer_size) {