applet: Add appletSelfExit()

This commit is contained in:
leo60228 2018-09-18 16:07:58 -04:00 committed by yellows8
parent 00b12b93fb
commit 1c948e2d32
2 changed files with 37 additions and 0 deletions

View File

@ -71,6 +71,12 @@ Result appletSetScreenShotPermission(s32 val);
Result appletSetScreenShotImageOrientation(s32 val); Result appletSetScreenShotImageOrientation(s32 val);
/**
* @brief Exits the application.
* @note Can only be used with AppletType_Application.
*/
Result appletSelfExit(void);
/** /**
* @brief Processes the current applet status. Generally used within a main loop. * @brief Processes the current applet status. Generally used within a main loop.
* @return Whether the application should continue running. * @return Whether the application should continue running.

View File

@ -1071,6 +1071,37 @@ Result appletSetScreenShotImageOrientation(s32 val) {
return rc; return rc;
} }
Result appletSelfExit(void) {
IpcCommand c;
ipcInitialize(&c);
struct {
u64 magic;
u64 cmd_id;
} *raw;
raw = ipcPrepareHeader(&c, sizeof(*raw));
raw->magic = SFCI_MAGIC;
raw->cmd_id = 0;
Result rc = serviceIpcDispatch(&g_appletISelfController);
if (R_SUCCEEDED(rc)) {
IpcParsedCommand r;
ipcParse(&r);
struct {
u64 magic;
u64 result;
} *resp = r.Raw;
rc = resp->result;
}
return rc;
}
Result appletCreateManagedDisplayLayer(u64 *out) { Result appletCreateManagedDisplayLayer(u64 *out) {
IpcCommand c; IpcCommand c;
ipcInitialize(&c); ipcInitialize(&c);