From b1eb84bc59c07b110e36714bf0222197f298ec09 Mon Sep 17 00:00:00 2001 From: notaz Date: Fri, 16 Sep 2022 02:31:37 +0300 Subject: [PATCH] cdrom: adjust timing --- libpcsxcore/cdrom.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/libpcsxcore/cdrom.c b/libpcsxcore/cdrom.c index 487dfb8d..3f405795 100644 --- a/libpcsxcore/cdrom.c +++ b/libpcsxcore/cdrom.c @@ -295,8 +295,8 @@ static void setIrq(int log_cmd) if (cdr.Stat) { int i; - SysPrintf("CDR IRQ=%d cmd %02x stat %02x: ", - !!(cdr.Stat & cdr.Reg2), log_cmd, cdr.Stat); + SysPrintf("%u cdrom: CDR IRQ=%d cmd %02x stat %02x: ", + psxRegs.cycle, !!(cdr.Stat & cdr.Reg2), log_cmd, cdr.Stat); for (i = 0; i < cdr.ResultC; i++) SysPrintf("%02x ", cdr.Result[i]); SysPrintf("\n"); @@ -651,7 +651,8 @@ void cdrInterrupt(void) { int i; if (cdr.Stat) { - CDR_LOG_I("cdrom: cmd %02x with irqstat %x\n", cdr.CmdInProgress, cdr.Stat); + CDR_LOG_I("%u cdrom: cmd %02x with irqstat %x\n", + psxRegs.cycle, cdr.CmdInProgress, cdr.Stat); return; } if (cdr.Irq1Pending) { @@ -1118,7 +1119,8 @@ void cdrInterrupt(void) { } else if (cdr.Cmd && cdr.Cmd != (Cmd & 0xff)) { cdr.CmdInProgress = cdr.Cmd; - CDR_LOG_I("cdrom: cmd %02x came before %02x finished\n", cdr.Cmd, Cmd); + CDR_LOG_I("%u cdrom: cmd %02x came before %02x finished\n", + psxRegs.cycle, cdr.Cmd, Cmd); } setIrq(Cmd); @@ -1344,7 +1346,7 @@ void cdrWrite1(unsigned char rt) { } #ifdef CDR_LOG_CMD_IRQ - SysPrintf("CD1 write: %x (%s)", rt, CmdName[rt]); + SysPrintf("%u cdrom: CD1 write: %x (%s)", psxRegs.cycle, rt, CmdName[rt]); if (cdr.ParamC) { int i; SysPrintf(" Param[%d] = {", cdr.ParamC); @@ -1365,8 +1367,8 @@ void cdrWrite1(unsigned char rt) { CDR_INT(5000); } else { - CDR_LOG_I("cdr: cmd while busy: %02x, prev %02x, busy %02x\n", - rt, cdr.Cmd, cdr.CmdInProgress); + CDR_LOG_I("%u cdrom: cmd while busy: %02x, prev %02x, busy %02x\n", + psxRegs.cycle, rt, cdr.Cmd, cdr.CmdInProgress); if (cdr.CmdInProgress < 0x100) // no pending 2nd response cdr.CmdInProgress = rt; } @@ -1428,11 +1430,13 @@ void cdrWrite3(unsigned char rt) { case 1: if (cdr.Stat & rt) { #ifdef CDR_LOG_CMD_IRQ - SysPrintf("ack %02x (w %02x)\n", cdr.Stat & rt, rt); + SysPrintf("%u cdrom: ack %02x (w %02x)\n", + psxRegs.cycle, cdr.Stat & rt, rt); #endif + // note: Croc vs Discworld Noir if (!(psxRegs.interrupt & (1 << PSXINT_CDR)) && (cdr.CmdInProgress || cdr.Irq1Pending)) - CDR_INT(2000); // 710+ + CDR_INT(850); // 711-993 } cdr.Stat &= ~rt; -- 2.39.5