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