From 0f8e18573df7deb41d900722c248bf5112640426 Mon Sep 17 00:00:00 2001 From: yellows8 Date: Tue, 20 Aug 2019 11:19:49 -0400 Subject: [PATCH] Added appletLaunchDevMenu. --- nx/include/switch/services/applet.h | 7 +++++++ nx/source/services/applet.c | 13 +++++++++++++ 2 files changed, 20 insertions(+) diff --git a/nx/include/switch/services/applet.h b/nx/include/switch/services/applet.h index 5ff96c44..a869cfdb 100644 --- a/nx/include/switch/services/applet.h +++ b/nx/include/switch/services/applet.h @@ -1381,6 +1381,13 @@ Result appletGetHomeButtonWriterLockAccessor(AppletLockAccessor *a); */ Result appletPopRequestLaunchApplicationForDebug(u128 *userIDs, s32 count, u64 *titleID, s32 *total_out); +/** + * @brief Launches DevMenu and the dev Overlay-applet. This will enter an infinite-sleep-loop on success. + * @note Only available with AppletType_SystemApplet on [8.0.0+]. + * @note This verifies that DebugMode is enabled, then uses a ns cmd. That cmd then loads the system-settings for these two titleIDs (which normally only exist on devunits), and verifies that these titles are installed + launches them. + */ +Result appletLaunchDevMenu(void); + // IGlobalStateController /** diff --git a/nx/source/services/applet.c b/nx/source/services/applet.c index 3da3f8c1..5a512ff5 100644 --- a/nx/source/services/applet.c +++ b/nx/source/services/applet.c @@ -4314,6 +4314,19 @@ Result appletPopRequestLaunchApplicationForDebug(u128 *userIDs, s32 count, u64 * return rc; } +Result appletLaunchDevMenu(void) { + Result rc=0; + + if (__nx_applet_type != AppletType_SystemApplet) + return MAKERESULT(Module_Libnx, LibnxError_NotInitialized); + if (hosversionBefore(8,0,0)) + return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); + + rc = _appletCmdNoIO(&g_appletIFunctions, 200); + if (R_SUCCEEDED(rc)) _appletInfiniteSleepLoop(); + return rc; +} + // IGlobalStateController Result appletStartSleepSequence(bool flag) {