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

libpcsxcore/cdrom.c

index a417a52..43d25d3 100644 (file)
@@ -539,6 +539,7 @@ void cdrInterrupt() {
        int start_rotating = 0;
        int error = 0;
        int delay;
+       unsigned int seekTime = 0;
 
        // Reschedule IRQ
        if (cdr.Stat) {
@@ -910,6 +911,8 @@ void cdrInterrupt() {
                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;
                        }
@@ -949,7 +952,7 @@ void cdrInterrupt() {
                                // - 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;