[Core/CD] fixed CDD position reset when disc is stopped (fixes random freezes in Spiderman vs Kingpin when switching between audio tracks)

This commit is contained in:
ekeeke 2023-05-07 14:46:23 +02:00
parent 1db51e2c5f
commit b5f1027c15
6 changed files with 24 additions and 10 deletions

View File

@ -49,7 +49,8 @@ Genesis Plus GX 1.7.5 (xx/xx/xxxx) (Eke-Eke)
* fixed byte access to font data registers * fixed byte access to font data registers
* fixed pending level 1 interrupts when GFX interrupt is disabled (fixes random freezes when exiting "Batman Returns" option menu) * fixed pending level 1 interrupts when GFX interrupt is disabled (fixes random freezes when exiting "Batman Returns" option menu)
* fixed CDD seek command again (Final Fight CD freeze with model 2 BIOS) * fixed CDD seek command again (Final Fight CD freeze with model 2 BIOS)
* fixed CDD status reported during seek/access time (sound effect synchronization issue in Bari Arm) * fixed CDD status reported during seek/access time (fixes sound effect synchronization issue in Bari Arm)
* fixed CDD position reset when disc is stopped (fixes random freezes in Spiderman vs Kingpin when switching between audio tracks)
* fixed word access to CDD control register (fixes spurious audio track playback on startup with Mode 1 patched games using MSU-MD driver) * fixed word access to CDD control register (fixes spurious audio track playback on startup with Mode 1 patched games using MSU-MD driver)
* fixed CD communication registers state on peripheral reset (fixes SUB-CPU side initialization in MSU-MD sample demo and some Mode 1 patched games using MSU-MD driver) * fixed CD communication registers state on peripheral reset (fixes SUB-CPU side initialization in MSU-MD sample demo and some Mode 1 patched games using MSU-MD driver)
* fixed 32x32 pixels stamp index masking during GFX operation (fixes graphics rotation/scaling effects in "Chuck Rock II - Son of Chuck") * fixed 32x32 pixels stamp index masking during GFX operation (fixes graphics rotation/scaling effects in "Chuck Rock II - Son of Chuck")

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 MiB

After

Width:  |  Height:  |  Size: 3.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 MiB

After

Width:  |  Height:  |  Size: 4.0 MiB

View File

