diff --git a/MarathonRecomp/patches/player_patches.cpp b/MarathonRecomp/patches/player_patches.cpp index 97743ccc4..5401308c4 100644 --- a/MarathonRecomp/patches/player_patches.cpp +++ b/MarathonRecomp/patches/player_patches.cpp @@ -184,6 +184,68 @@ 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; +} + bool DisablePushState() { return Config::DisablePushState; diff --git a/MarathonRecomp/user/config_def.h b/MarathonRecomp/user/config_def.h index 612d2eb0d..fabeb4518 100644 --- a/MarathonRecomp/user/config_def.h +++ b/MarathonRecomp/user/config_def.h @@ -84,6 +84,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 6e89faaeb..8cdebc621 100644 --- a/MarathonRecompLib/config/Marathon.toml +++ b/MarathonRecompLib/config/Marathon.toml @@ -338,6 +338,30 @@ 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 + [[midasm_hook]] name = "DisablePushState" address = 0x821A03F0