X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=menu.c;h=04c0410c80a27fcd8f683d145cfe97afd6cf112a;hb=c54d04fd84f59c60c6ecdbd2502fbda5de735b4b;hp=eb27ce6a41cf36b5af4129927508b36c0d074813;hpb=4db02226eb3c80f49f5c412f7718c437c5e817fc;p=libpicofe.git diff --git a/menu.c b/menu.c index eb27ce6..04c0410 100644 --- a/menu.c +++ b/menu.c @@ -31,10 +31,8 @@ void *g_menuscreen_ptr; void *g_menubg_src_ptr; void *g_menubg_ptr; -#if !MSCREEN_SIZE_FIXED int g_menuscreen_w; int g_menuscreen_h; -#endif static unsigned char *menu_font_data = NULL; static int menu_text_color = 0xfffe; // default to white @@ -983,12 +981,12 @@ static const char *menu_loop_romsel(char *curr_path, int len, // is this a dir or a full path? if (!plat_is_dir(curr_path)) { - char *p = curr_path + strlen(curr_path) - 1; - for (; p > curr_path && *p != '/'; p--) - ; - *p = 0; - curr_path_restore = p; - snprintf(sel_fname, sizeof(sel_fname), "%s", p + 1); + char *p = strrchr(curr_path, '/'); + if (p != NULL) { + *p = 0; + curr_path_restore = p; + snprintf(sel_fname, sizeof(sel_fname), "%s", p + 1); + } if (rom_fname_reload[0] == 0) show_help = 2;