linux port fixed; some cleanups
[libpicofe.git] / common / menu.c
index 2f29e87..32bf12f 100644 (file)
 #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
 #include "posix.h"\r
+#include <version.h>\r
 \r
 #include <pico/pico_int.h>\r
 #include <pico/patch.h>\r
@@ -33,10 +33,14 @@ static int  menu_error_time = 0;
 static unsigned char *menu_font_data = NULL;\r
 static int menu_text_color = 0xffff; // default to white\r
 static int menu_sel_color = -1; // disabled\r
+\r
+/* note: these might become non-constant in future */\r
 #if MENU_X2\r
 static const int me_mfont_w = 16, me_mfont_h = 20;\r
+static const int me_sfont_w = 12, me_sfont_h = 20;\r
 #else\r
 static const int me_mfont_w = 8, me_mfont_h = 10;\r
+static const int me_sfont_w = 6, me_sfont_h = 10;\r
 #endif\r
 \r
 // draws text to current bbp16 screen\r
@@ -113,35 +117,41 @@ void text_out16(int x, int y, const char *texto, ...)
        text_out16_(x,y,buffer,menu_text_color);\r
 }\r
 \r
-\r
+/* draws in 6x8 font, might multiply size by integer */\r
 static void smalltext_out16_(int x, int y, const char *texto, int color)\r
 {\r
-       int i;\r
        unsigned char  *src;\r
        unsigned short *dst;\r
+       int multiplier = me_sfont_w / 6;\r
+       int i;\r
 \r
-       for (i = 0;; i++, x += 6)\r
+       for (i = 0;; i++, x += me_sfont_w)\r
        {\r
                unsigned char c = (unsigned char) texto[i];\r
                int h = 8;\r
 \r
-               if (!c) break;\r
+               if (!c || c == '\n')\r
+                       break;\r
 \r
                src = fontdata6x8[c];\r
                dst = (unsigned short *)g_screen_ptr + x + y * g_screen_width;\r
 \r
                while (h--)\r
                {\r
-                       int w = 0x20;\r
-                       while (w)\r
+                       int m, w2, h2;\r
+                       for (h2 = multiplier; h2 > 0; h2--)\r
                        {\r
-                               if( *src & w ) *dst = color;\r
-                               dst++;\r
-                               w>>=1;\r
+                               for (m = 0x20; m; m >>= 1) {\r
+                                       if (*src & m)\r
+                                               for (w2 = multiplier; w2 > 0; w2--)\r
+                                                       *dst++ = color;\r
+                                       else\r
+                                               dst += multiplier;\r
+                               }\r
+\r
+                               dst += g_screen_width - me_sfont_w;\r
                        }\r
                        src++;\r
-\r
-                       dst += g_screen_width - 6;\r
                }\r
        }\r
 }\r
@@ -176,7 +186,7 @@ static void menu_draw_selection(int x, int y, int w)
        for (h = me_mfont_h + 1; h > 0; h--)\r
        {\r
                dst = dest;\r
-               for (i = w; i > 0; i--)\r
+               for (i = w - 14; i > 0; i--)\r
                        *dst++ = menu_sel_color;\r
                dest += g_screen_width;\r
        }\r
@@ -472,7 +482,7 @@ static void me_loop(menu_entry *menu, int *menu_sel)
                return;\r
        }\r
 \r
-       while (!menu[sel].enabled && sel < menu_sel_max)\r
+       while ((!menu[sel].enabled || !menu[sel].selectable) && sel < menu_sel_max)\r
                sel++;\r
 \r
        /* make sure action buttons are not pressed on entering menu */\r
@@ -585,15 +595,15 @@ static void cdload_progress_cb(int percent)
        int ln, len = percent * g_screen_width / 100;\r
        unsigned short *dst = (unsigned short *)g_screen_ptr + g_screen_width * 10 * 2;\r
 \r
-       memset(dst, 0xff, g_screen_width * (10 - 2) * 2);\r
+       memset(dst, 0xff, g_screen_width * (me_sfont_h - 2) * 2);\r
 \r
