summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorAdmiral H. Curtiss <pikachu025@gmail.com>2023-11-22 23:10:51 +0100
committerGitHub <noreply@github.com>2023-11-22 23:10:51 +0100
commit937cb8ef3a0a413e9c76c0cf90cffd8a935ab595 (patch)
treeccb8daa47dfab250efd369334ca8fdef19db0d4c /Source
parentab76b15e0557f3186dc24a34766a2f4c3f8224e7 (diff)
parentb57ba42a55099f82a71c3acede18f9de0c67bf74 (diff)
Merge pull request #12299 from TryTwo/PR_bugfix_frame_advance
Core: Add option to not report state change to SetState (bugfix)
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/Core/Core.cpp11
-rw-r--r--Source/Core/Core/Core.h2
-rw-r--r--Source/Core/DolphinQt/Debugger/CodeDiffDialog.cpp4
3 files changed, 10 insertions, 7 deletions
diff --git a/Source/Core/Core/Core.cpp b/Source/Core/Core/Core.cpp
index 870d4729f7..536244869a 100644
--- a/Source/Core/Core/Core.cpp
+++ b/Source/Core/Core/Core.cpp
@@ -712,7 +712,7 @@ static void EmuThread(std::unique_ptr<BootParameters> boot, WindowSystemInfo wsi
// Set or get the running state
-void SetState(State state)
+void SetState(State state, bool report_state_change)
{
// State cannot be controlled until the CPU Thread is operational
if (!IsRunningAndStarted())
@@ -739,7 +739,10 @@ void SetState(State state)
break;
}
- CallOnStateChangedCallbacks(GetState());
+ // Certain callers only change the state momentarily. Sending a callback for them causes
+ // unwanted updates, such as the Pause/Play button flickering between states on frame advance.
+ if (report_state_change)
+ CallOnStateChangedCallbacks(GetState());
}
State GetState()
@@ -750,7 +753,7 @@ State GetState()
if (s_hardware_initialized)
{
auto& system = Core::System::GetInstance();
- if (system.GetCPU().IsStepping() || s_frame_step)
+ if (system.GetCPU().IsStepping())
return State::Paused;
return State::Running;
@@ -1083,7 +1086,7 @@ void DoFrameStep()
// if already paused, frame advance for 1 frame
s_stop_frame_step = false;
s_frame_step = true;
- SetState(State::Running);
+ SetState(State::Running, false);
}
else if (!s_frame_step)
{
diff --git a/Source/Core/Core/Core.h b/Source/Core/Core/Core.h
index 0ff8c32b5c..d8c5c9a0da 100644
--- a/Source/Core/Core/Core.h
+++ b/Source/Core/Core/Core.h
@@ -147,7 +147,7 @@ bool IsHostThread();
bool WantsDeterminism();
// [NOT THREADSAFE] For use by Host only
-void SetState(State state);
+void SetState(State state, bool report_state_change = true);
State GetState();
void SaveScreenShot();
diff --git a/Source/Core/DolphinQt/Debugger/CodeDiffDialog.cpp b/Source/Core/DolphinQt/Debugger/CodeDiffDialog.cpp
index 6698a8289e..f8610e3b85 100644
--- a/Source/Core/DolphinQt/Debugger/CodeDiffDialog.cpp
+++ b/Source/Core/DolphinQt/Debugger/CodeDiffDialog.cpp
@@ -160,7 +160,7 @@ void CodeDiffDialog::ClearBlockCache()
Core::State old_state = Core::GetState();
if (old_state == Core::State::Running)
- Core::SetState(Core::State::Paused);
+ Core::SetState(Core::State::Paused, false);
Core::System::GetInstance().GetJitInterface().ClearCache();
@@ -349,7 +349,7 @@ void CodeDiffDialog::Update(bool include)
// Wrap everything in a pause
Core::State old_state = Core::GetState();
if (old_state == Core::State::Running)
- Core::SetState(Core::State::Paused);
+ Core::SetState(Core::State::Paused, false);
// Main process
if (include)