some work on PSP CLUT
[picodrive.git] / platform / psp / menu.c
index c878f40..1f3c6ea 100644 (file)
@@ -39,8 +39,6 @@ static const char * const pspKeyNames[] = {
        pspKeyUnkn, pspKeyUnkn, pspKeyUnkn, pspKeyUnkn, pspKeyUnkn, pspKeyUnkn, pspKeyUnkn, pspKeyUnkn
 };
 
-unsigned int __attribute__((aligned(16))) guCmdList[1024]; // TODO: adjust, mv
-
 static unsigned char bg_buffer[480*272*2] __attribute__((aligned(16))); // TODO: move to vram?
 #define menu_screen psp_screen
 
@@ -92,10 +90,11 @@ static void menu_draw_begin(void)
        // for (i = 272; i >= 0; i--, dst += 512, src += 480)
        //      memcpy32((int *)dst, (int *)src, 480*2/4);
 
+       sceGuSync(0,0); // sync with prev
        sceGuStart(GU_DIRECT, guCmdList);
        sceGuCopyImage(GU_PSM_5650, 0, 0, 480, 272, 480, bg_buffer, 0, 0, 512, menu_screen);
        sceGuFinish();
-       sceGuSync(0, GU_SYNC_FINISH);
+       sceGuSync(0,0);
 }
 
 
@@ -1032,6 +1031,7 @@ menu_entry opt_entries[] =
        { "Use SRAM/BRAM savestates",  MB_ONOFF, MA_OPT_SRAM_STATES,   &currentConfig.EmuOpt,  0x0001, 0, 0, 1 },
        { NULL,                        MB_NONE,  MA_OPT_CONFIRM_STATES,NULL, 0, 0, 0, 1 },
        { "Save slot",                 MB_RANGE, MA_OPT_SAVE_SLOT,     &state_slot, 0, 0, 9, 1 },
+       { NULL,                        MB_NONE,  MA_OPT_CPU_CLOCKS,    NULL, 0, 0, 0, 1 },
        { "[Sega/Mega CD options]",    MB_NONE,  MA_OPT_SCD_OPTS,      NULL, 0, 0, 0, 1 },
        { "[advanced options]",        MB_NONE,  MA_OPT_ADV_OPTS,      NULL, 0, 0, 0, 1 },
        { NULL,                        MB_NONE,  MA_OPT_SAVECFG,       NULL, 0, 0, 0, 1 },
@@ -1102,6 +1102,9 @@ static void menu_opt_cust_draw(const menu_entry *entry, int x, int y, void *para
                        }
                        text_out16(x, y, "Confirm savestate          %s", str);
                        break;
+               case MA_OPT_CPU_CLOCKS:
+                       text_out16(x, y, "CPU/bus clock       %3i/%3iMHz", currentConfig.CPUclock, currentConfig.CPUclock/2);
+                       break;
                case MA_OPT_SAVECFG:
                        str24[0] = 0;
                        if (config_slot != 0) sprintf(str24, " (profile: %i)", config_slot);
@@ -1250,6 +1253,14 @@ static int menu_loop_options(void)
                                                 } else {state_slot--; if (state_slot < 0) state_slot = 9;
                                                 }
                                                 break;
+                                       case MA_OPT_CPU_CLOCKS:
+                                                while ((inp = psp_pad_read(0)) & (BTN_LEFT|BTN_RIGHT)) {
+                                                        currentConfig.CPUclock += (inp & BTN_LEFT) ? -1 : 1;
+                                                        if (currentConfig.CPUclock <  19) currentConfig.CPUclock = 19;
+                                                        if (currentConfig.CPUclock > 333) currentConfig.CPUclock = 333;
+                                                        draw_menu_options(menu_sel); // will wait vsync
+                                                }
+                                                break;
                                        case MA_OPT_SAVECFG:
                                        case MA_OPT_SAVECFG_GAME:
                                        case MA_OPT_LOADCFG: