diff --git a/src/common/offsets.rs b/src/common/offsets.rs index 50eb728..35ef240 100644 --- a/src/common/offsets.rs +++ b/src/common/offsets.rs @@ -344,4 +344,17 @@ static NEEDLE_LAYOUT_ARC_MALLOC: &[u8] = &[ 0xc1, 0xb6, 0x40, 0xf9, 0xc2, 0x57, 0x00, 0xb0, ]; -impl_offset!(LAYOUT_ARC_MALLOC); \ No newline at end of file +impl_offset!(LAYOUT_ARC_MALLOC); + +// OFFSET_TRAINING_RESET_CHECK = 0x1378e30 +static NEEDLE_TRAINING_RESET_CHECK: &[u8] = &[ + 0x1f, 0x09, 0x00, 0x71, + 0x41, 0x1c, 0x00, 0x54, + 0xe8, 0xf9, 0x01, 0xf0, + 0x08, 0x7d, 0x42, 0xf9, + 0x08, 0x01, 0x40, 0xf9, + 0x09, 0xa1, 0x40, 0xb9, + 0x3f, 0x05, 0x00, 0x71, + 0x2b, 0x0a, 0x00, 0x54, +]; +impl_offset!(TRAINING_RESET_CHECK); diff --git a/src/static/layout.arc b/src/static/layout.arc index da059da..a4b9b3b 100644 Binary files a/src/static/layout.arc and b/src/static/layout.arc differ diff --git a/src/training/mod.rs b/src/training/mod.rs index 818d85d..2d4e43a 100644 --- a/src/training/mod.rs +++ b/src/training/mod.rs @@ -418,6 +418,16 @@ pub unsafe fn handle_add_damage( original!()(damage_module, damage_to_add, param_2) } +// Control L+R+A Resets +// This function already checks for training mode, so we don't need to check for training mode here +#[skyline::hook(offset = *OFFSET_TRAINING_RESET_CHECK, inline)] +unsafe fn lra_handle(ctx: &mut InlineCtx) { + let x8 = ctx.registers[8].x.as_mut(); + if !(MENU.lra_reset.as_bool()) { + *x8 = 0; + } +} + // Set Stale Moves to On // One instruction after stale moves toggle register is set to 0 #[skyline::hook(offset = *OFFSET_STALE, inline)] @@ -915,6 +925,8 @@ pub fn training_mods() { handle_article_get_int, handle_fighter_effect, handle_fighter_joint_effect, + // L+R+A Reset + lra_handle ); items::init(); diff --git a/training_mod_consts/src/lib.rs b/training_mod_consts/src/lib.rs index e05a6eb..cad47ff 100644 --- a/training_mod_consts/src/lib.rs +++ b/training_mod_consts/src/lib.rs @@ -93,6 +93,7 @@ pub struct TrainingModpackMenu { pub stale_dodges: OnOff, pub tech_hide: OnOff, pub update_policy: UpdatePolicy, + pub lra_reset: OnOff, } #[repr(C)] @@ -200,6 +201,7 @@ pub static DEFAULTS_MENU: TrainingModpackMenu = TrainingModpackMenu { stale_dodges: OnOff::ON, tech_hide: OnOff::OFF, update_policy: UpdatePolicy::default(), + lra_reset: OnOff::ON, }; pub static mut MENU: TrainingModpackMenu = DEFAULTS_MENU; @@ -729,6 +731,14 @@ impl_toggletrait! { true, 1, } +impl_toggletrait! { + OnOff, + "L+R+A Reset", + "lra_reset", + "L+R+A Reset: Reset Training Room when pressing L+R+A", + true, + 1, +} impl_toggletrait! { RecordSlot, "Recording Slot", @@ -948,6 +958,7 @@ pub unsafe fn create_app<'a>() -> App<'a> { misc_tab_submenus.push(to_submenu_stage_hazards()); misc_tab_submenus.push(to_submenu_hud()); misc_tab_submenus.push(to_submenu_update_policy()); + misc_tab_submenus.push(to_submenu_lra_reset()); let misc_tab = Tab { id: "misc", title: "Misc Settings",