From f497eb519e672a0dffbcd029dc937425af754ba0 Mon Sep 17 00:00:00 2001 From: Dentomologist Date: Sun, 4 Jun 2023 17:07:07 -0700 Subject: [PATCH] FifoManager: Extract RestoreState from PauseAndLock Replace calls of FifoManager::PauseAndLock(do_lock=false) with new function RestoreState for clarity. --- Source/Core/DolphinQt/Host.cpp | 2 +- Source/Core/VideoCommon/Fifo.cpp | 6 ++++++ Source/Core/VideoCommon/Fifo.h | 1 + Source/Core/VideoCommon/VideoConfig.cpp | 2 +- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Source/Core/DolphinQt/Host.cpp b/Source/Core/DolphinQt/Host.cpp index 46b0aa8963a..78ff0fae8a8 100644 --- a/Source/Core/DolphinQt/Host.cpp +++ b/Source/Core/DolphinQt/Host.cpp @@ -108,7 +108,7 @@ static void RunWithGPUThreadInactive(std::function f) auto& fifo = system.GetFifo(); fifo.PauseAndLock(true, was_running); f(); - fifo.PauseAndLock(false, was_running); + fifo.RestoreState(was_running); } else { diff --git a/Source/Core/VideoCommon/Fifo.cpp b/Source/Core/VideoCommon/Fifo.cpp index 513b6554087..7e07e0bbf37 100644 --- a/Source/Core/VideoCommon/Fifo.cpp +++ b/Source/Core/VideoCommon/Fifo.cpp @@ -86,6 +86,12 @@ void FifoManager::PauseAndLock(bool do_lock, bool unpause_on_unlock) } } +void FifoManager::RestoreState(const bool was_running) +{ + if (was_running) + EmulatorState(true); +} + void FifoManager::Init() { if (!m_config_callback_id) diff --git a/Source/Core/VideoCommon/Fifo.h b/Source/Core/VideoCommon/Fifo.h index 2fce8fdcb53..c6fc6376615 100644 --- a/Source/Core/VideoCommon/Fifo.h +++ b/Source/Core/VideoCommon/Fifo.h @@ -53,6 +53,7 @@ public: void Prepare(); // Must be called from the CPU thread. void DoState(PointerWrap& f); void PauseAndLock(bool do_lock, bool unpause_on_unlock); + void RestoreState(bool was_running); void UpdateWantDeterminism(bool want); bool UseDeterministicGPUThread() const { return m_use_deterministic_gpu_thread; } bool UseSyncGPU() const { return m_config_sync_gpu; } diff --git a/Source/Core/VideoCommon/VideoConfig.cpp b/Source/Core/VideoCommon/VideoConfig.cpp index 46f8732c2fa..4c11fb084e8 100644 --- a/Source/Core/VideoCommon/VideoConfig.cpp +++ b/Source/Core/VideoCommon/VideoConfig.cpp @@ -70,7 +70,7 @@ void VideoConfig::Refresh() g_Config.VerifyValidity(); if (lock_gpu_thread) - system.GetFifo().PauseAndLock(false, true); + system.GetFifo().RestoreState(true); }; s_config_changed_callback_id =