Use the "magic numbers" from Duckstation for CDLPause
authorgameblabla <gameblabla@protonmail.com>
Sat, 25 Sep 2021 13:33:10 +0000 (15:33 +0200)
committergameblabla <gameblabla@protonmail.com>
Sat, 25 Sep 2021 13:33:10 +0000 (15:33 +0200)
We need to make sure not to break Gundam Battle Assault 2 in PAL mode
as otherwise it will lockup.
Amusingly, Mednafen currently cannot run this game in PAL mode.

libpcsxcore/cdrom.c

index edd6c04..d6ee520 100644 (file)
@@ -716,14 +716,28 @@ void cdrInterrupt() {
                        /*
                        Gundam Battle Assault 2: much slower (*)
                        - Fixes boot, gameplay
-
                        Hokuto no Ken 2: slower
                        - Fixes intro + subtitles
-
                        InuYasha - Feudal Fairy Tale: slower
                        - Fixes battles
                        */
-                       AddIrqQueue(CdlPause + 0x100, cdReadTime * 3);
+                       /* Gameblabla - Tightening the timings (as taken from Duckstation). 
+                        * The timings from Duckstation are based upon hardware tests.
+                        * Mednafen's timing don't work for Gundam Battle Assault 2 in PAL/50hz mode,
+                        * seems to be timing sensitive as it can depend on the CPU's clock speed.
+                        * 
+                        * We will need to get around this for Bedlam/Rise 2 later...
+                        * */
+                       if (cdr.DriveState != DRIVESTATE_STANDBY)
+                       {
+                               delay = 7000;
+                       }
+                       else
+                       {
+                               delay = (((cdr.Mode & MODE_SPEED) ? 2 : 1) * (1000000));
+                               CDRMISC_INT((cdr.Mode & MODE_SPEED) ? cdReadTime / 2 : cdReadTime);
+                       }
+                       AddIrqQueue(CdlPause + 0x100, delay);
                        cdr.Ctrl |= 0x80;
                        break;