move CD tray handling out of emu loop
authornotaz <notasas@gmail.com>
Mon, 10 Aug 2009 12:11:33 +0000 (12:11 +0000)
committernotaz <notasas@gmail.com>
Mon, 10 Aug 2009 12:11:33 +0000 (12:11 +0000)
git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@743 be3aeb3a-fb24-0410-a615-afba39da0efa

common/emu.c
common/emu.h
common/main.c
common/menu.c

index 167f2f0..2e813d3 100644 (file)
@@ -797,7 +797,8 @@ char *emu_get_save_fname(int load, int is_sram, int slot)
 \r
        if (is_sram)\r
        {\r
-               romfname_ext(saveFname, (PicoAHW&1) ? "brm"PATH_SEP : "srm"PATH_SEP, (PicoAHW&1) ? ".brm" : ".srm");\r
+               romfname_ext(saveFname, (PicoAHW & PAHW_MCD) ? "brm"PATH_SEP : "srm"PATH_SEP,\r
+                               (PicoAHW & PAHW_MCD) ? ".brm" : ".srm");\r
                if (load) {\r
                        if (try_ropen_file(saveFname)) return saveFname;\r
                        // try in current dir..\r
@@ -989,9 +990,14 @@ void emu_set_fastforward(int set_on)
        }\r
 }\r
 \r
-static void emu_msg_tray_open(void)\r
+static void emu_tray_open(void)\r
 {\r
-       emu_status_msg("CD tray opened");\r
+       engineState = PGS_TrayMenu;\r
+}\r
+\r
+static void emu_tray_close(void)\r
+{\r
+       emu_status_msg("CD tray closed.");\r
 }\r
 \r
 void emu_reset_game(void)\r
@@ -1213,8 +1219,8 @@ void emu_init(void)
 \r
        PicoInit();\r
        PicoMessage = plat_status_msg_busy_next;\r
-       PicoMCDopenTray = emu_msg_tray_open;\r
-       PicoMCDcloseTray = menu_loop_tray;\r
+       PicoMCDopenTray = emu_tray_open;\r
+       PicoMCDcloseTray = emu_tray_close;\r
 }\r
 \r
 void emu_finish(void)\r
index 2f5357a..f08d12a 100644 (file)
@@ -91,6 +91,7 @@ enum TPicoGameState {
        PGS_KeyConfig,
        PGS_ReloadRom,
        PGS_Menu,
+       PGS_TrayMenu,
        PGS_RestartRun,
        PGS_Suspending,         /* PSP */
        PGS_SuspendWake,        /* PSP */
index bdcdc14..7a7c876 100644 (file)
@@ -104,6 +104,10 @@ int main(int argc, char *argv[])
                                menu_loop();\r
                                break;\r
 \r
+                       case PGS_TrayMenu:\r
+                               menu_loop_tray();\r
+                               break;\r
+\r
                        case PGS_ReloadRom:\r
                                if (emu_reload_rom(rom_fname_reload))\r
                                        engineState = PGS_Running;\r
@@ -115,6 +119,7 @@ int main(int argc, char *argv[])
 \r
                        case PGS_RestartRun:\r
                                engineState = PGS_Running;\r
+                               /* vvv fallthrough */\r
 \r
                        case PGS_Running:\r
                                emu_loop();\r
index b7f9e4d..18c4a3f 100644 (file)
@@ -1985,8 +1985,7 @@ static int mh_tray_nothing(menu_id id, int keys)
 \r
 static menu_entry e_menu_tray[] =\r
 {\r
-       mee_label  ("The unit is about to"),\r
-       mee_label  ("close the CD tray."),\r
+       mee_label  ("The CD tray has opened."),\r
        mee_label  (""),\r
        mee_label  (""),\r
        mee_handler("Load CD image",  mh_tray_load_cd),\r