Branch Watch Tool: Ignore Apploader Branch Hits Concurrency Fix

Also removed worthless `Start` and `Pause` helpers from `Core::BranchWatch`.
This commit is contained in:
mitaclaw 2024-08-07 02:39:17 -07:00
parent e4500b5798
commit 8bdfdc88b2
3 changed files with 6 additions and 14 deletions

View File

@ -163,7 +163,7 @@ bool CBoot::RunApploader(Core::System& system, const Core::CPUThreadGuard& guard
const bool resume_branch_watch = branch_watch.GetRecordingActive();
if (system.IsBranchWatchIgnoreApploader())
branch_watch.Pause();
branch_watch.SetRecordingActive(guard, false);
// Call iAppLoaderEntry.
DEBUG_LOG_FMT(BOOT, "Call iAppLoaderEntry");
@ -226,7 +226,7 @@ bool CBoot::RunApploader(Core::System& system, const Core::CPUThreadGuard& guard
// return
ppc_state.pc = ppc_state.gpr[3];
branch_watch.SetRecordingActive(resume_branch_watch);
branch_watch.SetRecordingActive(guard, resume_branch_watch);
return true;
}

View File

@ -117,9 +117,7 @@ public:
using SelectionInspection = BranchWatchSelectionInspection;
bool GetRecordingActive() const { return m_recording_active; }
void SetRecordingActive(bool active) { m_recording_active = active; }
void Start() { SetRecordingActive(true); }
void Pause() { SetRecordingActive(false); }
void SetRecordingActive(const CPUThreadGuard& guard, bool active) { m_recording_active = active; }
void Clear(const CPUThreadGuard& guard);
void Save(const CPUThreadGuard& guard, std::FILE* file) const;

View File

@ -516,7 +516,6 @@ BranchWatchDialog::~BranchWatchDialog()
}
static constexpr int BRANCH_WATCH_TOOL_TIMER_DELAY_MS = 100;
static constexpr int BRANCH_WATCH_TOOL_TIMER_PAUSE_ONESHOT_MS = 200;
static bool TimerCondition(const Core::BranchWatch& branch_watch, Core::State state)
{
@ -537,23 +536,18 @@ void BranchWatchDialog::showEvent(QShowEvent* event)
void BranchWatchDialog::OnStartPause(bool checked) const
{
m_branch_watch.SetRecordingActive(Core::CPUThreadGuard{m_system}, checked);
if (checked)
{
m_branch_watch.Start();
m_btn_start_pause->setText(tr("Pause Branch Watch"));
// Restart the timer if the situation calls for it, but always turn off single-shot.
m_timer->setSingleShot(false);
if (Core::GetState(m_system) > Core::State::Paused)
m_timer->start(BRANCH_WATCH_TOOL_TIMER_DELAY_MS);
}
else
{
m_branch_watch.Pause();
m_btn_start_pause->setText(tr("Start Branch Watch"));
// Schedule one last update in the future in case Branch Watch is in the middle of a hit.
if (Core::GetState(m_system) > Core::State::Paused)
m_timer->setInterval(BRANCH_WATCH_TOOL_TIMER_PAUSE_ONESHOT_MS);
m_timer->setSingleShot(true);
if (m_timer->isActive())
m_timer->stop();
}
Update();
}