From 95465b976c88587fba20a8c6877a0bc1f476f276 Mon Sep 17 00:00:00 2001 From: gameblabla Date: Sat, 25 Sep 2021 15:23:40 +0200 Subject: [PATCH] CdlGetmode is GetParam, fix it according to Mednafen's implementation 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 | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/libpcsxcore/cdrom.c b/libpcsxcore/cdrom.c index c77a5745..eaae938a 100644 --- a/libpcsxcore/cdrom.c +++ b/libpcsxcore/cdrom.c @@ -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; -- 2.39.5