CDROM: Rename Reset+Init commands, fix "This is Football 2" lockup
authorgameblabla <gameblabla@protonmail.com>
Wed, 25 Aug 2021 20:35:07 +0000 (22:35 +0200)
committergameblabla <gameblabla@protonmail.com>
Wed, 25 Aug 2021 20:46:45 +0000 (22:46 +0200)
Upon the reset command being issued, we need to set the Mode to 0x20
(as it was confirmed in Mednafen) and also disable the muting.

We also change the seektime for the reset command appropriately.
Please see Mednafen's implementation as reference :
https://github.com/libretro-mirrors/mednafen-git/blob/1899500078169e787f86eb5302a3f35abdaa8764/src/psx/cdc.cpp#L2007

This fixes the black screen issue in "This is Football 2".
This also fixes the black screen issue in Pooh's Party
after you selected a character.

libpcsxcore/cdrom.c

index 00a10e1..2cafe19 100644 (file)
@@ -58,7 +58,7 @@ static unsigned char *pTransfer;
 #define CdlStandby     7
 #define CdlStop        8
 #define CdlPause       9
-#define CdlInit        10
+#define CdlReset       10
 #define CdlMute        11
 #define CdlDemute      12
 #define CdlSetfilter   13
@@ -76,19 +76,19 @@ static unsigned char *pTransfer;
 #define CdlTest        25
 #define CdlID          26
 #define CdlReadS       27
-#define CdlReset       28
+#define CdlInit        28
 #define CdlGetQ        29
 #define CdlReadToc     30
 
 char *CmdName[0x100]= {
     "CdlSync",     "CdlNop",       "CdlSetloc",  "CdlPlay",
     "CdlForward",  "CdlBackward",  "CdlReadN",   "CdlStandby",
-    "CdlStop",     "CdlPause",     "CdlInit",    "CdlMute",
+    "CdlStop",     "CdlPause",     "CdlReset",    "CdlMute",
     "CdlDemute",   "CdlSetfilter", "CdlSetmode", "CdlGetmode",
     "CdlGetlocL",  "CdlGetlocP",   "CdlReadT",   "CdlGetTN",
     "CdlGetTD",    "CdlSeekL",     "CdlSeekP",   "CdlSetclock",
     "CdlGetclock", "CdlTest",      "CdlID",      "CdlReadS",
-    "CdlReset",    NULL,           "CDlReadToc", NULL
+    "CdlInit",    NULL,           "CDlReadToc", NULL
 };
 
 unsigned char Test04[] = { 0 };
@@ -736,13 +736,15 @@ void cdrInterrupt() {
                        cdr.Stat = Complete;
                        break;
 
-               case CdlInit:
-                       AddIrqQueue(CdlInit + 0x100, cdReadTime * 6);
+               case CdlReset:
+                       cdr.Muted = FALSE;
+                       cdr.Mode = 0x20; /* Needed for This is Football 2, Pooh's Party and possibly others. */
+                       AddIrqQueue(CdlReset + 0x100, 4100000);
                        no_busy_error = 1;
                        start_rotating = 1;
                        break;
 
-               case CdlInit + 0x100:
+               case CdlReset + 0x100:
                        cdr.Stat = Complete;
                        break;
 
@@ -893,7 +895,7 @@ void cdrInterrupt() {
                        cdr.Stat = Complete;
                        break;
 
-               case CdlReset:
+               case CdlInit:
                        // yes, it really sets STATUS_SHELLOPEN
                        cdr.StatP |= STATUS_SHELLOPEN;
                        cdr.DriveState = DRIVESTATE_RESCAN_CD;
@@ -1278,8 +1280,8 @@ void cdrWrite1(unsigned char rt) {
                StopReading();
                break;
 
-       case CdlReset:
        case CdlInit:
+       case CdlReset:
                cdr.Seeked = SEEK_DONE;
                StopCdda();
                StopReading();