From 6ca2da53e86766f54df1ae79e65bb220b41ed7ef Mon Sep 17 00:00:00 2001 From: JosJuice Date: Tue, 2 Jul 2024 17:27:04 +0200 Subject: Partially revert "Revert "Audit uses of IsRunning and GetState"" This reverts the revert commit bc67fc97c39628c76a4dbca411b0e8a9bfaf726a, except for the changes in BaseConfigLoader.cpp, which caused the bug that made us revert 72cf2bdb87f09deff22e1085de3290126aa4ad05. PR 12917 contains an improved change to BaseConfigLoader.cpp, which can be merged (or rejected) independently. A few changes have also been made based on review comments. --- Source/Core/DolphinQt/FIFO/FIFOPlayerWindow.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'Source/Core/DolphinQt/FIFO/FIFOPlayerWindow.cpp') diff --git a/Source/Core/DolphinQt/FIFO/FIFOPlayerWindow.cpp b/Source/Core/DolphinQt/FIFO/FIFOPlayerWindow.cpp index c01381f9a6..721a960f71 100644 --- a/Source/Core/DolphinQt/FIFO/FIFOPlayerWindow.cpp +++ b/Source/Core/DolphinQt/FIFO/FIFOPlayerWindow.cpp @@ -59,10 +59,14 @@ FIFOPlayerWindow::FIFOPlayerWindow(FifoPlayer& fifo_player, FifoRecorder& fifo_r }); connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, [this](Core::State state) { + if (state == m_emu_state) + return; + if (state == Core::State::Running && m_emu_state != Core::State::Paused) OnEmulationStarted(); else if (state == Core::State::Uninitialized) OnEmulationStopped(); + m_emu_state = state; }); @@ -376,9 +380,11 @@ void FIFOPlayerWindow::UpdateLimits() void FIFOPlayerWindow::UpdateControls() { - bool running = Core::IsRunning(Core::System::GetInstance()); - bool is_recording = m_fifo_recorder.IsRecording(); - bool is_playing = m_fifo_player.IsPlaying(); + Core::System& system = Core::System::GetInstance(); + const bool core_is_uninitialized = Core::IsUninitialized(system); + const bool core_is_running = Core::IsRunning(system); + const bool is_recording = m_fifo_recorder.IsRecording(); + const bool is_playing = m_fifo_player.IsPlaying(); m_frame_range_from->setEnabled(is_playing); m_frame_range_from_label->setEnabled(is_playing); @@ -394,10 +400,10 @@ void FIFOPlayerWindow::UpdateControls() m_frame_record_count_label->setEnabled(enable_frame_record_count); m_frame_record_count->setEnabled(enable_frame_record_count); - m_load->setEnabled(!running); - m_record->setEnabled(running && !is_playing); + m_load->setEnabled(core_is_uninitialized); + m_record->setEnabled(core_is_running && !is_playing); - m_stop->setVisible(running && is_recording); + m_stop->setVisible(core_is_running && is_recording); m_record->setVisible(!m_stop->isVisible()); m_save->setEnabled(m_fifo_recorder.IsRecordingDone()); -- cgit v1.2.3