mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-01-06 03:29:55 -06:00
Fix loading screen speed at high frame rates
This commit is contained in:
@@ -3,6 +3,9 @@
|
||||
#include "ui/window.h"
|
||||
#include "config.h"
|
||||
|
||||
float m_lastLoadingFrameDelta = 0.0f;
|
||||
std::chrono::steady_clock::time_point m_lastLoadingFrameTime;
|
||||
|
||||
void HighFrameRateDeltaTimeFixMidAsmHook(PPCRegister& f1)
|
||||
{
|
||||
// Having 60 FPS threshold ensures we still retain
|
||||
@@ -58,3 +61,15 @@ void Camera2DSlopeLerpFixMidAsmHook(PPCRegister& t, PPCRegister& deltaTime)
|
||||
{
|
||||
t.f64 = ComputeLerpFactor(t.f64, deltaTime.f64 / 60.0);
|
||||
}
|
||||
|
||||
void LoadingScreenSpeedFixMidAsmHook(PPCRegister& r4)
|
||||
{
|
||||
auto now = std::chrono::high_resolution_clock::now();
|
||||
|
||||
m_lastLoadingFrameDelta = std::min(std::chrono::duration<float>(now - m_lastLoadingFrameTime).count(), 1.0f / 15.0f);
|
||||
m_lastLoadingFrameTime = now;
|
||||
|
||||
auto pDeltaTime = (be<float>*)g_memory.Translate(r4.u32);
|
||||
|
||||
*pDeltaTime = m_lastLoadingFrameDelta;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user