cdrom: adjust timing
authornotaz <notasas@gmail.com>
Thu, 15 Sep 2022 23:31:37 +0000 (02:31 +0300)
committernotaz <notasas@gmail.com>
Thu, 15 Sep 2022 23:31:37 +0000 (02:31 +0300)
libpcsxcore/cdrom.c

index 487dfb8..3f40579 100644 (file)
@@ -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;