diff --git a/nx/include/switch/services/applet.h b/nx/include/switch/services/applet.h index bf1b2e6d..38cec328 100644 --- a/nx/include/switch/services/applet.h +++ b/nx/include/switch/services/applet.h @@ -2189,13 +2189,6 @@ Result appletStartShutdownSequenceForOverlay(void); */ Result appletStartRebootSequenceForOverlay(void); -/** - * @brief Sets HandlingHomeButtonShortPressedEnabled. - * @note Only available with AppletType_OverlayApplet on [8.0.0+]. - * @param[in] flag Flag - */ -Result appletSetHandlingHomeButtonShortPressedEnabled(bool flag); - /** * @brief SetHealthWarningShowingState * @note Only available with AppletType_OverlayApplet on [9.0.0+]. @@ -2418,6 +2411,13 @@ Result appletGetLaunchStorageInfoForDebug(NcmStorageId *app_storageId, NcmStorag */ Result appletGetGpuErrorDetectedSystemEvent(Event *out_event); +/** + * @brief Sets HandlingHomeButtonShortPressedEnabled. + * @note Only available with AppletType_OverlayApplet on [8.0.0+]. Or with non-AppletType_OverlayApplet on [9.1.0+]. + * @param[in] flag Flag + */ +Result appletSetHandlingHomeButtonShortPressedEnabled(bool flag); + ///@} ///@name State / other diff --git a/nx/source/services/applet.c b/nx/source/services/applet.c index bbe93e7a..be6d2708 100644 --- a/nx/source/services/applet.c +++ b/nx/source/services/applet.c @@ -2675,7 +2675,6 @@ Result appletStartRebootSequenceForOverlay(void) { return rc; } -IPC_MAKE_CMD_IMPL_INITEXPR_HOSVER(Result appletSetHandlingHomeButtonShortPressedEnabled(bool flag), &g_appletIFunctions, 20, _appletCmdInBoolNoOut, __nx_applet_type != AppletType_OverlayApplet, (8,0,0), flag) IPC_MAKE_CMD_IMPL_INITEXPR_HOSVER(Result appletSetHealthWarningShowingState(bool flag), &g_appletIFunctions, 30, _appletCmdInBoolNoOut, __nx_applet_type != AppletType_OverlayApplet, (9,0,0), flag) IPC_MAKE_CMD_IMPL_INITEXPR_HOSVER(Result appletBeginToObserveHidInputForDevelop(void), &g_appletIFunctions, 101, _appletCmdNoIO, __nx_applet_type != AppletType_OverlayApplet, (5,0,0)) @@ -2832,6 +2831,22 @@ Result appletGetGpuErrorDetectedSystemEvent(Event *out_event) { return _appletCmdGetEvent(srv, out_event, false, 130); } +Result appletSetHandlingHomeButtonShortPressedEnabled(bool flag) { + if (__nx_applet_type == AppletType_OverlayApplet && hosversionBefore(8,0,0)) + return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); + if (__nx_applet_type != AppletType_OverlayApplet && hosversionBefore(9,1,0)) + return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); + + Service *srv = &g_appletIFunctions; + u32 cmd_id = 20; + if (__nx_applet_type != AppletType_OverlayApplet && hosversionAtLeast(9,1,0)) { + srv = &g_appletICommonStateGetter; + cmd_id = 100; + } + + return _appletCmdInBoolNoOut(srv, flag, cmd_id); +} + // State / other AppletOperationMode appletGetOperationMode(void) {