Refactor out to menu_init_core_info.

This commit is contained in:
Themaister 2013-10-11 09:17:32 +02:00
parent b8fbc58e44
commit 48602cbdbb
4 changed files with 15 additions and 14 deletions

View File

@ -883,3 +883,12 @@ void menu_resolve_supported_cores(rgui_handle_t *rgui)
rgui_list_sort_on_alt(rgui->selection_buf);
}
void menu_init_core_info(rgui_handle_t *rgui)
{
core_info_list_free(rgui->core_info);
rgui->core_info = NULL;
if (*rgui->libretro_dir)
rgui->core_info = core_info_list_new(rgui->libretro_dir);
}

View File

@ -355,6 +355,8 @@ void menu_ticker_line(char *buf, size_t len, unsigned tick, const char *str, boo
void menu_resolve_libretro_names(rgui_list_t *list, const char *dir);
void menu_resolve_supported_cores(rgui_handle_t *rgui);
void menu_init_core_info(rgui_handle_t *rgui);
void load_menu_game_prepare(void);
bool load_menu_game(void);
void load_menu_game_history(unsigned game_index);

View File

@ -570,8 +570,7 @@ int menu_set_settings(unsigned setting, unsigned action)
if (action == RGUI_ACTION_START)
{
*rgui->libretro_dir = '\0';
core_info_list_free(rgui->core_info);
rgui->core_info = NULL;
menu_init_core_info(rgui);
}
break;
#endif
@ -579,10 +578,7 @@ int menu_set_settings(unsigned setting, unsigned action)
if (action == RGUI_ACTION_START)
{
*g_settings.libretro_info_path = '\0';
core_info_list_free(rgui->core_info);
rgui->core_info = NULL;
if (*rgui->libretro_dir)
rgui->core_info = core_info_list_new(rgui->libretro_dir);
menu_init_core_info(rgui);
}
break;
case RGUI_CONFIG_DIR_PATH:

View File

@ -1426,10 +1426,7 @@ static int rgui_iterate(void *data, unsigned action)
else if (menu_type == RGUI_LIBRETRO_DIR_PATH)
{
strlcpy(rgui->libretro_dir, dir, sizeof(rgui->libretro_dir));
core_info_list_free(rgui->core_info);
rgui->core_info = NULL;
if (*rgui->libretro_dir)
rgui->core_info = core_info_list_new(rgui->libretro_dir);
menu_init_core_info(rgui);
rgui_flush_menu_stack_type(rgui, RGUI_SETTINGS_PATH_OPTIONS);
}
else if (menu_type == RGUI_CONFIG_DIR_PATH)
@ -1441,10 +1438,7 @@ static int rgui_iterate(void *data, unsigned action)
else if (menu_type == RGUI_LIBRETRO_INFO_DIR_PATH)
{
strlcpy(g_settings.libretro_info_path, dir, sizeof(g_settings.libretro_info_path));
core_info_list_free(rgui->core_info);
rgui->core_info = NULL;
if (*rgui->libretro_dir)
rgui->core_info = core_info_list_new(rgui->libretro_dir);
menu_init_core_info(rgui);
rgui_flush_menu_stack_type(rgui, RGUI_SETTINGS_PATH_OPTIONS);
}
else if (menu_type == RGUI_SHADER_DIR_PATH)