an alt hack for Judge Dredd
[pcsx_rearmed.git] / libpcsxcore / cdrom.c
index fac5fd3..3991bad 100644 (file)
@@ -344,26 +344,22 @@ void cdrLidSeekInterrupt(void)
 
                // 02, 12, 10
                if (!(cdr.StatP & STATUS_SHELLOPEN)) {
+                       StopReading();
                        SetPlaySeekRead(cdr.StatP, 0);
                        cdr.StatP |= STATUS_SHELLOPEN;
 
                        // IIRC this sometimes doesn't happen on real hw
                        // (when lots of commands are sent?)
-                       if (cdr.Reading) {
-                               StopReading();
-                               SetResultSize(2);
-                               cdr.Result[0] = cdr.StatP | STATUS_SEEKERROR;
-                               cdr.Result[1] = ERROR_SHELLOPEN;
-                               setIrq(DiskError, 0x1006);
-                       }
+                       SetResultSize(2);
+                       cdr.Result[0] = cdr.StatP | STATUS_SEEKERROR;
+                       cdr.Result[1] = ERROR_SHELLOPEN;
                        if (cdr.CmdInProgress) {
                                psxRegs.interrupt &= ~(1 << PSXINT_CDR);
                                cdr.CmdInProgress = 0;
-                               SetResultSize(2);
                                cdr.Result[0] = cdr.StatP | STATUS_ERROR;
                                cdr.Result[1] = ERROR_NOTREADY;
-                               setIrq(DiskError, 0x1007);
                        }
+                       setIrq(DiskError, 0x1006);
 
                        set_event(PSXINT_CDRLID, cdReadTime * 30);
                        break;
@@ -719,6 +715,7 @@ void cdrInterrupt(void) {
        int read_ok;
        u16 not_ready = 0;
        u8 IrqStat = Acknowledge;
+       u8 DriveStateOld;
        u16 Cmd;
        int i;
 
@@ -968,7 +965,16 @@ void cdrInterrupt(void) {
                                second_resp_time = (((cdr.Mode & MODE_SPEED) ? 1 : 2) * 1097107);
                        }
                        SetPlaySeekRead(cdr.StatP, 0);
+                       DriveStateOld = cdr.DriveState;
                        cdr.DriveState = DRIVESTATE_PAUSED;
+                       if (DriveStateOld == DRIVESTATE_SEEK) {
+                               // According to Duckstation this fails, but the
+                               // exact conditions and effects are not clear.
+                               // Moto Racer World Tour seems to rely on this.
+                               // For now assume pause works anyway, just errors out.
+                               error = ERROR_NOTREADY;
+                               goto set_error;
+                       }
                        break;
 
                case CdlPause + CMD_PART2: