From 30b722b8071ad987c00858298a5fb4b0ee6cc7f5 Mon Sep 17 00:00:00 2001 From: Robert Neumann Date: Fri, 8 Jun 2018 03:57:14 +0200 Subject: [PATCH] psxmode: actually apply the new iop / cd read timings; add seek delays that mimic real ones; altogether this at least fixes fmv playing way too quickly (music in Chrono Cross intro is fine now, for example) --- pcsx2/CDVD/CDVD.cpp | 5 ++-- pcsx2/CDVD/CdRom.cpp | 65 +++++++++++++++++++++++++++++++------------- 2 files changed, 48 insertions(+), 22 deletions(-) diff --git a/pcsx2/CDVD/CDVD.cpp b/pcsx2/CDVD/CDVD.cpp index e86dece608..ef2b11c96a 100644 --- a/pcsx2/CDVD/CDVD.cpp +++ b/pcsx2/CDVD/CDVD.cpp @@ -1420,15 +1420,14 @@ static __fi void cdvdWrite0F(u8 rt) { // TYPE static __fi void cdvdWrite14(u8 rt) { // PS1 MODE?? // This should be done in the SBUS_F240 bit 19 write in HwWrite.cpp u32 cycle = psxRegs.cycle; - PSXCLK = 33868800; - setPsxSpeed(); - if (rt == 0xFE) Console.Warning("*PCSX2*: go PS1 mode DISC SPEED = FAST"); else Console.Warning("*PCSX2*: go PS1 mode DISC SPEED = %dX", rt); psxReset(); + PSXCLK = 33868800; + setPsxSpeed(); psxHu32(0x1f801450) = 0x8; psxHu32(0x1f801078) = 1; psxRegs.cycle = cycle; diff --git a/pcsx2/CDVD/CdRom.cpp b/pcsx2/CDVD/CdRom.cpp index b7512d7276..19d6661f3f 100644 --- a/pcsx2/CDVD/CdRom.cpp +++ b/pcsx2/CDVD/CdRom.cpp @@ -85,11 +85,13 @@ u8 Test23[] = { 0x43, 0x58, 0x44, 0x32, 0x39 ,0x34, 0x30, 0x51 }; // 1x = 75 sectors per second // PSXCLK = 1 sec in the ps // so (PSXCLK / 75) / BIAS = cdr read time (linuzappz) -u32 cdReadTime;// = ((PSXCLK / 75) / BIAS); +u32 cdReadTime; // = ((PSXCLK / 75) / BIAS); #define CDR_INT(eCycle) PSX_INT(IopEvt_Cdrom, eCycle) #define CDREAD_INT(eCycle) PSX_INT(IopEvt_CdromRead, eCycle) +const uint shortSectorSeekReadDelay = 1000; // delay for reads/seeks that may or may not have a seek action preceeding it +uint sectorSeekReadDelay = 0x800; // for calculated seek delays static void AddIrqQueue(u8 irq, u32 ecycle); @@ -97,7 +99,9 @@ static __fi void StartReading(u32 type) { cdr.Reading = type; cdr.FirstSector = 1; cdr.Readed = 0xff; - AddIrqQueue(READ_ACK, 0x800); + //DevCon.Warning("ReadN/ReadS delay: %d", sectorSeekReadDelay); + AddIrqQueue(READ_ACK, sectorSeekReadDelay); + sectorSeekReadDelay = shortSectorSeekReadDelay; } static __fi void StopReading() { @@ -493,7 +497,7 @@ void cdrReadInterrupt() { return; if (cdr.Stat) { - CDREAD_INT(0x800); + CDREAD_INT(0x800 * 4); // * 4 reduces dma3 errors lots here return; } @@ -548,8 +552,8 @@ void cdrReadInterrupt() { } else { ReadTrack(); - // psxmode: extra delays | remove once dma is stable (fixes "dma3 not ready" and mdec glitches) - CDREAD_INT((cdr.Mode & 0x80) ? (cdReadTime / 2) * 3 : cdReadTime * 3); + //DevCon.Warning("normal: %d",cdReadTime); + CDREAD_INT((cdr.Mode & 0x80) ? (cdReadTime / 2) : cdReadTime); } psxHu32(0x1070)|= 0x4; @@ -605,7 +609,11 @@ void cdrWrite0(u8 rt) { void setPsxSpeed() { - cdReadTime = ((PSXCLK / 75) / BIAS); + // psxmode: trying to get delays right (fix "dma3 not ready" and mdec glitches) + // odd.. tests suggest this should be exactly * 2. could it be that the old psx 1x / 2x speeds aren't handled the same on PS2? + // used Chrono Cross intro music and see that it doesn't stutter, then use any other FMV game (with sound) and see that it doesn't stall. + // result: cdReadTime = ((PSXCLK / 75) / BIAS) * 2; is exactly right + cdReadTime = ((PSXCLK / 75) / BIAS) * 2; } u8 cdrRead1(void) { @@ -627,13 +635,14 @@ void cdrWrite1(u8 rt) { cdr.Cmd = rt; cdr.OCUP = 0; +//#define CDRCMD_DEBUG #ifdef CDRCMD_DEBUG - SysPrintf("CD1 write: %x (%s)", rt, CmdName[rt]); + DevCon.Warning("CD1 write: %x (%s)", rt, CmdName[rt]); if (cdr.ParamC) { - SysPrintf(" Param[%d] = {", cdr.ParamC); - for (i=0;i