Skip to content

Commit

Permalink
Backport notaz/pcsx_rearmed#165 (Fix crash on retrying mission in dri…
Browse files Browse the repository at this point in the history
…ver)
  • Loading branch information
jdgleaver committed Dec 5, 2020
1 parent a8712a2 commit d9676ac
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/cdrom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,7 @@ void cdrInterrupt()
int start_rotating = 0;
int error = 0;
int delay;
unsigned int seekTime = 0;

// Reschedule IRQ
if (cdr.Stat) {
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit d9676ac

Please sign in to comment.