cdrom: adjust the resume timing hack
[pcsx_rearmed.git] / libpcsxcore / cdrom.c
index 6f48df0..e23660c 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <assert.h>
 #include "cdrom.h"
+#include "misc.h"
 #include "ppf.h"
 #include "psxdma.h"
 #include "arm_features.h"
@@ -65,7 +66,8 @@ static struct {
                unsigned char Absolute[3];
        } subq;
        unsigned char TrackChanged;
-       unsigned char unused3[3];
+       unsigned char ReportDelay;
+       unsigned char unused3[2];
        unsigned int  freeze_ver;
 
        unsigned char Prev[4];
@@ -524,7 +526,9 @@ static void cdrPlayInterrupt_Autopause()
                StopCdda();
                SetPlaySeekRead(cdr.StatP, 0);
        }
-       else if (((cdr.Mode & MODE_REPORT) || cdr.FastForward || cdr.FastBackward)) {
+       else if ((cdr.Mode & MODE_REPORT) && !cdr.ReportDelay &&
+                ((cdr.subq.Absolute[2] & 0x0f) == 0 || cdr.FastForward || cdr.FastBackward))
+       {
                cdr.Result[0] = cdr.StatP;
                cdr.Result[1] = cdr.subq.Track;
                cdr.Result[2] = cdr.subq.Index;
@@ -560,6 +564,9 @@ static void cdrPlayInterrupt_Autopause()
                SetResultSize(8);
                setIrq(0x1001);
        }
+
+       if (cdr.ReportDelay)
+               cdr.ReportDelay--;
 }
 
 // LastReadCycles
@@ -570,7 +577,7 @@ static int cdrSeekTime(unsigned char *target)
        seekTime = MAX_VALUE(seekTime, 20000);
 
        // need this stupidly long penalty or else Spyro2 intro desyncs
-       pausePenalty = (s32)(psxRegs.cycle - cdr.LastReadCycles) > cdReadTime * 4 ? cdReadTime * 25 : 0;
+       pausePenalty = (s32)(psxRegs.cycle - cdr.LastReadCycles) > cdReadTime * 8 ? cdReadTime * 25 : 0;
        seekTime += pausePenalty;
 
        seekTime = MIN_VALUE(seekTime, PSXCLK * 2 / 3);
@@ -817,6 +824,7 @@ void cdrInterrupt(void) {
                        cdr.SubqForwardSectors = 1;
                        cdr.TrackChanged = FALSE;
                        cdr.FirstSector = 1;
+                       cdr.ReportDelay = 60;
 
                        if (!Config.Cdda)
                                CDR_play(cdr.SetSectorPlay);