Show prettified core info display names in Core Updater

This commit is contained in:
twinaphex 2015-07-04 18:57:04 +02:00
parent 671e1d98a2
commit c7d9f2f7e8
4 changed files with 63 additions and 5 deletions

View File

@ -377,6 +377,39 @@ bool core_info_list_get_display_name(core_info_list_t *core_info_list,
return false; return false;
} }
bool core_info_get_display_name(const char *path, char *s, size_t len)
{
size_t i;
char *core_name = NULL;
config_file_t *conf = NULL;
if (!path_file_exists(path))
return false;
conf = config_file_new(path);
if (!conf)
goto error;
config_get_string(conf, "corename",
&core_name);
config_file_free(conf);
if (!core_name)
goto error;
if (!conf)
return false;
strlcpy(s, core_name, len);
return true;
error:
return false;
}
bool core_info_list_get_info(core_info_list_t *core_info_list, bool core_info_list_get_info(core_info_list_t *core_info_list,
core_info_t *out_info, const char *path) core_info_t *out_info, const char *path)
{ {

View File

@ -104,6 +104,8 @@ const char *core_info_list_get_all_extensions(core_info_list_t *list);
bool core_info_list_get_display_name(core_info_list_t *list, bool core_info_list_get_display_name(core_info_list_t *list,
const char *path, char *buf, size_t size); const char *path, char *buf, size_t size);
bool core_info_get_display_name_from_file(const char *path, char *buf, size_t size);
void core_info_get_name(const char *path, char *s, size_t len); void core_info_get_name(const char *path, char *s, size_t len);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -802,7 +802,7 @@ static void menu_action_setting_disp_set_label_menu_file_filter(
path, "(FILTER)", s2, len2); path, "(FILTER)", s2, len2);
} }
static void menu_action_setting_disp_set_label_menu_file_url( static void menu_action_setting_disp_set_label_menu_file_url_core(
file_list_t* list, file_list_t* list,
unsigned *w, unsigned type, unsigned i, unsigned *w, unsigned type, unsigned i,
const char *label, const char *label,
@ -811,8 +811,12 @@ static void menu_action_setting_disp_set_label_menu_file_url(
const char *path, const char *path,
char *s2, size_t len2) char *s2, size_t len2)
{ {
menu_action_setting_generic_disp_set_label(w, s, len, const char *alt = NULL;
path, "(URL)", s2, len2); strlcpy(s, "(CORE)", len);
menu_list_get_alt_at_offset(list, i, &alt);
*w = strlen(s);
if (alt)
strlcpy(s2, alt, len2);
} }
static void menu_action_setting_disp_set_label_menu_file_rdb( static void menu_action_setting_disp_set_label_menu_file_rdb(
@ -1066,7 +1070,7 @@ static int menu_cbs_init_bind_get_string_representation_compare_type(
break; break;
case MENU_FILE_DOWNLOAD_CORE: case MENU_FILE_DOWNLOAD_CORE:
cbs->action_get_value = cbs->action_get_value =
menu_action_setting_disp_set_label_menu_file_url; menu_action_setting_disp_set_label_menu_file_url_core;
break; break;
case MENU_FILE_RDB: case MENU_FILE_RDB:
cbs->action_get_value = cbs->action_get_value =

View File

@ -45,7 +45,7 @@ extern size_t core_len;
static void print_buf_lines(file_list_t *list, char *buf, int buf_size, static void print_buf_lines(file_list_t *list, char *buf, int buf_size,
unsigned type) unsigned type)
{ {
int i; int i, j = 0;
char c; char c;
char *line_start = buf; char *line_start = buf;
@ -74,6 +74,25 @@ static void print_buf_lines(file_list_t *list, char *buf, int buf_size,
menu_list_push(list, line_start, "", menu_list_push(list, line_start, "",
type, 0, 0); type, 0, 0);
if (type == MENU_FILE_DOWNLOAD_CORE)
{
char core_path[PATH_MAX_LENGTH] = {0};
char display_name[PATH_MAX_LENGTH] = {0};
settings_t *settings = config_get_ptr();
global_t *global = global_get_ptr();
fill_pathname_join(core_path, settings->libretro_info_path,
line_start, sizeof(core_path));
path_remove_extension(core_path);
path_remove_extension(core_path);
strlcat(core_path, ".info", sizeof(core_path));
if (core_info_get_display_name(
core_path, display_name, sizeof(display_name)))
menu_list_set_alt_at_offset(list, j, display_name);
}
j++;
/* Restore the saved char */ /* Restore the saved char */
*(buf + i + 1) = c; *(buf + i + 1) = c;