From 927612e6e55ac57d87ca8e2b2db740df6feac523 Mon Sep 17 00:00:00 2001 From: GradualSyrup <68757075+GradualSyrup@users.noreply.github.com> Date: Sun, 18 Feb 2024 20:22:01 -0600 Subject: [PATCH] Revert to make it crash on MALLOC --- src/common/offsets.rs | 65 ++++++++++++++++++++++++++----------------- src/training/mod.rs | 2 +- 2 files changed, 40 insertions(+), 27 deletions(-) diff --git a/src/common/offsets.rs b/src/common/offsets.rs index 6f684db..a55a928 100644 --- a/src/common/offsets.rs +++ b/src/common/offsets.rs @@ -75,8 +75,6 @@ static NEEDLE_COPY_SETUP: &[u8] = &[ 0xf4, 0x4f, 0x05, 0xa9, 0xfd, 0x7b, 0x06, 0xa9, 0xfd, 0x83, 0x01, 0x91, - 0xff, 0x43, 0x17, 0xd1, - 0x18, 0xa4, 0x40, 0xf9, ]; impl_offset!(COPY_SETUP); @@ -106,7 +104,7 @@ static NEEDLE_SET_CPU_CONTROLS: &[u8] = &[ ]; impl_offset!(SET_CPU_CONTROLS); -// OFFSET_ADD_DAMAGE = 0x3ff9c0 +// OFFSET_ADD_DAMAGE = 0x3ff9a0 static NEEDLE_ADD_DAMAGE: &[u8] = &[ 0x08, 0x20, 0x20, 0x1e, 0x8d, 0x00, 0x00, 0x54, @@ -116,7 +114,7 @@ static NEEDLE_ADD_DAMAGE: &[u8] = &[ ]; impl_offset!(ADD_DAMAGE); -// OFFSET_CHANGE_ACTIVE_CAMERA = 0x4ee480 +// OFFSET_CHANGE_ACTIVE_CAMERA = 0x4ee460 static NEEDLE_CHANGE_ACTIVE_CAMERA: &[u8] = &[ 0xff, 0x03, 0x02, 0xd1, 0xf8, 0x5f, 0x04, 0xa9, @@ -129,12 +127,17 @@ static NEEDLE_CHANGE_ACTIVE_CAMERA: &[u8] = &[ ]; impl_offset!(CHANGE_ACTIVE_CAMERA); -// OFFSET_SET_TRAINING_FIXED_CAMERA_VALUES = 0x3158830 +// OFFSET_SET_TRAINING_FIXED_CAMERA_VALUES = 0x3157bb0 static NEEDLE_SET_TRAINING_FIXED_CAMERA_VALUES: &[u8] = &[ 0x01, 0xe4, 0x00, 0x2f, 0x20, 0x00, 0xc0, 0x3d, 0x22, 0x1c, 0xa1, 0x4e, 0x02, 0x44, 0x04, 0x6e, + 0xe8, 0x0a, 0x01, 0xf0, + 0x08, 0x81, 0x47, 0xf9, + 0x08, 0x01, 0x40, 0xf9, + 0x40, 0x04, 0x18, 0x6e, + 0x00, 0xf5, 0x82, 0x3d, ]; impl_offset!(SET_TRAINING_FIXED_CAMERA_VALUES); @@ -151,7 +154,7 @@ static NEEDLE_DRAW: &[u8] = &[ ]; impl_offset!(DRAW); -// OFFSET_CLOUD_ADD_LIMIT = 0x8dc160 +// OFFSET_CLOUD_ADD_LIMIT = 0x8dc140 static NEEDLE_CLOUD_ADD_LIMIT: &[u8] = &[ 0xff, 0x03, 0x03, 0xd1, 0xe9, 0x23, 0x05, 0x6d, @@ -191,7 +194,7 @@ static NEEDLE_STALE: &[u8] = &[ impl_offset!(STALE); // todo!(Can we remove this and replace with SoundModule::play_se()?) -// OFFSET_PLAY_SE = 0x4cf6c0 +// OFFSET_PLAY_SE = 0x4cf6a0 static NEEDLE_PLAY_SE: &[u8] = &[ 0xa8, 0x00, 0x00, 0x12, 0x9f, 0x00, 0x00, 0x72, @@ -203,7 +206,7 @@ static NEEDLE_PLAY_SE: &[u8] = &[ ]; impl_offset!(PLAY_SE); -// OFFSET_CAN_FUTTOBI_BACK = 0x26105d0 +// OFFSET_CAN_FUTTOBI_BACK = 0x260f950 static NEEDLE_CAN_FUTTOBI_BACK: &[u8] = &[ 0x00, 0x07, 0x00, 0xb4, 0x09, 0x04, 0x40, 0xf9, @@ -220,7 +223,7 @@ static NEEDLE_CAN_FUTTOBI_BACK: &[u8] = &[ ]; impl_offset!(CAN_FUTTOBI_BACK); -// OFFSET_REUSED_UI = 0x68cda0 +// OFFSET_REUSED_UI = 0x68cd80 static NEEDLE_REUSED_UI: &[u8] = &[ 0xff, 0x43, 0x01, 0xd1, 0xf5, 0x13, 0x00, 0xf9, @@ -234,18 +237,20 @@ static NEEDLE_REUSED_UI: &[u8] = &[ impl_offset!(REUSED_UI); -// OFFSET_OPCF = 0x6b7ffc -static NEEDLE_OPCF: &[u8] = &[ - 0x68, 0xb6, 0x40, 0xf9, - 0x09, 0x81, 0x49, 0x39, - 0x69, 0xe1, 0xff, 0x35, - 0x08, 0x55, 0x41, 0x39, - 0x28, 0xe1, 0x1f, 0x37, - 0xe0, 0x03, 0x13, 0xaa, -]; -impl_offset!(OPCF); +// // OFFSET_OPCF = 0x6b7ffc (old: 0x6b7fdc) +// static NEEDLE_OPCF: &[u8] = &[ +// 0x68, 0xb6, 0x40, 0xf9, +// 0x09, 0x81, 0x49, 0x39, +// 0x69, 0xe1, 0xff, 0x35, +// 0x08, 0x55, 0x41, 0x39, +// 0x28, 0xe1, 0x1f, 0x37, +// 0xe0, 0x03, 0x13, 0xaa, +// 0x5b, 0x88, 0xf0, 0x97, +// 0xe9, 0x23, 0x43, 0x6d, +// ]; +// impl_offset!(OPCF); -// OFFSET_FIM = 0x1750f70 +// OFFSET_FIM = 0x17504a0 static NEEDLE_FIM: &[u8] = &[ 0xff, 0x03, 0x02, 0xd1, 0xf7, 0x23, 0x00, 0xf9, @@ -258,7 +263,7 @@ static NEEDLE_FIM: &[u8] = &[ ]; impl_offset!(FIM); -// OFFSET_SSS_TRAINING = 0x184dca8 +// OFFSET_SSS_TRAINING = 0x184d1d8 static NEEDLE_SSS_TRAINING: &[u8] = &[ 0x9f, 0xe3, 0x0b, 0x39, 0x88, 0xbf, 0x0b, 0x39, @@ -269,7 +274,7 @@ static NEEDLE_SSS_TRAINING: &[u8] = &[ ]; impl_offset!(SSS_TRAINING); -// OFFSET_GENERATE_ARTICLE_FOR_TARGET = 0x3d40c0 +// OFFSET_GENERATE_ARTICLE_FOR_TARGET = 0x3d40a0 static NEEDLE_GENERATE_ARTICLE_FOR_TARGET: &[u8] = &[ 0xf4, 0x4f, 0xbe, 0xa9, 0xfd, 0x7b, 0x01, 0xa9, @@ -280,7 +285,7 @@ static NEEDLE_GENERATE_ARTICLE_FOR_TARGET: &[u8] = &[ ]; impl_offset!(GENERATE_ARTICLE_FOR_TARGET); -// OFFSET_KIRBY_OPFF = 0xb971d0 +// OFFSET_KIRBY_OPFF = 0xb971b0 static NEEDLE_KIRBY_OPFF: &[u8] = &[ 0xff, 0x43, 0x02, 0xd1, 0xfc, 0x6f, 0x03, 0xa9, @@ -297,7 +302,7 @@ static NEEDLE_KIRBY_OPFF: &[u8] = &[ ]; impl_offset!(KIRBY_OPFF); -// OFFSET_ACTIVATE_AUTONOMY = 0x34b6970 +// OFFSET_ACTIVATE_AUTONOMY = 0x34b5cf0 static NEEDLE_ACTIVATE_AUTONOMY: &[u8] = &[ 0xf6, 0x57, 0xbd, 0xa9, 0xf4, 0x4f, 0x01, 0xa9, @@ -310,21 +315,29 @@ static NEEDLE_ACTIVATE_AUTONOMY: &[u8] = &[ ]; impl_offset!(ACTIVATE_AUTONOMY); -// OFFSET_POKEMON_DECIDE = 0x34ce8e4 +// OFFSET_POKEMON_DECIDE = 0x34cdc64 static NEEDLE_POKEMON_DECIDE: &[u8] = &[ 0x28, 0x69, 0x2b, 0x38, 0x48, 0x26, 0x8b, 0x52, 0x2a, 0x69, 0x28, 0x38, 0x88, 0x12, 0x40, 0xf9, + 0x49, 0x01, 0x80, 0x52, + 0x14, 0x29, 0x40, 0xf9, + 0xe9, 0x0b, 0x00, 0xb9, + 0x29, 0xdf, 0x00, 0xb0, ]; impl_offset!(POKEMON_DECIDE); -// OFFSET_LAYOUT_ARC_MALLOC = 0x3773d54 +// OFFSET_LAYOUT_ARC_MALLOC = 0x37730d4 static NEEDLE_LAYOUT_ARC_MALLOC: &[u8] = &[ 0xe3, 0xe6, 0x06, 0x94, 0xa0, 0x05, 0x00, 0xb4, 0xe1, 0x03, 0x15, 0xaa, 0xe2, 0x03, 0x17, 0xaa, + 0xc0, 0xb6, 0x00, 0xf9, + 0x72, 0x2e, 0x09, 0x94, + 0xc1, 0xb6, 0x40, 0xf9, + 0xc2, 0x57, 0x00, 0xb0, ]; impl_offset!(LAYOUT_ARC_MALLOC); diff --git a/src/training/mod.rs b/src/training/mod.rs index 2d4e43a..a1bd752 100644 --- a/src/training/mod.rs +++ b/src/training/mod.rs @@ -781,7 +781,7 @@ pub unsafe fn handle_article_get_int( // Instruction run on the completion of the CPU Control function // One instruction after the CPU Control function completes -#[skyline::hook(offset = *OFFSET_OPCF, inline)] +#[skyline::hook(offset = 0x6b7fdc, inline)] unsafe fn handle_once_per_cpu_frame(_ctx: &mut InlineCtx) { input_record::handle_recording(); frame_counter::tick_ingame();