some pandora tweaks
[libpicofe.git] / common / menu.c
index fdc8e89..39a71b1 100644 (file)
@@ -164,7 +164,7 @@ static void smalltext_out16_(int x, int y, const char *texto, int color)
 static void smalltext_out16(int x, int y, const char *texto, int color)\r
 {\r
        char buffer[128];\r
-       int maxw = (g_screen_width - x) / 6;\r
+       int maxw = (g_screen_width - x) / me_sfont_w;\r
 \r
        if (maxw < 0)\r
                return;\r
@@ -274,7 +274,7 @@ void menu_init(void)
        memcpy(menu_font_data, menu_font_data + ((int)'>') * me_mfont_w * me_mfont_h / 2,\r
                me_mfont_w * me_mfont_h / 2);\r
        emu_make_path(buff, "skin/selector.png", sizeof(buff));\r
-       readpng(menu_font_data, buff, READPNG_SELECTOR, MENU_X2 ? 16 : 8, MENU_X2 ? 20 : 10);\r
+       readpng(menu_font_data, buff, READPNG_SELECTOR, me_mfont_w, me_mfont_h);\r
 \r
        // load custom colors\r
        emu_make_path(buff, "skin/skin.txt", sizeof(buff));\r
@@ -413,9 +413,12 @@ static void me_draw(const menu_entry *entries, int sel, void (*draw_more)(void))
                        wt = col2_offs;\r
 \r
                        switch (ent->beh) {\r
-                       case MB_NONE: break;\r
+                       case MB_NONE:\r
+                               break;\r
                        case MB_OPT_ONOFF:\r
-                       case MB_OPT_RANGE: wt += me_mfont_w * 3; break;\r
+                       case MB_OPT_RANGE:\r
+                               wt += me_mfont_w * 3;\r
+                               break;\r
                        case MB_OPT_CUSTOM:\r
                        case MB_OPT_CUSTONOFF:\r
                        case MB_OPT_CUSTRANGE:\r
@@ -694,11 +697,11 @@ static int cdload_called = 0;
 static void load_progress_cb(int percent)\r
 {\r
        int ln, len = percent * g_screen_width / 100;\r
-       unsigned short *dst = (unsigned short *)g_screen_ptr + g_screen_width * 10 * 2;\r
+       unsigned short *dst = (unsigned short *)g_screen_ptr + g_screen_width * me_sfont_h * 2;\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
        plat_video_menu_end();\r
 }\r
@@ -706,7 +709,7 @@ static void load_progress_cb(int percent)
 static void cdload_progress_cb(const char *fname, int percent)\r
 {\r
        int ln, len = percent * g_screen_width / 100;\r
-       unsigned short *dst = (unsigned short *)g_screen_ptr + g_screen_width * 10 * 2;\r
+       unsigned short *dst = (unsigned short *)g_screen_ptr + g_screen_width * me_sfont_h * 2;\r
 \r
        memset(dst, 0xff, g_screen_width * (me_sfont_h - 2) * 2);\r
 \r
@@ -767,8 +770,8 @@ static void do_delete(const char *fpath, const char *fname)
                menu_darken_bg(g_screen_ptr, 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
+       if (len > g_screen_width / me_sfont_w)\r
+               len = g_screen_width / me_sfont_w;\r
 \r
        mid = g_screen_width / 2;\r
        text_out16(mid - me_mfont_w * 15 / 2,  8 * me_mfont_h, "About to delete");\r
@@ -1021,7 +1024,7 @@ static void draw_patchlist(int sel)
 {\r
        int max_cnt, start, i, pos, active;\r
 \r
-       max_cnt = g_screen_height / 10;\r
+       max_cnt = g_screen_height / me_sfont_h;\r
        start = max_cnt / 2 - sel;\r
 \r
        plat_video_menu_begin();\r
@@ -1031,8 +1034,8 @@ 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 * 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
+               smalltext_out16(14,                pos * me_sfont_h, active ? "ON " : "OFF", active ? 0xfff6 : 0xffff);\r
+               smalltext_out16(14 + me_sfont_w*4, pos * me_sfont_h, PicoPatches[i].name,    active ? 0xfff6 : 0xffff);\r
        }\r
        pos = start + i;\r
        if (pos < max_cnt)\r
@@ -1095,7 +1098,7 @@ static void draw_savestate_bg(int slot)
        PicoStateLoadGfx(fname);\r
 \r
        /* do a frame and fetch menu bg */\r
-       pemu_forced_frame(POPT_EN_SOFTSCALE);\r
+       pemu_forced_frame(POPT_EN_SOFTSCALE, 0);\r
        menu_enter(1);\r
 \r
        PicoTmpStateRestore(tmp_state);\r
@@ -1539,6 +1542,8 @@ static int menu_loop_cd_options(menu_id id, int keys)
 \r
 // ------------ 32X options menu ------------\r
 \r
+#ifndef NO_32X\r
+\r
 // convert from multiplier of VClk\r
 static int mh_opt_sh2cycles(menu_id id, int keys)\r
 {\r
@@ -1591,6 +1596,8 @@ static int menu_loop_32x_options(menu_id id, int keys)
        return 0;\r
 }\r
 \r
+#endif\r
+\r
 // ------------ adv options menu ------------\r
 \r
 static menu_entry e_menu_adv_options[] =\r
@@ -1814,7 +1821,9 @@ static menu_entry e_menu_options[] =
        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   ("[Sega/Mega CD options]",   menu_loop_cd_options),\r
+#ifndef NO_32X\r
        mee_handler   ("[32X options]",            menu_loop_32x_options),\r
+#endif\r
        mee_handler   ("[Advanced options]",       menu_loop_adv_options),\r
        mee_cust_nosave("Save global config",      MA_OPT_SAVECFG, mh_saveloadcfg, mgn_saveloadcfg),\r
        mee_cust_nosave("Save cfg for loaded game",MA_OPT_SAVECFG_GAME, mh_saveloadcfg, mgn_saveloadcfg),\r
@@ -1899,7 +1908,7 @@ static void draw_frame_debug(void)
        if (PicoDrawMask & PDRAW_32X_ON)         memcpy(layer_str + 26, "32x", 4);\r
 \r
        memset(g_screen_ptr, 0, g_screen_width * g_screen_height * 2);\r
-       pemu_forced_frame(0);\r
+       pemu_forced_frame(0, 0);\r
        smalltext_out16(4, 1, "build: r" REVISION "  "__DATE__ " " __TIME__ " " COMPILER, 0xffff);\r
        smalltext_out16(4, g_screen_height - me_sfont_h, layer_str, 0xffff);\r
 }\r
@@ -1924,12 +1933,14 @@ static void debug_menu_loop(void)
                                        dumped = 0;\r
                                }\r
                                break;\r
-                       case 1: draw_frame_debug(); break;\r
+                       case 1: draw_frame_debug();\r
+                               break;\r
                        case 2: memset(g_screen_ptr, 0, g_screen_width * g_screen_height * 2);\r
-                               pemu_forced_frame(0);\r
+                               pemu_forced_frame(0, 1);\r
                                menu_darken_bg(g_screen_ptr, g_screen_ptr, g_screen_width * g_screen_height, 0);\r
                                PDebugShowSpriteStats((unsigned short *)g_screen_ptr + (g_screen_height/2 - 240/2)*g_screen_width +\r
-                                       g_screen_width/2 - 320/2, g_screen_width); break;\r
+                                       g_screen_width/2 - 320/2, g_screen_width);\r
+                               break;\r
                        case 3: memset(g_screen_ptr, 0, g_screen_width * g_screen_height * 2);\r
                                PDebugShowPalette(g_screen_ptr, g_screen_width);\r
                                PDebugShowSprite((unsigned short *)g_screen_ptr + g_screen_width*120 + g_screen_width/2 + 16,\r
@@ -2199,7 +2210,9 @@ static menu_entry *e_menu_table[] =
        e_menu_gfx_options,\r
        e_menu_adv_options,\r
        e_menu_cd_options,\r
+#ifndef NO_32X\r
        e_menu_32x_options,\r
+#endif\r
        e_menu_keyconfig,\r
        e_menu_hidden,\r
 };\r