From e7606d0edc6178f862d94164617e8c5ea4bbbe3b Mon Sep 17 00:00:00 2001 From: notaz Date: Sun, 15 Oct 2023 00:48:20 +0300 Subject: [PATCH] cdrom: adjust timing notaz/pcsx_rearmed#317 --- libpcsxcore/cdrom.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libpcsxcore/cdrom.c b/libpcsxcore/cdrom.c index 047172ce..2ce7fe97 100644 --- a/libpcsxcore/cdrom.c +++ b/libpcsxcore/cdrom.c @@ -106,7 +106,7 @@ static struct { u16 CmdInProgress; u8 Irq1Pending; u8 unused5; - u32 LastReadCycles; + u32 LastReadSeekCycles; u8 unused7; @@ -555,16 +555,15 @@ static void cdrPlayInterrupt_Autopause() cdr.ReportDelay--; } -// LastReadCycles static int cdrSeekTime(unsigned char *target) { int diff = msf2sec(cdr.SetSectorPlay) - msf2sec(target); - int pausePenalty, seekTime = abs(diff) * (cdReadTime / 2000); + int seekTime = abs(diff) * (cdReadTime / 2000); seekTime = MAX_VALUE(seekTime, 20000); // need this stupidly long penalty or else Spyro2 intro desyncs - pausePenalty = (s32)(psxRegs.cycle - cdr.LastReadCycles) > cdReadTime * 8 ? cdReadTime * 25 : 0; - seekTime += pausePenalty; + if ((s32)(psxRegs.cycle - cdr.LastReadSeekCycles) > cdReadTime * 8) + seekTime += cdReadTime * 25; seekTime = MIN_VALUE(seekTime, PSXCLK * 2 / 3); CDR_LOG("seek: %.2f %.2f\n", (float)seekTime / PSXCLK, (float)seekTime / cdReadTime); @@ -633,7 +632,7 @@ static void msfiSub(u8 *msfi, u32 count) void cdrPlayReadInterrupt(void) { - cdr.LastReadCycles = psxRegs.cycle; + cdr.LastReadSeekCycles = psxRegs.cycle; if (cdr.Reading) { cdrReadInterrupt(); @@ -1071,6 +1070,7 @@ void cdrInterrupt(void) { memcpy(cdr.LocL, buf, 8); UpdateSubq(cdr.SetSectorPlay); cdr.TrackChanged = FALSE; + cdr.LastReadSeekCycles = psxRegs.cycle; break; case CdlTest: -- 2.39.5