From e8b11f49b9d081a08962d3cc70eec8870195018d Mon Sep 17 00:00:00 2001 From: Sergiy Dvodnenko Date: Fri, 4 Apr 2025 20:53:08 +0300 Subject: [PATCH] PCECD: abort SAPEP interrupt by the other command. --- support/pcecd/pcecd.h | 1 + support/pcecd/pcecdd.cpp | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/support/pcecd/pcecd.h b/support/pcecd/pcecd.h index fdf785d..7f0fe61 100644 --- a/support/pcecd/pcecd.h +++ b/support/pcecd/pcecd.h @@ -98,6 +98,7 @@ private: int CDDAStart; int CDDAEnd; int CDDAFirst; + int int_pend; uint8_t CDDAMode; sense_t sense; uint8_t region; diff --git a/support/pcecd/pcecdd.cpp b/support/pcecd/pcecdd.cpp index ff0f50d..02cdf3a 100644 --- a/support/pcecd/pcecdd.cpp +++ b/support/pcecd/pcecdd.cpp @@ -330,6 +330,7 @@ void pcecdd_t::Reset() { CDDAStart = 0; CDDAEnd = 0; CDDAMode = PCECD_CDDAMODE_SILENT; + int_pend = false; stat = 0x0000; @@ -451,11 +452,13 @@ void pcecdd_t::Update() { this->state = PCECD_STATE_IDLE; } - if (this->CDDAMode == PCECD_CDDAMODE_INTERRUPT) { + if (this->int_pend) { SendStatus(MAKE_STATUS(PCECD_STATUS_GOOD, 0)); } - printf("\x1b[32mPCECD: playback reached the end %d\n\x1b[0m", this->lba); + printf("\x1b[32mPCECD: playback reached the end %d, int mode = %i\n\x1b[0m", this->lba, this->int_pend); + + this->int_pend = false; } } else if (this->state == PCECD_STATE_PAUSE) @@ -476,6 +479,8 @@ void pcecdd_t::CommandExec() { memset(buf, 0, 32); + this->int_pend = false; + switch (comm[0]) { case PCECD_COMM_TESTUNIT: if (state == PCECD_STATE_NODISC) { @@ -727,7 +732,10 @@ void pcecdd_t::CommandExec() { this->state = PCECD_STATE_PLAY; } - if (this->CDDAMode != PCECD_CDDAMODE_INTERRUPT) { + if (this->CDDAMode == PCECD_CDDAMODE_INTERRUPT) { + this->int_pend = true; + } + else { SendStatus(MAKE_STATUS(PCECD_STATUS_GOOD, 0)); }