CDROM: Don't crash emulator when interrupts are missed

This commit is contained in:
Connor McLaughlin 2019-10-26 22:34:05 +10:00
parent b0c492fd43
commit 62f6a5597e
2 changed files with 8 additions and 0 deletions

View File

@ -424,6 +424,12 @@ void CDROM::SetAsyncInterrupt(Interrupt interrupt)
DeliverAsyncInterrupt();
}
void CDROM::CancelAsyncInterrupt()
{
m_pending_async_interrupt = 0;
m_async_response_fifo.Clear();
}
void CDROM::DeliverAsyncInterrupt()
{
Assert(m_pending_async_interrupt != 0 && !HasPendingInterrupt());
@ -992,6 +998,7 @@ void CDROM::DoSectorRead()
if (HasPendingAsyncInterrupt())
{
Log_WarningPrintf("Data interrupt was not delivered");
CancelAsyncInterrupt();
}
if (!m_sector_buffer.empty())
{

View File

@ -171,6 +171,7 @@ private:
bool HasPendingAsyncInterrupt() const { return m_pending_async_interrupt != 0; }
void SetInterrupt(Interrupt interrupt);
void SetAsyncInterrupt(Interrupt interrupt);
void CancelAsyncInterrupt();
void DeliverAsyncInterrupt();
void SendACKAndStat();
void SendErrorResponse(u8 reason = 0x80);