Sync to latest upstream
authornegativeExponent <negativeExponent@users.noreply.github.com>
Tue, 4 Aug 2020 00:02:35 +0000 (08:02 +0800)
committernegativeExponent <negativeExponent@users.noreply.github.com>
Tue, 4 Aug 2020 00:11:13 +0000 (08:11 +0800)
Fixed bug where MSB of a 15-bit BGR color could corrupt green value. Also added documentation.
https://github.com/libretro/pcsx_rearmed/commit/92db7708f2fd2a26ea730d761a60a582a646405a

Fix crash on retrying mission in driver (https://github.com/notaz/pcsx_rearmed/pull/165)
https://github.com/libretro/pcsx_rearmed/commit/fbf19ce6b6c02da47a67f58e23d8294cfcd18f55

1  2 
libpcsxcore/cdrom.c

diff --combined libpcsxcore/cdrom.c
@@@ -539,6 -539,7 +539,7 @@@ void cdrInterrupt() 
        int start_rotating = 0;
        int error = 0;
        int delay;
+       unsigned int seekTime = 0;
  
        // Reschedule IRQ
        if (cdr.Stat) {
                        }
                        cdr.Result[0] |= (cdr.Result[1] >> 4) & 0x08;
  
 -                      strncpy((char *)&cdr.Result[4], "PCSX", 4);
 +                      /* This adds the string "PCSX" in Playstation bios boot screen */
 +                      memcpy((char *)&cdr.Result[4], "PCSX", 4);
                        cdr.Stat = Complete;
                        break;
  
                case CdlReadN:
                case CdlReadS:
                        if (cdr.SetlocPending) {
+                               seekTime = abs(msf2sec(cdr.SetSectorPlay) - msf2sec(cdr.SetSector)) * (cdReadTime / 200);
+                               if(seekTime > 1000000) seekTime = 1000000;
                                memcpy(cdr.SetSectorPlay, cdr.SetSector, 4);
                                cdr.SetlocPending = 0;
                        }
                                // - fix cutscene speech (startup)
  
                                // ??? - use more accurate seek time later
-                               CDREAD_INT((cdr.Mode & 0x80) ? (cdReadTime / 2) : cdReadTime * 1);
+                               CDREAD_INT(((cdr.Mode & 0x80) ? (cdReadTime / 2) : cdReadTime * 1) + seekTime);
                        } else {
                                cdr.StatP |= STATUS_READ;
                                cdr.StatP &= ~STATUS_SEEK;