mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2025-12-19 14:32:19 +00:00
Fix loading screen speed at high frame rates
This commit is contained in:
parent
3080412dc0
commit
c9b6a6913f
3 changed files with 21 additions and 0 deletions
|
|
@ -3,6 +3,9 @@
|
||||||
#include "ui/window.h"
|
#include "ui/window.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
float m_lastLoadingFrameDelta = 0.0f;
|
||||||
|
std::chrono::steady_clock::time_point m_lastLoadingFrameTime;
|
||||||
|
|
||||||
void HighFrameRateDeltaTimeFixMidAsmHook(PPCRegister& f1)
|
void HighFrameRateDeltaTimeFixMidAsmHook(PPCRegister& f1)
|
||||||
{
|
{
|
||||||
// Having 60 FPS threshold ensures we still retain
|
// 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);
|
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;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include <chrono>
|
||||||
#include <xbox.h>
|
#include <xbox.h>
|
||||||
#include <xxhash.h>
|
#include <xxhash.h>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include <ankerl/unordered_dense.h>
|
||||||
|
|
|
||||||
|
|
@ -417,3 +417,8 @@ jump_address_on_true = 0x827D20EC
|
||||||
name = "ParticleTestDrawIndexedPrimitiveMidAsmHook"
|
name = "ParticleTestDrawIndexedPrimitiveMidAsmHook"
|
||||||
address = 0x827D25AC
|
address = 0x827D25AC
|
||||||
registers = ["r7"]
|
registers = ["r7"]
|
||||||
|
|
||||||
|
[[midasm_hook]]
|
||||||
|
name = "LoadingScreenSpeedFixMidAsmHook"
|
||||||
|
address = 0x824DAB60
|
||||||
|
registers = ["r4"]
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue