1
0
Fork 0
mirror of https://github.com/jugeeya/UltimateTrainingModpack.git synced 2024-11-19 16:36:35 +00:00

Toggleable L + R + A Reset (#663)

* Working w/ raw offset and no icon

* Use dynamic offsets

* Add icon

* Fixed layout.arc

* Cargo fmt
This commit is contained in:
GradualSyrup 2024-02-05 16:01:32 -06:00 committed by GitHub
parent 312363d744
commit 6862c235fe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 37 additions and 1 deletions

View file

@ -344,4 +344,17 @@ static NEEDLE_LAYOUT_ARC_MALLOC: &[u8] = &[
0xc1, 0xb6, 0x40, 0xf9,
0xc2, 0x57, 0x00, 0xb0,
];
impl_offset!(LAYOUT_ARC_MALLOC);
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);

Binary file not shown.

View file

@ -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();

View file

@ -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",