mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 12:32:40 +02:00
Minor appletNotifyRunning improvements and added docs.
This commit is contained in:
parent
493abc7703
commit
3b2e484d88
@ -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.
|
||||
|
@ -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));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user