From 075ee43808e99dd57477a3bbc88910e46ca5f3b4 Mon Sep 17 00:00:00 2001 From: Skyth <19259897+blueskythlikesclouds@users.noreply.github.com> Date: Mon, 9 Dec 2024 13:46:17 +0300 Subject: [PATCH] Redo down force HFR fix. --- UnleashedRecomp/patches/fps_patches.cpp | 14 ++++++++++++++ UnleashedRecompLib/config/SWA.toml | 12 +++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/UnleashedRecomp/patches/fps_patches.cpp b/UnleashedRecomp/patches/fps_patches.cpp index f6f2c6b..33055db 100644 --- a/UnleashedRecomp/patches/fps_patches.cpp +++ b/UnleashedRecomp/patches/fps_patches.cpp @@ -7,6 +7,20 @@ float m_lastLoadingFrameDelta = 0.0f; std::chrono::steady_clock::time_point m_lastLoadingFrameTime; +void DownForceDeltaTimeFixMidAsmHook(PPCRegister& f0) +{ + f0.f64 = 30.0; +} + +void DownForceDeltaTimeFixMidAsmHook(PPCVRegister& v127, PPCRegister& f24) +{ + double factor = 1.0 / (f24.f64 * 30.0); + v127.f32[0] *= factor; + v127.f32[1] *= factor; + v127.f32[2] *= factor; + v127.f32[3] *= factor; +} + void HighFrameRateDeltaTimeFixMidAsmHook(PPCRegister& f1) { // Having 60 FPS threshold ensures we still retain diff --git a/UnleashedRecompLib/config/SWA.toml b/UnleashedRecompLib/config/SWA.toml index 99b60fc..7ccbab9 100644 --- a/UnleashedRecompLib/config/SWA.toml +++ b/UnleashedRecompLib/config/SWA.toml @@ -143,9 +143,15 @@ registers = ["r30"] # Down force HFR fix [[midasm_hook]] -name = "HighFrameRateDeltaTimeFixMidAsmHook" -address = 0x8234AB94 -registers = ["f1"] +name = "DownForceDeltaTimeFixMidAsmHook" +address = 0x82319D60 +registers = ["f0"] +jump_address = 0x82319D64 + +[[midasm_hook]] +name = "DownForceDeltaTimeFixMidAsmHook" +address = 0x82319DCC +registers = ["v127", "f24"] # 2D spline HFR fix [[midasm_hook]]