diff --git a/nx/include/switch/applets/libapplet.h b/nx/include/switch/applets/libapplet.h index 0a1d0cb1..47844f88 100644 --- a/nx/include/switch/applets/libapplet.h +++ b/nx/include/switch/applets/libapplet.h @@ -41,3 +41,11 @@ void libappletArgsSetPlayStartupSound(LibAppletArgs* a, bool flag); */ Result libappletArgsPush(LibAppletArgs* a, AppletHolder *h); +/// Wrapper for \ref appletPushToGeneralChannel, see appletPushToGeneralChannel regarding the requirements for using this. +/// Returns to the main Home Menu, equivalent to pressing the HOME button. +Result libappletRequestHomeMenu(void); + +/// Wrapper for \ref appletPushToGeneralChannel, see appletPushToGeneralChannel regarding the requirements for using this. +/// Equivalent to entering "System Update" under System Settings. When leaving this, it returns to the main Home Menu. +Result libappletRequestJumpToSystemUpdate(void); + diff --git a/nx/source/applets/libapplet.c b/nx/source/applets/libapplet.c index ae4d6cb8..ae8115e5 100644 --- a/nx/source/applets/libapplet.c +++ b/nx/source/applets/libapplet.c @@ -40,3 +40,29 @@ Result libappletArgsPush(LibAppletArgs* a, AppletHolder *h) { return appletHolderPushInData(h, &storage); } +static Result _libappletQlaunchRequest(u8* buf, size_t size) { + Result rc=0; + AppletStorage storage; + + rc = appletCreateStorage(&storage, size); + if (R_FAILED(rc)) return rc; + + rc = appletStorageWrite(&storage, 0, buf, size); + if (R_FAILED(rc)) { + appletStorageClose(&storage); + return rc; + } + + return appletPushToGeneralChannel(&storage); +} + +Result libappletRequestHomeMenu(void) { + u8 storagedata[0x10] = {0x53, 0x41, 0x4d, 0x53, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00};//RequestHomeMenu + return _libappletQlaunchRequest(storagedata, sizeof(storagedata)); +} + +Result libappletRequestJumpToSystemUpdate(void) { + u8 storagedata[0x10] = {0x53, 0x41, 0x4d, 0x53, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00};//RequestJumpToSystemUpdate + return _libappletQlaunchRequest(storagedata, sizeof(storagedata)); +} +