Make sure GS interrupts only occur when events occur.

This commit is contained in:
Jean-Philip Desjardins 2018-10-19 12:56:05 -04:00
parent 5b9b9ed5e8
commit f70a5b12ac
2 changed files with 7 additions and 7 deletions

View File

@ -236,7 +236,7 @@ void CGSHandler::SetVBlank()
std::lock_guard<std::recursive_mutex> registerMutexLock(m_registerMutex);
m_nCSR |= CSR_VSYNC_INT;
CheckPendingInterrupt();
NotifyEvent(CSR_VSYNC_INT);
}
void CGSHandler::ResetVBlank()
@ -252,10 +252,10 @@ int CGSHandler::GetPendingTransferCount() const
return m_transferCount;
}
void CGSHandler::CheckPendingInterrupt()
void CGSHandler::NotifyEvent(uint32 eventBit)
{
uint32 mask = (~m_nIMR >> 8) & 0x1F;
bool hasPendingInterrupt = (m_nCSR & mask) != 0;
bool hasPendingInterrupt = (eventBit & mask) != 0;
if(m_intc && hasPendingInterrupt)
{
m_intc->AssertLine(CINTC::INTC_LINE_GS);
@ -272,7 +272,7 @@ uint32 CGSHandler::ReadPrivRegister(uint32 nAddress)
{
std::lock_guard<std::recursive_mutex> registerMutexLock(m_registerMutex);
m_nCSR |= CSR_HSYNC_INT;
CheckPendingInterrupt();
NotifyEvent(CSR_HSYNC_INT);
R_REG(nAddress, nData, m_nCSR);
}
break;
@ -454,12 +454,12 @@ void CGSHandler::WriteRegisterMassively(RegisterWriteList registerWrites, const
m_nSIGLBLID = siglblid;
assert((m_nCSR & CSR_SIGNAL_EVENT) == 0);
m_nCSR |= CSR_SIGNAL_EVENT;
CheckPendingInterrupt();
NotifyEvent(CSR_SIGNAL_EVENT);
}
break;
case GS_REG_FINISH:
m_nCSR |= CSR_FINISH_EVENT;
CheckPendingInterrupt();
NotifyEvent(CSR_FINISH_EVENT);
break;
case GS_REG_LABEL:
{

View File

@ -751,7 +751,7 @@ public:
void SetSMODE2(uint64);
int GetPendingTransferCount() const;
void CheckPendingInterrupt();
void NotifyEvent(uint32);
unsigned int GetCrtWidth() const;
unsigned int GetCrtHeight() const;