From dc0ee8d424293ea687a137ec1ca0440f88a1e5a5 Mon Sep 17 00:00:00 2001 From: gameblabla Date: Wed, 18 Aug 2021 20:24:33 +0000 Subject: [PATCH] CDRom timings changes (#184) 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 | 3 ++- 2 files changed, 23 insertions(+), 3 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..a37f6baf 100644 --- a/libpcsxcore/cdrom.h +++ b/libpcsxcore/cdrom.h @@ -59,7 +59,8 @@ typedef struct { unsigned char Absolute[3]; } subq; unsigned char TrackChanged; - unsigned char pad1[3]; + boolean m_locationChanged; + unsigned char pad1[2]; unsigned int freeze_ver; unsigned char Prev[4]; -- 2.39.5