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

Function HandleMenuMessage

projects/uSystem/source/main.cpp:737–1025  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

735 }
736
737 void HandleMenuMessage() {
738 if(IsMenuRunning()) {
739 u32 app_list_count;
740
741 // Note: ignoring result since this won't always succeed, and would error if no commands were received
742 smi::ReceiveCommand(
743 [&](const ul::smi::SystemMessage msg, smi::ScopedStorageReader &reader) -> Result {
744 switch(msg) {
745 case ul::smi::SystemMessage::SetSelectedUser: {
746 UL_RC_TRY(reader.Pop(g_SelectedUser));
747 CheckApplicationRecordChanges();
748 break;
749 }
750 case ul::smi::SystemMessage::LaunchApplication: {
751 u64 launch_app_id;
752 UL_RC_TRY(reader.Pop(launch_app_id));
753
754 if(app::IsActive()) {
755 return ul::ResultApplicationActive;
756 }
757 if(!accountUidIsValid(&g_SelectedUser)) {
758 return ul::ResultInvalidSelectedUser;
759 }
760
761 g_ActionQueue.push_back({
762 .type = ActionType::LaunchApplication,
763 .launch_application = {
764 .app_id = launch_app_id
765 }
766 });
767 break;
768 }
769 case ul::smi::SystemMessage::ResumeApplication: {
770 if(!app::IsActive()) {
771 return ul::ResultApplicationNotActive;
772 }
773
774 UL_RC_TRY(app::SetForeground());
775 break;
776 }
777 case ul::smi::SystemMessage::TerminateApplication: {
778 UL_RC_TRY(app::Terminate());
779 g_LastHomebrewApplicationLaunchTarget = {};
780 break;
781 }
782 case ul::smi::SystemMessage::LaunchHomebrewLibraryApplet: {
783 ul::loader::TargetInput temp_ipt;
784 UL_RC_TRY(reader.Pop(temp_ipt));
785
786 g_ActionQueue.push_back({
787 .type = ActionType::LaunchHomebrewLibraryApplet,
788 .launch_loader = {
789 .target_input = temp_ipt,
790 .choose_mode = false
791 }
792 });
793 break;
794 }

Callers 1

MainLoopFunction · 0.85

Calls 13

IsMenuRunningFunction · 0.85
ReceiveCommandFunction · 0.85
CreateFunction · 0.85
CopyToStringBufferFunction · 0.85
PopMethod · 0.80
GetEntryMethod · 0.80
PopDataMethod · 0.80
PushMethod · 0.80
LoadConfigFunction · 0.70
IsActiveFunction · 0.50
SetForegroundFunction · 0.50

Tested by

no test coverage detected