From d9676acbde2448b0f8e65028e1dfd3070230568f Mon Sep 17 00:00:00 2001 From: jdgleaver Date: Sat, 5 Dec 2020 14:34:28 +0000 Subject: [PATCH] Backport https://github.com/notaz/pcsx_rearmed/pull/165 (Fix crash on retrying mission in driver) --- src/cdrom.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cdrom.cpp b/src/cdrom.cpp index d16fb78..9e0b4ab 100644 --- a/src/cdrom.cpp +++ b/src/cdrom.cpp @@ -607,6 +607,7 @@ void cdrInterrupt() int start_rotating = 0; int error = 0; int delay; + unsigned int seekTime = 0; // Reschedule IRQ if (cdr.Stat) { @@ -977,6 +978,8 @@ void cdrInterrupt() case CdlReadN: case CdlReadS: if (cdr.SetlocPending) { + seekTime = abs((int)msf2sec(cdr.SetSectorPlay) - (int)msf2sec(cdr.SetSector)) * (cdReadTime / 200); + if(seekTime > 1000000) seekTime = 1000000; memcpy(cdr.SetSectorPlay, cdr.SetSector, 4); cdr.SetlocPending = 0; } @@ -1016,7 +1019,7 @@ void cdrInterrupt() // - fix cutscene speech (startup) // ??? - use more accurate seek time later - CDREAD_INT((cdr.Mode & 0x80) ? (cdReadTime / 2) : cdReadTime * 1); + CDREAD_INT(((cdr.Mode & 0x80) ? (cdReadTime / 2) : cdReadTime * 1) + seekTime); } else { cdr.StatP |= STATUS_READ; cdr.StatP &= ~STATUS_SEEK;