1
0
Fork 0
mirror of https://github.com/jugeeya/UltimateTrainingModpack.git synced 2025-03-14 02:16:10 +00:00

enable janky input_recording

This commit is contained in:
jugeeya 2020-09-26 01:07:13 +00:00
parent 8301d73790
commit c6c600aae1
4 changed files with 36 additions and 26 deletions

View file

@ -51,25 +51,3 @@ pub unsafe fn handle_get_npad_state(
delayed_states.truncate(MENU.input_delay as usize);
}
}
#[macro_export]
macro_rules! create_nn_hid_hooks {
(
$(
($func:ident, $hook:ident)
),*
) => {
$(
#[allow(non_snake_case)]
#[skyline::hook(replace = $func)]
pub unsafe fn $hook(
state: *mut skyline::nn::hid::NpadHandheldState,
controller_id: *const u32,
) {
original!()(state, controller_id);
input_delay::handle_get_npad_state(state, controller_id);
// input_record::handle_get_npad_state(state, controller_id);
}
)*
};
}

View file

@ -1,5 +1,5 @@
use skyline::nn::hid::NpadHandheldState;
use smash::app::{BattleObjectModuleAccessor, lua_bind::WorkModule};
use smash::app::{BattleObjectModuleAccessor, lua_bind::*};
use smash::lib::lua_const::*;
use crate::training::input_delay::p1_controller_id;
@ -32,6 +32,20 @@ pub unsafe fn get_command_flag_cat(module_accessor: &mut BattleObjectModuleAcces
WorkModule::get_int(module_accessor, *FIGHTER_INSTANCE_WORK_ID_INT_ENTRY_ID) as i32;
if entry_id_int == 0 {
// Attack + Dpad Right: Playback
if ControlModule::check_button_on(module_accessor, *CONTROL_PAD_BUTTON_ATTACK)
&& ControlModule::check_button_trigger(module_accessor, *CONTROL_PAD_BUTTON_APPEAL_S_R) {
playback();
}
// Attack + Dpad Left: Record
else if ControlModule::check_button_on(module_accessor, *CONTROL_PAD_BUTTON_CATCH)
&& ControlModule::check_button_trigger(module_accessor, *CONTROL_PAD_BUTTON_APPEAL_S_L)
{
record();
}
if INPUT_RECORD == Record || INPUT_RECORD == Playback {
if INPUT_RECORD_FRAME >= P1_NPAD_STATES.len() - 1 {
if INPUT_RECORD == Record {

View file

@ -17,7 +17,6 @@ mod character_specific;
mod fast_fall;
mod frame_counter;
mod full_hop;
#[macro_use]
mod input_delay;
mod input_record;
mod ledge;
@ -268,6 +267,27 @@ fn params_main(params_info: &ParamsInfo<'_>) {
}
}
macro_rules! create_nn_hid_hooks {
(
$(
($func:ident, $hook:ident)
),*
) => {
$(
#[allow(non_snake_case)]
#[skyline::hook(replace = $func)]
pub unsafe fn $hook(
state: *mut skyline::nn::hid::NpadHandheldState,
controller_id: *const u32,
) {
original!()(state, controller_id);
input_delay::handle_get_npad_state(state, controller_id);
input_record::handle_get_npad_state(state, controller_id);
}
)*
};
}
create_nn_hid_hooks!(
(GetNpadHandheldState, handle_get_npad_handheld_state),
(GetNpadFullKeyState, handle_get_npad_full_key_state),

View file

@ -86,8 +86,6 @@ pub unsafe fn save_states(module_accessor: &mut app::BattleObjectModuleAccessor)
SAVE_STATE_CPU.state = KillPlayer;
}
// crate::training::input_record::playback();
reset::on_reset();
return;
}