From 381299ca941c082edcd4371f28e3cf322ccbf13f Mon Sep 17 00:00:00 2001 From: kub Date: Mon, 30 Sep 2024 22:08:41 +0200 Subject: [PATCH] mcd, add a hack for d32xr --- README.md | 5 +++-- pico/cd/megasd.c | 9 ++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d188ab24..233daa3e 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,9 @@ At present, most development activity occurs in ### Using MSU, MD+/32X+, and Mode 1 on Sega/Mega CD PicoDrive supports using CD audio enhanced cartridge games in all 3 formats. -To start an enhanced cartridge, the "cue" or "chd" file of the audio CD must be -selected. Further instructions can be found in `platform/base_readme.txt`. +To start an enhanced cartridge, load the .cue or .chd file. The cartridge +file should have the same base name and be placed in the same directory. +Further instructions can be found in `platform/base_readme.txt`. ### Sega Pico and Storyware Pages diff --git a/pico/cd/megasd.c b/pico/cd/megasd.c index b53f8d32..8bc04593 100644 --- a/pico/cd/megasd.c +++ b/pico/cd/megasd.c @@ -82,6 +82,7 @@ static void msd_playtrack(int idx, s32 offs, int loop) Pico_msd.result = Pico_msd.command = 0; return; } + Pico_msd.index = idx-1; track = &cdd.toc.tracks[Pico_msd.index]; @@ -160,13 +161,19 @@ void msd_update() Pico_msd.command = 0; if (cdd.lba >= Pico_msd.endlba-1 || cdd.index > Pico_msd.index) { if (!Pico_msd.loop || Pico_msd.index < 0) { - cdd_stop(); + cdd_pause(); // audio done Pico_msd.index = -1; } else cdd_play(Pico_msd.looplba - CDD_PLAY_OFFSET); } } + + // Hack for D32XR: to prevent BIOS freaking out, pretend drive is "ready" + // TODO find out what a real MEGASD is doing with this schizophrenia! + u8 state = Pico_mcd->s68k_regs[0x38]; + Pico_mcd->s68k_regs[0x41] = ~(~Pico_mcd->s68k_regs[0x41] + CD_READY-state) & 0xf; + Pico_mcd->s68k_regs[0x38] = CD_READY; } } } -- 2.39.5