mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
cd: hacks..
This commit is contained in:
parent
274fcc35aa
commit
7b3ddc11dc
4 changed files with 35 additions and 6 deletions
|
@ -163,8 +163,8 @@ void cdd_reset(void)
|
|||
cdd.lba = 0;
|
||||
|
||||
/* reset status */
|
||||
cdd.status = cdd.loaded ? CD_STOP : NO_DISC;
|
||||
|
||||
cdd.status = NO_DISC;
|
||||
|
||||
/* reset CD-DA fader (full volume) */
|
||||
cdd.volume = 0x400;
|
||||
|
||||
|
@ -426,6 +426,10 @@ int cdd_load(const char *filename, int type)
|
|||
|
||||
/* CD loaded */
|
||||
cdd.loaded = 1;
|
||||
|
||||
/* disc not scanned yet */
|
||||
cdd.status = NO_DISC;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -473,6 +477,9 @@ int cdd_unload(void)
|
|||
|
||||
/* CD unloaded */
|
||||
cdd.loaded = 0;
|
||||
|
||||
if (cdd.status != CD_OPEN)
|
||||
cdd.status = NO_DISC;
|
||||
}
|
||||
|
||||
/* reset TOC */
|
||||
|
@ -927,6 +934,9 @@ void cdd_process(void)
|
|||
|
||||
case 0x02: /* Read TOC */
|
||||
{
|
||||
if (cdd.status == NO_DISC)
|
||||
cdd.status = cdd.loaded ? CD_STOP : NO_DISC;
|
||||
|
||||
/* Infos automatically retrieved by CDD processor from Q-Channel */
|
||||
/* commands 0x00-0x02 (current block) and 0x03-0x05 (Lead-In) */
|
||||
switch (Pico_mcd->regs[0x44>>1].byte.l)
|
||||
|
@ -1287,6 +1297,7 @@ void cdd_process(void)
|
|||
|
||||
if (PicoMCDcloseTray)
|
||||
PicoMCDcloseTray();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,10 +42,8 @@ PICO_INTERNAL void PicoPowerMCD(void)
|
|||
memset(Pico_mcd->s68k_regs, 0, sizeof(Pico_mcd->s68k_regs));
|
||||
memset(&Pico_mcd->pcm, 0, sizeof(Pico_mcd->pcm));
|
||||
memset(&Pico_mcd->m, 0, sizeof(Pico_mcd->m));
|
||||
Pico_mcd->s68k_regs[0x38+9] = 0x0f; // default checksum
|
||||
|
||||
cdc_init();
|
||||
cdd_reset();
|
||||
gfx_init();
|
||||
|
||||
// cold reset state (tested)
|
||||
|
@ -57,7 +55,7 @@ PICO_INTERNAL void PicoPowerMCD(void)
|
|||
|
||||
void pcd_soft_reset(void)
|
||||
{
|
||||
// Reset_CD(); // breaks Fahrenheit CD swap
|
||||
elprintf(EL_CD, "cd: soft reset");
|
||||
|
||||
Pico_mcd->m.s68k_pend_ints = 0;
|
||||
cdc_reset();
|
||||
|
@ -66,6 +64,9 @@ void pcd_soft_reset(void)
|
|||
//PicoMemResetCDdecode(1); // don't have to call this in 2M mode
|
||||
#endif
|
||||
|
||||
memset(&Pico_mcd->s68k_regs[0x38], 0, 9);
|
||||
Pico_mcd->s68k_regs[0x38+9] = 0x0f; // default checksum
|
||||
|
||||
pcd_event_schedule_s68k(PCD_EVENT_CDC, 12500000/75);
|
||||
|
||||
// TODO: test if register state/timers change
|
||||
|
|
|
@ -434,8 +434,23 @@ void s68k_reg_write8(u32 a, u32 d)
|
|||
return;
|
||||
}
|
||||
case 0x4b:
|
||||
Pico_mcd->s68k_regs[a] = (u8) d;
|
||||
Pico_mcd->s68k_regs[a] = 0; // (u8) d; ?
|
||||
cdd_process();
|
||||
{
|
||||
static const char *nm[] =
|
||||
{ "stat", "stop", "read_toc", "play",
|
||||
"seek", "???", "pause", "resume",
|
||||
"ff", "fr", "tjump", "???",
|
||||
"close","open", "???", "???" };
|
||||
u8 *c = &Pico_mcd->s68k_regs[0x42];
|
||||
u8 *s = &Pico_mcd->s68k_regs[0x38];
|
||||
elprintf(EL_CD,
|
||||
"CDD command: %02x %02x %02x %02x %02x %02x %02x %02x %12s",
|
||||
c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], nm[c[0] & 0x0f]);
|
||||
elprintf(EL_CD,
|
||||
"CDD status: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x",
|
||||
s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], s[8], s[9]);
|
||||
}
|
||||
return;
|
||||
case 0x58:
|
||||
return;
|
||||
|
|
|
@ -1019,6 +1019,8 @@ static int main_menu_handler(int id, int keys)
|
|||
break;
|
||||
case MA_MAIN_CHANGE_CD:
|
||||
if (PicoAHW & PAHW_MCD) {
|
||||
// if cd is loaded, cdd_unload() triggers eject and
|
||||
// returns 1, else we'll select and load new CD here
|
||||
if (!cdd_unload())
|
||||
menu_loop_tray();
|
||||
return 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue