From b9d7b4e52ffb19455a5c35a3a3b4628ed16d90a0 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 6 Jun 2015 20:35:39 +0200 Subject: [PATCH] Create 'action_select' binding for core settings --- menu/menu_entries_cbs.h | 6 ++++++ menu/menu_entries_cbs_right.c | 2 +- menu/menu_entries_cbs_select.c | 23 +++++++++++++++++------ 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/menu/menu_entries_cbs.h b/menu/menu_entries_cbs.h index 83dc8190f6..91652af810 100644 --- a/menu/menu_entries_cbs.h +++ b/menu/menu_entries_cbs.h @@ -31,6 +31,12 @@ extern size_t hack_shader_pass; extern char core_updater_path[PATH_MAX_LENGTH]; #endif +/* Function callbacks */ + +int core_setting_right(unsigned type, const char *label, + bool wraparound); +/* End of function callbacks */ + void menu_entries_common_load_content(bool persist); int menu_entries_common_is_settings_entry(const char *label); diff --git a/menu/menu_entries_cbs_right.c b/menu/menu_entries_cbs_right.c index 3539a19ab4..ea4b073562 100644 --- a/menu/menu_entries_cbs_right.c +++ b/menu/menu_entries_cbs_right.c @@ -324,7 +324,7 @@ static int action_right_video_resolution(unsigned type, const char *label, return 0; } -static int core_setting_right(unsigned type, const char *label, +int core_setting_right(unsigned type, const char *label, bool wraparound) { unsigned idx = type - MENU_SETTINGS_CORE_OPTION_START; diff --git a/menu/menu_entries_cbs_select.c b/menu/menu_entries_cbs_select.c index 3870369cc5..976814e8fa 100644 --- a/menu/menu_entries_cbs_select.c +++ b/menu/menu_entries_cbs_select.c @@ -57,6 +57,12 @@ static int action_select_directory(const char *path, const char *label, unsigned return 0; } +static int action_select_core_setting(const char *path, const char *label, unsigned type, + size_t idx) +{ + return core_setting_right(type, label, true); +} + void menu_entries_cbs_init_bind_select(menu_file_list_cbs_t *cbs, const char *path, const char *label, unsigned type, size_t idx, const char *elem0, const char *elem1, @@ -67,12 +73,17 @@ void menu_entries_cbs_init_bind_select(menu_file_list_cbs_t *cbs, cbs->action_select = action_select_default; - switch (type) + if ((type >= MENU_SETTINGS_CORE_OPTION_START)) + cbs->action_select = action_select_core_setting; + else { - case MENU_FILE_PATH: - case MENU_FILE_DIRECTORY: - case MENU_FILE_USE_DIRECTORY: - cbs->action_select = action_select_directory; - break; + switch (type) + { + case MENU_FILE_PATH: + case MENU_FILE_DIRECTORY: + case MENU_FILE_USE_DIRECTORY: + cbs->action_select = action_select_directory; + break; + } } }