From d87470c5971ed25b64299ad42fed52aeb8e063d5 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 17 Nov 2014 16:16:52 +0100 Subject: [PATCH] (Menu) Add stub Navigation Wrap-Around options --- general.h | 8 ++++++++ menu/backend/menu_common_backend.c | 4 ++-- retroarch.cfg | 6 ++++++ settings.c | 8 ++++++++ settings_data.c | 29 +++++++++++++++++++++++++++++ 5 files changed, 53 insertions(+), 2 deletions(-) diff --git a/general.h b/general.h index 7e8a516441..6cc4ac400e 100644 --- a/general.h +++ b/general.h @@ -293,6 +293,14 @@ struct settings char driver[32]; bool pause_libretro; bool mouse_enable; + struct + { + struct + { + bool horizontal_enable; + bool vertical_enable; + } wraparound; + } navigation; } menu; #endif diff --git a/menu/backend/menu_common_backend.c b/menu/backend/menu_common_backend.c index 06b69fcd07..7b40becd48 100644 --- a/menu/backend/menu_common_backend.c +++ b/menu/backend/menu_common_backend.c @@ -598,8 +598,8 @@ static int menu_common_iterate(unsigned action) { case MENU_ACTION_UP: if (driver.menu->selection_ptr >= scroll_speed) - menu_navigation_set(driver.menu, - driver.menu->selection_ptr - scroll_speed, true); + menu_navigation_set(driver.menu, + driver.menu->selection_ptr - scroll_speed, true); else menu_navigation_set(driver.menu, menu_list_get_size(driver.menu->menu_list) - 1, true); diff --git a/retroarch.cfg b/retroarch.cfg index f27ca0dcb9..74326b4650 100644 --- a/retroarch.cfg +++ b/retroarch.cfg @@ -548,6 +548,12 @@ # Enable mouse input inside the menu. # menu_mouse_enable = false +# Wrap-around toe beginning and/or end if boundary of list reached horizontally +# menu_navigation_wraparound_horizontal_enable = false + +# Wrap-around to beginning and/or end if boundary of list reached vertically +# menu_navigation_wraparound_vertical_enable = false + #### Camera # Override the default camera device the camera driver uses. This is driver dependant. diff --git a/settings.c b/settings.c index c89d04ea88..30d73fe66f 100644 --- a/settings.c +++ b/settings.c @@ -433,6 +433,8 @@ static void config_set_defaults(void) g_settings.menu_show_start_screen = menu_show_start_screen; g_settings.menu.pause_libretro = true; g_settings.menu.mouse_enable = false; + g_settings.menu.navigation.wraparound.horizontal_enable = true; + g_settings.menu.navigation.wraparound.vertical_enable = true; #endif g_settings.location.allow = false; @@ -886,6 +888,8 @@ static bool config_load_file(const char *path, bool set_defaults) #ifdef HAVE_MENU CONFIG_GET_BOOL(menu.pause_libretro, "menu_pause_libretro"); CONFIG_GET_BOOL(menu.mouse_enable, "menu_mouse_enable"); + CONFIG_GET_BOOL(menu.navigation.wraparound.horizontal_enable, "menu_navigation_wraparound_horizontal_enable"); + CONFIG_GET_BOOL(menu.navigation.wraparound.vertical_enable, "menu_navigation_wraparound_vertical_enable"); #endif CONFIG_GET_INT(video.hard_sync_frames, "video_hard_sync_frames"); @@ -1657,6 +1661,10 @@ bool config_save_file(const char *path) g_settings.menu_config_directory : "default"); config_set_bool(conf, "rgui_show_start_screen", g_settings.menu_show_start_screen); + config_set_bool(conf, "menu_navigation_wraparound_horizontal_enable", + g_settings.menu.navigation.wraparound.horizontal_enable); + config_set_bool(conf, "menu_navigation_wraparound_vertical_enable", + g_settings.menu.navigation.wraparound.vertical_enable); #endif config_set_path(conf, "game_history_path", g_settings.content_history_path); diff --git a/settings_data.c b/settings_data.c index 69dfc0bc51..af5764cb7c 100644 --- a/settings_data.c +++ b/settings_data.c @@ -4629,6 +4629,35 @@ static bool setting_data_append_list_menu_options( general_read_handler); END_SUB_GROUP(list, list_info); + + START_SUB_GROUP(list, list_info, "Navigation", group_info.name, subgroup_info); + + CONFIG_BOOL( + g_settings.menu.navigation.wraparound.horizontal_enable, + "menu_navigation_wraparound_horizontal_enable", + "Navigation Wrap-Around Horizontal", + true, + "OFF", + "ON", + group_info.name, + subgroup_info.name, + general_write_handler, + general_read_handler); + + CONFIG_BOOL( + g_settings.menu.navigation.wraparound.vertical_enable, + "menu_navigation_wraparound_vertical_enable", + "Navigation Wrap-Around Vertical", + true, + "OFF", + "ON", + group_info.name, + subgroup_info.name, + general_write_handler, + general_read_handler); + + END_SUB_GROUP(list, list_info); + END_GROUP(list, list_info); #endif