diff --git a/nx/include/switch/services/applet.h b/nx/include/switch/services/applet.h index c9db8a11..15fcc0df 100644 --- a/nx/include/switch/services/applet.h +++ b/nx/include/switch/services/applet.h @@ -1402,6 +1402,12 @@ Result appletGetNextReturnDestinationAppletIdentityInfo(AppletIdentityInfo *info */ Result appletGetMainAppletApplicationDesiredLanguage(u64 *LanguageCode); +/** + * @brief Exits the current applet. Same as \ref appletHolderRequestExit except this is for the current applet. + * @note Only available with AppletType_LibraryApplet on [6.0.0+]. + */ +Result appletRequestExitToSelf(void); + // IFunctions for AppletType_OverlayApplet (IOverlayFunctions). /** diff --git a/nx/source/services/applet.c b/nx/source/services/applet.c index 41930139..849242ff 100644 --- a/nx/source/services/applet.c +++ b/nx/source/services/applet.c @@ -4201,6 +4201,15 @@ Result appletGetMainAppletApplicationDesiredLanguage(u64 *LanguageCode) { return _appletCmdNoInOut64(&g_appletILibraryAppletSelfAccessor, LanguageCode, 60); } +Result appletRequestExitToSelf(void) { + if (__nx_applet_type != AppletType_LibraryApplet) + return MAKERESULT(Module_Libnx, LibnxError_NotInitialized); + if (hosversionBefore(6,0,0)) + return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); + + return _appletCmdNoIO(&g_appletILibraryAppletSelfAccessor, 80); +} + // IOverlayFunctions Result appletBeginToWatchShortHomeButtonMessage(void) {