X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=common%2Fmenu.c;h=611cee90ae32385f53e68a9b0bedbe83c3210ab0;hb=86883f7f8a1f3d0b0542907bef84e40ad127a513;hp=00afc34b0dc54fd451beab4f14b834822983f224;hpb=dfa8d77a42bf22658504d9d1f3d6700dd41d0c7d;p=libpicofe.git diff --git a/common/menu.c b/common/menu.c index 00afc34..611cee9 100644 --- a/common/menu.c +++ b/common/menu.c @@ -39,6 +39,8 @@ me_bind_action me_ctrl_actions[15] = }; +#ifndef UIQ3 + static unsigned char menu_font_data[10240]; static int menu_text_color = 0xffff; // default to white static int menu_sel_color = -1; // disabled @@ -331,38 +333,30 @@ int me_process(menu_entry *entries, int count, menu_id id, int is_next) } } -const char *me_region_name(unsigned int code, int auto_order) -{ - static const char *names[] = { "Auto", " Japan NTSC", " Japan PAL", " USA", " Europe" }; - static const char *names_short[] = { "", " JP", " JP", " US", " EU" }; - int u, i = 0; - if (code) { - code <<= 1; - while((code >>= 1)) i++; - if (i > 4) return "unknown"; - return names[i]; - } else { - static char name[24]; - strcpy(name, "Auto:"); - for (u = 0; u < 3; u++) { - i = 0; code = ((auto_order >> u*4) & 0xf) << 1; - while((code >>= 1)) i++; - strcat(name, names_short[i]); - } - return name; - } -} - // ------------ debug menu ------------ #include #include -#include -#include +#include +#include void SekStepM68k(void); +static void mplayer_loop(void) +{ + emu_startSound(); + + while (1) + { + PDebugZ80Frame(); + if (read_buttons_async(PBTN_NORTH)) break; + emu_waitSound(); + } + + emu_endSound(); +} + static void draw_text_debug(const char *str, int skip, int from) { const char *p; @@ -405,13 +399,16 @@ void debug_menu_loop(void) { int inp, mode = 0; int spr_offs = 0, dumped = 0; + char *tmp; while (1) { switch (mode) { case 0: menu_draw_begin(); - draw_text_debug(PDebugMain(), 0, 0); + tmp = PDebugMain(); + emu_platformDebugCat(tmp); + draw_text_debug(tmp, 0, 0); if (dumped) { smalltext_out16(SCREEN_WIDTH-6*10, SCREEN_HEIGHT-8, "dumped", 0xffff); dumped = 0; @@ -432,41 +429,71 @@ void debug_menu_loop(void) } menu_draw_end(); - inp = read_buttons(BTN_EAST|BTN_SOUTH|BTN_WEST|BTN_L|BTN_R|BTN_UP|BTN_DOWN|BTN_LEFT|BTN_RIGHT); - if (inp & BTN_SOUTH) return; - if (inp & BTN_L) { mode--; if (mode < 0) mode = 3; } - if (inp & BTN_R) { mode++; if (mode > 3) mode = 0; } + inp = read_buttons(PBTN_EAST|PBTN_SOUTH|PBTN_WEST|PBTN_NORTH|PBTN_L|PBTN_R|PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT); + if (inp & PBTN_SOUTH) return; + if (inp & PBTN_L) { mode--; if (mode < 0) mode = 3; } + if (inp & PBTN_R) { mode++; if (mode > 3) mode = 0; } switch (mode) { case 0: - if (inp & BTN_EAST) SekStepM68k(); - if ((inp & (BTN_WEST|BTN_LEFT)) == (BTN_WEST|BTN_LEFT)) { + if (inp & PBTN_EAST) SekStepM68k(); + if (inp & PBTN_NORTH) { + while (inp & PBTN_NORTH) inp = read_buttons_async(PBTN_NORTH); + mplayer_loop(); + } + if ((inp & (PBTN_WEST|PBTN_LEFT)) == (PBTN_WEST|PBTN_LEFT)) { mkdir("dumps", 0777); PDebugDumpMem(); - while (inp & BTN_WEST) inp = read_buttons_async(BTN_WEST); + while (inp & PBTN_WEST) inp = read_buttons_async(PBTN_WEST); dumped = 1; } break; case 1: - if (inp & BTN_LEFT) PicoDrawMask ^= PDRAW_LAYERB_ON; - if (inp & BTN_RIGHT) PicoDrawMask ^= PDRAW_LAYERA_ON; - if (inp & BTN_DOWN) PicoDrawMask ^= PDRAW_SPRITES_LOW_ON; - if (inp & BTN_UP) PicoDrawMask ^= PDRAW_SPRITES_HI_ON; - if (inp & BTN_EAST) { + if (inp & PBTN_LEFT) PicoDrawMask ^= PDRAW_LAYERB_ON; + if (inp & PBTN_RIGHT) PicoDrawMask ^= PDRAW_LAYERA_ON; + if (inp & PBTN_DOWN) PicoDrawMask ^= PDRAW_SPRITES_LOW_ON; + if (inp & PBTN_UP) PicoDrawMask ^= PDRAW_SPRITES_HI_ON; + if (inp & PBTN_EAST) { PsndOut = NULL; // just in case PicoSkipFrame = 1; PicoFrame(); PicoSkipFrame = 0; - while (inp & BTN_EAST) inp = read_buttons_async(BTN_EAST); + while (inp & PBTN_EAST) inp = read_buttons_async(PBTN_EAST); } break; case 3: - if (inp & BTN_DOWN) spr_offs++; - if (inp & BTN_UP) spr_offs--; + if (inp & PBTN_DOWN) spr_offs++; + if (inp & PBTN_UP) spr_offs--; if (spr_offs < 0) spr_offs = 0; break; } } } +#endif // !UIQ3 + +// ------------ util ------------ + +const char *me_region_name(unsigned int code, int auto_order) +{ + static const char *names[] = { "Auto", " Japan NTSC", " Japan PAL", " USA", " Europe" }; + static const char *names_short[] = { "", " JP", " JP", " US", " EU" }; + int u, i = 0; + if (code) { + code <<= 1; + while((code >>= 1)) i++; + if (i > 4) return "unknown"; + return names[i]; + } else { + static char name[24]; + strcpy(name, "Auto:"); + for (u = 0; u < 3; u++) { + i = 0; code = ((auto_order >> u*4) & 0xf) << 1; + while((code >>= 1)) i++; + strcat(name, names_short[i]); + } + return name; + } +} +