Skip to content

Commit

Permalink
timer thread paused if stepping
Browse files Browse the repository at this point in the history
  • Loading branch information
aminoa committed Jan 22, 2025
1 parent 259c6f4 commit c07c983
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Source/Core/Core/HW/CPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,17 @@ void CPUManager::StartTimePlayedTimer()
auto curr_time = timer.now();

// Check that emulation is not paused
// If the emulation is paused, wait for SetStepping() to reactivate
if (m_state == State::Running)
{
auto diff_time = std::chrono::duration_cast<std::chrono::milliseconds>(curr_time - prev_time);
time_played.AddTime(diff_time);
}
else if (m_state == State::Stepping)
{
m_time_played_finish_sync.Wait();
curr_time = timer.now();
}

prev_time = curr_time;

Expand Down Expand Up @@ -313,6 +319,7 @@ void CPUManager::SetStepping(bool stepping)
else if (SetStateLocked(State::Running))
{
m_state_cpu_cvar.notify_one();
m_time_played_finish_sync.Set();
RunAdjacentSystems(true);
}
}
Expand Down

0 comments on commit c07c983

Please sign in to comment.