apt: Add APT_LockTransition, use it in aptWaitForWakeUp
This commit is contained in:
parent
6ce690828c
commit
b48b5da211
@ -371,10 +371,16 @@ Result APT_AppletUtility(int id, void* out, size_t outSize, const void* in, size
|
||||
/// Sleeps if shell is closed (?).
|
||||
Result APT_SleepIfShellClosed(void);
|
||||
|
||||
/**
|
||||
* @brief Locks a transition (?).
|
||||
* @param transition Transition ID.
|
||||
* @param flag Flag (?)
|
||||
*/
|
||||
Result APT_LockTransition(u32 transition, bool flag);
|
||||
|
||||
/**
|
||||
* @brief Tries to lock a transition (?).
|
||||
* @param transition Transition ID.
|
||||
* @param succeeded Pointer to output whether the lock was successfully applied.
|
||||
*/
|
||||
Result APT_TryLockTransition(u32 transition, bool* succeeded);
|
||||
|
||||
|
@ -480,9 +480,9 @@ APT_Command aptWaitForWakeUp(APT_Transition transition)
|
||||
{
|
||||
APT_Command cmd;
|
||||
APT_NotifyToWait(envGetAptAppId());
|
||||
aptFlags &= ~FLAG_ACTIVE;
|
||||
if (transition != TR_ENABLE)
|
||||
APT_SleepIfShellClosed();
|
||||
aptFlags &= ~FLAG_ACTIVE;
|
||||
for (;;)
|
||||
{
|
||||
Result res = aptReceiveParameter(&cmd, NULL, NULL);
|
||||
@ -512,8 +512,8 @@ APT_Command aptWaitForWakeUp(APT_Transition transition)
|
||||
APT_SleepIfShellClosed();
|
||||
} else
|
||||
{
|
||||
bool dummy;
|
||||
APT_TryLockTransition(0x01, &dummy);
|
||||
aptHomeButtonState = 1;
|
||||
APT_LockTransition(0x01, true);
|
||||
}
|
||||
|
||||
if (transition == TR_JUMPTOMENU || transition == TR_LIBAPPLET || transition == TR_SYSAPPLET || transition == TR_APPJUMP)
|
||||
@ -991,6 +991,18 @@ Result APT_SleepIfShellClosed(void)
|
||||
return APT_AppletUtility(4, &out, sizeof(out), &in, sizeof(in));
|
||||
}
|
||||
|
||||
Result APT_LockTransition(u32 transition, bool flag)
|
||||
{
|
||||
const struct
|
||||
{
|
||||
u32 transition;
|
||||
bool flag;
|
||||
u8 padding[3];
|
||||
} in = { transition, flag, {0} };
|
||||
u8 out;
|
||||
return APT_AppletUtility(5, &out, sizeof(out), &in, sizeof(in));
|
||||
}
|
||||
|
||||
Result APT_TryLockTransition(u32 transition, bool* succeeded)
|
||||
{
|
||||
return APT_AppletUtility(6, &succeeded, sizeof(succeeded), &transition, sizeof(transition));
|
||||
|
Loading…
Reference in New Issue
Block a user