mirror of
https://github.com/hedge-dev/UnleashedRecomp
synced 2026-05-24 23:22:18 -04:00
Implement frame limiter. (#60)
* Implement audio timing with integer math. * Add busy loop to audio thread. * Implement a frame limiter. * Implement implot. * Add more stuff to the profiler window. * Redo frame limiter logic to fix drifting. * Move frame limiter, add limiters for SFD & loading screen. * Update waiting logic for audio thread. * Correct small delta time errors. * Decrease delta time error threshold. * Set busy wait threshold to 2ms. * Change spin wait in D3D12 present to infinite wait. * Replace FPS literals with constants.
This commit is contained in:
@@ -38,6 +38,14 @@ PPC_FUNC(sub_824EB490)
|
||||
PPC_FUNC_IMPL(__imp__sub_822C1130);
|
||||
PPC_FUNC(sub_822C1130)
|
||||
{
|
||||
// Correct small delta time errors.
|
||||
if (Config::FPS >= FPS_MIN && Config::FPS < FPS_MAX)
|
||||
{
|
||||
double targetDeltaTime = 1.0 / Config::FPS;
|
||||
if (abs(ctx.f1.f64 - targetDeltaTime) < 0.00001)
|
||||
ctx.f1.f64 = targetDeltaTime;
|
||||
}
|
||||
|
||||
App::s_deltaTime = ctx.f1.f64;
|
||||
|
||||
SDL_PumpEvents();
|
||||
@@ -48,3 +56,4 @@ PPC_FUNC(sub_822C1130)
|
||||
|
||||
__imp__sub_822C1130(ctx, base);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user