diff --git a/src/common/menu.rs b/src/common/menu.rs index 95870d9..9087d86 100644 --- a/src/common/menu.rs +++ b/src/common/menu.rs @@ -3,7 +3,7 @@ use crate::events::{Event, EVENT_QUEUE}; use crate::logging::*; use crate::training::frame_counter; -use skyline::nn::hid::NpadGcState; +use skyline::nn::hid::{GetNpadStyleSet, NpadGcState}; use training_mod_consts::MenuJsonStruct; static mut FRAME_COUNTER_INDEX: usize = 0; @@ -261,6 +261,16 @@ pub unsafe fn quick_menu_loop() { continue; } + // Check for all controllers unplugged + let mut potential_controller_ids = (0..8).collect::>(); + potential_controller_ids.push(0x20); + if potential_controller_ids + .iter() + .all(|i| GetNpadStyleSet(i as *const _).flags == 0) { + QUICK_MENU_ACTIVE = false; + continue; + } + let app = &mut *QUICK_MENU_APP.data_ptr(); button_presses.a.read_press().then(|| { app.on_a();