1
0
Fork 0
mirror of https://github.com/jugeeya/UltimateTrainingModpack.git synced 2024-11-27 20:34:03 +00:00

Don't use once-per-cpu-frame to fix input recording/save state issues

This commit is contained in:
jugeeya 2024-02-19 21:22:54 -08:00
parent 7dd05f1afd
commit 5b0b5490cc
2 changed files with 29 additions and 20 deletions

View file

@ -233,18 +233,18 @@ static NEEDLE_REUSED_UI: &[u8] = &[
impl_offset!(REUSED_UI); impl_offset!(REUSED_UI);
// // OFFSET_OPCF = 0x6b7ffc (old: 0x6b7fdc) // OFFSET_OPCF = 0x6b7ffc
// static NEEDLE_OPCF: &[u8] = &[ static NEEDLE_OPCF: &[u8] = &[
// 0x68, 0xb6, 0x40, 0xf9, 0x68, 0xb6, 0x40, 0xf9,
// 0x09, 0x81, 0x49, 0x39, 0x09, 0x81, 0x49, 0x39,
// 0x69, 0xe1, 0xff, 0x35, 0x69, 0xe1, 0xff, 0x35,
// 0x08, 0x55, 0x41, 0x39, 0x08, 0x55, 0x41, 0x39,
// 0x28, 0xe1, 0x1f, 0x37, 0x28, 0xe1, 0x1f, 0x37,
// 0xe0, 0x03, 0x13, 0xaa, 0xe0, 0x03, 0x13, 0xaa,
// 0x5b, 0x88, 0xf0, 0x97, 0x5b, 0x88, 0xf0, 0x97,
// 0xe9, 0x23, 0x43, 0x6d, 0xe9, 0x23, 0x43, 0x6d,
// ]; ];
// impl_offset!(OPCF); impl_offset!(OPCF);
// OFFSET_FIM = 0x17504a0 // OFFSET_FIM = 0x17504a0
static NEEDLE_FIM: &[u8] = &[ static NEEDLE_FIM: &[u8] = &[

View file

@ -123,6 +123,9 @@ fn once_per_frame_per_fighter(module_accessor: &mut BattleObjectModuleAccessor,
} }
unsafe { unsafe {
input_record::handle_recording();
frame_counter::tick_ingame();
tech::hide_tech();
if menu::menu_condition() { if menu::menu_condition() {
menu::spawn_menu(); menu::spawn_menu();
} }
@ -442,7 +445,7 @@ unsafe fn stale_handle(ctx: &mut InlineCtx) {
#[skyline::hook(offset = *OFFSET_STALE_MENU, inline)] #[skyline::hook(offset = *OFFSET_STALE_MENU, inline)]
unsafe fn stale_menu_handle(ctx: &mut InlineCtx) { unsafe fn stale_menu_handle(ctx: &mut InlineCtx) {
// Set the text pointer to where "mel_training_on" is located // Set the text pointer to where "mel_training_on" is located
let on_text_ptr = (getRegionAddress(Region::Text) as u64) + 0x42b215e; let on_text_ptr = (getRegionAddress(Region::Text) as u64) + 0x42b315e;
let x1 = ctx.registers[1].x.as_mut(); let x1 = ctx.registers[1].x.as_mut();
*x1 = on_text_ptr; *x1 = on_text_ptr;
} }
@ -781,12 +784,12 @@ pub unsafe fn handle_article_get_int(
// Instruction run on the completion of the CPU Control function // Instruction run on the completion of the CPU Control function
// One instruction after the CPU Control function completes // One instruction after the CPU Control function completes
#[skyline::hook(offset = 0x6b7fdc, inline)] // #[skyline::hook(offset = *OFFSET_OPCF, inline)]
unsafe fn handle_once_per_cpu_frame(_ctx: &mut InlineCtx) { // unsafe fn handle_once_per_cpu_frame(_ctx: &mut InlineCtx) {
input_record::handle_recording(); // input_record::handle_recording();
frame_counter::tick_ingame(); // frame_counter::tick_ingame();
tech::hide_tech(); // tech::hide_tech();
} // }
#[skyline::hook(offset = *OFFSET_FIM)] #[skyline::hook(offset = *OFFSET_FIM)]
unsafe fn handle_final_input_mapping( unsafe fn handle_final_input_mapping(
@ -863,6 +866,12 @@ pub fn training_mods() {
.nop() .nop()
.unwrap(); .unwrap();
println!(
"Searching for STALE_MENU offset first! : {}",
*OFFSET_STALE_MENU
);
println!("Searching for STALE offset second! : {}", *OFFSET_STALE);
skyline::install_hooks!( skyline::install_hooks!(
// Mash airdodge/jump // Mash airdodge/jump
handle_get_command_flag_cat, handle_get_command_flag_cat,
@ -911,7 +920,7 @@ pub fn training_mods() {
// Clatter // Clatter
clatter::hook_start_clatter, clatter::hook_start_clatter,
// Notifications // Notifications
handle_once_per_cpu_frame, // handle_once_per_cpu_frame,
// Input // Input
handle_final_input_mapping, handle_final_input_mapping,
// Charge // Charge