CDVD: Fix some read timing logic

This commit is contained in:
refractionpcsx2 2021-12-12 13:19:35 +00:00
parent 103dd3954a
commit e4ef41f86a
1 changed files with 11 additions and 21 deletions

View File

@ -1139,14 +1139,10 @@ __fi void cdvdReadInterrupt()
cdvd.Reading = 1; cdvd.Reading = 1;
cdvd.Readed = 1; cdvd.Readed = 1;
cdvd.Sector = cdvd.SeekToSector; cdvd.Sector = cdvd.SeekToSector;
CDVD_LOG("Cdvd Seek Complete > Scheduling block read interrupt at iopcycle=%8.8x.", CDVD_LOG("Cdvd Seek Complete at iopcycle=%8.8x.", psxRegs.cycle);
psxRegs.cycle + cdvd.ReadTime);
CDVDREAD_INT(cdvd.ReadTime);
cdvd.Status = CDVD_STATUS_READ;
return;
} }
else if (cdvd.Reading)
if (cdvd.Reading)
{ {
if (cdvd.RErr == 0) if (cdvd.RErr == 0)
{ {
@ -1300,6 +1296,7 @@ static uint cdvdStartSeek(uint newsector, CDVD_MODE_TYPE mode)
// if delta > 0 it will read a new sector so the readInterrupt will account for this. // if delta > 0 it will read a new sector so the readInterrupt will account for this.
seektime = 0; seektime = 0;
isSeeking = false;
if (delta == 0) if (delta == 0)
{ {
@ -1324,24 +1321,16 @@ static uint cdvdStartSeek(uint newsector, CDVD_MODE_TYPE mode)
} }
else else
{ {
CDVDSECTORREADY_INT(cdvd.ReadTime); delta = 1; // Forces it to use the rotational delay since we have no sectors buffered and it isn't buffering any.
seektime = cdvd.ReadTime + ((cdvd.BlockSize / 4) * 12);
} }
} }
else else
seektime = (cdvd.BlockSize / 4) * 12; return (cdvd.BlockSize / 4) * 12;
} }
else else
{ {
if (delta < cdvd.nextSectorsBuffered) psxRegs.interrupt &= ~(1 << IopEvt_CdvdSectorReady);
{ cdvd.nextSectorsBuffered = 0;
isSeeking = false;
}
else
{
psxRegs.interrupt &= ~(1 << IopEvt_CdvdSectorReady);
cdvd.nextSectorsBuffered = 0;
}
} }
} }
@ -1354,8 +1343,9 @@ static uint cdvdStartSeek(uint newsector, CDVD_MODE_TYPE mode)
CDVDSECTORREADY_INT(seektime); CDVDSECTORREADY_INT(seektime);
seektime += (cdvd.BlockSize / 4) * 12; seektime += (cdvd.BlockSize / 4) * 12;
} }
else if(cdvd.nCommand != N_CD_SEEK) else
CDVDSECTORREADY_INT(seektime + ((cdvd.BlockSize / 4) * 12)); CDVDSECTORREADY_INT(seektime);
return seektime; return seektime;
} }