X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=gp2x%2Fmenu.c;h=76eb73e02bc23b39866621aa40631ac670e237c7;hb=84e21f25e41b90d9729088dba5991a84330964ea;hp=0a4cb73b8fc8405a967bd8f92ccbf6852392f325;hpb=e1cd546fc7ec6f3c83a5b0f50e2d4ea93b139e3c;p=libpicofe.git diff --git a/gp2x/menu.c b/gp2x/menu.c index 0a4cb73..76eb73e 100644 --- a/gp2x/menu.c +++ b/gp2x/menu.c @@ -25,7 +25,7 @@ #include #ifndef _DIRENT_HAVE_D_TYPE -#error "need d_type for file browser +#error "need d_type for file browser" #endif extern int mmuhack_status; @@ -46,16 +46,16 @@ static int inp_prevjoy = 0; static unsigned long wait_for_input(unsigned long interesting) { unsigned long ret; - static int repeats = 0, wait = 50*1000; + static int repeats = 0, wait = 20; int release = 0, i; - if (repeats == 2 || repeats == 4) wait /= 2; - if (repeats == 6) wait = 15 * 1000; + if (repeats == 2) wait = 3; + else if (repeats == 4) wait = 2; + else if (repeats == 6) wait = 1; - for (i = 0; i < 6 && inp_prev == gp2x_joystick_read(1); i++) { + for (i = 0; i < wait && inp_prev == gp2x_joystick_read(1); i++) { if (i == 0) repeats++; - if (wait >= 30*1000) usleep(wait); // usleep sleeps for ~30ms minimum - else spend_cycles(wait * currentConfig.CPUclock); + usleep(30000); } while ( !((ret = gp2x_joystick_read(1)) & interesting) ) { @@ -65,8 +65,10 @@ static unsigned long wait_for_input(unsigned long interesting) if (release || ret != inp_prev) { repeats = 0; - wait = 50*1000; + wait = 20; } + if (wait > 6 && (ret&(GP2X_UP|GP2X_LEFT|GP2X_DOWN|GP2X_RIGHT|GP2X_L|GP2X_R))) + wait = 6; inp_prev = ret; inp_prevjoy = 0; @@ -430,8 +432,10 @@ rescan: // ------------ debug menu ------------ char *debugString(void); +void PicoDrawShowSpriteStats(unsigned short *screen); +void PicoDrawShowPalette(unsigned short *screen); -static void draw_debug(void) +static void draw_main_debug(void) { char *p, *str = debugString(); int len, line; @@ -448,13 +452,47 @@ static void draw_debug(void) if (*p == 0) break; p++; str = p; } - menu_flip(); +} + +static void draw_frame_debug(void) +{ + char layer_str[48] = "layers: "; + if (PicoDrawMask & PDRAW_LAYERB_ON) memcpy(layer_str + 8, "B", 1); + if (PicoDrawMask & PDRAW_LAYERA_ON) memcpy(layer_str + 10, "A", 1); + if (PicoDrawMask & PDRAW_SPRITES_LOW_ON) memcpy(layer_str + 12, "spr_lo", 6); + if (PicoDrawMask & PDRAW_SPRITES_HI_ON) memcpy(layer_str + 19, "spr_hi", 6); + + memset(gp2x_screen, 0, 320*240*2); + emu_forcedFrame(0); + smalltext_out16(4, 232, layer_str, 0xffff); } static void debug_menu_loop(void) { - draw_debug(); - wait_for_input(GP2X_B|GP2X_X); + int inp, mode = 0; + + while (1) + { + switch (mode) + { + case 0: draw_main_debug(); break; + case 1: draw_frame_debug(); break; + case 2: PicoDrawShowSpriteStats(gp2x_screen); break; + case 3: PicoDrawShowPalette(gp2x_screen); break; + } + menu_flip(); + + inp = wait_for_input(GP2X_B|GP2X_X|GP2X_L|GP2X_R|GP2X_UP|GP2X_DOWN|GP2X_LEFT|GP2X_RIGHT); + if (inp & (GP2X_B|GP2X_X)) return; + if (inp & GP2X_L) { mode--; if (mode < 0) mode = 3; } + if (inp & GP2X_R) { mode++; if (mode > 3) mode = 0; } + if (mode == 1) { + if (inp & GP2X_LEFT) PicoDrawMask ^= PDRAW_LAYERB_ON; + if (inp & GP2X_RIGHT) PicoDrawMask ^= PDRAW_LAYERA_ON; + if (inp & GP2X_DOWN) PicoDrawMask ^= PDRAW_SPRITES_LOW_ON; + if (inp & GP2X_UP) PicoDrawMask ^= PDRAW_SPRITES_HI_ON; + } + } } // ------------ patch/gg menu ------------ @@ -567,7 +605,7 @@ static void draw_savestate_bg(int slot) areaClose(file); } - emu_forcedFrame(); + emu_forcedFrame(POPT_EN_SOFTSCALE); menu_prepare_bg(1); memcpy(Pico.vram, tmp_vram, sizeof(Pico.vram)); @@ -1073,6 +1111,7 @@ menu_entry opt2_entries[] = { "craigix's RAM timings", MB_ONOFF, MA_OPT2_RAMTIMINGS, ¤tConfig.EmuOpt, 0x0100, 0, 0, 1, 1 }, { NULL, MB_ONOFF, MA_OPT2_SQUIDGEHACK, ¤tConfig.EmuOpt, 0x0010, 0, 0, 1, 1 }, { "SVP dynarec", MB_ONOFF, MA_OPT2_SVP_DYNAREC, &PicoOpt, 0x20000, 0, 0, 1, 1 }, + { "Disable idle loop patching",MB_ONOFF, MA_OPT2_NO_IDLE_LOOPS, &PicoOpt, 0x80000, 0, 0, 1, 1 }, { "done", MB_NONE, MA_OPT2_DONE, NULL, 0, 0, 0, 1, 0 }, }; @@ -1147,7 +1186,6 @@ menu_entry opt_entries[] = { { NULL, MB_NONE, MA_OPT_RENDERER, NULL, 0, 0, 0, 1, 1 }, { NULL, MB_RANGE, MA_OPT_SCALING, ¤tConfig.scaling, 0, 0, 3, 1, 1 }, - { "Accurate timing (slower)", MB_ONOFF, MA_OPT_ACC_TIMING, &PicoOpt, 0x040, 0, 0, 1, 1 }, { "Accurate sprites (slower)", MB_ONOFF, MA_OPT_ACC_SPRITES, &PicoOpt, 0x080, 0, 0, 1, 1 }, { "Show FPS", MB_ONOFF, MA_OPT_SHOW_FPS, ¤tConfig.EmuOpt, 0x002, 0, 0, 1, 1 }, { NULL, MB_RANGE, MA_OPT_FRAMESKIP, ¤tConfig.Frameskip, 0, -1, 16, 1, 1 }, @@ -1426,7 +1464,7 @@ static int menu_loop_options(void) static void draw_menu_credits(void) { - int tl_x = 15, tl_y = 64, y; + int tl_x = 15, tl_y = 56, y; gp2x_pd_clone_buffer2(); text_out16(tl_x, 20, "PicoDrive v" VERSION " (c) notaz, 2006-2008"); @@ -1436,17 +1474,19 @@ static void draw_menu_credits(void) text_out16(tl_x, (y+=10), " base code of PicoDrive"); text_out16(tl_x, (y+=10), "Reesy & FluBBa: DrZ80 core"); text_out16(tl_x, (y+=10), "MAME devs: YM2612 and SN76496 cores"); - text_out16(tl_x, (y+=10), "Charles MacDonald: Genesis hw docs"); - text_out16(tl_x, (y+=10), "Stephane Dallongeville:"); - text_out16(tl_x, (y+=10), " opensource Gens"); - text_out16(tl_x, (y+=10), "Haze: Genesis hw info"); text_out16(tl_x, (y+=10), "rlyeh and others: minimal SDK"); text_out16(tl_x, (y+=10), "Squidge: squidgehack"); text_out16(tl_x, (y+=10), "Dzz: ARM940 sample"); - text_out16(tl_x, (y+=10), "GnoStiC / Puck2099: USB joystick"); + text_out16(tl_x, (y+=10), "GnoStiC / Puck2099: USB joy code"); text_out16(tl_x, (y+=10), "craigix: GP2X hardware"); text_out16(tl_x, (y+=10), "ketchupgun: skin design"); + text_out16(tl_x, (y+=20), "special thanks (for docs, ideas):"); + text_out16(tl_x, (y+=10), " Charles MacDonald, Haze,"); + text_out16(tl_x, (y+=10), " Stephane Dallongeville,"); + text_out16(tl_x, (y+=10), " Lordus, Exophase, Rokas,"); + text_out16(tl_x, (y+=10), " Nemesis, Tasco Deluxe"); + menu_flip(); } @@ -1545,6 +1585,7 @@ static void menu_loop_root(void) if (rom_loaded) { if(savestate_menu_loop(1)) continue; + while (gp2x_joystick_read(1) & GP2X_B) usleep(50*1000); engineState = PGS_Running; return; } @@ -1552,6 +1593,7 @@ static void menu_loop_root(void) case MA_MAIN_RESET_GAME: if (rom_loaded) { emu_ResetGame(); + while (gp2x_joystick_read(1) & GP2X_B) usleep(50*1000); engineState = PGS_Running; return; }