diff options
| author | Admiral H. Curtiss <pikachu025@gmail.com> | 2024-07-04 20:07:03 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-04 20:07:03 +0200 |
| commit | 1fb4dbcea46985eeeca04714b27f01bdae776f2f (patch) | |
| tree | b40a9dd6d28e9e3072c123883339b098b697cf93 /Source/Core | |
| parent | 654ccb0b705c65acbb91d030e101b11e3da586d6 (diff) | |
| parent | f29fe15d77122d6ddfc6bd30ff91680a6bcbecb8 (diff) | |
Merge pull request #12784 from TryTwo/PR_Frame_Advance_Fix
Frame Advance: Fix UI update spam when continuously advancing.
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/DolphinQt/Host.cpp | 3 | ||||
| -rw-r--r-- | Source/Core/DolphinQt/HotkeyScheduler.cpp | 4 | ||||
| -rw-r--r-- | Source/Core/DolphinQt/Settings.cpp | 17 | ||||
| -rw-r--r-- | Source/Core/DolphinQt/Settings.h | 5 |
4 files changed, 28 insertions, 1 deletions
diff --git a/Source/Core/DolphinQt/Host.cpp b/Source/Core/DolphinQt/Host.cpp index bb912a7ab2..80a4247a2b 100644 --- a/Source/Core/DolphinQt/Host.cpp +++ b/Source/Core/DolphinQt/Host.cpp @@ -250,6 +250,9 @@ void Host_YieldToUI() void Host_UpdateDisasmDialog() { + if (Settings::Instance().GetIsContinuouslyFrameStepping()) + return; + QueueOnObject(QApplication::instance(), [] { emit Host::GetInstance()->UpdateDisasmDialog(); }); } diff --git a/Source/Core/DolphinQt/HotkeyScheduler.cpp b/Source/Core/DolphinQt/HotkeyScheduler.cpp index 66dbaeb8d8..39e4633a9e 100644 --- a/Source/Core/DolphinQt/HotkeyScheduler.cpp +++ b/Source/Core/DolphinQt/HotkeyScheduler.cpp @@ -113,6 +113,8 @@ static void HandleFrameStepHotkeys() if ((frame_step_count == 0 || frame_step_count == FRAME_STEP_DELAY) && !frame_step_hold) { + if (frame_step_count > 0) + Settings::Instance().SetIsContinuouslyFrameStepping(true); Core::QueueHostJob([](auto& system) { Core::DoFrameStep(system); }); frame_step_hold = true; } @@ -138,6 +140,8 @@ static void HandleFrameStepHotkeys() frame_step_count = 0; frame_step_hold = false; frame_step_delay_count = 0; + Settings::Instance().SetIsContinuouslyFrameStepping(false); + emit Settings::Instance().EmulationStateChanged(Core::GetState(Core::System::GetInstance())); } } diff --git a/Source/Core/DolphinQt/Settings.cpp b/Source/Core/DolphinQt/Settings.cpp index 4ab29c3e0f..195cf16579 100644 --- a/Source/Core/DolphinQt/Settings.cpp +++ b/Source/Core/DolphinQt/Settings.cpp @@ -59,7 +59,12 @@ Settings::Settings() { qRegisterMetaType<Core::State>(); Core::AddOnStateChangedCallback([this](Core::State new_state) { - QueueOnObject(this, [this, new_state] { emit EmulationStateChanged(new_state); }); + QueueOnObject(this, [this, new_state] { + // Avoid signal spam while continuously frame stepping. Will still send a signal for the first + // and last framestep. + if (!m_continuously_frame_stepping) + emit EmulationStateChanged(new_state); + }); }); Config::AddConfigChangedCallback([this] { @@ -827,3 +832,13 @@ void Settings::SetUSBKeyboardConnected(bool connected) emit USBKeyboardConnectionChanged(connected); } } + +void Settings::SetIsContinuouslyFrameStepping(bool is_stepping) +{ + m_continuously_frame_stepping = is_stepping; +} + +bool Settings::GetIsContinuouslyFrameStepping() const +{ + return m_continuously_frame_stepping; +} diff --git a/Source/Core/DolphinQt/Settings.h b/Source/Core/DolphinQt/Settings.h index c1dae424fc..a1ceb0c8c5 100644 --- a/Source/Core/DolphinQt/Settings.h +++ b/Source/Core/DolphinQt/Settings.h @@ -120,6 +120,9 @@ public: bool IsUSBKeyboardConnected() const; void SetUSBKeyboardConnected(bool connected); + void SetIsContinuouslyFrameStepping(bool is_stepping); + bool GetIsContinuouslyFrameStepping() const; + // Graphics Config::ShowCursor GetCursorVisibility() const; bool GetLockCursor() const; @@ -229,6 +232,8 @@ private: Settings(); bool m_batch = false; + std::atomic<bool> m_continuously_frame_stepping = false; + std::shared_ptr<NetPlay::NetPlayClient> m_client; std::shared_ptr<NetPlay::NetPlayServer> m_server; ControllerInterface::HotplugCallbackHandle m_hotplug_callback_handle; |
