Minor appletNotifyRunning improvements and added docs.

This commit is contained in:
yellows8 2019-07-25 20:22:36 -04:00
parent 493abc7703
commit 3b2e484d88
No known key found for this signature in database
GPG Key ID: 0AF90DA3F1E60E43
2 changed files with 7 additions and 34 deletions

View File

@ -728,7 +728,11 @@ Result appletBeginBlockingHomeButton(s64 val);
*/
Result appletEndBlockingHomeButton(void);
void appletNotifyRunning(u8 *out);
/**
* @brief Notify that the app is now running, for the Application logo screen. This throws a fatal-error on failure.
* @note This will just return when applet-type isn't AppletType_Application, or when this was already used previously. Used automatically by \ref appletInitialize when __nx_applet_auto_notifyrunning is set to true (the default value).
*/
void appletNotifyRunning(bool *out);
/**
* @brief Gets the PseudoDeviceId. This is derived from the output of a ns command, and from data in the host title control.nacp.

View File

@ -2609,42 +2609,11 @@ Result appletEndBlockingHomeButton(void) {
return _appletCmdNoIO(&g_appletIFunctions, 33);
}
void appletNotifyRunning(u8 *out) {
IpcCommand c;
ipcInitialize(&c);
void appletNotifyRunning(bool *out) {
if (__nx_applet_type!=AppletType_Application || g_appletNotifiedRunning) return;
g_appletNotifiedRunning = 1;
struct {
u64 magic;
u64 cmd_id;
} *raw;
raw = serviceIpcPrepareHeader(&g_appletIFunctions, &c, sizeof(*raw));
raw->magic = SFCI_MAGIC;
raw->cmd_id = 40;
Result rc = serviceIpcDispatch(&g_appletIFunctions);
if (R_SUCCEEDED(rc)) {
IpcParsedCommand r;
struct {
u64 magic;
u64 result;
u8 out;
} *resp;
serviceIpcParse(&g_appletIFunctions, &r, sizeof(*resp));
resp = r.Raw;
rc = resp->result;
if (R_SUCCEEDED(rc) && out) {
*out = resp->out;
}
}
Result rc = _appletCmdNoInOutBool(&g_appletIFunctions, out, 40);
if (R_FAILED(rc)) fatalSimple(MAKERESULT(Module_Libnx, LibnxError_BadAppletNotifyRunning));
}