From f70a5b12ac02d80303048c7831f2974a3a7d4f13 Mon Sep 17 00:00:00 2001 From: Jean-Philip Desjardins Date: Fri, 19 Oct 2018 12:56:05 -0400 Subject: [PATCH] Make sure GS interrupts only occur when events occur. --- Source/gs/GSHandler.cpp | 12 ++++++------ Source/gs/GSHandler.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Source/gs/GSHandler.cpp b/Source/gs/GSHandler.cpp index 9f73e005..2808a928 100644 --- a/Source/gs/GSHandler.cpp +++ b/Source/gs/GSHandler.cpp @@ -236,7 +236,7 @@ void CGSHandler::SetVBlank() std::lock_guard 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 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: { diff --git a/Source/gs/GSHandler.h b/Source/gs/GSHandler.h index 9f8a3397..c07d8af6 100644 --- a/Source/gs/GSHandler.h +++ b/Source/gs/GSHandler.h @@ -751,7 +751,7 @@ public: void SetSMODE2(uint64); int GetPendingTransferCount() const; - void CheckPendingInterrupt(); + void NotifyEvent(uint32); unsigned int GetCrtWidth() const; unsigned int GetCrtHeight() const;