move CD tray handling out of emu loop

git-svn-id: file:///home/notaz/opt/svn/PicoDrive@743 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
notaz 2009-08-10 12:11:33 +00:00
parent c5c73e2fe4
commit d687ef5041
7 changed files with 24 additions and 14 deletions

View file

@ -208,7 +208,9 @@ int Insert_CD(const char *cdimg_name, int type)
ret = Load_CD_Image(cdimg_name, type);
if (ret == 0) {
CD_Present = 1;
Pico_mcd->scd.Status_CDD = READY;
/* for open tray close command will handle Status_CDD */
if (Pico_mcd->scd.Status_CDD != TRAY_OPEN)
Pico_mcd->scd.Status_CDD = READY;
}
}
@ -651,15 +653,12 @@ PICO_INTERNAL int Fast_Rewind_CDD_c9(void)
PICO_INTERNAL int Close_Tray_CDD_cC(void)
{
CD_Present = 0;
//Clear_Sound_Buffer();
Pico_mcd->scd.Status_CDC &= ~1; // Stop CDC read
elprintf(EL_STATUS, "tray close\n");
if (PicoMCDcloseTray != NULL)
CD_Present = PicoMCDcloseTray();
PicoMCDcloseTray();
Pico_mcd->scd.Status_CDD = CD_Present ? STOPPED : NOCD;
Pico_mcd->cdd.Status = 0x0000;

View file

@ -8,7 +8,7 @@ extern unsigned char formatted_bram[4*0x10];
extern unsigned int s68k_poll_adclk;
void (*PicoMCDopenTray)(void) = NULL;
int (*PicoMCDcloseTray)(void) = NULL;
void (*PicoMCDcloseTray)(void) = NULL;
PICO_INTERNAL void PicoInitMCD(void)

View file

@ -78,7 +78,7 @@ void PicoGetInternal(pint_t which, pint_ret_t *ret);
// cd/Pico.c
extern void (*PicoMCDopenTray)(void);
extern int (*PicoMCDcloseTray)(void);
extern void (*PicoMCDcloseTray)(void);
extern int PicoCDBuffers;
// Pico/Pico.c