From eb63e78cf683baff85ab9a737a2c40a56c525111 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 9 Mar 2015 04:18:47 +0100 Subject: [PATCH] Update action toggle handler --- menu/menu_setting.c | 7 ++++--- settings_data.c | 25 +++++++++++++++---------- settings_list.h | 2 +- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/menu/menu_setting.c b/menu/menu_setting.c index fc03830aad..906079a4c7 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -54,7 +54,7 @@ static void setting_handler(rarch_setting_t *setting, unsigned action) case MENU_ACTION_LEFT: case MENU_ACTION_RIGHT: if (setting->action_toggle) - setting->action_toggle(setting, action); + setting->action_toggle(setting, action, false); break; case MENU_ACTION_OK: if (setting->action_ok) @@ -79,7 +79,7 @@ int menu_setting_handler(rarch_setting_t *setting, unsigned action) } static int menu_action_handle_setting(rarch_setting_t *setting, - unsigned type, unsigned action) + unsigned type, unsigned action, bool wraparound) { if (!setting) return -1; @@ -128,5 +128,6 @@ int menu_setting_set(unsigned type, const char *label, if (!setting) return 0; - return menu_action_handle_setting(setting, type, action); + return menu_action_handle_setting(setting, + type, action, wraparound); } diff --git a/settings_data.c b/settings_data.c index 026c5590ef..263e39b1fc 100644 --- a/settings_data.c +++ b/settings_data.c @@ -472,7 +472,8 @@ static int setting_data_bind_action_start(void *data) * * Returns: 0 on success, -1 on error. **/ -static int setting_data_action_toggle_analog_dpad_mode(void *data, unsigned action) +static int setting_data_action_toggle_analog_dpad_mode(void *data, + unsigned action, bool wraparound) { unsigned port = 0; rarch_setting_t *setting = (rarch_setting_t*)data; @@ -512,7 +513,7 @@ static int setting_data_action_toggle_analog_dpad_mode(void *data, unsigned acti * Returns: 0 on success, -1 on error. **/ static int setting_data_action_toggle_libretro_device_type( - void *data, unsigned action) + void *data, unsigned action, bool wraparound) { unsigned current_device, current_idx, i, devices[128], types = 0, port = 0; @@ -591,7 +592,7 @@ static int setting_data_action_toggle_libretro_device_type( * Returns: 0 on success, -1 on error. **/ static int setting_data_action_toggle_savestates( - void *data, unsigned action) + void *data, unsigned action, bool wraparound) { rarch_setting_t *setting = (rarch_setting_t*)data; @@ -624,7 +625,8 @@ static int setting_data_action_toggle_savestates( * * Returns: 0 on success, -1 on error. **/ -static int setting_data_action_toggle_bind_device(void *data, unsigned action) +static int setting_data_action_toggle_bind_device(void *data, + unsigned action, bool wraparound) { unsigned *p = NULL; rarch_setting_t *setting = (rarch_setting_t*)data; @@ -651,7 +653,8 @@ static int setting_data_action_toggle_bind_device(void *data, unsigned action) return 0; } -static int setting_data_bool_action_toggle_default(void *data, unsigned action) +static int setting_data_bool_action_toggle_default(void *data, + unsigned action, bool wraparound) { rarch_setting_t *setting = (rarch_setting_t*)data; @@ -669,7 +672,8 @@ static int setting_data_bool_action_toggle_default(void *data, unsigned action) return 0; } -static int setting_data_uint_action_toggle_default(void *data, unsigned action) +static int setting_data_uint_action_toggle_default(void *data, + unsigned action, bool wraparound) { rarch_setting_t *setting = (rarch_setting_t*)data; @@ -706,7 +710,7 @@ static int setting_data_uint_action_toggle_default(void *data, unsigned action) } static int setting_data_fraction_action_toggle_default( - void *data, unsigned action) + void *data, unsigned action, bool wraparound) { rarch_setting_t *setting = (rarch_setting_t*)data; @@ -742,7 +746,7 @@ static int setting_data_fraction_action_toggle_default( } static int setting_data_string_action_toggle_driver(void *data, - unsigned action) + unsigned action, bool wraparound) { rarch_setting_t *setting = (rarch_setting_t*)data; @@ -762,7 +766,7 @@ static int setting_data_string_action_toggle_driver(void *data, return 0; } -static int core_list_action_toggle(void *data, unsigned action) +static int core_list_action_toggle(void *data, unsigned action, bool wraparound) { rarch_setting_t *setting = (rarch_setting_t *)data; @@ -790,7 +794,8 @@ static int core_list_action_toggle(void *data, unsigned action) * * Returns: 0 on success, -1 on error. **/ -static int load_content_action_toggle(void *data, unsigned action) +static int load_content_action_toggle(void *data, unsigned action, + bool wraparound) { rarch_setting_t *setting = (rarch_setting_t *)data; diff --git a/settings_list.h b/settings_list.h index f268245781..4baa28bb26 100644 --- a/settings_list.h +++ b/settings_list.h @@ -88,7 +88,7 @@ enum setting_list_flags #define SL_FLAG_ALL_SETTINGS (SL_FLAG_ALL - SL_FLAG_MAIN_MENU) typedef void (*change_handler_t )(void *data); -typedef int (*action_toggle_handler_t )(void *data, unsigned action); +typedef int (*action_toggle_handler_t )(void *data, unsigned action, bool wraparound); typedef int (*action_up_or_down_handler_t )(void *data, unsigned action); typedef int (*action_start_handler_t )(void *data); typedef int (*action_iterate_handler_t )(unsigned action);