mcd, fix audio crash after end of last track

This commit is contained in:
kub 2023-07-05 19:54:40 +00:00
parent ae4d881a2f
commit 05d2acaeb2
3 changed files with 10 additions and 9 deletions

View file

@ -700,6 +700,13 @@ void cdd_update(void)
/* reading disc */
if (cdd.status == CD_PLAY)
{
if (cdd.index >= cdd.toc.last)
{
/* end of disc */
cdd.status = CD_END;
return;
}
/* track type */
if (!is_audio(cdd.index))
{
@ -714,7 +721,7 @@ void cdd_update(void)
/* data track sector read is controlled by CDC */
cdd.lba += cdc_decoder_update(header);
}
else if (cdd.index < cdd.toc.last)
else
{
uint8 header[4] = { 0, };
@ -731,12 +738,6 @@ void cdd_update(void)
/* next audio block is automatically read */
cdd.lba++;
}
else
{
/* end of disc */
cdd.status = CD_END;
return;
}
/* check end of current track */
if (cdd.lba >= cdd.toc.tracks[cdd.index].end)