cdrom: always error out on shell open
authornotaz <notasas@gmail.com>
Tue, 21 Nov 2023 22:27:27 +0000 (00:27 +0200)
committernotaz <notasas@gmail.com>
Tue, 21 Nov 2023 22:27:27 +0000 (00:27 +0200)
Duckstation claims it has been verified on console.
libretro/pcsx_rearmed#804

libpcsxcore/cdrom.c

index fac5fd3..6d8e631 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;