-       smalltext_out16(1, 3 * 10, "Processing CD image / MP3s", 0xffff);\r
-       smalltext_out16(1, 4 * 10, rom_fname_loaded, 0xffff);\r
-       dst += g_screen_width * 30;\r
+       smalltext_out16(1, 3 * me_sfont_h, "Processing CD image / MP3s", 0xffff);\r
+       smalltext_out16(1, 4 * me_sfont_h, rom_fname_loaded, 0xffff);\r
+       dst += g_screen_width * me_sfont_h * 3;\r
 \r
        if (len > g_screen_width)\r
                len = g_screen_width;\r
-       for (ln = (10 - 2); ln > 0; ln--, dst += g_screen_width)\r
+       for (ln = (me_sfont_h - 2); ln > 0; ln--, dst += g_screen_width)\r
                memset(dst, 0xff, len * 2);\r
 \r
        plat_video_menu_end();\r
@@ -604,18 +614,18 @@ void menu_romload_prepare(const char *rom_name)
 {\r
        const char *p = rom_name + strlen(rom_name);\r
 \r
-       plat_video_menu_begin();\r
-\r
        while (p > rom_name && *p != '/')\r
                p--;\r
 \r
        /* fill both buffers, callbacks won't update in full */\r
+       plat_video_menu_begin();\r
        smalltext_out16(1, 1, "Loading", 0xffff);\r
-       smalltext_out16(1, 10, p, 0xffff);\r
+       smalltext_out16(1, me_sfont_h, p, 0xffff);\r
        plat_video_menu_end();\r
 \r
+       plat_video_menu_begin();\r
        smalltext_out16(1, 1, "Loading", 0xffff);\r
-       smalltext_out16(1, 10, p, 0xffff);\r
+       smalltext_out16(1, me_sfont_h, p, 0xffff);\r
        plat_video_menu_end();\r
 \r
        PicoCartLoadProgressCB = load_progress_cb;\r
@@ -626,11 +636,49 @@ void menu_romload_prepare(const char *rom_name)
 void menu_romload_end(void)\r
 {\r
        PicoCartLoadProgressCB = PicoCDLoadProgressCB = NULL;\r
-       smalltext_out16(1, (cdload_called ? 6 : 3) * 10,\r
+       smalltext_out16(1, (cdload_called ? 6 : 3) * me_sfont_h,\r
                "Starting emulation...", 0xffff);\r
        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
@@ -651,9 +699,9 @@ static unsigned short file2color(const char *fname)
 \r
 static void draw_dirlist(char *curdir, struct dirent **namelist, int n, int sel)\r
 {\r
-       int max_cnt, start, i, pos;\r
+       int max_cnt, start, i, x, pos;\r
 \r
-       max_cnt = g_screen_height / 10;\r
+       max_cnt = g_screen_height / me_sfont_h;\r
        start = max_cnt / 2 - sel;\r
        n--; // exclude current dir (".")\r
 \r
@@ -664,21 +712,22 @@ static void draw_dirlist(char *curdir, struct dirent **namelist, int n, int sel)
 \r
        menu_darken_bg((short *)g_screen_ptr + g_screen_width * max_cnt/2 * 10, g_screen_width * 8, 0);\r
 \r
+       x = 5 + me_mfont_w + 1;\r
        if (start - 2 >= 0)\r
-               smalltext_out16(14, (start - 2)*10, curdir, 0xffff);\r
+               smalltext_out16(14, (start - 2) * me_sfont_h, curdir, 0xffff);\r
        for (i = 0; i < n; i++) {\r
                pos = start + i;\r
                if (pos < 0)  continue;\r
                if (pos >= max_cnt) break;\r
                if (namelist[i+1]->d_type == DT_DIR) {\r
-                       smalltext_out16(14,   pos*10, "/", 0xfff6);\r
-                       smalltext_out16(14+6, pos*10, namelist[i+1]->d_name, 0xfff6);\r
+                       smalltext_out16(x, pos * me_sfont_h, "/", 0xfff6);\r
+                       smalltext_out16(x + me_sfont_w, pos * me_sfont_h, namelist[i+1]->d_name, 0xfff6);\r
                } else {\r
                        unsigned short color = file2color(namelist[i+1]->d_name);\r
-                       smalltext_out16(14,   pos*10, namelist[i+1]->d_name, color);\r
+                       smalltext_out16(x, pos * me_sfont_h, namelist[i+1]->d_name, color);\r
                }\r
        }\r
-       smalltext_out16(5, max_cnt/2 * 10, ">", 0xffff);\r
+       smalltext_out16(5, max_cnt/2 * me_sfont_h, ">", 0xffff);\r
        plat_video_menu_end();\r
 }\r
 \r
@@ -777,7 +826,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
@@ -855,14 +904,14 @@ static void draw_patchlist(int sel)
                if (pos < 0) continue;\r
                if (pos >= max_cnt) break;\r
                active = PicoPatches[i].active;\r
-               smalltext_out16(14,     pos*10, active ? "ON " : "OFF", active ? 0xfff6 : 0xffff);\r
-               smalltext_out16(14+6*4, pos*10, PicoPatches[i].name,    active ? 0xfff6 : 0xffff);\r
+               smalltext_out16(14,     pos * me_sfont_h, active ? "ON " : "OFF", active ? 0xfff6 : 0xffff);\r
+               smalltext_out16(14+6*4, pos * me_sfont_h, PicoPatches[i].name,    active ? 0xfff6 : 0xffff);\r
        }\r
        pos = start + i;\r
        if (pos < max_cnt)\r
-               smalltext_out16(14, pos * 10, "done", 0xffff);\r
+               smalltext_out16(14, pos * me_sfont_h, "done", 0xffff);\r
 \r
-       text_out16(5, max_cnt / 2 * 10, ">");\r
+       text_out16(5, max_cnt / 2 * me_sfont_h, ">");\r
        plat_video_menu_end();\r
 }\r
 \r
@@ -965,7 +1014,7 @@ static void draw_savestate_menu(int menu_sel, int is_loading)
        if (state_slot_flags & (1 << menu_sel))\r
                draw_savestate_bg(menu_sel);\r
 \r
-       w = 13 * me_mfont_w + me_mfont_w * 2;\r
+       w = (13 + 2) * me_mfont_w;\r
        h = (1+2+10+1) * me_mfont_h;\r
        x = g_screen_width / 2 - w / 2;\r
        if (x < 0) x = 0;\r
@@ -977,7 +1026,7 @@ static void draw_savestate_menu(int menu_sel, int is_loading)
        text_out16(x, y, is_loading ? "Load state" : "Save state");\r
        y += 3 * me_mfont_h;\r
 \r
-       menu_draw_selection(x - me_mfont_w * 2, y + menu_sel * me_mfont_h, 13 * me_mfont_w + 4);\r
+       menu_draw_selection(x - me_mfont_w * 2, y + menu_sel * me_mfont_h, (13 + 2) * me_mfont_w + 4);\r
 \r
        /* draw all 10 slots */\r
        for (i = 0; i < 10; i++, y += me_mfont_h)\r
@@ -1044,10 +1093,11 @@ static char *action_binds(int player_idx, int action_mask, int dev_id)
        if (binds == NULL)\r
                return static_buff;\r
 \r
-       count = in_get_dev_bind_count(dev_id);\r
+       count = in_get_dev_info(dev_id, IN_INFO_BIND_COUNT);\r
        for (k = 0; k < count; k++)\r
        {\r
                const char *xname;\r
+               int len;\r
                if (!(binds[k] & action_mask))\r
                        continue;\r
 \r
@@ -1055,9 +1105,12 @@ static char *action_binds(int player_idx, int action_mask, int dev_id)
                        continue;\r
 \r
                xname = in_get_key_name(dev_id, k);\r
-               if (static_buff[0])\r
-                       strncat(static_buff, " + ", sizeof(static_buff));\r
-               strncat(static_buff, xname, sizeof(static_buff));\r
+               len = strlen(static_buff);\r
+               if (len) {\r
+                       strncat(static_buff, " + ", sizeof(static_buff) - len - 1);\r
+                       len += 3;\r
+               }\r
+               strncat(static_buff, xname, sizeof(static_buff) - len - 1);\r
        }\r
 \r
        return static_buff;\r
@@ -1073,7 +1126,7 @@ static int count_bound_keys(int dev_id, int action_mask, int player_idx)
        if (binds == NULL)\r
                return 0;\r
 \r
-       count = in_get_dev_bind_count(dev_id);\r
+       count = in_get_dev_info(dev_id, IN_INFO_BIND_COUNT);\r
        for (k = 0; k < count; k++)\r
        {\r
                if (!(binds[k] & action_mask))\r
@@ -1091,10 +1144,11 @@ static int count_bound_keys(int dev_id, int action_mask, int player_idx)
 static void draw_key_config(const me_bind_action *opts, int opt_cnt, int player_idx,\r
                int sel, int dev_id, int dev_count, int is_bind)\r
 {\r
-       int x, y, w, i;\r
        const char *dev_name;\r
+       int x, y, w, i;\r
 \r
-       x = g_screen_width / 2 - 20 * me_mfont_w / 2;\r
+       w = ((player_idx >= 0) ? 20 : 30) * me_mfont_w;\r
+       x = g_screen_width / 2 - w / 2;\r
        y = (g_screen_height - 4 * me_mfont_h) / 2 - (2 + opt_cnt) * me_mfont_h / 2;\r
        if (x < me_mfont_w * 2)\r
                x = me_mfont_w * 2;\r
@@ -1106,7 +1160,7 @@ static void draw_key_config(const me_bind_action *opts, int opt_cnt, int player_
                text_out16(x, y, "Emulator controls");\r
 \r
        y += 2 * me_mfont_h;\r
-       menu_draw_selection(x - me_mfont_w * 2, y + sel * me_mfont_h, me_mfont_w); // FIXME last arg\r
+       menu_draw_selection(x - me_mfont_w * 2, y + sel * me_mfont_h, w + 2 * me_mfont_w);\r
 \r
        for (i = 0; i < opt_cnt; i++, y += me_mfont_h)\r
                text_out16(x, y, "%s : %s", opts[i].name,\r
@@ -1190,7 +1244,12 @@ static void key_config_loop(const me_bind_action *opts, int opt_cnt, int player_
                for (is_down = 1; is_down; )\r
                        kc = in_update_keycode(&dev_id, &is_down, -1);\r
 \r
-               unbind = count_bound_keys(dev_id, opts[sel].mask, player_idx) >= 2;\r
+               i = count_bound_keys(dev_id, opts[sel].mask, player_idx);\r
+               unbind = (i > 0);\r
+\r
+               /* allow combos if device supports them */\r
+               if (i == 1 && in_get_dev_info(dev_id, IN_INFO_DOES_COMBOS))\r
+                       unbind = 0;\r
 \r
                in_bind_key(dev_id, kc, opts[sel].mask, unbind);\r
                if (player_idx >= 0) {\r
@@ -1357,15 +1416,6 @@ static int menu_loop_cd_options(menu_id id, int keys)
 \r
 // ------------ adv options menu ------------\r
 \r
-// TODO FIXME fix if and mv\r
-static const char *mgn_aopt_sqhack(menu_id id, int *offs)\r
-{\r
-       *offs = -10;\r
-       sprintf(static_buff, "%s, %s", 111 ? "  active" : "inactive",\r
-               (currentConfig.EmuOpt & 0x10) ? "ON" : "OFF");\r
-       return static_buff;\r
-}\r
-\r
 static menu_entry e_menu_adv_options[] =\r
 {\r
        mee_onoff     ("SRAM/BRAM saves",          MA_OPT_SRAM_STATES,    currentConfig.EmuOpt, EOPT_USE_SRAM),\r
@@ -1376,9 +1426,8 @@ static menu_entry e_menu_adv_options[] =
        mee_onoff     ("Emulate SN76496 (PSG)",    MA_OPT2_ENABLE_SN76496,PicoOpt, POPT_EN_PSG),\r
        mee_onoff     ("gzip savestates",          MA_OPT2_GZIP_STATES,   currentConfig.EmuOpt, EOPT_GZIP_SAVES),\r
        mee_onoff     ("Don't save last used ROM", MA_OPT2_NO_LAST_ROM,   currentConfig.EmuOpt, EOPT_NO_AUTOSVCFG),\r
-       mee_label     ("- needs restart -"),\r
-       mee_onoff     ("craigix's RAM timings",    MA_OPT2_RAMTIMINGS,    currentConfig.EmuOpt, 0x0100),\r
-       mee_onoff_cust("Squidgehack",              MA_OPT2_SQUIDGEHACK,   currentConfig.EmuOpt, 0x0010, mgn_aopt_sqhack),\r
+       mee_onoff     ("RAM overclock",            MA_OPT2_RAMTIMINGS,    currentConfig.EmuOpt, EOPT_RAM_TIMINGS),\r
+       mee_onoff     ("MMU hack",                 MA_OPT2_SQUIDGEHACK,   currentConfig.EmuOpt, EOPT_MMUHACK),\r
        mee_onoff     ("SVP dynarec",              MA_OPT2_SVP_DYNAREC,   PicoOpt, POPT_EN_SVP_DRC),\r
        mee_onoff     ("Disable idle loop patching",MA_OPT2_NO_IDLE_LOOPS,PicoOpt, POPT_DIS_IDLE_DET),\r
        mee_end,\r
@@ -1395,12 +1444,12 @@ static int menu_loop_adv_options(menu_id id, int keys)
 \r
 static const char *mgn_opt_scaling(menu_id id, int *offs)\r
 {\r
-       *offs = -12;\r
+       *offs = -13;\r
        switch (currentConfig.scaling) {\r
-               default: return "            OFF";\r
-               case 1:  return "hw horizontal";\r
-               case 2:  return "hw horiz. + vert.";\r
-               case 3:  return "sw horizontal";\r
+               default:               return "             OFF";\r
+               case EOPT_SCALE_HW_H:  return "   hw horizontal";\r
+               case EOPT_SCALE_HW_HV: return "hw horiz. + vert";\r
+               case EOPT_SCALE_SW_H:  return "   sw horizontal";\r
        }\r
 }\r
 \r
@@ -1414,8 +1463,8 @@ static menu_entry e_menu_gfx_options[] =
 {\r
        mee_range_cust("Scaling",                  MA_OPT_SCALING,        currentConfig.scaling, 0, 3, mgn_opt_scaling),\r
        mee_range_cust("Gamma correction",         MA_OPT2_GAMMA,         currentConfig.gamma, 1, 300, mgn_aopt_gamma),\r
-       mee_onoff     ("A_SN's gamma curve",       MA_OPT2_A_SN_GAMMA,    currentConfig.EmuOpt, 0x1000),\r
-       mee_onoff     ("Perfect vsync",            MA_OPT2_VSYNC,         currentConfig.EmuOpt, 0x2000),\r
+       mee_onoff     ("A_SN's gamma curve",       MA_OPT2_A_SN_GAMMA,    currentConfig.EmuOpt, EOPT_A_SN_GAMMA),\r
+       mee_onoff     ("Perfect vsync",            MA_OPT2_VSYNC,         currentConfig.EmuOpt, EOPT_PSYNC),\r
        mee_end,\r
 };\r
 \r
@@ -1644,11 +1693,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
@@ -1676,9 +1721,6 @@ static int menu_loop_options(menu_id id, int keys)
 \r
 // ------------ debug menu ------------\r
 \r
-#include <sys/stat.h>\r
-#include <sys/types.h>\r
-\r
 #include <pico/debug.h>\r
 \r
 extern void SekStepM68k(void);\r
@@ -1706,17 +1748,21 @@ static void draw_text_debug(const char *str, int skip, int from)
        p = str;\r
        while (skip-- > 0)\r
        {\r
-               while (*p && *p != '\n') p++;\r
-               if (*p == 0 || p[1] == 0) return;\r
+               while (*p && *p != '\n')\r
+                       p++;\r
+               if (*p == 0 || p[1] == 0)\r
+                       return;\r
                p++;\r
        }\r
 \r
        str = p;\r
-       for (line = from; line < g_screen_height / 10; line++)\r
+       for (line = from; line < g_screen_height / me_sfont_h; line++)\r
        {\r
-               while (*p && *p != '\n') p++;\r
-               smalltext_out16(1, line*10, str, 0xffff);\r
-               if (*p == 0) break;\r
+               smalltext_out16(1, line * me_sfont_h, str, 0xffff);\r
+               while (*p && *p != '\n')\r
+                       p++;\r
+               if (*p == 0)\r
+                       break;\r
                p++; str = p;\r
        }\r
 }\r
@@ -1731,7 +1777,8 @@ 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, g_screen_height - 8, layer_str, 0xffff);\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
 static void debug_menu_loop(void)\r
@@ -1749,7 +1796,7 @@ static void debug_menu_loop(void)
                                emu_platformDebugCat(tmp);\r
                                draw_text_debug(tmp, 0, 0);\r
                                if (dumped) {\r
-                                       smalltext_out16(g_screen_width - 6 * me_mfont_h,\r
+                                       smalltext_out16(g_screen_width - 6 * me_sfont_h,\r
                                                g_screen_height - me_mfont_h, "dumped", 0xffff);\r
                                        dumped = 0;\r
                                }\r
@@ -1885,6 +1932,10 @@ static int main_menu_handler(menu_id id, int keys)
 \r
 static menu_entry e_menu_main[] =\r
 {\r
+       mee_label     ("PicoDrive " VERSION),\r
+       mee_label     (""),\r
+       mee_label     (""),\r
+       mee_label     (""),\r
        mee_handler_id("Resume game",        MA_MAIN_RESUME_GAME, main_menu_handler),\r
        mee_handler_id("Save State",         MA_MAIN_SAVE_STATE,  main_menu_handler),\r
        mee_handler_id("Load State",         MA_MAIN_LOAD_STATE,  main_menu_handler),\r
@@ -1911,13 +1962,15 @@ void menu_loop(void)
        plat_video_menu_enter(rom_loaded);\r
        in_set_blocking(1);\r
        me_loop(e_menu_main, &sel);\r
-       in_set_blocking(0);\r
 \r
-       if (rom_loaded && engineState == PGS_Menu) {\r
+       if (rom_loaded) {\r
+               if (engineState == PGS_Menu)\r
+                       engineState = PGS_Running;\r
                /* wait until menu, ok, back is released */\r
                while (in_menu_wait_any(50) & (PBTN_MENU|PBTN_MOK|PBTN_MBACK));\r
-               engineState = PGS_Running;\r
        }\r
+\r
+       in_set_blocking(0);\r
 }\r
 \r
 // --------- CD tray close menu ----------\r
@@ -1967,7 +2020,6 @@ int menu_loop_tray(void)
 \r
        in_set_blocking(1);\r
        me_loop(e_menu_tray, &sel);\r
-       in_set_blocking(0);\r
 \r
        if (engineState != PGS_RestartRun) {\r
                engineState = PGS_RestartRun;\r
@@ -1975,6 +2027,7 @@ int menu_loop_tray(void)
        }\r
 \r
        while (in_menu_wait_any(50) & (PBTN_MENU|PBTN_MOK|PBTN_MBACK));\r
+       in_set_blocking(0);\r
 \r
        return ret;\r
 }\r
@@ -1992,6 +2045,22 @@ void me_update_msg(const char *msg)
 \r
 // ------------ util ------------\r
 \r
+/* wiz for now, probably extend later */\r
+void menu_plat_setup(int is_wiz)\r
+{\r
+       int i;\r
+\r
+       if (!is_wiz)\r
+               return;\r
+\r
+       me_enable(e_menu_adv_options, MA_OPT_ARM940_SOUND, 0);\r
+       me_enable(e_menu_gfx_options, MA_OPT2_GAMMA, 0);\r
+       me_enable(e_menu_gfx_options, MA_OPT2_A_SN_GAMMA, 0);\r
+\r
+       i = me_id2offset(e_menu_gfx_options, MA_OPT_SCALING);\r
+       e_menu_gfx_options[i].max = 1;  /* only off and sw */\r
+}\r
+\r
 /* TODO: rename */\r
 void menu_darken_bg(void *dst, int pixels, int darker)\r
 {\r