From 18e3843db7a44bbe1a7af72c6c8fc016ab38a39b Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 2 Jul 2016 07:05:43 +0200 Subject: [PATCH] Cleanups --- menu/cbs/menu_cbs_cancel.c | 12 +++++----- menu/cbs/menu_cbs_left.c | 45 ++++++++++++++++++++++++-------------- menu/cbs/menu_cbs_right.c | 4 ++-- menu/menu_cbs.c | 2 +- menu/menu_cbs.h | 3 +-- 5 files changed, 38 insertions(+), 28 deletions(-) diff --git a/menu/cbs/menu_cbs_cancel.c b/menu/cbs/menu_cbs_cancel.c index 293a3a20f3..dcd9474187 100644 --- a/menu/cbs/menu_cbs_cancel.c +++ b/menu/cbs/menu_cbs_cancel.c @@ -48,7 +48,7 @@ static int action_cancel_core_content(const char *path, } static int menu_cbs_init_bind_cancel_compare_label(menu_file_list_cbs_t *cbs, - const char *label, uint32_t hash, const char *menu_label) + const char *label, const char *menu_label) { if (string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_CORE_CONTENT_LIST))) { @@ -60,16 +60,14 @@ static int menu_cbs_init_bind_cancel_compare_label(menu_file_list_cbs_t *cbs, } static int menu_cbs_init_bind_cancel_compare_type( - menu_file_list_cbs_t *cbs, unsigned type, - uint32_t label_hash) + menu_file_list_cbs_t *cbs, unsigned type) { return -1; } int menu_cbs_init_bind_cancel(menu_file_list_cbs_t *cbs, const char *path, const char *label, unsigned type, size_t idx, - const char *menu_label, - uint32_t label_hash) + const char *menu_label) { if (!cbs) return -1; @@ -77,11 +75,11 @@ int menu_cbs_init_bind_cancel(menu_file_list_cbs_t *cbs, BIND_ACTION_CANCEL(cbs, action_cancel_pop_default); - if (menu_cbs_init_bind_cancel_compare_label(cbs, label, label_hash, menu_label) == 0) + if (menu_cbs_init_bind_cancel_compare_label(cbs, label, menu_label) == 0) return 0; if (menu_cbs_init_bind_cancel_compare_type( - cbs, type, label_hash) == 0) + cbs, type) == 0) return 0; return -1; diff --git a/menu/cbs/menu_cbs_left.c b/menu/cbs/menu_cbs_left.c index 2a06a0ef30..63f4e39acf 100644 --- a/menu/cbs/menu_cbs_left.c +++ b/menu/cbs/menu_cbs_left.c @@ -46,7 +46,8 @@ static int generic_shader_action_parameter_left( if (shader) { param->current -= param->step; - param->current = MIN(MAX(param->minimum, param->current), param->maximum); + param->current = MIN(MAX(param->minimum, param->current), + param->maximum); } return 0; } @@ -59,11 +60,14 @@ static int shader_action_parameter_left(unsigned type, const char *label, video_shader_driver_get_current_shader(&shader_info); - param = &shader_info.data->parameters[type - MENU_SETTINGS_SHADER_PARAMETER_0]; - return generic_shader_action_parameter_left(shader_info.data, param, type, label, wraparound); + param = &shader_info.data->parameters[type + - MENU_SETTINGS_SHADER_PARAMETER_0]; + return generic_shader_action_parameter_left(shader_info.data, param, + type, label, wraparound); } -static int shader_action_parameter_preset_left(unsigned type, const char *label, +static int shader_action_parameter_preset_left(unsigned type, + const char *label, bool wraparound) { struct video_shader_parameter *param = NULL; @@ -75,7 +79,8 @@ static int shader_action_parameter_preset_left(unsigned type, const char *label, param = shader ? &shader->parameters[type - MENU_SETTINGS_SHADER_PRESET_PARAMETER_0] : NULL; - return generic_shader_action_parameter_left(shader, param, type, label, wraparound); + return generic_shader_action_parameter_left(shader, param, + type, label, wraparound); } #endif @@ -90,10 +95,13 @@ static int action_left_cheat(unsigned type, const char *label, static int action_left_input_desc(unsigned type, const char *label, bool wraparound) { - unsigned inp_desc_index_offset = type - MENU_SETTINGS_INPUT_DESC_BEGIN; - unsigned inp_desc_user = inp_desc_index_offset / (RARCH_FIRST_CUSTOM_BIND + 4); - unsigned inp_desc_button_index_offset = inp_desc_index_offset - (inp_desc_user * (RARCH_FIRST_CUSTOM_BIND + 4)); - settings_t *settings = config_get_ptr(); + unsigned inp_desc_index_offset = type - + MENU_SETTINGS_INPUT_DESC_BEGIN; + unsigned inp_desc_user = inp_desc_index_offset / + (RARCH_FIRST_CUSTOM_BIND + 4); + unsigned inp_desc_button_index_offset = inp_desc_index_offset + - (inp_desc_user * (RARCH_FIRST_CUSTOM_BIND + 4)); + settings_t *settings = config_get_ptr(); if (settings->input.remap_ids[inp_desc_user][inp_desc_button_index_offset] > 0) settings->input.remap_ids[inp_desc_user][inp_desc_button_index_offset]--; @@ -250,7 +258,8 @@ static int action_left_shader_filter_default(unsigned type, const char *label, bool wraparound) { #ifdef HAVE_SHADER_MANAGER - rarch_setting_t *setting = menu_setting_find_enum(MENU_ENUM_LABEL_VIDEO_SMOOTH); + rarch_setting_t *setting = menu_setting_find_enum( + MENU_ENUM_LABEL_VIDEO_SMOOTH); if (!setting) return menu_cbs_exit(); return menu_action_handle_setting(setting, @@ -326,9 +335,11 @@ static int playlist_association_left(unsigned type, const char *label, stnames = string_split(settings->playlist_names, ";"); stcores = string_split(settings->playlist_cores, ";"); - if (!menu_content_playlist_find_associated_core(path, core_path, sizeof(core_path))) + if (!menu_content_playlist_find_associated_core(path, + core_path, sizeof(core_path))) strlcpy(core_path, - file_path_str(FILE_PATH_DETECT), sizeof(core_path)); + file_path_str(FILE_PATH_DETECT), + sizeof(core_path)); for (i = 0; i < list->count; i++) { @@ -351,9 +362,11 @@ static int playlist_association_left(unsigned type, const char *label, if (found) string_list_set(stcores, found-1, info->path); - string_list_join_concat(new_playlist_cores, sizeof(new_playlist_cores), stcores, ";"); + string_list_join_concat(new_playlist_cores, + sizeof(new_playlist_cores), stcores, ";"); - strlcpy(settings->playlist_cores, new_playlist_cores, sizeof(settings->playlist_cores)); + strlcpy(settings->playlist_cores, + new_playlist_cores, sizeof(settings->playlist_cores)); string_list_free(stnames); string_list_free(stcores); @@ -497,7 +510,7 @@ static int menu_cbs_init_bind_left_compare_label(menu_file_list_cbs_t *cbs, } static int menu_cbs_init_bind_left_compare_type(menu_file_list_cbs_t *cbs, - unsigned type, uint32_t label_hash, const char *menu_label) + unsigned type, const char *menu_label) { if (type >= MENU_SETTINGS_CHEAT_BEGIN && type <= MENU_SETTINGS_CHEAT_END) @@ -620,7 +633,7 @@ int menu_cbs_init_bind_left(menu_file_list_cbs_t *cbs, if (menu_cbs_init_bind_left_compare_label(cbs, label, label_hash, menu_label) == 0) return 0; - if (menu_cbs_init_bind_left_compare_type(cbs, type, label_hash, menu_label) == 0) + if (menu_cbs_init_bind_left_compare_type(cbs, type, menu_label) == 0) return 0; return -1; diff --git a/menu/cbs/menu_cbs_right.c b/menu/cbs/menu_cbs_right.c index e4d98e4eb4..f24fd56dbc 100644 --- a/menu/cbs/menu_cbs_right.c +++ b/menu/cbs/menu_cbs_right.c @@ -407,7 +407,7 @@ int bind_right_generic(unsigned type, const char *label, } static int menu_cbs_init_bind_right_compare_type(menu_file_list_cbs_t *cbs, - unsigned type, uint32_t label_hash, const char *menu_label) + unsigned type, const char *menu_label) { if (type >= MENU_SETTINGS_CHEAT_BEGIN && type <= MENU_SETTINGS_CHEAT_END) @@ -643,7 +643,7 @@ int menu_cbs_init_bind_right(menu_file_list_cbs_t *cbs, ) == 0) return 0; - if (menu_cbs_init_bind_right_compare_type(cbs, type, label_hash, menu_label ) == 0) + if (menu_cbs_init_bind_right_compare_type(cbs, type, menu_label ) == 0) return 0; return menu_cbs_exit(); diff --git a/menu/menu_cbs.c b/menu/menu_cbs.c index a7c702e832..a2ab93ed24 100644 --- a/menu/menu_cbs.c +++ b/menu/menu_cbs.c @@ -70,7 +70,7 @@ void menu_cbs_init(void *data, menu_cbs_init_log(repr_label, "OK", cbs->action_ok_ident); - menu_cbs_init_bind_cancel(cbs, path, label, type, idx, menu_label, label_hash); + menu_cbs_init_bind_cancel(cbs, path, label, type, idx, menu_label); menu_cbs_init_log(repr_label, "CANCEL", cbs->action_cancel_ident); diff --git a/menu/menu_cbs.h b/menu/menu_cbs.h index 3a9c3e07ff..680fcedacc 100644 --- a/menu/menu_cbs.h +++ b/menu/menu_cbs.h @@ -149,8 +149,7 @@ int menu_cbs_init_bind_content_list_switch(menu_file_list_cbs_t *cbs, int menu_cbs_init_bind_cancel(menu_file_list_cbs_t *cbs, const char *path, const char *label, unsigned type, size_t idx, - const char *menu_label, - uint32_t label_hash); + const char *menu_label); int menu_cbs_init_bind_ok(menu_file_list_cbs_t *cbs, const char *path, const char *label, unsigned type, size_t idx,