From 068a6133171b026956bbfd91e9bf4666def8823d Mon Sep 17 00:00:00 2001 From: gameblabla Date: Fri, 13 Aug 2021 18:00:47 +0200 Subject: [PATCH] CDRom timings changes Upstreamed changes from PCSX Redux as seen here : https://github.com/grumpycoders/pcsx-redux/commit/5730e04f0183f37038bc1d133cf9f9092425b90a This apparently fixes Deus Fight in Xenogears. Co-authored-by: Nicolas Noble --- libpcsxcore/cdrom.c | 23 +++++++++++++++++++++-- libpcsxcore/cdrom.h | 1 + 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/libpcsxcore/cdrom.c b/libpcsxcore/cdrom.c index a725efad..16b7ca1a 100644 --- a/libpcsxcore/cdrom.c +++ b/libpcsxcore/cdrom.c @@ -496,6 +496,7 @@ void cdrPlayInterrupt() if (cdr.SetlocPending) { memcpy(cdr.SetSectorPlay, cdr.SetSector, 4); cdr.SetlocPending = 0; + cdr.m_locationChanged = TRUE; } Find_CurTrack(cdr.SetSectorPlay); ReadTrack(cdr.SetSectorPlay); @@ -527,7 +528,15 @@ void cdrPlayInterrupt() } } - CDRMISC_INT(cdReadTime); + if (cdr.m_locationChanged) + { + CDRMISC_INT(cdReadTime * 30); + cdr.m_locationChanged = FALSE; + } + else + { + CDRMISC_INT(cdReadTime); + } // update for CdlGetlocP/autopause generate_subq(cdr.SetSectorPlay); @@ -589,6 +598,7 @@ void cdrInterrupt() { if (cdr.SetlocPending) { memcpy(cdr.SetSectorPlay, cdr.SetSector, 4); cdr.SetlocPending = 0; + cdr.m_locationChanged = TRUE; } // BIOS CD Player @@ -914,6 +924,7 @@ void cdrInterrupt() { if(seekTime > 1000000) seekTime = 1000000; memcpy(cdr.SetSectorPlay, cdr.SetSector, 4); cdr.SetlocPending = 0; + cdr.m_locationChanged = TRUE; } Find_CurTrack(cdr.SetSectorPlay); @@ -1130,7 +1141,13 @@ void cdrReadInterrupt() { cdr.Readed = 0; - CDREAD_INT((cdr.Mode & MODE_SPEED) ? (cdReadTime / 2) : cdReadTime); + uint32_t delay = (cdr.Mode & MODE_SPEED) ? (cdReadTime / 2) : cdReadTime; + if (cdr.m_locationChanged) { + CDREAD_INT(delay * 30); + cdr.m_locationChanged = FALSE; + } else { + CDREAD_INT(delay); + } /* Croc 2: $40 - only FORM1 (*) @@ -1468,6 +1485,8 @@ void cdrReset() { cdr.DriveState = DRIVESTATE_STANDBY; cdr.StatP = STATUS_ROTATING; pTransfer = cdr.Transfer; + cdr.SetlocPending = 0; + cdr.m_locationChanged = FALSE; // BIOS player - default values cdr.AttenuatorLeftToLeft = 0x80; diff --git a/libpcsxcore/cdrom.h b/libpcsxcore/cdrom.h index 543c619d..afa45010 100644 --- a/libpcsxcore/cdrom.h +++ b/libpcsxcore/cdrom.h @@ -83,6 +83,7 @@ typedef struct { unsigned char SetSector[4]; unsigned char Track; boolean Play, Muted; + boolean m_locationChanged; int CurTrack; int Mode, File, Channel; int Reset; -- 2.39.5