From 88c7b8b8d5be2c0996b9602ea84c367ec7cec7b0 Mon Sep 17 00:00:00 2001 From: Skyth <19259897+blueskythlikesclouds@users.noreply.github.com> Date: Tue, 5 Nov 2024 15:17:31 +0300 Subject: [PATCH] Add player 2D camera HFR patches. --- UnleashedRecomp/game.cpp | 5 ++++ UnleashedRecompLib/config/SWA.toml | 37 ++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/UnleashedRecomp/game.cpp b/UnleashedRecomp/game.cpp index 07e8d38..c4bd838 100644 --- a/UnleashedRecomp/game.cpp +++ b/UnleashedRecomp/game.cpp @@ -370,4 +370,9 @@ void CameraTargetSideOffsetLerpFixMidAsmHook(PPCVRegister& v13, PPCVRegister& v6 } } +void Camera2DLerpFixMidAsmHook(PPCRegister& t, PPCRegister& deltaTime) +{ + t.f64 = ComputeLerpFactor(std::min(1.0, t.f64 * 2.0), deltaTime.f64 / 60.0); +} + #pragma endregion diff --git a/UnleashedRecompLib/config/SWA.toml b/UnleashedRecompLib/config/SWA.toml index 330efa2..f6f7305 100644 --- a/UnleashedRecompLib/config/SWA.toml +++ b/UnleashedRecompLib/config/SWA.toml @@ -287,6 +287,43 @@ name = "CameraTargetSideOffsetLerpFixMidAsmHook" address = 0x8247F12C # Target side offset registers = ["v13", "v62", "f21"] +# 2D camera HFR fixes +[[midasm_hook]] +name = "Camera2DLerpFixMidAsmHook" +address = 0x824761AC # Player velocity +registers = ["f0", "f28"] +jump_address = 0x824761B0 + +[[midasm_hook]] +name = "Camera2DLerpFixMidAsmHook" +address = 0x824762AC # Player position +registers = ["f0", "f28"] +jump_address = 0x824762B0 + +[[midasm_hook]] +name = "Camera2DLerpFixMidAsmHook" +address = 0x8247645C # Spherical position +registers = ["f0", "f28"] +jump_address = 0x82476460 + +[[midasm_hook]] +name = "Camera2DLerpFixMidAsmHook" +address = 0x82476514 # Target up offset +registers = ["f0", "f28"] +jump_address = 0x82476518 + +[[midasm_hook]] +name = "Camera2DLerpFixMidAsmHook" +address = 0x824768A0 # Spherical position +registers = ["f0", "f28"] +jump_address = 0x824768A4 + +[[midasm_hook]] +name = "Camera2DLerpFixMidAsmHook" +address = 0x824768C8 # Spherical position +registers = ["f0", "f28"] +jump_address = 0x824768CC + [[midasm_hook]] name = "GetStageIDMidAsmHook" address = 0x82528198