Fix Rooftop Run barrels rolling backwards at HFR (#368)

This commit is contained in:
Hyper 2025-02-11 15:15:43 +00:00 committed by GitHub
parent a07610fb7a
commit e86922b2b2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 0 deletions

View file

@ -28,6 +28,17 @@ void HighFrameRateDeltaTimeFixMidAsmHook(PPCRegister& f1)
f1.f64 = threshold;
}
// This hook expects the vector register to store delta time at the first index.
void HighFrameRateDeltaTimeFixVectorMidAsmHook(PPCVRegister& v62)
{
// Having 60 FPS threshold ensures we still retain
// the original game behavior when locked to 30/60 FPS.
constexpr double threshold = 1.0 / 60.0;
if (v62.f32[3] < threshold)
v62.f32[3] = threshold;
}
void CameraDeltaTimeFixMidAsmHook(PPCRegister& dest, PPCRegister& src)
{
dest.f64 = src.f64 / 30.0;

View file

@ -973,3 +973,9 @@ registers = ["r30", "f30"]
name = "SparkleLocusMidAsmHook"
address = 0x82E96804
jump_address_on_true = 0x82E96808
# Rooftop Run barrel fix (works at up to ~400 FPS)
[[midasm_hook]]
name = "HighFrameRateDeltaTimeFixVectorMidAsmHook"
address = 0x827673CC
registers = ["v62"]