1
0
Fork 0
mirror of https://github.com/jugeeya/UltimateTrainingModpack.git synced 2024-11-24 10:54:16 +00:00

Input Recording in Button Config (#562)

* Fix standby on Ryujinx; fix playback when no slot is selected

* Add notifications to input recording

* Move to button config
This commit is contained in:
jugeeya 2023-08-03 18:37:18 -07:00 committed by GitHub
parent dc6a1f8915
commit c2f5bd5bb1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 9 deletions

View file

@ -40,6 +40,14 @@ static mut BUTTON_COMBO_CONFIG: BtnComboConfig = BtnComboConfig {
hold: vec![], hold: vec![],
press: vec![], press: vec![],
}, },
input_record: BtnList {
hold: vec![],
press: vec![],
},
input_playback: BtnList {
hold: vec![],
press: vec![],
},
}; };
#[derive(Debug, EnumIter, PartialEq)] #[derive(Debug, EnumIter, PartialEq)]
@ -47,6 +55,8 @@ pub enum ButtonCombo {
OpenMenu, OpenMenu,
SaveState, SaveState,
LoadState, LoadState,
InputRecord,
InputPlayback,
} }
#[derive(Deserialize, Default)] #[derive(Deserialize, Default)]
@ -60,6 +70,8 @@ struct BtnComboConfig {
open_menu: BtnList, open_menu: BtnList,
save_state: BtnList, save_state: BtnList,
load_state: BtnList, load_state: BtnList,
input_record: BtnList,
input_playback: BtnList,
} }
#[derive(Deserialize)] #[derive(Deserialize)]
@ -106,6 +118,14 @@ fn save_all_btn_config_from_defaults() {
hold: vec!["SHIELD".to_string()], hold: vec!["SHIELD".to_string()],
press: vec!["UPTAUNT".to_string()], press: vec!["UPTAUNT".to_string()],
}, },
input_record: BtnList {
hold: vec!["ATTACK".to_string()],
press: vec!["LEFTTAUNT".to_string()],
},
input_playback: BtnList {
hold: vec!["ATTACK".to_string()],
press: vec!["RIGHTTAUNT".to_string()],
},
}, },
}; };
unsafe { unsafe {
@ -170,6 +190,14 @@ unsafe fn get_combo_keys(combo: ButtonCombo) -> (&'static Vec<String>, &'static
&BUTTON_COMBO_CONFIG.load_state.hold, &BUTTON_COMBO_CONFIG.load_state.hold,
&BUTTON_COMBO_CONFIG.load_state.press, &BUTTON_COMBO_CONFIG.load_state.press,
), ),
ButtonCombo::InputRecord => (
&BUTTON_COMBO_CONFIG.input_record.hold,
&BUTTON_COMBO_CONFIG.input_record.press,
),
ButtonCombo::InputPlayback => (
&BUTTON_COMBO_CONFIG.input_playback.hold,
&BUTTON_COMBO_CONFIG.input_playback.press,
),
} }
} }
@ -234,4 +262,12 @@ press=["DOWNTAUNT",]
[button_config.load_state] [button_config.load_state]
hold=["SHIELD",] hold=["SHIELD",]
press=["UPTAUNT",] press=["UPTAUNT",]
[button_config.input_record]
hold=["ATTACK",]
press=["LEFTTAUNT",]
[button_config.input_playback]
hold=["ATTACK",]
press=["RIGHTTAUNT",]
"#; "#;

View file

@ -1,4 +1,5 @@
use crate::common::consts::{FighterId, HitstunPlayback, RecordTrigger}; use crate::common::button_config;
use crate::common::consts::{FighterId, HitstunPlayback};
use crate::common::{get_module_accessor, is_in_hitstun, is_in_shieldstun, MENU}; use crate::common::{get_module_accessor, is_in_hitstun, is_in_shieldstun, MENU};
use crate::training::input_recording::structures::*; use crate::training::input_recording::structures::*;
use crate::training::mash; use crate::training::mash;
@ -177,19 +178,19 @@ pub unsafe fn get_command_flag_cat(module_accessor: &mut BattleObjectModuleAcces
CURRENT_RECORD_SLOT = MENU.recording_slot.into_idx(); CURRENT_RECORD_SLOT = MENU.recording_slot.into_idx();
if entry_id_int == 0 && !fighter_is_nana { if entry_id_int == 0 && !fighter_is_nana {
// Attack + Dpad Right: Playback if button_config::combo_passes_exclusive(
if ControlModule::check_button_on(module_accessor, *CONTROL_PAD_BUTTON_ATTACK) module_accessor,
&& ControlModule::check_button_trigger(module_accessor, *CONTROL_PAD_BUTTON_APPEAL_S_R) button_config::ButtonCombo::InputPlayback,
{ ) {
//crate::common::raygun_printer::print_string(&mut *module_accessor, "PLAYBACK"); //crate::common::raygun_printer::print_string(&mut *module_accessor, "PLAYBACK");
playback(); playback();
println!("Playback Command Received!"); //debug println!("Playback Command Received!"); //debug
} }
// Attack + Dpad Left: Record // Attack + Dpad Left: Record
else if ControlModule::check_button_on(module_accessor, *CONTROL_PAD_BUTTON_ATTACK) else if button_config::combo_passes_exclusive(
&& ControlModule::check_button_trigger(module_accessor, *CONTROL_PAD_BUTTON_APPEAL_S_L) module_accessor,
&& MENU.record_trigger == RecordTrigger::Command button_config::ButtonCombo::InputRecord,
{ ) {
//crate::common::raygun_printer::print_string(&mut *module_accessor, "RECORDING"); //crate::common::raygun_printer::print_string(&mut *module_accessor, "RECORDING");
lockout_record(); lockout_record();
println!("Record Command Received!"); //debug println!("Record Command Received!"); //debug