From d0cc13c2fdff25ed8a3e48bca52fa858d6cf2cbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90e=C3=A4Th?= <55578911+DeaTh-G@users.noreply.github.com> Date: Mon, 24 Mar 2025 20:15:46 +0100 Subject: [PATCH] Fix "Disable Boost Filter" code not affecting certain parts of the game. (#1468) * hook different part of the code to affect Eggmanland too * Update UnleashedRecomp/patches/misc_patches.cpp Co-authored-by: Skyth (Asilkan) <19259897+blueskythlikesclouds@users.noreply.github.com> --------- Co-authored-by: Skyth (Asilkan) <19259897+blueskythlikesclouds@users.noreply.github.com> --- UnleashedRecomp/patches/misc_patches.cpp | 16 +++++++++++----- UnleashedRecompLib/config/SWA.toml | 5 ----- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/UnleashedRecomp/patches/misc_patches.cpp b/UnleashedRecomp/patches/misc_patches.cpp index addeff94..ed225827 100644 --- a/UnleashedRecomp/patches/misc_patches.cpp +++ b/UnleashedRecomp/patches/misc_patches.cpp @@ -157,12 +157,18 @@ PPC_FUNC(sub_824C1E60) __imp__sub_824C1E60(ctx, base); } -// Remove boost filter -void DisableBoostFilterMidAsmHook(PPCRegister& r11) +// This function is called in various places but primarily for the boost filter +// when the second argument (r4) is set to "boost". Whilst boosting the third argument (f1) +// will go up to 1.0f and then down to 0.0f as the player lets off of the boost button. +// To avoid the boost filter from kicking in at all if the function is called with "boost" +// we set the third argument to zero no matter what (if the code is on). +PPC_FUNC_IMPL(__imp__sub_82B4DB48); +PPC_FUNC(sub_82B4DB48) { - if (Config::DisableBoostFilter) + if (Config::DisableBoostFilter && strcmp((const char*)(base + ctx.r4.u32), "boost") == 0) { - if (r11.u32 == 1) - r11.u32 = 0; + ctx.f1.f64 = 0.0; } + + __imp__sub_82B4DB48(ctx, base); } diff --git a/UnleashedRecompLib/config/SWA.toml b/UnleashedRecompLib/config/SWA.toml index db6ed45d..db5bf2d7 100644 --- a/UnleashedRecompLib/config/SWA.toml +++ b/UnleashedRecompLib/config/SWA.toml @@ -1101,11 +1101,6 @@ name = "ObjGrindDashPanelAllocMidAsmHook" address = 0x82614948 registers = ["r3"] -[[midasm_hook]] -name = "DisableBoostFilterMidAsmHook" -address = 0x82B48C9C -registers = ["r11"] - [[midasm_hook]] name = "UseAlternateTitleMidAsmHook" address = 0x82580F44