From 8199411acb00df1d72d57676e6768f42d85c71be Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 1 Feb 2015 10:08:14 +0100 Subject: [PATCH] Cleanups --- menu/menu_entries_cbs.c | 27 +++++++++++++++++++++++++-- settings_data.c | 12 ------------ 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/menu/menu_entries_cbs.c b/menu/menu_entries_cbs.c index bd1e663f45..b3e1973062 100644 --- a/menu/menu_entries_cbs.c +++ b/menu/menu_entries_cbs.c @@ -4063,6 +4063,27 @@ static void menu_action_setting_disp_set_label_input_desc( strlcpy(path_buf, path, path_buf_size); } +static void menu_action_setting_disp_set_label_cheat( + file_list_t* list, + unsigned *w, unsigned type, unsigned i, + const char *label, + char *type_str, size_t type_str_size, + const char *entry_label, + const char *path, + char *path_buf, size_t path_buf_size) +{ + unsigned cheat_index = type - MENU_SETTINGS_CHEAT_BEGIN; + + if (cheat_index < g_extern.cheat->buf_size) + snprintf(type_str, type_str_size, "%s : (%s)", + (g_extern.cheat->cheats[cheat_index].code != NULL) + ? g_extern.cheat->cheats[cheat_index].code : "N/A", + g_extern.cheat->cheats[cheat_index].state ? "ON" : "OFF" + ); + *w = 19; + strlcpy(path_buf, path, path_buf_size); +} + static void menu_action_setting_disp_set_label_menu_more( file_list_t* list, unsigned *w, unsigned type, unsigned i, @@ -4888,10 +4909,12 @@ static void menu_entries_cbs_init_bind_get_string_representation(menu_file_list_ if (type >= MENU_SETTINGS_INPUT_DESC_BEGIN && type <= MENU_SETTINGS_INPUT_DESC_END) - { cbs->action_get_representation = menu_action_setting_disp_set_label_input_desc; - } + else if (type >= MENU_SETTINGS_CHEAT_BEGIN + && type <= MENU_SETTINGS_CHEAT_END) + cbs->action_get_representation = + menu_action_setting_disp_set_label_cheat; else { switch (type) diff --git a/settings_data.c b/settings_data.c index de0203c317..c6f9c8cf10 100644 --- a/settings_data.c +++ b/settings_data.c @@ -2926,18 +2926,6 @@ void setting_data_get_label(void *data, char *type_str, else if (!strcmp(label, "remap_file_load")) fill_pathname_base(type_str, g_settings.input.remapping_path, type_str_size); - else if (type >= MENU_SETTINGS_CHEAT_BEGIN - && type <= MENU_SETTINGS_CHEAT_END) - { - unsigned cheat_index = type - MENU_SETTINGS_CHEAT_BEGIN; - - if (cheat_index < g_extern.cheat->buf_size) - snprintf(type_str, type_str_size, "%s : (%s)", - (g_extern.cheat->cheats[cheat_index].code != NULL) - ? g_extern.cheat->cheats[cheat_index].code : "N/A", - g_extern.cheat->cheats[cheat_index].state ? "ON" : "OFF" - ); - } else if (type >= MENU_SETTINGS_PERF_COUNTERS_BEGIN && type <= MENU_SETTINGS_PERF_COUNTERS_END) menu_common_setting_set_label_perf(type_str, type_str_size, w, type,