From 91092847f863cf9ce07df284d5c69c9b6970882c Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Mon, 1 Feb 2021 02:00:08 +1000 Subject: [PATCH] CommonHostInterface: Restore display skip on exit/pause Fixes CPU usage/controller moving too quickly in menus after fast forwarding in big duck mode. --- src/frontend-common/common_host_interface.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/frontend-common/common_host_interface.cpp b/src/frontend-common/common_host_interface.cpp index 81649479b..e849d1c4d 100644 --- a/src/frontend-common/common_host_interface.cpp +++ b/src/frontend-common/common_host_interface.cpp @@ -2,10 +2,10 @@ #include "common/assert.h" #include "common/audio_stream.h" #include "common/byte_stream.h" +#include "common/crash_handler.h" #include "common/file_system.h" #include "common/log.h" #include "common/string_util.h" -#include "common/crash_handler.h" #include "controller_interface.h" #include "core/cdrom.h" #include "core/cheats.h" @@ -643,7 +643,7 @@ void CommonHostInterface::UpdateSpeedLimiterState() !System::IsRunning() || (m_throttler_enabled && g_settings.audio_sync_enabled && !is_non_standard_speed); const bool video_sync_enabled = !System::IsRunning() || (m_throttler_enabled && g_settings.video_sync_enabled && !is_non_standard_speed); - const float max_display_fps = m_throttler_enabled ? 0.0f : g_settings.display_max_fps; + const float max_display_fps = (!System::IsValid() || m_throttler_enabled) ? 0.0f : g_settings.display_max_fps; Log_InfoPrintf("Target speed: %f%%", target_speed * 100.0f); Log_InfoPrintf("Syncing to %s%s", audio_sync_enabled ? "audio" : "", (audio_sync_enabled && video_sync_enabled) ? " and video" : (video_sync_enabled ? "video" : "")); @@ -799,6 +799,10 @@ void CommonHostInterface::OnSystemPaused(bool paused) void CommonHostInterface::OnSystemDestroyed() { + // Restore present-all-frames behavior. + if (m_display) + m_display->SetDisplayMaxFPS(0.0f); + HostInterface::OnSystemDestroyed(); StopControllerRumble();