CdlGetmode is GetParam, fix it according to Mednafen's implementation
authorgameblabla <gameblabla@protonmail.com>
Sat, 25 Sep 2021 13:23:40 +0000 (15:23 +0200)
committergameblabla <gameblabla@protonmail.com>
Sat, 25 Sep 2021 13:23:40 +0000 (15:23 +0200)
The result size for GetParam (previously Getmode) should be only 5 and done this way.

Here's Mednafen implementation :
https://github.com/libretro-mirrors/mednafen-git/blob/1899500078169e787f86eb5302a3f35abdaa8764/src/psx/cdc.cpp#L2095

Nocash's documentation also shows that our previous implementation was wrong :
https://problemkaputt.de/psx-spx.htm
(See CDROM Controller Command Summary section or CDROM - Status Commands)

libpcsxcore/cdrom.c

index c77a574..eaae938 100644 (file)
@@ -63,7 +63,7 @@ static unsigned char *pTransfer;
 #define CdlDemute      12
 #define CdlSetfilter   13
 #define CdlSetmode     14
-#define CdlGetmode     15
+#define CdlGetparam    15
 #define CdlGetlocL     16
 #define CdlGetlocP     17
 #define CdlReadT       18
@@ -83,8 +83,8 @@ static unsigned char *pTransfer;
 char *CmdName[0x100]= {
     "CdlSync",     "CdlNop",       "CdlSetloc",  "CdlPlay",
     "CdlForward",  "CdlBackward",  "CdlReadN",   "CdlStandby",
-    "CdlStop",     "CdlPause",     "CdlReset",    "CdlMute",
-    "CdlDemute",   "CdlSetfilter", "CdlSetmode", "CdlGetmode",
+    "CdlStop",     "CdlPause",     "CdlReset",   "CdlMute",
+    "CdlDemute",   "CdlSetfilter", "CdlSetmode", "CdlGetparam",
     "CdlGetlocL",  "CdlGetlocP",   "CdlReadT",   "CdlGetTN",
     "CdlGetTD",    "CdlSeekL",     "CdlSeekP",   "CdlSetclock",
     "CdlGetclock", "CdlTest",      "CdlID",      "CdlReadS",
@@ -764,13 +764,12 @@ void cdrInterrupt() {
                        no_busy_error = 1;
                        break;
 
-               case CdlGetmode:
-                       SetResultSize(6);
+               case CdlGetparam:
+                       SetResultSize(5);
                        cdr.Result[1] = cdr.Mode;
-                       cdr.Result[2] = cdr.File;
-                       cdr.Result[3] = cdr.Channel;
-                       cdr.Result[4] = 0;
-                       cdr.Result[5] = 0;
+                       cdr.Result[2] = 0;
+                       cdr.Result[3] = cdr.File;
+                       cdr.Result[4] = cdr.Channel;
                        no_busy_error = 1;
                        break;