mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 12:32:40 +02:00
Added appletRequestToAcquireSleepLock, appletReleaseSleepLock, and appletReleaseSleepLockTransiently.
This commit is contained in:
parent
d73e1a09b5
commit
6c194fc6a6
@ -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.
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user