Added appletRequestToAcquireSleepLock, appletReleaseSleepLock, and appletReleaseSleepLockTransiently.

This commit is contained in:
yellows8 2019-08-03 20:53:42 -04:00
parent d73e1a09b5
commit 6c194fc6a6
No known key found for this signature in database
GPG Key ID: 0AF90DA3F1E60E43
2 changed files with 47 additions and 0 deletions

View File

@ -263,6 +263,23 @@ Result appletGetCradleStatus(u8 *status);
*/
Result appletGetBootMode(PmBootMode *mode);
/**
* @brief Request to AcquireSleepLock.
* @note On success, this then uses cmd GetAcquiredSleepLockEvent and waits on that event.
*/
Result appletRequestToAcquireSleepLock(void);
/**
* @brief Release the SleepLock.
*/
Result appletReleaseSleepLock(void);
/**
* @brief Release the SleepLock transiently.
* @note On success, this then uses cmd GetAcquiredSleepLockEvent and waits on that event.
*/
Result appletReleaseSleepLockTransiently(void);
/**
* @brief Pushes a storage to the general channel. Used for sending requests to qlaunch.
* @note This is not usable under an Application, however it is usable under a LibraryApplet.

View File

@ -1272,6 +1272,36 @@ static Result _appletGetCurrentFocusState(u8 *out) {
return rc;
}
static Result _appletGetAcquiredSleepLockEvent(Event *out_event) {
return _appletGetEvent(&g_appletICommonStateGetter, out_event, 13, false);
}
static Result _appletWaitAcquiredSleepLockEvent(void) {
Result rc=0;
Event tmpevent={0};
rc = _appletGetAcquiredSleepLockEvent(&tmpevent);
if (R_SUCCEEDED(rc)) rc = eventWait(&tmpevent, U64_MAX);
eventClose(&tmpevent);
return rc;
}
Result appletRequestToAcquireSleepLock(void) {
Result rc = _appletCmdNoIO(&g_appletICommonStateGetter, 10);
if (R_SUCCEEDED(rc)) rc = _appletWaitAcquiredSleepLockEvent();
return rc;
}
Result appletReleaseSleepLock(void) {
return _appletCmdNoIO(&g_appletICommonStateGetter, 11);
}
Result appletReleaseSleepLockTransiently(void) {
Result rc = _appletCmdNoIO(&g_appletICommonStateGetter, 12);
if (R_SUCCEEDED(rc)) rc = _appletWaitAcquiredSleepLockEvent();
return rc;
}
Result appletPushToGeneralChannel(AppletStorage *s) {
return _appletCmdInStorage(&g_appletICommonStateGetter, s, 20);
}