From fd2fb745e08e88461cc1bee44b1eb9c7b608b120 Mon Sep 17 00:00:00 2001 From: Hyper <34012267+hyperbx@users.noreply.github.com> Date: Sun, 2 Mar 2025 22:42:25 +0000 Subject: [PATCH] Fix XButtonHoming patch leaking state into other parameters (#640) --- UnleashedRecomp/patches/player_patches.cpp | 6 ++++-- UnleashedRecompLib/config/SWA.toml | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/UnleashedRecomp/patches/player_patches.cpp b/UnleashedRecomp/patches/player_patches.cpp index 3377c98..e951199 100644 --- a/UnleashedRecomp/patches/player_patches.cpp +++ b/UnleashedRecomp/patches/player_patches.cpp @@ -95,9 +95,11 @@ void PostUnleashMidAsmHook(PPCRegister& r30) g_isUnleashCancelled = false; } -void SetXButtonHomingMidAsmHook(PPCRegister& r30) +void SetXButtonHomingMidAsmHook(PPCRegister& r1) { - r30.u32 = !Config::HomingAttackOnJump; + auto pXButtonHoming = (bool*)(g_memory.base + r1.u32 + 0x63); + + *pXButtonHoming = !Config::HomingAttackOnJump; } // SWA::Player::CEvilSonicContext diff --git a/UnleashedRecompLib/config/SWA.toml b/UnleashedRecompLib/config/SWA.toml index 901688c..0575ef5 100644 --- a/UnleashedRecompLib/config/SWA.toml +++ b/UnleashedRecompLib/config/SWA.toml @@ -199,8 +199,8 @@ return_on_false = true [[midasm_hook]] name = "SetXButtonHomingMidAsmHook" -address = 0x8237AC88 -registers = ["r30"] +address = 0x8237AC90 +registers = ["r1"] # Down force HFR fix [[midasm_hook]]