Improve CdlPause command based on Mednafen's implementation (#207)
authorgameblabla <gameblabla@users.noreply.github.com>
Fri, 27 Aug 2021 22:05:02 +0000 (22:05 +0000)
committerGitHub <noreply@github.com>
Fri, 27 Aug 2021 22:05:02 +0000 (01:05 +0300)
Reference :
https://github.com/libretro-mirrors/mednafen-git/blob/master/src/psx/cdc.cpp#L1969

This fixed an issue with Worms Pinball booting to the language screen.
Previously, it would sometimes boot to it but not reliably
and the screen would always not appear or be black.

Now, the emulator doesn't crash anymore and the language screen
can be seen (although it is a glitchy mess).

libpcsxcore/cdrom.c

index 95e739f..2d9d77f 100644 (file)
@@ -722,7 +722,17 @@ void cdrInterrupt() {
                        InuYasha - Feudal Fairy Tale: slower
                        - Fixes battles
                        */
-                       AddIrqQueue(CdlPause + 0x100, cdReadTime * 3);
+                       /* Gameblabla - Tightening the timings (as taken from Mednafen). */
+                       if (cdr.DriveState != DRIVESTATE_STANDBY)
+                       {
+                               delay = 5000;
+                       }
+                       else
+                       {
+                               delay = (1124584 + (msf2sec(cdr.SetSectorPlay) * 42596 / (75 * 60))) * ((cdr.Mode & MODE_SPEED) ? 1 : 2);
+                               CDRMISC_INT((cdr.Mode & MODE_SPEED) ? cdReadTime / 2 : cdReadTime);
+                       }
+                       AddIrqQueue(CdlPause + 0x100, delay);
                        cdr.Ctrl |= 0x80;
                        break;