X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=common%2Fmenu.c;h=c3ef87f56f06d3c13ab5a9de511f13a4a2feadf6;hb=7f022a8d573295d721fd6a517c8f1fe04480a8f0;hp=241af9f5be7e354cb13ff9f981f57af5812a7b37;hpb=725d7f6c16b396ad3c7f98175cc20289c5241f3a;p=libpicofe.git diff --git a/common/menu.c b/common/menu.c index 241af9f..c3ef87f 100644 --- a/common/menu.c +++ b/common/menu.c @@ -13,6 +13,7 @@ #include "readpng.h" #include "lprintf.h" #include "common.h" +#include "input.h" #include "emu.h" @@ -350,7 +351,7 @@ static void mplayer_loop(void) while (1) { PDebugZ80Frame(); - if (read_buttons_async(BTN_NORTH)) break; + if (in_menu_wait_any(0) & PBTN_NORTH) break; emu_waitSound(); } @@ -429,41 +430,41 @@ void debug_menu_loop(void) } menu_draw_end(); - 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; } + inp = in_menu_wait(PBTN_EAST|PBTN_MBACK|PBTN_WEST|PBTN_NORTH|PBTN_L|PBTN_R|PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT); + if (inp & PBTN_MBACK) 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_NORTH) { - while (inp & BTN_NORTH) inp = read_buttons_async(BTN_NORTH); + if (inp & PBTN_EAST) SekStepM68k(); + if (inp & PBTN_NORTH) { + while (inp & PBTN_NORTH) inp = in_menu_wait_any(-1); mplayer_loop(); } - if ((inp & (BTN_WEST|BTN_LEFT)) == (BTN_WEST|BTN_LEFT)) { + 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 = in_menu_wait_any(-1); 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 = in_menu_wait_any(-1); } 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; }