From 2097ff232cb1af768075e1ae36f68b7979edd1dd Mon Sep 17 00:00:00 2001 From: refractionpcsx2 Date: Fri, 6 Feb 2026 22:00:06 +0000 Subject: [PATCH] IOP: Fix IRQ edges for SIO2 and CDVD and SIO2 ISTAT usage and silence a log --- pcsx2/CDVD/CDVD.cpp | 10 ++++++++-- pcsx2/IopCounters.cpp | 4 ++-- pcsx2/SIO/Sio2.cpp | 7 ++++++- pcsx2/ps2/Iop/IopHwWrite.cpp | 2 +- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/pcsx2/CDVD/CDVD.cpp b/pcsx2/CDVD/CDVD.cpp index aebaba2659..405bebb0b1 100644 --- a/pcsx2/CDVD/CDVD.cpp +++ b/pcsx2/CDVD/CDVD.cpp @@ -102,10 +102,16 @@ static void CDVD_INT(int eCycle) // test (which will cause the exception to be handled). static void cdvdSetIrq(uint id = (1 << Irq_CommandComplete)) { + if (!(cdvd.IntrStat & id)) + { + iopIntcIrq(2); + psxSetNextBranchDelta(20); + } + else + DevCon.Warning("CDVD trying to double issue IRQ %x", id); + cdvd.IntrStat |= id; cdvd.AbortRequested = false; - iopIntcIrq(2); - psxSetNextBranchDelta(20); } static int mg_BIToffset(u8* buffer) diff --git a/pcsx2/IopCounters.cpp b/pcsx2/IopCounters.cpp index 4ef83be2e6..2b9a580d42 100644 --- a/pcsx2/IopCounters.cpp +++ b/pcsx2/IopCounters.cpp @@ -782,8 +782,8 @@ void psxRcntSetNewIntrMode(int index) psxCounters[index].mode.overflowFlag = false; psxCounters[index].mode.intrEnable = true; - if (psxCounters[index].mode.repeatIntr != psxCounters[index].currentIrqMode.repeatInterrupt || psxCounters[index].mode.toggleIntr != psxCounters[index].currentIrqMode.toggleInterrupt) - DevCon.Warning("Updating psxCounter[%d] mode old repeat %d new %d old toggle %d new %d", index, psxCounters[index].mode.repeatIntr, psxCounters[index].currentIrqMode.repeatInterrupt, psxCounters[index].mode.toggleIntr, psxCounters[index].currentIrqMode.toggleInterrupt); + //if (psxCounters[index].mode.repeatIntr != psxCounters[index].currentIrqMode.repeatInterrupt || psxCounters[index].mode.toggleIntr != psxCounters[index].currentIrqMode.toggleInterrupt) + // DevCon.Warning("Updating psxCounter[%d] mode old repeat %d new %d old toggle %d new %d", index, psxCounters[index].mode.repeatIntr, psxCounters[index].currentIrqMode.repeatInterrupt, psxCounters[index].mode.toggleIntr, psxCounters[index].currentIrqMode.toggleInterrupt); psxCounters[index].currentIrqMode.repeatInterrupt = psxCounters[index].mode.repeatIntr; psxCounters[index].currentIrqMode.toggleInterrupt = psxCounters[index].mode.toggleIntr; diff --git a/pcsx2/SIO/Sio2.cpp b/pcsx2/SIO/Sio2.cpp index 93e9f74355..ed790085ed 100644 --- a/pcsx2/SIO/Sio2.cpp +++ b/pcsx2/SIO/Sio2.cpp @@ -100,7 +100,12 @@ void Sio2::SoftReset() void Sio2::Interrupt() { - iopIntcIrq(17); + if (!iStat) + iopIntcIrq(17); + else + DevCon.Warning("Nearly sent double SIO2 IRQ"); + + iStat |= 1; } void Sio2::SetCtrl(u32 value) diff --git a/pcsx2/ps2/Iop/IopHwWrite.cpp b/pcsx2/ps2/Iop/IopHwWrite.cpp index 7f1f9c7703..54387e07da 100644 --- a/pcsx2/ps2/Iop/IopHwWrite.cpp +++ b/pcsx2/ps2/Iop/IopHwWrite.cpp @@ -653,7 +653,7 @@ void iopHwWrite32_Page8( u32 addr, mem32_t val ) break; case (HW_SIO2_INTR & 0x0fff): Sio2Log.WriteLn("%s(%08X, %08X) SIO2 ISTAT Write", __FUNCTION__, addr, val); - g_Sio2.iStat = val; + g_Sio2.iStat &= ~val; break; // Other SIO2 registers are read-only, no-ops on write. default: