From 8a80db141d4c7e0f960bc752a2c5c91f9d8549d9 Mon Sep 17 00:00:00 2001 From: NextinHKRY <38560522+NextinMono@users.noreply.github.com> Date: Thu, 6 Mar 2025 06:46:45 +0100 Subject: [PATCH 1/3] code: Add Disable Boost Filter code (#999) --- UnleashedRecomp/patches/misc_patches.cpp | 10 ++++++++++ UnleashedRecomp/user/config_def.h | 1 + UnleashedRecompLib/config/SWA.toml | 5 +++++ 3 files changed, 16 insertions(+) diff --git a/UnleashedRecomp/patches/misc_patches.cpp b/UnleashedRecomp/patches/misc_patches.cpp index c321e277..9f318fb4 100644 --- a/UnleashedRecomp/patches/misc_patches.cpp +++ b/UnleashedRecomp/patches/misc_patches.cpp @@ -146,3 +146,13 @@ PPC_FUNC(sub_824C1E60) __imp__sub_824C1E60(ctx, base); } + +// Remove boost filter +void DisableBoostFilterMidAsmHook(PPCRegister& r11) +{ + if (Config::DisableBoostFilter) + { + if (r11.u32 == 1) + r11.u32 = 0; + } +} diff --git a/UnleashedRecomp/user/config_def.h b/UnleashedRecomp/user/config_def.h index cb282c1e..c58c9e92 100644 --- a/UnleashedRecomp/user/config_def.h +++ b/UnleashedRecomp/user/config_def.h @@ -77,6 +77,7 @@ CONFIG_DEFINE_ENUM_LOCALISED("Video", EUIAlignmentMode, UIAlignmentMode, EUIAlig CONFIG_DEFINE_HIDDEN("Codes", bool, AllowCancellingUnleash, false); CONFIG_DEFINE_HIDDEN("Codes", bool, DisableAutoSaveWarning, false); +CONFIG_DEFINE_HIDDEN("Codes", bool, DisableBoostFilter, false); CONFIG_DEFINE_HIDDEN("Codes", bool, DisableDLCIcon, false); CONFIG_DEFINE_HIDDEN("Codes", bool, DisableDWMRoundedCorners, false); CONFIG_DEFINE_HIDDEN("Codes", bool, EnableEventCollisionDebugView, false); diff --git a/UnleashedRecompLib/config/SWA.toml b/UnleashedRecompLib/config/SWA.toml index 0575ef50..489aa134 100644 --- a/UnleashedRecompLib/config/SWA.toml +++ b/UnleashedRecompLib/config/SWA.toml @@ -1093,3 +1093,8 @@ registers = ["r31", "r29", "r28"] name = "ObjGrindDashPanelAllocMidAsmHook" address = 0x82614948 registers = ["r3"] + +[[midasm_hook]] +name = "DisableBoostFilterMidAsmHook" +address = 0x82B48C9C +registers = ["r11"] From c07a754f4fbf28a2ec008d9c5fe516bec67df1a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Francart?= <38794835+Refragg@users.noreply.github.com> Date: Thu, 6 Mar 2025 06:59:22 +0100 Subject: [PATCH 2/3] Add hidden DisableDPadAsAnalogInput option (#604) This commit adds a configuration entry in the 'Codes' section named DisableDPadAsAnalogInput allowing someone to enable or disable the movement of Sonic / the world map cursor using the directional pad buttons. --- UnleashedRecomp/patches/input_patches.cpp | 40 ++++++++++++++++------- UnleashedRecomp/user/config_def.h | 1 + 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/UnleashedRecomp/patches/input_patches.cpp b/UnleashedRecomp/patches/input_patches.cpp index 6c5c9813..9db182c7 100644 --- a/UnleashedRecomp/patches/input_patches.cpp +++ b/UnleashedRecomp/patches/input_patches.cpp @@ -212,6 +212,9 @@ g_sdlEventListenerForInputPatches; static bool IsDPadThreshold(const SWA::SPadState* pPadState) { + if (Config::DisableDPadAsAnalogInput) + return false; + return pPadState->IsDown(SWA::eKeyState_DpadUp) || pPadState->IsDown(SWA::eKeyState_DpadDown) || pPadState->IsDown(SWA::eKeyState_DpadLeft) || @@ -237,6 +240,9 @@ static bool IsCursorThreshold(double deadzone = 0, bool isBelowThreshold = false static void SetDPadAnalogDirectionX(PPCRegister& pPadState, PPCRegister& x, bool invert, float max = 1.0f) { + if (Config::DisableDPadAsAnalogInput) + return; + auto pGuestPadState = (SWA::SPadState*)g_memory.Translate(pPadState.u32); if (pGuestPadState->IsDown(SWA::eKeyState_DpadLeft)) @@ -248,6 +254,9 @@ static void SetDPadAnalogDirectionX(PPCRegister& pPadState, PPCRegister& x, bool static void SetDPadAnalogDirectionY(PPCRegister& pPadState, PPCRegister& y, bool invert, float max = 1.0f) { + if (Config::DisableDPadAsAnalogInput) + return; + auto pGuestPadState = (SWA::SPadState*)g_memory.Translate(pPadState.u32); if (pGuestPadState->IsDown(SWA::eKeyState_DpadUp)) @@ -283,6 +292,9 @@ void PostureDPadSupportYMidAsmHook(PPCRegister& pPadState, PPCRegister& y) void PostureSpaceHurrierDPadSupportXMidAsmHook(PPCRegister& pPadState, PPCVRegister& vector) { + if (Config::DisableDPadAsAnalogInput) + return; + auto pGuestPadState = (SWA::SPadState*)g_memory.Translate(pPadState.u32); if (pGuestPadState->IsDown(SWA::eKeyState_DpadLeft)) @@ -294,6 +306,9 @@ void PostureSpaceHurrierDPadSupportXMidAsmHook(PPCRegister& pPadState, PPCVRegis void PostureSpaceHurrierDPadSupportYMidAsmHook(PPCRegister& pPadState, PPCVRegister& vector) { + if (Config::DisableDPadAsAnalogInput) + return; + auto pGuestPadState = (SWA::SPadState*)g_memory.Translate(pPadState.u32); if (pGuestPadState->IsDown(SWA::eKeyState_DpadUp)) @@ -403,17 +418,20 @@ PPC_FUNC(sub_8256C938) pWorldMapCursor->m_LeftStickVertical = rPadState.LeftStickVertical; pWorldMapCursor->m_LeftStickHorizontal = rPadState.LeftStickHorizontal; - if (rPadState.IsDown(SWA::eKeyState_DpadUp)) - pWorldMapCursor->m_LeftStickVertical = 1.0f; - - if (rPadState.IsDown(SWA::eKeyState_DpadDown)) - pWorldMapCursor->m_LeftStickVertical = -1.0f; - - if (rPadState.IsDown(SWA::eKeyState_DpadLeft)) - pWorldMapCursor->m_LeftStickHorizontal = -1.0f; - - if (rPadState.IsDown(SWA::eKeyState_DpadRight)) - pWorldMapCursor->m_LeftStickHorizontal = 1.0f; + if (!Config::DisableDPadAsAnalogInput) + { + if (rPadState.IsDown(SWA::eKeyState_DpadUp)) + pWorldMapCursor->m_LeftStickVertical = 1.0f; + + if (rPadState.IsDown(SWA::eKeyState_DpadDown)) + pWorldMapCursor->m_LeftStickVertical = -1.0f; + + if (rPadState.IsDown(SWA::eKeyState_DpadLeft)) + pWorldMapCursor->m_LeftStickHorizontal = -1.0f; + + if (rPadState.IsDown(SWA::eKeyState_DpadRight)) + pWorldMapCursor->m_LeftStickHorizontal = 1.0f; + } if (sqrtl((pWorldMapCursor->m_LeftStickHorizontal * pWorldMapCursor->m_LeftStickHorizontal) + (pWorldMapCursor->m_LeftStickVertical * pWorldMapCursor->m_LeftStickVertical)) > WORLD_MAP_ROTATE_DEADZONE) diff --git a/UnleashedRecomp/user/config_def.h b/UnleashedRecomp/user/config_def.h index c58c9e92..41385724 100644 --- a/UnleashedRecomp/user/config_def.h +++ b/UnleashedRecomp/user/config_def.h @@ -93,5 +93,6 @@ CONFIG_DEFINE_HIDDEN("Codes", bool, SkipIntroLogos, false); CONFIG_DEFINE_HIDDEN("Codes", bool, UseArrowsForTimeOfDayTransition, false); CONFIG_DEFINE_HIDDEN("Codes", bool, UseOfficialTitleOnTitleBar, false); CONFIG_DEFINE_HIDDEN("Codes", bool, DisableLowResolutionFontOnCustomUI, false); +CONFIG_DEFINE_HIDDEN("Codes", bool, DisableDPadAsAnalogInput, false); CONFIG_DEFINE("Update", time_t, LastChecked, 0); From df5e48f528b530c7c7984c3286779c4b75498a37 Mon Sep 17 00:00:00 2001 From: Hyper <34012267+hyperbx@users.noreply.github.com> Date: Thu, 6 Mar 2025 06:33:13 +0000 Subject: [PATCH 3/3] Increase FPS slider max to 241 (#1082) --- UnleashedRecomp/user/config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UnleashedRecomp/user/config.h b/UnleashedRecomp/user/config.h index e038d023..5cda9d9d 100644 --- a/UnleashedRecomp/user/config.h +++ b/UnleashedRecomp/user/config.h @@ -95,7 +95,7 @@ enum class ETripleBuffering : uint32_t }; static constexpr int32_t FPS_MIN = 15; -static constexpr int32_t FPS_MAX = 240; +static constexpr int32_t FPS_MAX = 241; enum class EAntiAliasing : uint32_t {