X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=frontend%2Fcommon%2Fmenu.c;h=cf31610705a9d9468a06f65a4b70187da60dc1f3;hp=31522f7ef074f3649155eb089e4e2aa6a8af19b1;hb=51f77282d6cb4bc06248395cc1e712ee298910af;hpb=43bca6fbee5f6b26ee02e8850bf7dace8d63336b diff --git a/frontend/common/menu.c b/frontend/common/menu.c index 31522f7e..cf316107 100644 --- a/frontend/common/menu.c +++ b/frontend/common/menu.c @@ -560,11 +560,11 @@ static int me_process(menu_entry *entry, int is_next, int is_lr) names = (const char **)entry->data; for (c = 0; names[c] != NULL; c++) ; - *(int *)entry->var += is_next ? 1 : -1; - if (*(int *)entry->var < 0) - *(int *)entry->var = 0; - if (*(int *)entry->var >= c) - *(int *)entry->var = c - 1; + *(signed char *)entry->var += is_next ? 1 : -1; + if (*(signed char *)entry->var < 0) + *(signed char *)entry->var = 0; + if (*(signed char *)entry->var >= c) + *(signed char *)entry->var = c - 1; return 1; default: return 0; @@ -573,14 +573,14 @@ static int me_process(menu_entry *entry, int is_next, int is_lr) static void debug_menu_loop(void); -static void me_loop(menu_entry *menu, int *menu_sel, void (*draw_more)(void)) +static int me_loop_d(menu_entry *menu, int *menu_sel, void (*draw_prep)(void), void (*draw_more)(void)) { - int ret, inp, sel = *menu_sel, menu_sel_max; + int ret = 0, inp, sel = *menu_sel, menu_sel_max; menu_sel_max = me_count(menu) - 1; if (menu_sel_max < 0) { lprintf("no enabled menu entries\n"); - return; + return 0; } while ((!menu[sel].enabled || !menu[sel].selectable) && sel < menu_sel_max) @@ -592,6 +592,9 @@ static void me_loop(menu_entry *menu, int *menu_sel, void (*draw_more)(void)) for (;;) { + if (draw_prep != NULL) + draw_prep(); + me_draw(menu, sel, draw_more); inp = in_menu_wait(PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT| PBTN_MOK|PBTN_MBACK|PBTN_MENU|PBTN_L|PBTN_R, 70); @@ -636,17 +639,23 @@ static void me_loop(menu_entry *menu, int *menu_sel, void (*draw_more)(void)) } } *menu_sel = sel; + + return ret; +} + +static int me_loop(menu_entry *menu, int *menu_sel) +{ + return me_loop_d(menu, menu_sel, NULL, NULL); } /* ***************************************** */ -static void draw_menu_credits(void (*draw_more)(void)) +static void draw_menu_message(const char *msg, void (*draw_more)(void)) { - const char *creds, *p; int x, y, h, w, wt; + const char *p; - p = creds = plat_get_credits(); - + p = msg; for (h = 1, w = 0; *p != 0; h++) { for (wt = 0; *p != 0 && *p != '\n'; p++) wt++; @@ -665,7 +674,7 @@ static void draw_menu_credits(void (*draw_more)(void)) menu_draw_begin(1); - for (p = creds; *p != 0 && y <= g_menuscreen_h - me_mfont_h; y += me_mfont_h) { + for (p = msg; *p != 0 && y <= g_menuscreen_h - me_mfont_h; y += me_mfont_h) { text_out16(x, y, p); for (; *p != 0 && *p != '\n'; p++) @@ -767,11 +776,6 @@ static int scandir_cmp(const void *p1, const void *p2) return alphasort(d1, d2); } -static const char *filter_exts[] = { - ".mp3", ".MP3", ".srm", ".brm", "s.gz", ".mds", "bcfg", ".txt", ".htm", "html", - ".jpg", ".gpe" -}; - static int scandir_filter(const struct dirent *ent) { const char *p;