diff --git a/nx/include/switch/services/applet.h b/nx/include/switch/services/applet.h index 68a9ad81..8defa352 100644 --- a/nx/include/switch/services/applet.h +++ b/nx/include/switch/services/applet.h @@ -259,6 +259,18 @@ Result appletSetGamePlayRecordingState(bool state); /// Only usable when running under a title which supports video recording. Using this is only needed when the host title control.nacp has VideoCaptureMode set to Enabled, with Automatic appletInitializeGamePlayRecording is not needed. Result appletInitializeGamePlayRecording(void); +/** + * @brief Requests a system shutdown. + * @note Only available with AppletType_*Application on 3.0.0+. + */ +Result appletRequestToShutdown(void); + +/** + * @brief Requests a system reboot. + * @note Only available with AppletType_*Application on 3.0.0+. + */ +Result appletRequestToReboot(void); + /** * @brief Gets ApplicationPlayStatistics. * @note Only available with AppletType_*Application on 5.0.0+. diff --git a/nx/source/services/applet.c b/nx/source/services/applet.c index 166713a0..ce0694a4 100644 --- a/nx/source/services/applet.c +++ b/nx/source/services/applet.c @@ -1561,6 +1561,24 @@ Result appletInitializeGamePlayRecording(void) { return rc; } +Result appletRequestToShutdown(void) { + if (!serviceIsActive(&g_appletSrv) || !_appletIsApplication()) + return MAKERESULT(Module_Libnx, LibnxError_NotInitialized); + if (hosversionBefore(3,0,0)) + return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); + + return _appletCmdNoIO(&g_appletIFunctions, 70); +} + +Result appletRequestToReboot(void) { + if (!serviceIsActive(&g_appletSrv) || !_appletIsApplication()) + return MAKERESULT(Module_Libnx, LibnxError_NotInitialized); + if (hosversionBefore(3,0,0)) + return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); + + return _appletCmdNoIO(&g_appletIFunctions, 71); +} + //Official sw has these under 'pdm'. Result appletQueryApplicationPlayStatistics(PdmApplicationPlayStatistics *stats, const u64 *titleIDs, s32 count, s32 *total_out) { IpcCommand c;