X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=common%2Fmenu.c;h=241af9f5be7e354cb13ff9f981f57af5812a7b37;hb=725d7f6c16b396ad3c7f98175cc20289c5241f3a;hp=2775859386b7de75f1fb514759113abb9bfe7aae;hpb=b846453101c070b93938dd2224f0cca130a55e8c;p=libpicofe.git diff --git a/common/menu.c b/common/menu.c index 2775859..241af9f 100644 --- a/common/menu.c +++ b/common/menu.c @@ -19,23 +19,28 @@ char menuErrorMsg[64] = { 0, }; // PicoPad[] format: MXYZ SACB RLDU -me_bind_action me_ctrl_actions[12] = +me_bind_action me_ctrl_actions[15] = { - { "UP ", 0x001 }, - { "DOWN ", 0x002 }, - { "LEFT ", 0x004 }, - { "RIGHT ", 0x008 }, - { "A ", 0x040 }, - { "B ", 0x010 }, - { "C ", 0x020 }, - { "START ", 0x080 }, - { "MODE ", 0x800 }, - { "X ", 0x400 }, - { "Y ", 0x200 }, - { "Z ", 0x100 } + { "UP ", 0x0001 }, + { "DOWN ", 0x0002 }, + { "LEFT ", 0x0004 }, + { "RIGHT ", 0x0008 }, + { "A ", 0x0040 }, + { "B ", 0x0010 }, + { "C ", 0x0020 }, + { "A turbo", 0x4000 }, + { "B turbo", 0x1000 }, + { "C turbo", 0x2000 }, + { "START ", 0x0080 }, + { "MODE ", 0x0800 }, + { "X ", 0x0400 }, + { "Y ", 0x0200 }, + { "Z ", 0x0100 } }; +#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 @@ -328,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(BTN_NORTH)) break; + emu_waitSound(); + } + + emu_endSound(); +} + static void draw_text_debug(const char *str, int skip, int from) { const char *p; @@ -402,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; @@ -418,7 +418,8 @@ void debug_menu_loop(void) case 2: clear_screen(); emu_forcedFrame(0); darken_screen(); - PDebugShowSpriteStats(SCREEN_BUFFER, SCREEN_WIDTH); break; + PDebugShowSpriteStats((unsigned short *)SCREEN_BUFFER + (SCREEN_HEIGHT/2 - 240/2)*SCREEN_WIDTH + + SCREEN_WIDTH/2 - 320/2, SCREEN_WIDTH); break; case 3: clear_screen(); PDebugShowPalette(SCREEN_BUFFER, SCREEN_WIDTH); PDebugShowSprite((unsigned short *)SCREEN_BUFFER + SCREEN_WIDTH*120+SCREEN_WIDTH/2+16, @@ -428,7 +429,7 @@ 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); + inp = read_buttons(BTN_EAST|BTN_SOUTH|BTN_WEST|BTN_NORTH|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; } @@ -436,9 +437,14 @@ void debug_menu_loop(void) { case 0: if (inp & BTN_EAST) SekStepM68k(); + if (inp & BTN_NORTH) { + while (inp & BTN_NORTH) inp = read_buttons_async(BTN_NORTH); + mplayer_loop(); + } if ((inp & (BTN_WEST|BTN_LEFT)) == (BTN_WEST|BTN_LEFT)) { mkdir("dumps", 0777); PDebugDumpMem(); + while (inp & BTN_WEST) inp = read_buttons_async(BTN_WEST); dumped = 1; } break; @@ -447,6 +453,13 @@ void debug_menu_loop(void) 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) { + PsndOut = NULL; // just in case + PicoSkipFrame = 1; + PicoFrame(); + PicoSkipFrame = 0; + while (inp & BTN_EAST) inp = read_buttons_async(BTN_EAST); + } break; case 3: if (inp & BTN_DOWN) spr_offs++; @@ -457,4 +470,30 @@ void debug_menu_loop(void) } } +#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; + } +} +