From f846f464393b827a3d7c3053523f9bf9ff8d4dff Mon Sep 17 00:00:00 2001 From: Isaac Marovitz Date: Fri, 5 Sep 2025 23:41:27 -0400 Subject: [PATCH] RestoreChainJumpFlips Signed-off-by: Isaac Marovitz --- MarathonRecomp/patches/player_patches.cpp | 62 +++++++++++++++++++++++ MarathonRecomp/user/config_def.h | 1 + MarathonRecompLib/config/Marathon.toml | 24 +++++++++ 3 files changed, 87 insertions(+) diff --git a/MarathonRecomp/patches/player_patches.cpp b/MarathonRecomp/patches/player_patches.cpp index a3104b170..6c9cdb0a3 100644 --- a/MarathonRecomp/patches/player_patches.cpp +++ b/MarathonRecomp/patches/player_patches.cpp @@ -183,3 +183,65 @@ bool ControllableSpinkick() { return Config::ControllableSpinkick; } + +bool RestoreChainJumpFlips1(PPCRegister& f3, PPCRegister& r1) +{ + if (Config::RestoreChainJumpFlips) + { + auto base = g_memory.base; + + PPCRegister temp{}; + temp.u32 = PPC_LOAD_U32(r1.u32 + 0x7C); + f3.f64 = double(temp.f32); + + return true; + } + + return false; +} + +bool RestoreChainJumpFlips2(PPCRegister& r10, PPCRegister& r11) +{ + if (Config::RestoreChainJumpFlips) + { + auto base = g_memory.base; + + PPC_STORE_U32(r10.u32 + 0x44, r11.u32); + + return true; + } + + return false; +} + +bool RestoreChainJumpFlips3(PPCRegister& f31, PPCRegister& r11) +{ + if (Config::RestoreChainJumpFlips) + { + auto base = g_memory.base; + + PPCRegister temp{}; + temp.f32 = float(f31.f64); + PPC_STORE_U32(r11.u32 + 0x44, temp.u32); + + return true; + } + + return false; +} + +bool RestoreChainJumpFlips4(PPCRegister& f0, PPCRegister& r11) +{ + if (Config::RestoreChainJumpFlips) + { + auto base = g_memory.base; + + PPCRegister temp{}; + temp.f32 = float(f0.f64); + PPC_STORE_U32(r11.u32 + 0x44, temp.u32); + + return true; + } + + return false; +} diff --git a/MarathonRecomp/user/config_def.h b/MarathonRecomp/user/config_def.h index 6ff529718..a8328905a 100644 --- a/MarathonRecomp/user/config_def.h +++ b/MarathonRecomp/user/config_def.h @@ -83,6 +83,7 @@ CONFIG_DEFINE_HIDDEN("Codes", bool, FixPowerUpJingleDuration, false); CONFIG_DEFINE_HIDDEN("Codes", bool, UseOfficialTitleOnTitleBar, false); CONFIG_DEFINE_HIDDEN("Codes", bool, DisableLowResolutionFontOnCustomUI, false); CONFIG_DEFINE_HIDDEN("Codes", bool, RestoreContextualHUDColours, false); +CONFIG_DEFINE_HIDDEN("Codes", bool, RestoreChainJumpFlips, false); CONFIG_DEFINE_HIDDEN("Codes", bool, DisableEdgeGrabLeftover, false); CONFIG_DEFINE_HIDDEN("Codes", bool, TailsGauge, false); CONFIG_DEFINE_HIDDEN("Codes", bool, PlayerDebugMode, false); diff --git a/MarathonRecompLib/config/Marathon.toml b/MarathonRecompLib/config/Marathon.toml index 852886a90..927cd079e 100644 --- a/MarathonRecompLib/config/Marathon.toml +++ b/MarathonRecompLib/config/Marathon.toml @@ -337,3 +337,27 @@ jump_address = 0x8258E308 name = "NOP" address = 0x8258E600 jump_address = 0x8258E604 + +[[midasm_hook]] +name = "RestoreChainJumpFlips1" +address = 0x82199650 +registers = ["f3", "r1"] +jump_address_on_true = 0x82199654 + +[[midasm_hook]] +name = "RestoreChainJumpFlips2" +address = 0x82209B74 +registers = ["r10", "r11"] +jump_address_on_true = 0x82209B78 + +[[midasm_hook]] +name = "RestoreChainJumpFlips3" +address = 0x8220C0BC +registers = ["f31", "r11"] +jump_address_on_true = 0x8220C0C0 + +[[midasm_hook]] +name = "RestoreChainJumpFlips4" +address = 0x822106BC +registers = ["f0", "r11"] +jump_address_on_true = 0x822106C0