From 05d2acaeb2873a9cb2b38ccf2d592328cf775023 Mon Sep 17 00:00:00 2001 From: kub Date: Wed, 5 Jul 2023 19:54:40 +0000 Subject: [PATCH] mcd, fix audio crash after end of last track --- pico/cd/cdd.c | 15 ++++++++------- pico/cd/mcd.c | 2 +- pico/cd/memory.c | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/pico/cd/cdd.c b/pico/cd/cdd.c index 6e510c2c..a3c3c93a 100644 --- a/pico/cd/cdd.c +++ b/pico/cd/cdd.c @@ -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) diff --git a/pico/cd/mcd.c b/pico/cd/mcd.c index 2943f431..c9a4e6a9 100644 --- a/pico/cd/mcd.c +++ b/pico/cd/mcd.c @@ -57,7 +57,7 @@ PICO_INTERNAL void PicoPowerMCD(void) Pico_mcd->m.state_flags = PCD_ST_S68K_RST; Pico_mcd->m.busreq = 2; // busreq on, s68k in reset Pico_mcd->s68k_regs[3] = 1; // 2M word RAM mode, m68k access - if (Pico.romsize <= 0x20000) + if (Pico.romsize <= 0x20000) // hack to detect BIOS, no GA HINT vector for MSU memset(Pico.rom + 0x70, 0xff, 4); } diff --git a/pico/cd/memory.c b/pico/cd/memory.c index 4aa1abc4..ac42b8c5 100644 --- a/pico/cd/memory.c +++ b/pico/cd/memory.c @@ -1235,8 +1235,8 @@ PICO_INTERNAL void PicoMemSetupCD(void) // MSU cartridge. Fake BIOS detection cpu68k_map_set(m68k_read8_map, 0x400000, 0x41ffff, PicoReadM68k8_bios, 1); cpu68k_map_set(m68k_read16_map, 0x400000, 0x41ffff, PicoReadM68k16_bios, 1); - // RAM cart } else { + // RAM cart cpu68k_map_set(m68k_read8_map, 0x400000, 0x7fffff, PicoReadM68k8_ramc, 1); cpu68k_map_set(m68k_read16_map, 0x400000, 0x7fffff, PicoReadM68k16_ramc, 1); cpu68k_map_set(m68k_write8_map, 0x400000, 0x7fffff, PicoWriteM68k8_ramc, 1); -- 2.39.5