@ -1905,6 +1905,10 @@ void cdd_process(void)
/* update reported drive status */ /* update reported drive status */
scd.regs[0x38>>1].byte.h = cdd.status; scd.regs[0x38>>1].byte.h = cdd.status;
/* do not update RS1-RS8 if disc is stopped */
if ((cdd.status == CD_STOP) || (cdd.status > CD_PAUSE))
break;
/* check if RS1 indicated invalid track infos (during seeking) */ /* check if RS1 indicated invalid track infos (during seeking) */
if (scd.regs[0x38>>1].byte.l == 0x0f) if (scd.regs[0x38>>1].byte.l == 0x0f)
{ {
@ -1954,11 +1958,14 @@ void cdd_process(void)
scd.regs[0x36>>1].byte.h = 0x01; scd.regs[0x36>>1].byte.h = 0x01;
/* RS1-RS8 ignored, expects 0x0 (CD_STOP) in RS0 once */ /* RS1-RS8 ignored, expects 0x0 (CD_STOP) in RS0 once */
scd.regs[0x38>>1].w = CD_STOP << 8; scd.regs[0x38>>1].w = (CD_STOP << 8) | 0x0f;
scd.regs[0x3a>>1].w = 0x0000; scd.regs[0x3a>>1].w = 0x0000;
scd.regs[0x3c>>1].w = 0x0000; scd.regs[0x3c>>1].w = 0x0000;
scd.regs[0x3e>>1].w = 0x0000; scd.regs[0x3e>>1].w = 0x0000;
scd.regs[0x40>>1].w = ~CD_STOP & 0x0f; scd.regs[0x40>>1].w = ~(CD_STOP + 0x0f) & 0x0f;
/* reset drive position */
cdd.index = cdd.lba = 0;
return; return;
} }
@ -2129,7 +2136,7 @@ void cdd_process(void)
scd.regs[0x3a>>1].w = 0x0000; scd.regs[0x3a>>1].w = 0x0000;
scd.regs[0x3c>>1].w = 0x0000; scd.regs[0x3c>>1].w = 0x0000;
scd.regs[0x3e>>1].w = 0x0000; scd.regs[0x3e>>1].w = 0x0000;
scd.regs[0x40>>1].w = ~(CD_SEEK + 0xf) & 0x0f; scd.regs[0x40>>1].w = ~(CD_SEEK + 0x0f) & 0x0f;
return; return;
} }
@ -2195,7 +2202,7 @@ void cdd_process(void)
scd.regs[0x3a>>1].w = 0x0000; scd.regs[0x3a>>1].w = 0x0000;
scd.regs[0x3c>>1].w = 0x0000; scd.regs[0x3c>>1].w = 0x0000;
scd.regs[0x3e>>1].w = 0x0000; scd.regs[0x3e>>1].w = 0x0000;
scd.regs[0x40>>1].w = ~(CD_SEEK + 0xf) & 0x0f; scd.regs[0x40>>1].w = ~(CD_SEEK + 0x0f) & 0x0f;
return; return;
} }
@ -2260,11 +2267,14 @@ void cdd_process(void)
cdd.status = cdd.loaded ? CD_TOC : NO_DISC; cdd.status = cdd.loaded ? CD_TOC : NO_DISC;
/* RS1-RS8 ignored, expects CD_STOP in RS0 once */ /* RS1-RS8 ignored, expects CD_STOP in RS0 once */
scd.regs[0x38>>1].w = CD_STOP << 8; scd.regs[0x38>>1].w = (CD_STOP << 8) | 0x0f;
scd.regs[0x3a>>1].w = 0x0000; scd.regs[0x3a>>1].w = 0x0000;
scd.regs[0x3c>>1].w = 0x0000; scd.regs[0x3c>>1].w = 0x0000;
scd.regs[0x3e>>1].w = 0x0000; scd.regs[0x3e>>1].w = 0x0000;
scd.regs[0x40>>1].w = ~CD_STOP & 0x0f; scd.regs[0x40>>1].w = ~(CD_STOP + 0x0f) & 0x0f;
/* reset drive position */
cdd.index = cdd.lba = 0;
#ifdef CD_TRAY_CALLBACK #ifdef CD_TRAY_CALLBACK
CD_TRAY_CALLBACK CD_TRAY_CALLBACK
@ -2279,11 +2289,14 @@ void cdd_process(void)
/* update status (RS1-RS8 ignored) */ /* update status (RS1-RS8 ignored) */
cdd.status = CD_OPEN; cdd.status = CD_OPEN;
scd.regs[0x38>>1].w = CD_OPEN << 8; scd.regs[0x38>>1].w = (CD_OPEN << 8) | 0x0f;
scd.regs[0x3a>>1].w = 0x0000; scd.regs[0x3a>>1].w = 0x0000;
scd.regs[0x3c>>1].w = 0x0000; scd.regs[0x3c>>1].w = 0x0000;
scd.regs[0x3e>>1].w = 0x0000; scd.regs[0x3e>>1].w = 0x0000;
scd.regs[0x40>>1].w = ~CD_OPEN & 0x0f; scd.regs[0x40>>1].w = ~(CD_OPEN + 0x0f) & 0x0f;
/* reset drive position */
cdd.index = cdd.lba = 0;
#ifdef CD_TRAY_CALLBACK #ifdef CD_TRAY_CALLBACK
CD_TRAY_CALLBACK CD_TRAY_CALLBACK

View File

@ -2,7 +2,7 @@
* Genesis Plus * Genesis Plus
* CD drive processor & CD-DA fader * CD drive processor & CD-DA fader
* *
* Copyright (C) 2012-2022 Eke-Eke (Genesis Plus GX) * Copyright (C) 2013-2022 Eke-Eke (Genesis Plus GX)
* *
* Redistribution and use of this code or any derivative works are permitted * Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met: * provided that the following conditions are met: