refactoring for Wiz port; random cleanups
[libpicofe.git] / common / menu.c
index 6f29f37..0b49234 100644 (file)
@@ -12,7 +12,6 @@
 #include "fonts.h"\r
 #include "readpng.h"\r
 #include "lprintf.h"\r
-#include "common.h"\r
 #include "input.h"\r
 #include "emu.h"\r
 #include "plat.h"\r
@@ -641,6 +640,44 @@ void menu_romload_end(void)
        plat_video_menu_end();\r
 }\r
 \r
+// -------------- del confirm ---------------\r
+\r
+static void do_delete(const char *fpath, const char *fname)\r
+{\r
+       int len, mid, inp;\r
+       const char *nm;\r
+       char tmp[64];\r
+\r
+       plat_video_menu_begin();\r
+\r
+       if (!rom_loaded)\r
+               menu_darken_bg(g_screen_ptr, g_screen_width * g_screen_height, 0);\r
+\r
+       len = strlen(fname);\r
+       if (len > g_screen_width/6)\r
+               len = g_screen_width/6;\r
+\r
+       mid = g_screen_width / 2;\r
+       text_out16(mid - me_mfont_w * 15 / 2,  8 * me_mfont_h, "About to delete");\r
+       smalltext_out16(mid - len * me_sfont_w / 2, 9 * me_mfont_h + 5, fname, 0xbdff);\r
+       text_out16(mid - me_mfont_w * 13 / 2, 11 * me_mfont_h, "Are you sure?");\r
+\r
+       nm = in_get_key_name(-1, -PBTN_MA3);\r
+       snprintf(tmp, sizeof(tmp), "(%s - confirm, ", nm);\r
+       len = strlen(tmp);\r
+       nm = in_get_key_name(-1, -PBTN_MBACK);\r
+       snprintf(tmp + len, sizeof(tmp) - len, "%s - cancel)", nm);\r
+       len = strlen(tmp);\r
+\r
+       text_out16(mid - me_mfont_w * len / 2, 12 * me_mfont_h, tmp);\r
+       plat_video_menu_end();\r
+\r
+       while (in_menu_wait_any(50) & (PBTN_MENU|PBTN_MA2));\r
+       inp = in_menu_wait(PBTN_MA3|PBTN_MBACK, 100);\r
+       if (inp & PBTN_MA3)\r
+               remove(fpath);\r
+}\r
+\r
 // -------------- ROM selector --------------\r
 \r
 // rrrr rggg gggb bbbb\r
@@ -788,7 +825,7 @@ rescan:
                                        ret = rom_fname_reload;\r
                                        break;\r
                                }\r
-//                             do_delete(rom_fname_reload, namelist[sel+1]->d_name); // TODO\r
+                               do_delete(rom_fname_reload, namelist[sel+1]->d_name);\r
                                if (n > 0) {\r
                                        while (n--) free(namelist[n]);\r
                                        free(namelist);\r
@@ -1665,11 +1702,7 @@ static menu_entry e_menu_options[] =
        mee_onoff     ("Enable sound",             MA_OPT_ENABLE_SOUND,  currentConfig.EmuOpt, 0x004),\r
        mee_cust      ("Sound Quality",            MA_OPT_SOUND_QUALITY, mh_opt_misc, mgn_opt_sound),\r
        mee_cust      ("Confirm savestate",        MA_OPT_CONFIRM_STATES,mh_opt_misc, mgn_opt_c_saves),\r
-#if   defined(__GP2X__)\r
-       mee_range     ("GP2X CPU clocks",          MA_OPT_CPU_CLOCKS,    currentConfig.CPUclock, 20, 400),\r
-#elif defined(PSP)\r
-       mee_range     ("PSP CPU clock",            MA_OPT_CPU_CLOCKS,    currentConfig.CPUclock, )\r
-#endif\r
+       mee_range     (cpu_clk_name,               MA_OPT_CPU_CLOCKS,    currentConfig.CPUclock, 20, 900),\r
        mee_handler   ("[Display options]",        menu_loop_gfx_options),\r
        mee_handler   ("[Advanced options]",       menu_loop_adv_options),\r
        mee_handler   ("[Sega/Mega CD options]",   menu_loop_cd_options),\r
@@ -1753,6 +1786,7 @@ static void draw_frame_debug(void)
 \r
        memset(g_screen_ptr, 0, g_screen_width * g_screen_height * 2);\r
        emu_forcedFrame(0);\r
+       smalltext_out16(4, 1, "build: " __DATE__ " " __TIME__, 0xffff);\r
        smalltext_out16(4, g_screen_height - me_sfont_h, layer_str, 0xffff);\r
 }\r
 \r