summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/RenderBase.cpp
diff options
context:
space:
mode:
authorFiloppi <filippotarpini@hotmail.it>2020-12-31 14:03:20 +0200
committerFiloppi <filippotarpini@hotmail.it>2021-05-06 01:10:04 +0300
commit818672b5856ed0ba36af27343f4dbf31544bc1a4 (patch)
treedaff6cc4b8828cb8e7f0e63f78b5f72008acf92e /Source/Core/VideoCommon/RenderBase.cpp
parent31780a6059366112283fbbc894d9123b1fb2281e (diff)
Fix FPS counter and Game Window speed % breaking on pause/unpause
-Add pause state to FPSCounter. -Add ability to have more than one "OnStateChanged" callback in core. -Add GetActualEmulationSpeed() to Core. Returns 1 by default. It's used by my input PRs.
Diffstat (limited to 'Source/Core/VideoCommon/RenderBase.cpp')
-rw-r--r--Source/Core/VideoCommon/RenderBase.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp
index c16dcd95c3..fdcc0f4a99 100644
--- a/Source/Core/VideoCommon/RenderBase.cpp
+++ b/Source/Core/VideoCommon/RenderBase.cpp
@@ -1329,7 +1329,12 @@ void Renderer::Swap(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height, u6
{
// Remove stale EFB/XFB copies.
g_texture_cache->Cleanup(m_frame_count);
- Core::Callback_FramePresented();
+ const double last_speed_denominator =
+ m_fps_counter.GetDeltaTime() * VideoInterface::GetTargetRefreshRate();
+ // The denominator should always be > 0 but if it's not, just return 1
+ const double last_speed =
+ last_speed_denominator > 0.0 ? (1.0 / last_speed_denominator) : 1.0;
+ Core::Callback_FramePresented(last_speed);
}
// Handle any config changes, this gets propogated to the backend.