MCPcopy Create free account
hub / github.com/XorTroll/uLaunch / HandleAppletMessage

Function HandleAppletMessage

projects/uSystem/source/main.cpp:666–735  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

664 }
665
666 void HandleAppletMessage() {
667 u32 finished_verify_count = 0;
668 for(auto &ctx: *g_ApplicationVerifyContexts) {
669 if(ctx.finished) {
670 UL_RC_ASSERT(threadWaitForExit(&ctx.thread));
671 UL_RC_ASSERT(threadClose(&ctx.thread));
672 finished_verify_count++;
673 }
674 }
675
676 if(finished_verify_count > 0) {
677 auto new_end = std::remove_if(g_ApplicationVerifyContexts->begin(), g_ApplicationVerifyContexts->end(), [](const ApplicationVerifyContext &ctx) { return ctx.finished; });
678 g_ApplicationVerifyContexts->erase(new_end, g_ApplicationVerifyContexts->end());
679 }
680
681 u32 raw_msg = 0;
682 if(R_SUCCEEDED(appletGetMessage(&raw_msg))) {
683 switch(static_cast<ul::system::AppletMessage>(raw_msg)) {
684 case ul::system::AppletMessage::ChangeIntoForeground: {
685 UL_LOG_INFO("Got AppletMessage: ChangeIntoForeground");
686 break;
687 }
688 case ul::system::AppletMessage::ChangeIntoBackground: {
689 UL_LOG_INFO("Got AppletMessage: ChangeIntoBackground");
690 break;
691 }
692 case ul::system::AppletMessage::ApplicationExited: {
693 UL_LOG_INFO("Got AppletMessage: ApplicationExited");
694 break;
695 }
696 case ul::system::AppletMessage::DetectShortPressingHomeButton: {
697 HandleHomeButton();
698 break;
699 }
700 case ul::system::AppletMessage::DetectShortPressingPowerButton: {
701 HandleSleep();
702 break;
703 }
704 case ul::system::AppletMessage::FinishedSleepSequence: {
705 if(IsMenuRunning()) {
706 PushSimpleMenuMessage(ul::smi::MenuMessage::FinishedSleep);
707 }
708 break;
709 }
710 case ul::system::AppletMessage::AutoPowerDown: {
711 // From auto-sleep functionality
712 HandleSleep();
713 break;
714 }
715 case ul::system::AppletMessage::OperationModeChanged: {
716 UpdateOperationMode();
717 break;
718 }
719 case ul::system::AppletMessage::SdCardRemoved: {
720 if(IsMenuRunning()) {
721 PushSimpleMenuMessage(ul::smi::MenuMessage::SdCardEjected);
722 }
723 else {

Callers 1

MainLoopFunction · 0.85

Calls 5

HandleHomeButtonFunction · 0.85
HandleSleepFunction · 0.85
IsMenuRunningFunction · 0.85
PushSimpleMenuMessageFunction · 0.85
UpdateOperationModeFunction · 0.85

Tested by

no test coverage detected