diff --git a/frontend/frontend_context.c b/frontend/frontend_context.c index ab5c93314f..e750be312b 100644 --- a/frontend/frontend_context.c +++ b/frontend/frontend_context.c @@ -43,7 +43,7 @@ static const frontend_ctx_driver_t *frontend_ctx_drivers[] = { &frontend_ctx_psp, #endif &frontend_ctx_null, - NULL // zero length array is not valid + NULL }; const frontend_ctx_driver_t *frontend_ctx_find_driver(const char *ident) diff --git a/frontend/menu/backend/menu_common_shader_backend.c b/frontend/menu/backend/menu_common_shader_backend.c index bcd776dfd1..36ce51b39c 100644 --- a/frontend/menu/backend/menu_common_shader_backend.c +++ b/frontend/menu/backend/menu_common_shader_backend.c @@ -21,12 +21,14 @@ static void menu_common_shader_manager_init(menu_handle_t *menu) const char *config_path = NULL; struct gfx_shader *shader = (struct gfx_shader*)menu->shader; - if (*g_extern.core_specific_config_path && g_settings.core_specific_config) + if (*g_extern.core_specific_config_path + && g_settings.core_specific_config) config_path = g_extern.core_specific_config_path; else if (*g_extern.config_path) config_path = g_extern.config_path; - // In a multi-config setting, we can't have conflicts on menu.cgp/menu.glslp. + /* In a multi-config setting, we can't have + * conflicts on menu.cgp/menu.glslp. */ if (config_path) { fill_pathname_base(menu->default_glslp, config_path, diff --git a/frontend/menu/disp/lakka.c b/frontend/menu/disp/lakka.c index 05536d6404..ea4ed2bde5 100644 --- a/frontend/menu/disp/lakka.c +++ b/frontend/menu/disp/lakka.c @@ -231,10 +231,13 @@ static char *str_replace (const char *string, const char *substr, const char *re free (oldstr); return NULL; } - memcpy ( newstr, oldstr, tok - oldstr ); - memcpy ( newstr + (tok - oldstr), replacement, strlen ( replacement ) ); - memcpy ( newstr + (tok - oldstr) + strlen( replacement ), tok + strlen ( substr ), strlen ( oldstr ) - strlen ( substr ) - ( tok - oldstr ) ); - memset ( newstr + strlen ( oldstr ) - strlen ( substr ) + strlen ( replacement ) , 0, 1 ); + memcpy(newstr, oldstr, tok - oldstr ); + memcpy(newstr + (tok - oldstr), replacement, strlen ( replacement ) ); + memcpy(newstr + (tok - oldstr) + strlen( replacement ), tok + + strlen ( substr ), strlen ( oldstr ) - + strlen ( substr ) - ( tok - oldstr ) ); + memset(newstr + strlen ( oldstr ) - strlen ( substr ) + + strlen ( replacement ) , 0, 1 ); /* move back head right after the last replacement */ head = newstr + (tok - oldstr) + strlen( replacement ); free (oldstr); @@ -250,7 +253,8 @@ float inOutQuad(float t, float b, float c, float d) return -c / 2 * ((t - 1) * (t - 3) - 1) + b; } -void add_tween(float duration, float target_value, float* subject, easingFunc easing, tweenCallback callback) +void add_tween(float duration, float target_value, float* subject, + easingFunc easing, tweenCallback callback) { tween_t *tween; @@ -315,14 +319,16 @@ static void update_tweens(float dt) for(i = 0; i < numtweens; i++) { update_tween(&tweens[i], dt); - active_tweens += tweens[i].running_since < tweens[i].duration ? 1 : 0; + active_tweens += tweens[i].running_since < + tweens[i].duration ? 1 : 0; } if (numtweens && !active_tweens) numtweens = 0; } -static void lakka_draw_text(const char *str, float x, float y, float scale, float alpha) +static void lakka_draw_text(const char *str, float x, + float y, float scale, float alpha) { if (alpha > global_alpha) alpha = global_alpha; @@ -333,7 +339,8 @@ static void lakka_draw_text(const char *str, float x, float y, float scale, floa if (!gl) return; - if (x < -icon_size || x > gl->win_width + icon_size || y < -icon_size || y > gl->win_height + icon_size) + if (x < -icon_size || x > gl->win_width + icon_size + || y < -icon_size || y > gl->win_height + icon_size) return; gl_set_viewport(gl, gl->win_width, gl->win_height, false, false); @@ -383,7 +390,8 @@ void lakka_draw_background(void) gl->coords.color = gl->white_color_ptr; } -void lakka_draw_icon(GLuint texture, float x, float y, float alpha, float rotation, float scale) +void lakka_draw_icon(GLuint texture, float x, float y, + float alpha, float rotation, float scale) { if (alpha > global_alpha) alpha = global_alpha; @@ -396,7 +404,8 @@ void lakka_draw_icon(GLuint texture, float x, float y, float alpha, float rotati if (!gl) return; - if (x < -icon_size || x > gl->win_width + icon_size || y < -icon_size || y > gl->win_height + icon_size) + if (x < -icon_size || x > gl->win_width + icon_size + || y < -icon_size || y > gl->win_height + icon_size) return; GLfloat color[] = { @@ -444,8 +453,10 @@ static void lakka_draw_subitems(int i, int j) int k; menu_category_t *category = (menu_category_t*)&categories[i]; menu_item_t *item = (menu_item_t*)&category->items[j]; - menu_category_t *active_category = (menu_category_t*)&categories[menu_active_category]; - menu_item_t *active_item = (menu_item_t*)&active_category->items[active_category->active_item]; + menu_category_t *active_category = (menu_category_t*) + &categories[menu_active_category]; + menu_item_t *active_item = (menu_item_t*) + &active_category->items[active_category->active_item]; for(k = 0; k < item->num_subitems; k++) { @@ -459,14 +470,16 @@ static void lakka_draw_subitems(int i, int j) && strcmp(g_extern.fullpath, &active_item->rom) == 0) { lakka_draw_icon(textures[TEXTURE_RESUME].id, - margin_left + hspacing*(i+2.25) + all_categories_x - icon_size/2.0, - margin_top + subitem->y + icon_size/2.0, - subitem->alpha, + margin_left + hspacing*(i+2.25) + + all_categories_x - icon_size/2.0, + margin_top + subitem->y + icon_size/2.0, + subitem->alpha, 0, subitem->zoom); - lakka_draw_text("Resume", - margin_left + hspacing*(i+2.25) + all_categories_x + label_margin_left, - margin_top + subitem->y + label_margin_top, + lakka_draw_text("Resume", + margin_left + hspacing*(i+2.25) + + all_categories_x + label_margin_left, + margin_top + subitem->y + label_margin_top, 1, subitem->alpha); } @@ -477,13 +490,15 @@ static void lakka_draw_subitems(int i, int j) strcmp(g_extern.fullpath, &active_item->rom) == 0)) { lakka_draw_icon(subitem->icon, - margin_left + hspacing*(i+2.25) + all_categories_x - icon_size/2.0, + margin_left + hspacing*(i+2.25) + + all_categories_x - icon_size/2.0, margin_top + subitem->y + icon_size/2.0, subitem->alpha, 0, subitem->zoom); lakka_draw_text(subitem->name, - margin_left + hspacing * (i+2.25) + all_categories_x + label_margin_left, + margin_left + hspacing * (i+2.25) + + all_categories_x + label_margin_left, margin_top + subitem->y + label_margin_top, 1, subitem->alpha); @@ -496,8 +511,10 @@ static void lakka_draw_items(int i) { int j; menu_category_t *category = (menu_category_t*)&categories[i]; - menu_category_t *active_category = (menu_category_t*)&categories[menu_active_category]; - menu_item_t *active_item = (menu_item_t*)&active_category->items[active_category->active_item]; + menu_category_t *active_category = (menu_category_t*) + &categories[menu_active_category]; + menu_item_t *active_item = (menu_item_t*) + &active_category->items[active_category->active_item]; for(j = 0; j < category->num_items; j++) { @@ -507,10 +524,11 @@ static void lakka_draw_items(int i) continue; if (i >= menu_active_category - 1 && - i <= menu_active_category + 1) // performance improvement + i <= menu_active_category + 1) /* performance improvement */ { lakka_draw_icon(category->item_icon, - margin_left + hspacing*(i+1) + all_categories_x - icon_size/2.0, + margin_left + hspacing*(i+1) + + all_categories_x - icon_size/2.0, margin_top + item->y + icon_size/2.0, item->alpha, 0, @@ -518,13 +536,16 @@ static void lakka_draw_items(int i) if (depth == 0) lakka_draw_text(item->name, - margin_left + hspacing * (i+1) + all_categories_x + label_margin_left, + margin_left + hspacing * (i+1) + + all_categories_x + label_margin_left, margin_top + item->y + label_margin_top, 1, item->alpha); } - if (i == menu_active_category && j == category->active_item && depth == 1) // performance improvement + /* performance improvement */ + if (i == menu_active_category + && j == category->active_item && depth == 1) lakka_draw_subitems(i, j); } } @@ -540,12 +561,13 @@ static void lakka_draw_categories(void) if (!category) continue; - // draw items + /* draw items */ lakka_draw_items(i); - // draw category icon + /* draw category icon */ lakka_draw_icon(category->icon, - margin_left + (hspacing*(i+1)) + all_categories_x - icon_size/2.0, + margin_left + (hspacing*(i+1)) + + all_categories_x - icon_size/2.0, margin_top + icon_size/2.0, category->alpha, 0, @@ -557,13 +579,15 @@ static void lakka_frame(void) { struct font_output_list *msg; gl_t *gl = (gl_t*)driver.video_data; - menu_category_t *active_category = (menu_category_t*)&categories[menu_active_category]; + menu_category_t *active_category = (menu_category_t*) + &categories[menu_active_category]; menu_item_t *active_item; if (!driver.menu || !gl || !active_category) return; - active_item = (menu_item_t*)&active_category->items[active_category->active_item]; + active_item = (menu_item_t*) + &active_category->items[active_category->active_item]; update_tweens(0.002); @@ -574,13 +598,17 @@ static void lakka_frame(void) lakka_draw_categories(); if (depth == 0 && active_category) - lakka_draw_text(active_category->name, title_margin_left, title_margin_top, 1, 1.0); + lakka_draw_text(active_category->name, + title_margin_left, title_margin_top, 1, 1.0); else if (active_item) - lakka_draw_text(active_item->name, title_margin_left, title_margin_top, 1, 1.0); + lakka_draw_text(active_item->name, + title_margin_left, title_margin_top, 1, 1.0); lakka_draw_icon(textures[TEXTURE_ARROW].id, - margin_left + hspacing*(menu_active_category+1) + all_categories_x + icon_size/2.0, - margin_top + vspacing*active_item_factor + icon_size/2.0, arrow_alpha, 0, i_active_zoom); + margin_left + hspacing*(menu_active_category+1) + + all_categories_x + icon_size/2.0, + margin_top + vspacing*active_item_factor + + icon_size/2.0, arrow_alpha, 0, i_active_zoom); gl_set_viewport(gl, gl->win_width, gl->win_height, false, false); } @@ -590,11 +618,12 @@ static GLuint png_texture_load(const char * file_name) struct texture_image ti; texture_image_load(&ti, file_name); - // Generate the OpenGL texture object + /* Generate the OpenGL texture object */ GLuint texture; glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, texture); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, ti.width, ti.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, ti.pixels); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, ti.width, ti.height, 0, + GL_RGBA, GL_UNSIGNED_BYTE, ti.pixels); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); @@ -655,7 +684,8 @@ void lakka_init_settings(void) category->zoom = c_active_zoom; category->active_item = 0; category->num_items = 0; - category->items = (menu_item_t*)calloc(category->num_items, sizeof(menu_item_t)); + category->items = (menu_item_t*) + calloc(category->num_items, sizeof(menu_item_t)); int j, k; @@ -663,67 +693,87 @@ void lakka_init_settings(void) j = 0; category->num_items++; - category->items = (menu_item_t*)realloc(category->items, category->num_items * sizeof(menu_item_t)); + category->items = (menu_item_t*) + realloc(category->items, category->num_items * sizeof(menu_item_t)); menu_item_t *item0 = (menu_item_t*)&category->items[j]; strlcpy(item0->name, "General Options", sizeof(item0->name)); item0->alpha = j ? 0.5 : 1.0; item0->zoom = j ? i_passive_zoom : i_active_zoom; - item0->y = j ? vspacing*(under_item_offset+j) : vspacing * active_item_factor; + item0->y = j ? + vspacing*(under_item_offset+j) : vspacing * active_item_factor; item0->active_subitem = 0; item0->num_subitems = 0; - // General options subitems + /* General options subitems */ k = 0; item0->num_subitems++; - //item0->subitems = (menu_subitem_t*)realloc(item0->subitems, item0->num_subitems * sizeof(menu_subitem_t)); - item0->subitems = (menu_subitem_t*)calloc(item0->num_subitems, sizeof(menu_subitem_t)); +#if 0 + item0->subitems = (menu_subitem_t*) + realloc(item0->subitems, item0->num_subitems * sizeof(menu_subitem_t)); +#endif + item0->subitems = (menu_subitem_t*) + calloc(item0->num_subitems, sizeof(menu_subitem_t)); menu_subitem_t *subitem0 = (menu_subitem_t*)&item0->subitems[k]; strlcpy(subitem0->name, "Libretro Logging Level", sizeof(subitem0->name)); subitem0->alpha = k ? 1.0 : 0.5; subitem0->zoom = k ? i_active_zoom : i_passive_zoom; - subitem0->y = k ? vspacing * (k + under_item_offset) : vspacing * active_item_factor; + subitem0->y = k ? vspacing * (k + under_item_offset) + : vspacing * active_item_factor; k = 1; item0->num_subitems++; - item0->subitems = (menu_subitem_t*)realloc(item0->subitems, item0->num_subitems * sizeof(menu_subitem_t)); - //item0->subitems = (menu_subitem_t*)calloc(item0->num_subitems, sizeof(menu_subitem_t)); + item0->subitems = (menu_subitem_t*) + realloc(item0->subitems, item0->num_subitems * sizeof(menu_subitem_t)); +#if 0 + item0->subitems = (menu_subitem_t*) + calloc(item0->num_subitems, sizeof(menu_subitem_t)); +#endif menu_subitem_t *subitem1 = (menu_subitem_t*)&item0->subitems[k]; strlcpy(subitem1->name, "Logging Verbosity", sizeof(subitem1->name)); subitem1->alpha = k ? 1.0 : 0.5; subitem1->zoom = k ? i_active_zoom : i_passive_zoom; - subitem1->y = k ? vspacing * (k + under_item_offset) : vspacing * active_item_factor; + subitem1->y = k ? vspacing * (k + under_item_offset) : + vspacing * active_item_factor; k = 2; item0->num_subitems++; - item0->subitems = (menu_subitem_t*)realloc(item0->subitems, item0->num_subitems * sizeof(menu_subitem_t)); - //item0->subitems = (menu_subitem_t*)calloc(item0->num_subitems, sizeof(menu_subitem_t)); + item0->subitems = (menu_subitem_t*) + realloc(item0->subitems, item0->num_subitems * sizeof(menu_subitem_t)); +#if 0 + item0->subitems = (menu_subitem_t*) + calloc(item0->num_subitems, sizeof(menu_subitem_t)); +#endif menu_subitem_t *subitem2 = (menu_subitem_t*)&item0->subitems[k]; - strlcpy(subitem2->name, "Configuration Save On Exit", sizeof(subitem2->name)); + strlcpy(subitem2->name, "Configuration Save On Exit", + sizeof(subitem2->name)); subitem2->alpha = k ? 1.0 : 0.5; subitem2->zoom = k ? i_active_zoom : i_passive_zoom; - subitem2->y = k ? vspacing * (k + under_item_offset) : vspacing * active_item_factor; + subitem2->y = k ? vspacing * (k + under_item_offset) : + vspacing * active_item_factor; - // Quit item + /* Quit item */ j = 1; category->num_items++; - category->items = (menu_item_t*)realloc(category->items, category->num_items * sizeof(menu_item_t)); + category->items = (menu_item_t*) + realloc(category->items, category->num_items * sizeof(menu_item_t)); menu_item_t *item1 = (menu_item_t*)&category->items[j]; strlcpy(item1->name, "Quit RetroArch", sizeof(item1->name)); item1->alpha = j ? 0.5 : 1.0; item1->zoom = j ? i_passive_zoom : i_active_zoom; - item1->y = j ? vspacing*(under_item_offset+j) : vspacing * active_item_factor; + item1->y = j ? vspacing*(under_item_offset+j) : + vspacing * active_item_factor; item1->active_subitem = 0; item1->num_subitems = 0; } @@ -740,19 +790,17 @@ void lakka_settings_context_reset(void) category->icon = textures[TEXTURE_SETTINGS].id; category->item_icon = textures[TEXTURE_SETTING].id; - // General options item - + /* General options item */ item = (menu_item_t*)&category->items[0]; - // General options subitems + /* General options subitems */ for (k = 0; k < 2; k++) { menu_subitem_t *subitem = (menu_subitem_t*)&item->subitems[k]; subitem->icon = textures[TEXTURE_SUBSETTING].id; } - // Quit item - + /* Quit item */ item = (menu_item_t*)&category->items[1]; } @@ -769,7 +817,8 @@ static void lakka_context_reset(void *data) if (!menu) return; - fill_pathname_join(mediapath, g_settings.assets_directory, "lakka", sizeof(mediapath)); + fill_pathname_join(mediapath, g_settings.assets_directory, + "lakka", sizeof(mediapath)); fill_pathname_join(themepath, mediapath, THEME, sizeof(themepath)); fill_pathname_join(iconpath, themepath, icon_dir, sizeof(iconpath)); fill_pathname_slash(iconpath, sizeof(iconpath)); @@ -778,17 +827,28 @@ static void lakka_context_reset(void *data) gl_font_init_first(&font_driver, &font, gl, font_path, lakka_font_size); - fill_pathname_join(textures[TEXTURE_BG].path, iconpath, "bg.png", sizeof(textures[TEXTURE_BG].path)); - fill_pathname_join(textures[TEXTURE_SETTINGS].path, iconpath, "settings.png", sizeof(textures[TEXTURE_SETTINGS].path)); - fill_pathname_join(textures[TEXTURE_SETTING].path, iconpath, "setting.png", sizeof(textures[TEXTURE_SETTING].path)); - fill_pathname_join(textures[TEXTURE_SUBSETTING].path, iconpath, "subsetting.png", sizeof(textures[TEXTURE_SUBSETTING].path)); - fill_pathname_join(textures[TEXTURE_ARROW].path, iconpath, "arrow.png", sizeof(textures[TEXTURE_ARROW].path)); - fill_pathname_join(textures[TEXTURE_RUN].path, iconpath, "run.png", sizeof(textures[TEXTURE_RUN].path)); - fill_pathname_join(textures[TEXTURE_RESUME].path, iconpath, "resume.png", sizeof(textures[TEXTURE_RESUME].path)); - fill_pathname_join(textures[TEXTURE_SAVESTATE].path, iconpath, "savestate.png", sizeof(textures[TEXTURE_SAVESTATE].path)); - fill_pathname_join(textures[TEXTURE_LOADSTATE].path, iconpath, "loadstate.png", sizeof(textures[TEXTURE_LOADSTATE].path)); - fill_pathname_join(textures[TEXTURE_SCREENSHOT].path, iconpath, "screenshot.png", sizeof(textures[TEXTURE_SCREENSHOT].path)); - fill_pathname_join(textures[TEXTURE_RELOAD].path, iconpath, "reload.png", sizeof(textures[TEXTURE_RELOAD].path)); + fill_pathname_join(textures[TEXTURE_BG].path, iconpath, + "bg.png", sizeof(textures[TEXTURE_BG].path)); + fill_pathname_join(textures[TEXTURE_SETTINGS].path, iconpath, + "settings.png", sizeof(textures[TEXTURE_SETTINGS].path)); + fill_pathname_join(textures[TEXTURE_SETTING].path, iconpath, + "setting.png", sizeof(textures[TEXTURE_SETTING].path)); + fill_pathname_join(textures[TEXTURE_SUBSETTING].path, iconpath, + "subsetting.png", sizeof(textures[TEXTURE_SUBSETTING].path)); + fill_pathname_join(textures[TEXTURE_ARROW].path, iconpath, + "arrow.png", sizeof(textures[TEXTURE_ARROW].path)); + fill_pathname_join(textures[TEXTURE_RUN].path, iconpath, + "run.png", sizeof(textures[TEXTURE_RUN].path)); + fill_pathname_join(textures[TEXTURE_RESUME].path, iconpath, + "resume.png", sizeof(textures[TEXTURE_RESUME].path)); + fill_pathname_join(textures[TEXTURE_SAVESTATE].path, iconpath, + "savestate.png", sizeof(textures[TEXTURE_SAVESTATE].path)); + fill_pathname_join(textures[TEXTURE_LOADSTATE].path, iconpath, + "loadstate.png", sizeof(textures[TEXTURE_LOADSTATE].path)); + fill_pathname_join(textures[TEXTURE_SCREENSHOT].path, iconpath, + "screenshot.png", sizeof(textures[TEXTURE_SCREENSHOT].path)); + fill_pathname_join(textures[TEXTURE_RELOAD].path, iconpath, + "reload.png", sizeof(textures[TEXTURE_RELOAD].path)); for (k = 0; k < TEXTURE_LAST; k++) textures[k].id = png_texture_load(textures[k].path); @@ -798,11 +858,13 @@ static void lakka_context_reset(void *data) { menu_category_t *category = (menu_category_t*)&categories[i]; - char core_id[256], texturepath[256], content_texturepath[256], mediapath[256], themepath[256]; + char core_id[256], texturepath[256], content_texturepath[256], + mediapath[256], themepath[256]; core_info_t *info; core_info_list_t *info_list; - fill_pathname_join(mediapath, g_settings.assets_directory, "lakka", sizeof(mediapath)); + fill_pathname_join(mediapath, g_settings.assets_directory, + "lakka", sizeof(mediapath)); fill_pathname_join(themepath, mediapath, THEME, sizeof(themepath)); fill_pathname_join(iconpath, themepath, icon_dir, sizeof(iconpath)); fill_pathname_slash(iconpath, sizeof(iconpath)); @@ -862,10 +924,12 @@ static void lakka_context_reset(void *data) } } -static void lakka_init_items(int i, menu_category_t *category, core_info_t *info, const char* path) +static void lakka_init_items(int i, menu_category_t *category, + core_info_t *info, const char* path) { int num_items, j, n, k; - struct string_list *list = (struct string_list*)dir_list_new(path, info->supported_extensions, true); + struct string_list *list = (struct string_list*) + dir_list_new(path, info->supported_extensions, true); dir_list_sort(list, true); @@ -882,17 +946,21 @@ static void lakka_init_items(int i, menu_category_t *category, core_info_t *info n = category->num_items; category->num_items++; - category->items = (menu_item_t*)realloc(category->items, category->num_items * sizeof(menu_item_t)); + category->items = (menu_item_t*)realloc(category->items, + category->num_items * sizeof(menu_item_t)); item = (menu_item_t*)&category->items[n]; - strlcpy(item->name, path_basename(list->elems[j].data), sizeof(item->name)); + strlcpy(item->name, path_basename(list->elems[j].data), + sizeof(item->name)); strlcpy(item->rom, list->elems[j].data, sizeof(item->rom)); item->alpha = i != menu_active_category ? 0 : n ? 0.5 : 1; item->zoom = n ? i_passive_zoom : i_active_zoom; - item->y = n ? vspacing*(under_item_offset+n) : vspacing*active_item_factor; + item->y = n ? vspacing*(under_item_offset+n) : + vspacing*active_item_factor; item->active_subitem = 0; item->num_subitems = 5; - item->subitems = (menu_subitem_t*)calloc(item->num_subitems, sizeof(menu_subitem_t)); + item->subitems = (menu_subitem_t*) + calloc(item->num_subitems, sizeof(menu_subitem_t)); for (k = 0; k < item->num_subitems; k++) { @@ -921,7 +989,8 @@ static void lakka_init_items(int i, menu_category_t *category, core_info_t *info } subitem->alpha = 0; subitem->zoom = k ? i_passive_zoom : i_active_zoom; - subitem->y = k ? vspacing * (k+under_item_offset) : vspacing * active_item_factor; + subitem->y = k ? vspacing * (k+under_item_offset) : + vspacing * active_item_factor; } } } @@ -937,7 +1006,8 @@ static void lakka_free(void *data) static int lakka_input_postprocess(uint64_t old_state) { - if ((driver.menu && driver.menu->trigger_state & (1ULL << RARCH_MENU_TOGGLE)) && + if ((driver.menu && driver.menu->trigger_state + & (1ULL << RARCH_MENU_TOGGLE)) && g_extern.main_is_init && !g_extern.libretro_dummy) { @@ -960,7 +1030,9 @@ static void lakka_init_core_info(void *data) core_info_list_free(menu->core_info); menu->core_info = NULL; - menu->core_info = (core_info_list_t*)core_info_list_new(*g_settings.libretro_directory ? g_settings.libretro_directory : "/usr/lib/libretro"); + menu->core_info = (core_info_list_t*) + core_info_list_new(*g_settings.libretro_directory ? + g_settings.libretro_directory : "/usr/lib/libretro"); if (menu->core_info) { @@ -980,7 +1052,8 @@ static void *lakka_init(void) lakka_responsive(); lakka_init_core_info(menu); - categories = (menu_category_t*)calloc(num_categories, sizeof(menu_category_t)); + categories = (menu_category_t*) + calloc(num_categories, sizeof(menu_category_t)); lakka_init_settings(); @@ -1002,7 +1075,8 @@ static void *lakka_init(void) category->zoom = c_passive_zoom; category->active_item = 0; category->num_items = 0; - category->items = (menu_item_t*)calloc(category->num_items, sizeof(menu_item_t)); + category->items = (menu_item_t*) + calloc(category->num_items, sizeof(menu_item_t)); lakka_init_items(i, category, info, g_settings.content_directory); } diff --git a/frontend/menu/disp/rgui.c b/frontend/menu/disp/rgui.c index 846d047d7b..ba408716f4 100644 --- a/frontend/menu/disp/rgui.c +++ b/frontend/menu/disp/rgui.c @@ -188,13 +188,15 @@ static void rgui_render_background(void) 5, 5, driver.menu->width - 10, 5, green_filler); fill_rect(driver.menu->frame_buf, driver.menu->frame_buf_pitch, - 5, driver.menu->height - 10, driver.menu->width - 10, 5, green_filler); + 5, driver.menu->height - 10, driver.menu->width - 10, 5, + green_filler); fill_rect(driver.menu->frame_buf, driver.menu->frame_buf_pitch, 5, 5, 5, driver.menu->height - 10, green_filler); fill_rect(driver.menu->frame_buf, driver.menu->frame_buf_pitch, - driver.menu->width - 10, 5, 5, driver.menu->height - 10, green_filler); + driver.menu->width - 10, 5, 5, driver.menu->height - 10, + green_filler); } static void rgui_render_messagebox(const char *message) @@ -280,7 +282,7 @@ static void rgui_render(void) driver.menu->selection_ptr + RGUI_TERM_HEIGHT : file_list_get_size(driver.menu->selection_buf); - // Do not scroll if all items are visible. + /* Do not scroll if all items are visible. */ if (file_list_get_size(driver.menu->selection_buf) <= RGUI_TERM_HEIGHT) begin = 0; @@ -466,7 +468,8 @@ static void rgui_render(void) file_list_get_at_offset(driver.menu->selection_buf, i, &path, &label, &type); rarch_setting_t *setting = (rarch_setting_t*)setting_data_find_setting( - setting_data_get_list(), driver.menu->selection_buf->list[i].label); + setting_data_get_list(), + driver.menu->selection_buf->list[i].label); unsigned w = 19; (void)setting; if (menu_type == MENU_SETTINGS_PERFORMANCE_COUNTERS) @@ -515,7 +518,7 @@ static void rgui_render(void) } else #endif - // Pretty-print libretro cores from menu. + /* Pretty-print libretro cores from menu. */ if ( menu_type == MENU_SETTINGS_CORE || menu_type == MENU_SETTINGS_DEFERRED_CORE) diff --git a/frontend/menu/disp/rmenu.c b/frontend/menu/disp/rmenu.c index e41c0ac256..bd7febebfc 100644 --- a/frontend/menu/disp/rmenu.c +++ b/frontend/menu/disp/rmenu.c @@ -107,8 +107,10 @@ static void rmenu_render_messagebox(const char *message) font_parms.scale = FONT_SIZE_NORMAL; font_parms.color = WHITE; - if (driver.video_data && driver.video_poke && driver.video_poke->set_osd_msg) - driver.video_poke->set_osd_msg(driver.video_data, msg, &font_parms); + if (driver.video_data && driver.video_poke + && driver.video_poke->set_osd_msg) + driver.video_poke->set_osd_msg(driver.video_data, + msg, &font_parms); } render_normal = false; @@ -137,8 +139,12 @@ static void rmenu_render(void) if (!menu->selection_buf) return; - begin = (menu->selection_ptr >= (ENTRIES_HEIGHT / 2)) ? (menu->selection_ptr - (ENTRIES_HEIGHT / 2)) : 0; - end = ((menu->selection_ptr + ENTRIES_HEIGHT) <= file_list_get_size(menu->selection_buf)) ? menu->selection_ptr + ENTRIES_HEIGHT : file_list_get_size(menu->selection_buf); + begin = (menu->selection_ptr >= (ENTRIES_HEIGHT / 2)) ? + (menu->selection_ptr - (ENTRIES_HEIGHT / 2)) : 0; + end = ((menu->selection_ptr + ENTRIES_HEIGHT) <= + file_list_get_size(menu->selection_buf)) ? + menu->selection_ptr + ENTRIES_HEIGHT : + file_list_get_size(menu->selection_buf); if (file_list_get_size(menu->selection_buf) <= ENTRIES_HEIGHT) begin = 0; @@ -155,7 +161,8 @@ static void rmenu_render(void) unsigned menu_type_is = 0; file_list_get_last(menu->menu_stack, &dir, &label, &menu_type); - if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->type_is) + if (driver.menu_ctx && driver.menu_ctx->backend + && driver.menu_ctx->backend->type_is) menu_type_is = driver.menu_ctx->backend->type_is(menu_type); if (menu_type == MENU_SETTINGS_CORE) @@ -283,15 +290,19 @@ static void rmenu_render(void) } char title_buf[256]; - menu_ticker_line(title_buf, RMENU_TERM_WIDTH, g_extern.frame_count / 15, title, true); + menu_ticker_line(title_buf, RMENU_TERM_WIDTH, + g_extern.frame_count / 15, title, true); font_parms.x = POSITION_EDGE_MIN + POSITION_OFFSET; - font_parms.y = POSITION_EDGE_MIN + POSITION_RENDER_OFFSET - (POSITION_OFFSET*2); + font_parms.y = POSITION_EDGE_MIN + POSITION_RENDER_OFFSET + - (POSITION_OFFSET*2); font_parms.scale = FONT_SIZE_NORMAL; font_parms.color = WHITE; - if (driver.video_data && driver.video_poke && driver.video_poke->set_osd_msg) - driver.video_poke->set_osd_msg(driver.video_data, title_buf, &font_parms); + if (driver.video_data && driver.video_poke + && driver.video_poke->set_osd_msg) + driver.video_poke->set_osd_msg(driver.video_data, + title_buf, &font_parms); char title_msg[64]; const char *core_name = menu->info.library_name; @@ -311,10 +322,13 @@ static void rmenu_render(void) font_parms.scale = FONT_SIZE_NORMAL; font_parms.color = WHITE; - snprintf(title_msg, sizeof(title_msg), "%s - %s %s", PACKAGE_VERSION, core_name, core_version); + snprintf(title_msg, sizeof(title_msg), "%s - %s %s", + PACKAGE_VERSION, core_name, core_version); - if (driver.video_data && driver.video_poke && driver.video_poke->set_osd_msg) - driver.video_poke->set_osd_msg(driver.video_data, title_msg, &font_parms); + if (driver.video_data && driver.video_poke + && driver.video_poke->set_osd_msg) + driver.video_poke->set_osd_msg(driver.video_data, + title_msg, &font_parms); size_t i, j; @@ -330,7 +344,8 @@ static void rmenu_render(void) char type_str[256]; unsigned w = 19; - if (menu_type == MENU_SETTINGS_INPUT_OPTIONS || menu_type == MENU_SETTINGS_CUSTOM_BIND) + if (menu_type == MENU_SETTINGS_INPUT_OPTIONS || + menu_type == MENU_SETTINGS_CUSTOM_BIND) w = 21; else if (menu_type == MENU_SETTINGS_PATH_OPTIONS) w = 24; @@ -339,7 +354,8 @@ static void rmenu_render(void) if (type >= MENU_SETTINGS_SHADER_FILTER && type <= MENU_SETTINGS_SHADER_LAST) { - // HACK. Work around that we're using the menu_type as dir type to propagate state correctly. + /* HACK. Work around that we're using the menu_type as + * dir type to propagate state correctly. */ if ((menu_type_is == MENU_SETTINGS_SHADER_OPTIONS) && (menu_type_is == MENU_SETTINGS_SHADER_OPTIONS)) { @@ -347,23 +363,33 @@ static void rmenu_render(void) strlcpy(type_str, "(DIR)", sizeof(type_str)); w = 5; } - else if (type == MENU_SETTINGS_SHADER_OPTIONS || type == MENU_SETTINGS_SHADER_PRESET || type == MENU_SETTINGS_SHADER_PARAMETERS || type == MENU_SETTINGS_SHADER_PRESET_PARAMETERS) + else if ( + type == MENU_SETTINGS_SHADER_OPTIONS || + type == MENU_SETTINGS_SHADER_PRESET || + type == MENU_SETTINGS_SHADER_PARAMETERS || + type == MENU_SETTINGS_SHADER_PRESET_PARAMETERS) strlcpy(type_str, "...", sizeof(type_str)); else if (type == MENU_SETTINGS_SHADER_FILTER) snprintf(type_str, sizeof(type_str), "%s", g_settings.video.smooth ? "Linear" : "Nearest"); - else if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->shader_manager_get_str) + else if (driver.menu_ctx && driver.menu_ctx->backend + && driver.menu_ctx->backend->shader_manager_get_str) { - if (type >= MENU_SETTINGS_SHADER_PARAMETER_0 && type <= MENU_SETTINGS_SHADER_PARAMETER_LAST) - driver.menu_ctx->backend->shader_manager_get_str(menu->parameter_shader, type_str, sizeof(type_str), type); + if (type >= MENU_SETTINGS_SHADER_PARAMETER_0 && + type <= MENU_SETTINGS_SHADER_PARAMETER_LAST) + driver.menu_ctx->backend->shader_manager_get_str( + menu->parameter_shader, type_str, sizeof(type_str), type); else - driver.menu_ctx->backend->shader_manager_get_str(menu->shader, type_str, sizeof(type_str), type); + driver.menu_ctx->backend->shader_manager_get_str( + menu->shader, type_str, sizeof(type_str), type); } } else #endif - // Pretty-print libretro cores from menu. - if (menu_type == MENU_SETTINGS_CORE || menu_type == MENU_SETTINGS_DEFERRED_CORE) + /* Pretty-print libretro cores from menu. */ + if ( + menu_type == MENU_SETTINGS_CORE || + menu_type == MENU_SETTINGS_DEFERRED_CORE) { if (type == MENU_FILE_PLAIN) { @@ -406,10 +432,13 @@ static void rmenu_render(void) } else if (type >= MENU_SETTINGS_CORE_OPTION_START) strlcpy(type_str, - core_option_get_val(g_extern.system.core_options, type - MENU_SETTINGS_CORE_OPTION_START), + core_option_get_val(g_extern.system.core_options, + type - MENU_SETTINGS_CORE_OPTION_START), sizeof(type_str)); - else if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->setting_set_label) - driver.menu_ctx->backend->setting_set_label(type_str, sizeof(type_str), &w, type, i); + else if (driver.menu_ctx && driver.menu_ctx->backend + && driver.menu_ctx->backend->setting_set_label) + driver.menu_ctx->backend->setting_set_label(type_str, + sizeof(type_str), &w, type, i); if (type_str[0] == '\0' && w == 0) { @@ -429,24 +458,32 @@ static void rmenu_render(void) char type_str_buf[64]; bool selected = i == menu->selection_ptr; - menu_ticker_line(entry_title_buf, RMENU_TERM_WIDTH - (w + 1 + 2), g_extern.frame_count / 15, path, selected); - menu_ticker_line(type_str_buf, w, g_extern.frame_count / 15, type_str, selected); + menu_ticker_line(entry_title_buf, RMENU_TERM_WIDTH - (w + 1 + 2), + g_extern.frame_count / 15, path, selected); + menu_ticker_line(type_str_buf, w, g_extern.frame_count / 15, + type_str, selected); - snprintf(message, sizeof(message), "%c %s", selected ? '>' : ' ', entry_title_buf); + snprintf(message, sizeof(message), "%c %s", + selected ? '>' : ' ', entry_title_buf); //blit_line(menu, x, y, message, selected); font_parms.x = POSITION_EDGE_MIN + POSITION_OFFSET; - font_parms.y = POSITION_EDGE_MIN + POSITION_RENDER_OFFSET + (POSITION_OFFSET * j); + font_parms.y = POSITION_EDGE_MIN + POSITION_RENDER_OFFSET + + (POSITION_OFFSET * j); font_parms.scale = FONT_SIZE_NORMAL; font_parms.color = WHITE; - if (driver.video_data && driver.video_poke && driver.video_poke->set_osd_msg) - driver.video_poke->set_osd_msg(driver.video_data, message, &font_parms); + if (driver.video_data && driver.video_poke + && driver.video_poke->set_osd_msg) + driver.video_poke->set_osd_msg(driver.video_data, + message, &font_parms); font_parms.x = POSITION_EDGE_CENTER + POSITION_OFFSET; - if (driver.video_data && driver.video_poke && driver.video_poke->set_osd_msg) - driver.video_poke->set_osd_msg(driver.video_data, type_str_buf, &font_parms); + if (driver.video_data && driver.video_poke + && driver.video_poke->set_osd_msg) + driver.video_poke->set_osd_msg(driver.video_data, + type_str_buf, &font_parms); } } @@ -457,9 +494,12 @@ void rmenu_set_texture(void *data) if (menu_texture_inited) return; - if (driver.video_data && driver.video_poke && driver.video_poke->set_texture_enable && menu_texture && menu_texture->pixels) + if (driver.video_data && driver.video_poke + && driver.video_poke->set_texture_enable + && menu_texture && menu_texture->pixels) { - driver.video_poke->set_texture_frame(driver.video_data, menu_texture->pixels, + driver.video_poke->set_texture_frame(driver.video_data, + menu_texture->pixels, true, menu->width, menu->height, 1.0f); menu_texture_inited = true; } @@ -473,7 +513,8 @@ static void rmenu_context_reset(void *data) if (!menu) return; - fill_pathname_join(menu_bg, g_settings.assets_directory, "rmenu", sizeof(menu_bg)); + fill_pathname_join(menu_bg, g_settings.assets_directory, + "rmenu", sizeof(menu_bg)); #ifdef _XBOX1 fill_pathname_join(menu_bg, menu_bg, "sd", sizeof(menu_bg)); #else diff --git a/frontend/menu/disp/rmenu_xui.cpp b/frontend/menu/disp/rmenu_xui.cpp index 2c7b45fed8..a2bbfc56ff 100644 --- a/frontend/menu/disp/rmenu_xui.cpp +++ b/frontend/menu/disp/rmenu_xui.cpp @@ -200,14 +200,17 @@ static void* rmenu_xui_init(void) goto error; } - hr = XuiLoadVisualFromBinary( L"file://game:/media/rarch_scene_skin.xur", NULL); + hr = XuiLoadVisualFromBinary( + L"file://game:/media/rarch_scene_skin.xur", NULL); if (FAILED(hr)) { RARCH_ERR("Failed to load skin.\n"); goto error; } - hr = XuiSceneCreate(hdmenus_allowed ? L"file://game:/media/hd/" : L"file://game:/media/sd/", L"rarch_main.xur", NULL, &root_menu); + hr = XuiSceneCreate(hdmenus_allowed ? + L"file://game:/media/hd/" : L"file://game:/media/sd/", + L"rarch_main.xur", NULL, &root_menu); if (FAILED(hr)) { RARCH_ERR("Failed to create scene 'rarch_main.xur'.\n"); @@ -215,14 +218,16 @@ static void* rmenu_xui_init(void) } current_menu = root_menu; - hr = XuiSceneNavigateFirst(app.GetRootObj(), current_menu, XUSER_INDEX_FOCUS); + hr = XuiSceneNavigateFirst(app.GetRootObj(), + current_menu, XUSER_INDEX_FOCUS); if (FAILED(hr)) { RARCH_ERR("XuiSceneNavigateFirst failed.\n"); goto error; } - if (driver.video_data && driver.video_poke && driver.video_poke->set_texture_enable) + if (driver.video_data && driver.video_poke + && driver.video_poke->set_texture_enable) driver.video_poke->set_texture_frame(driver.video_data, NULL, true, 0, 0, 1.0f); @@ -274,7 +279,8 @@ static void xui_render_message(const char *msg) msglen = RMENU_TERM_WIDTH; } #endif - float msg_width = (g_extern.lifecycle_state & (1ULL << MODE_MENU_HD)) ? 160 : 100; + float msg_width = (g_extern.lifecycle_state & + (1ULL << MODE_MENU_HD)) ? 160 : 100; float msg_height = 120; float msg_offset = 32; @@ -283,7 +289,8 @@ static void xui_render_message(const char *msg) font_parms.scale = 21; if (driver.video_poke && driver.video_poke->set_osd_msg) - driver.video_poke->set_osd_msg(driver.video_data, msg, &font_parms); + driver.video_poke->set_osd_msg(driver.video_data, + msg, &font_parms); } } @@ -310,7 +317,8 @@ static void rmenu_xui_frame(void) XUIMessage msg; XUIMessageRender msgRender; - XuiMessageRender( &msg, &msgRender, app.GetDC(), 0xffffffff, XUI_BLEND_NORMAL ); + XuiMessageRender( &msg, &msgRender, + app.GetDC(), 0xffffffff, XUI_BLEND_NORMAL ); XuiSendMessage( app.GetRootObj(), &msg ); XuiRenderSetViewTransform( app.GetDC(), &matOrigView ); @@ -392,9 +400,11 @@ static void rmenu_xui_render(void) rmenu_xui_render_background(); - file_list_get_last(driver.menu->menu_stack, &dir, &label, &menu_type); + file_list_get_last(driver.menu->menu_stack, &dir, + &label, &menu_type); - if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->type_is) + if (driver.menu_ctx && driver.menu_ctx->backend + && driver.menu_ctx->backend->type_is) menu_type_is = driver.menu_ctx->backend->type_is(menu_type); if (menu_type == MENU_SETTINGS_CORE) @@ -521,7 +531,8 @@ static void rmenu_xui_render(void) XuiTextElementSetText(m_menutitle, strw_buffer); char title_buf[256]; - menu_ticker_line(title_buf, RXUI_TERM_WIDTH - 3, g_extern.frame_count / 15, title, true); + menu_ticker_line(title_buf, RXUI_TERM_WIDTH - 3, + g_extern.frame_count / 15, title, true); blit_line(RXUI_TERM_START_X + 15, 15, title_buf, true); char title_msg[64]; @@ -537,8 +548,11 @@ static void rmenu_xui_render(void) if (!core_version) core_version = ""; - snprintf(title_msg, sizeof(title_msg), "%s - %s %s", PACKAGE_VERSION, core_name, core_version); - blit_line(RXUI_TERM_START_X + 15, (RXUI_TERM_HEIGHT * FONT_HEIGHT_STRIDE) + RXUI_TERM_START_Y + 2, title_msg, true); + snprintf(title_msg, sizeof(title_msg), "%s - %s %s", + PACKAGE_VERSION, core_name, core_version); + blit_line(RXUI_TERM_START_X + 15, + (RXUI_TERM_HEIGHT * FONT_HEIGHT_STRIDE) + RXUI_TERM_START_Y + 2, + title_msg, true); unsigned x, y; size_t i; @@ -551,12 +565,14 @@ static void rmenu_xui_render(void) const char *path = NULL; const char *path = NULL; unsigned type = 0; - file_list_get_at_offset(driver.menu->selection_buf, i, &path, &label, &type); + file_list_get_at_offset(driver.menu->selection_buf, i, + &path, &label, &type); char message[256]; char type_str[256]; unsigned w = 19; - if (menu_type == MENU_SETTINGS_INPUT_OPTIONS || menu_type == MENU_SETTINGS_CUSTOM_BIND) + if (menu_type == MENU_SETTINGS_INPUT_OPTIONS || + menu_type == MENU_SETTINGS_CUSTOM_BIND) w = 21; else if (menu_type == MENU_SETTINGS_PATH_OPTIONS) w = 24; @@ -564,7 +580,8 @@ static void rmenu_xui_render(void) if (type >= MENU_SETTINGS_SHADER_FILTER && type <= MENU_SETTINGS_SHADER_LAST) { - // HACK. Work around that we're using the menu_type as dir type to propagate state correctly. + /* HACK. Work around that we're using the menu_type as + * dir type to propagate state correctly. */ if ((menu_type_is == MENU_SETTINGS_SHADER_OPTIONS) && (menu_type_is == MENU_SETTINGS_SHADER_OPTIONS)) { @@ -572,17 +589,21 @@ static void rmenu_xui_render(void) strlcpy(type_str, "(DIR)", sizeof(type_str)); w = 5; } - else if (type == MENU_SETTINGS_SHADER_OPTIONS || type == MENU_SETTINGS_SHADER_PRESET) + else if (type == MENU_SETTINGS_SHADER_OPTIONS || + type == MENU_SETTINGS_SHADER_PRESET) strlcpy(type_str, "...", sizeof(type_str)); else if (type == MENU_SETTINGS_SHADER_FILTER) snprintf(type_str, sizeof(type_str), "%s", g_settings.video.smooth ? "Linear" : "Nearest"); - else if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->shader_manager_get_str) - driver.menu_ctx->backend->shader_manager_get_str(driver.menu->shader, type_str, sizeof(type_str), type); + else if (driver.menu_ctx && driver.menu_ctx->backend + && driver.menu_ctx->backend->shader_manager_get_str) + driver.menu_ctx->backend->shader_manager_get_str( + driver.menu->shader, type_str, sizeof(type_str), type); } else // Pretty-print libretro cores from menu. - if (menu_type == MENU_SETTINGS_CORE || menu_type == MENU_SETTINGS_DEFERRED_CORE) + if (menu_type == MENU_SETTINGS_CORE || + menu_type == MENU_SETTINGS_DEFERRED_CORE) { if (type == MENU_FILE_PLAIN) { @@ -625,10 +646,13 @@ static void rmenu_xui_render(void) } else if (type >= MENU_SETTINGS_CORE_OPTION_START) strlcpy(type_str, - core_option_get_val(g_extern.system.core_options, type - MENU_SETTINGS_CORE_OPTION_START), + core_option_get_val(g_extern.system.core_options, + type - MENU_SETTINGS_CORE_OPTION_START), sizeof(type_str)); - else if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->setting_set_label) - driver.menu_ctx->backend->setting_set_label(type_str, sizeof(type_str), &w, type, i); + else if (driver.menu_ctx && driver.menu_ctx->backend + && driver.menu_ctx->backend->setting_set_label) + driver.menu_ctx->backend->setting_set_label(type_str, + sizeof(type_str), &w, type, i); if (type_str[0] == '\0' && w == 0) { @@ -703,7 +727,8 @@ static void rmenu_xui_navigation_alphabet(void *data, size_t *ptr_out) XuiListSetCurSelVisible(m_menulist, *ptr_out); } -static void rmenu_xui_list_insert(void *data, const char *path, size_t list_size) +static void rmenu_xui_list_insert(void *data, + const char *path, size_t list_size) { (void)data; wchar_t buf[PATH_MAX]; diff --git a/frontend/menu/menu_common.c b/frontend/menu/menu_common.c index 0ff9454bb3..fc1ba993bf 100644 --- a/frontend/menu/menu_common.c +++ b/frontend/menu/menu_common.c @@ -28,9 +28,10 @@ void menu_update_system_info(menu_handle_t *menu, bool *load_no_content) libretro_get_system_info(g_settings.libretro, &menu->info, load_no_content); #endif - /* Keep track of info for the currently selected core. */ if (menu->core_info) { + /* Keep track of info for the currently selected core. */ + if (core_info_list_get_info(menu->core_info, menu->core_info_current, g_settings.libretro)) { @@ -55,8 +56,7 @@ void menu_update_system_info(menu_handle_t *menu, bool *load_no_content) } /* When selection is presented back, returns 0. - * If it can make a decision right now, returns -1. - */ + * If it can make a decision right now, returns -1. */ int menu_defer_core(core_info_list_t *core_info, const char *dir, const char *path, char *deferred_path, size_t sizeof_deferred_path) { @@ -92,13 +92,12 @@ void menu_content_history_push_current(void) { char tmp[PATH_MAX]; - /* g_extern.fullpath can be relative here. - * Ensure we're pushing absolute path. - */ - if (!g_extern.history) return; + /* g_extern.fullpath can be relative here. + * Ensure we're pushing absolute path. */ + strlcpy(tmp, g_extern.fullpath, sizeof(tmp)); if (*tmp) @@ -183,6 +182,8 @@ void load_menu_content_history(unsigned game_index) #endif } +/* Update menu state which depends on config. */ + static void menu_update_libretro_info(menu_handle_t *menu) { #ifndef HAVE_DYNAMIC @@ -231,7 +232,6 @@ bool load_menu_content(void) return false; } - /* Update menu state which depends on config. */ if (driver.menu) menu_update_libretro_info(driver.menu); @@ -519,8 +519,9 @@ bool menu_iterate(void) * Likely to have lots of small bugs. * Cleanly exit the main loop to ensure that all the tiny details * get set properly. - * This should mitigate most of the smaller bugs. - */ + * + * This should mitigate most of the smaller bugs. */ + bool menu_replace_config(const char *path) { if (strcmp(path, g_extern.config_path) == 0) @@ -539,8 +540,8 @@ bool menu_replace_config(const char *path) } /* Save a new config to a file. Filename is based - * on heuristics to avoid typing. - */ + * on heuristics to avoid typing. */ + bool menu_save_new_config(void) { char config_dir[PATH_MAX], config_name[PATH_MAX], @@ -637,8 +638,7 @@ static inline int menu_list_get_first_char(file_list_t *buf, ret = tolower(*path); /* "Normalize" non-alphabetical entries so they are lumped together - * for purposes of jumping. - */ + * for purposes of jumping. */ if (ret < 'a') ret = 'a' - 1; else if (ret > 'z') diff --git a/frontend/menu/menu_input_line_cb.c b/frontend/menu/menu_input_line_cb.c index d917abe45f..a3e676c4e7 100644 --- a/frontend/menu/menu_input_line_cb.c +++ b/frontend/menu/menu_input_line_cb.c @@ -220,8 +220,7 @@ static bool menu_poll_find_trigger_pad(struct menu_bind_state *state, struct men rested_distance >= 20000) { /* Take care of case where axis rests on +/- 0x7fff - * (e.g. 360 controller on Linux) - */ + * (e.g. 360 controller on Linux) */ state->target->joyaxis = n->axes[a] > 0 ? AXIS_POS(a) : AXIS_NEG(a); state->target->joykey = NO_BTN; @@ -271,7 +270,8 @@ bool menu_poll_find_trigger(struct menu_bind_state *state, { if (menu_poll_find_trigger_pad(state, new_state, i)) { - // Update the joypad mapping automatically. More friendly that way. + /* Update the joypad mapping automatically. + * More friendly that way. */ g_settings.input.joypad_map[state->player] = i; return true; }