diff --git a/src/training/mash.rs b/src/training/mash.rs index 6ef5b26..d68b655 100644 --- a/src/training/mash.rs +++ b/src/training/mash.rs @@ -97,11 +97,29 @@ pub unsafe fn get_command_flag_cat( check_buffer(module_accessor); - perform_action(module_accessor) + return 0; +} + +pub fn handle_mash(module_accessor: &mut app::BattleObjectModuleAccessor){ + unsafe{ + if !is_operation_cpu(module_accessor) { + return; + } + + perform_action(module_accessor); + } } unsafe fn check_buffer(module_accessor: &mut app::BattleObjectModuleAccessor) { if QUEUE.len() > 0 { + /* + Reset when CPU is idle to prevent deadlocks + and to reset when using the training mode reset + */ + if is_idle(module_accessor) { + reset(); + } + return; } diff --git a/src/training/mod.rs b/src/training/mod.rs index a20fa9e..14798c5 100644 --- a/src/training/mod.rs +++ b/src/training/mod.rs @@ -101,6 +101,7 @@ pub unsafe fn get_stick_y_no_clamp(module_accessor: &mut app::BattleObjectModule */ #[skyline::hook(replace = ControlModule::get_stick_x)] pub unsafe fn get_stick_x(module_accessor: &mut app::BattleObjectModuleAccessor) -> f32 { + mash::handle_mash(module_accessor); left_stick::mod_get_stick_x(module_accessor).unwrap_or_else(|| original!()(module_accessor)) }