summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2025-11-01 10:06:08 +0100
committerGitHub <noreply@github.com>2025-11-01 10:06:08 +0100
commit91fd53a98ce7adcce2c724f4a06fe7df1bd0367a (patch)
tree8201e0dd1e127932559f5b59dc46e4dfd0102005 /Source/Core/VideoCommon
parent828e72d604217d19e4b6875b7cac5d2e049ecedd (diff)
parent70d8bc6fd722c9d2fb13e20cc3de41b97a25a650 (diff)
Merge pull request #14035 from Dentomologist/pauseandlock_refactoring
PauseAndLock Refactoring
Diffstat (limited to 'Source/Core/VideoCommon')
-rw-r--r--Source/Core/VideoCommon/Fifo.cpp26
-rw-r--r--Source/Core/VideoCommon/Fifo.h3
-rw-r--r--Source/Core/VideoCommon/VideoConfig.cpp4
3 files changed, 16 insertions, 17 deletions
diff --git a/Source/Core/VideoCommon/Fifo.cpp b/Source/Core/VideoCommon/Fifo.cpp
index 0e7bb4c341..f183c93655 100644
--- a/Source/Core/VideoCommon/Fifo.cpp
+++ b/Source/Core/VideoCommon/Fifo.cpp
@@ -67,23 +67,21 @@ void FifoManager::DoState(PointerWrap& p)
p.Do(m_syncing_suspended);
}
-void FifoManager::PauseAndLock(bool do_lock, bool unpause_on_unlock)
+void FifoManager::PauseAndLock()
{
- if (do_lock)
- {
- SyncGPU(SyncGPUReason::Other);
- EmulatorState(false);
+ SyncGPU(SyncGPUReason::Other);
+ EmulatorState(false);
- if (!m_system.IsDualCoreMode() || m_use_deterministic_gpu_thread)
- return;
+ if (!m_system.IsDualCoreMode() || m_use_deterministic_gpu_thread)
+ return;
- m_gpu_mainloop.WaitYield(std::chrono::milliseconds(100), Host_YieldToUI);
- }
- else
- {
- if (unpause_on_unlock)
- EmulatorState(true);
- }
+ m_gpu_mainloop.WaitYield(std::chrono::milliseconds(100), Host_YieldToUI);
+}
+
+void FifoManager::RestoreState(const bool was_running)
+{
+ if (was_running)
+ EmulatorState(true);
}
void FifoManager::Init()
diff --git a/Source/Core/VideoCommon/Fifo.h b/Source/Core/VideoCommon/Fifo.h
index 2fce8fdcb5..2afa110532 100644
--- a/Source/Core/VideoCommon/Fifo.h
+++ b/Source/Core/VideoCommon/Fifo.h
@@ -52,7 +52,8 @@ public:
void Shutdown();
void Prepare(); // Must be called from the CPU thread.
void DoState(PointerWrap& f);
- void PauseAndLock(bool do_lock, bool unpause_on_unlock);
+ void PauseAndLock();
+ 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 46f8732c2f..60668f9f2d 100644
--- a/Source/Core/VideoCommon/VideoConfig.cpp
+++ b/Source/Core/VideoCommon/VideoConfig.cpp
@@ -64,13 +64,13 @@ void VideoConfig::Refresh()
const bool lock_gpu_thread = Core::IsRunning(system);
if (lock_gpu_thread)
- system.GetFifo().PauseAndLock(true, false);
+ system.GetFifo().PauseAndLock();
g_Config.Refresh();
g_Config.VerifyValidity();
if (lock_gpu_thread)
- system.GetFifo().PauseAndLock(false, true);
+ system.GetFifo().RestoreState(true);
};
s_config_changed_callback_id =