MCPcopy Create free account
hub / github.com/devkitPro/libctru / aptWaitForWakeUp

Function aptWaitForWakeUp

libctru/source/services/apt.c:647–703  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

645}
646
647APT_Command aptWaitForWakeUp(APT_Transition transition)
648{
649 APT_Command cmd;
650 APT_NotifyToWait(envGetAptAppId());
651 aptFlags &= ~FLAG_ACTIVE;
652 if (transition != TR_ENABLE)
653 APT_SleepIfShellClosed();
654 for (;;)
655 {
656 Result res = aptReceiveParameter(&cmd, NULL, NULL);
657 if (R_SUCCEEDED(res)
658 && (cmd==APTCMD_WAKEUP || cmd==APTCMD_WAKEUP_PAUSE || cmd==APTCMD_WAKEUP_EXIT || cmd==APTCMD_WAKEUP_CANCEL
659 || cmd==APTCMD_WAKEUP_CANCELALL || cmd==APTCMD_WAKEUP_POWERBUTTON || cmd==APTCMD_WAKEUP_JUMPTOHOME
660 || cmd==APTCMD_WAKEUP_LAUNCHAPP)) break;
661 }
662 aptFlags |= FLAG_ACTIVE;
663
664 void __ctru_speedup_config();
665 __ctru_speedup_config();
666
667 if (transition != TR_CANCELLIB && cmd != APTCMD_WAKEUP_CANCEL && cmd != APTCMD_WAKEUP)
668 {
669 GSPGPU_AcquireRight(0);
670 GSPGPU_RestoreVramSysArea();
671 aptCallHook(APTHOOK_ONRESTORE);
672 }
673
674 if (cmd == APTCMD_WAKEUP_CANCEL || cmd == APTCMD_WAKEUP_CANCELALL)
675 {
676 aptDspCancel();
677 if (cmd == APTCMD_WAKEUP_CANCEL) // for some reason, not for CANCELALL... is this a bug in official sw?
678 aptFlags |= FLAG_CANCELLED;
679 } else if (cmd != APTCMD_WAKEUP_LAUNCHAPP)
680 {
681 aptFlags &= ~FLAG_DSPWAKEUP;
682 aptDspWakeup();
683 }
684
685 if (cmd != APTCMD_WAKEUP_JUMPTOHOME)
686 {
687 APT_UnlockTransition(0x10);
688 APT_SleepIfShellClosed();
689 } else
690 {
691 aptFlags |= FLAG_SHOULDHOME;
692 aptHomeButtonState = 1;
693 APT_LockTransition(0x01, true);
694 }
695
696 if (transition == TR_JUMPTOMENU || transition == TR_LIBAPPLET || transition == TR_SYSAPPLET || transition == TR_APPJUMP)
697 {
698 if (cmd != APTCMD_WAKEUP_JUMPTOHOME)
699 aptClearJumpToHome();
700 }
701
702 return cmd;
703}
704

Callers 4

aptInitFunction · 0.85
aptJumpToHomeMenuFunction · 0.85
aptLaunchLibraryAppletFunction · 0.85
aptLaunchSystemAppletFunction · 0.85

Calls 13

APT_NotifyToWaitFunction · 0.85
envGetAptAppIdFunction · 0.85
APT_SleepIfShellClosedFunction · 0.85
aptReceiveParameterFunction · 0.85
__ctru_speedup_configFunction · 0.85
GSPGPU_AcquireRightFunction · 0.85
aptCallHookFunction · 0.85
APT_UnlockTransitionFunction · 0.85
APT_LockTransitionFunction · 0.85
aptClearJumpToHomeFunction · 0.85
aptDspCancelFunction · 0.70

Tested by

no test coverage detected