| 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 | } |
no test coverage detected