Use PBTN_MOK instead of PBTN_MA3 to confirm loading/saving state
[picodrive.git] / platform / common / emu.c
index c66c637..88fefd5 100644 (file)
@@ -530,19 +530,20 @@ out:
 \r
 int emu_swap_cd(const char *fname)\r
 {\r
-       cd_img_type cd_type;\r
+       enum cd_img_type cd_type;\r
        int ret = -1;\r
 \r
        cd_type = PicoCdCheck(fname, NULL);\r
        if (cd_type != CIT_NOT_CD)\r
-               ret = Insert_CD(fname, cd_type);\r
+               ret = cdd_load(fname, cd_type);\r
        if (ret != 0) {\r
                menu_update_msg("Load failed, invalid CD image?");\r
                return 0;\r
        }\r
 \r
        strncpy(rom_fname_loaded, fname, sizeof(rom_fname_loaded)-1);\r
-       rom_fname_loaded[sizeof(rom_fname_loaded)-1] = 0;\r
+       rom_fname_loaded[sizeof(rom_fname_loaded) - 1] = 0;\r
+\r
        return 1;\r
 }\r
 \r
@@ -606,7 +607,6 @@ void emu_set_defconfig(void)
        PsndRate = currentConfig.s_PsndRate;\r
        PicoRegionOverride = currentConfig.s_PicoRegion;\r
        PicoAutoRgnOrder = currentConfig.s_PicoAutoRgnOrder;\r
-       PicoCDBuffers = currentConfig.s_PicoCDBuffers;\r
 }\r
 \r
 int emu_read_config(const char *rom_fname, int no_defaults)\r
@@ -1073,9 +1073,9 @@ static void run_events_ui(unsigned int which)
                        char tmp[64];\r
                        int keys, len;\r
 \r
-                       strcpy(tmp, (which & PEV_STATE_LOAD) ? "LOAD STATE?" : "OVERWRITE SAVE?");\r
+                       strcpy(tmp, (which & PEV_STATE_LOAD) ? "LOAD STATE? " : "OVERWRITE SAVE? ");\r
                        len = strlen(tmp);\r
-                       nm = in_get_key_name(-1, -PBTN_MA3);\r
+                       nm = in_get_key_name(-1, -PBTN_MOK);\r
                        snprintf(tmp + len, sizeof(tmp) - len, "(%s=yes, ", nm);\r
                        len = strlen(tmp);\r
                        nm = in_get_key_name(-1, -PBTN_MBACK);\r
@@ -1084,13 +1084,13 @@ static void run_events_ui(unsigned int which)
                        plat_status_msg_busy_first(tmp);\r
 \r
                        in_set_config_int(0, IN_CFG_BLOCKING, 1);\r
-                       while (in_menu_wait_any(NULL, 50) & (PBTN_MA3|PBTN_MBACK))\r
+                       while (in_menu_wait_any(NULL, 50) & (PBTN_MOK | PBTN_MBACK))\r
                                ;\r
-                       while ( !((keys = in_menu_wait_any(NULL, 50)) & (PBTN_MA3|PBTN_MBACK)) )\r
+                       while ( !((keys = in_menu_wait_any(NULL, 50)) & (PBTN_MOK | PBTN_MBACK)))\r
                                ;\r
                        if (keys & PBTN_MBACK)\r
                                do_it = 0;\r
-                       while (in_menu_wait_any(NULL, 50) & (PBTN_MA3|PBTN_MBACK))\r
+                       while (in_menu_wait_any(NULL, 50) & (PBTN_MOK | PBTN_MBACK))\r
                                ;\r
                        in_set_config_int(0, IN_CFG_BLOCKING, 0);\r
                }\r
@@ -1336,10 +1336,6 @@ void emu_loop(void)
 \r
        PicoLoopPrepare();\r
 \r
-       // prepare CD buffer\r
-       if (PicoAHW & PAHW_MCD)\r
-               PicoCDBufferInit();\r
-\r
        plat_video_loop_prepare();\r
        emu_loop_prep();\r
        pemu_sound_start();\r
@@ -1383,6 +1379,8 @@ void emu_loop(void)
                        {\r
                                notice_msg_time = 0;\r
                                plat_status_msg_clear();\r
+                               plat_video_flip();\r
+                               plat_status_msg_clear(); /* Do it again in case of double buffering */\r
                                notice_msg = NULL;\r
                        }\r
                        else {\r
@@ -1501,10 +1499,4 @@ void emu_loop(void)
 \r
        pemu_loop_end();\r
        emu_sound_stop();\r
-\r
-       // pemu_loop_end() might want to do 1 frame for bg image,\r
-       // so free CD buffer here\r
-       if (PicoAHW & PAHW_MCD)\r
-               PicoCDBufferFree();\r
 }\r
-\r