move CD tray handling out of emu loop

git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@743 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
notaz 2009-08-10 12:11:33 +00:00
parent f27b1ceaae
commit 0f4090a90a
4 changed files with 18 additions and 7 deletions

View file

@ -797,7 +797,8 @@ char *emu_get_save_fname(int load, int is_sram, int slot)
if (is_sram)
{
romfname_ext(saveFname, (PicoAHW&1) ? "brm"PATH_SEP : "srm"PATH_SEP, (PicoAHW&1) ? ".brm" : ".srm");
romfname_ext(saveFname, (PicoAHW & PAHW_MCD) ? "brm"PATH_SEP : "srm"PATH_SEP,
(PicoAHW & PAHW_MCD) ? ".brm" : ".srm");
if (load) {
if (try_ropen_file(saveFname)) return saveFname;
// try in current dir..
@ -989,9 +990,14 @@ void emu_set_fastforward(int set_on)
}
}
static void emu_msg_tray_open(void)
static void emu_tray_open(void)
{
emu_status_msg("CD tray opened");
engineState = PGS_TrayMenu;
}
static void emu_tray_close(void)
{
emu_status_msg("CD tray closed.");
}
void emu_reset_game(void)
@ -1213,8 +1219,8 @@ void emu_init(void)
PicoInit();
PicoMessage = plat_status_msg_busy_next;
PicoMCDopenTray = emu_msg_tray_open;
PicoMCDcloseTray = menu_loop_tray;
PicoMCDopenTray = emu_tray_open;
PicoMCDcloseTray = emu_tray_close;
}
void emu_finish(void)

View file

@ -91,6 +91,7 @@ enum TPicoGameState {
PGS_KeyConfig,
PGS_ReloadRom,
PGS_Menu,
PGS_TrayMenu,
PGS_RestartRun,
PGS_Suspending, /* PSP */
PGS_SuspendWake, /* PSP */

View file

@ -104,6 +104,10 @@ int main(int argc, char *argv[])
menu_loop();
break;
case PGS_TrayMenu:
menu_loop_tray();
break;
case PGS_ReloadRom:
if (emu_reload_rom(rom_fname_reload))
engineState = PGS_Running;
@ -115,6 +119,7 @@ int main(int argc, char *argv[])
case PGS_RestartRun:
engineState = PGS_Running;
/* vvv fallthrough */
case PGS_Running:
emu_loop();

View file

@ -1985,8 +1985,7 @@ static int mh_tray_nothing(menu_id id, int keys)
static menu_entry e_menu_tray[] =
{
mee_label ("The unit is about to"),
mee_label ("close the CD tray."),
mee_label ("The CD tray has opened."),
mee_label (""),
mee_label (""),
mee_handler("Load CD image", mh_tray_load_cd),