DSPEmulator: Extract UnpauseAndUnlock from PauseAndLock

Replace call to PauseAndLock(do_lock=false) with new function
UnpauseAndUnlock.
This commit is contained in:
Dentomologist 2025-08-13 15:43:08 -07:00
parent 933071dd57
commit d5f079d78b
6 changed files with 20 additions and 1 deletions

View File

@ -798,7 +798,7 @@ static void RestoreStateAndUnlock(Core::System& system, const bool unpause_on_un
if (!IsRunning(system))
return;
system.GetDSP().GetDSPEmulator()->PauseAndLock(false);
system.GetDSP().GetDSPEmulator()->UnpauseAndUnlock();
ResetRumble();
// CPU is unlocked last because CPU::RestoreStateAndUnlock contains the synchronization mechanism

View File

@ -23,6 +23,7 @@ public:
virtual void DoState(PointerWrap& p) = 0;
virtual void PauseAndLock(bool do_lock) = 0;
virtual void UnpauseAndUnlock() = 0;
virtual void DSP_WriteMailBoxHigh(bool cpu_mailbox, u16 value) = 0;
virtual void DSP_WriteMailBoxLow(bool cpu_mailbox, u16 value) = 0;

View File

@ -245,4 +245,8 @@ u16 DSPHLE::DSP_ReadControlRegister()
void DSPHLE::PauseAndLock(bool do_lock)
{
}
void DSPHLE::UnpauseAndUnlock()
{
}
} // namespace DSP::HLE

View File

@ -35,6 +35,7 @@ public:
bool IsLLE() const override { return false; }
void DoState(PointerWrap& p) override;
void PauseAndLock(bool do_lock) override;
void UnpauseAndUnlock() override;
void DSP_WriteMailBoxHigh(bool cpu_mailbox, u16 value) override;
void DSP_WriteMailBoxLow(bool cpu_mailbox, u16 value) override;

View File

@ -305,4 +305,16 @@ void DSPLLE::PauseAndLock(bool do_lock)
}
}
}
void DSPLLE::UnpauseAndUnlock()
{
m_dsp_thread_mutex.unlock();
if (m_is_dsp_on_thread)
{
// Signal the DSP thread so it can perform any outstanding work now (if any)
m_ppc_event.Wait();
m_dsp_event.Set();
}
}
} // namespace DSP::LLE

View File

@ -27,6 +27,7 @@ public:
bool IsLLE() const override { return true; }
void DoState(PointerWrap& p) override;
void PauseAndLock(bool do_lock) override;
void UnpauseAndUnlock() override;
void DSP_WriteMailBoxHigh(bool cpu_mailbox, u16 value) override;
void DSP_WriteMailBoxLow(bool cpu_mailbox, u16 value) override;