Refactor find_prev/find_next menu driver functions

This commit is contained in:
twinaphex 2014-08-26 23:19:48 +02:00
parent d05d909373
commit 31e7f1009d
3 changed files with 2 additions and 27 deletions

View File

@ -568,29 +568,6 @@ void uninit_location(void)
}
#ifdef HAVE_MENU
void find_prev_menu_driver(void)
{
int i = find_driver_index(RARCH_DRIVER_MENU, g_settings.menu.driver);
if (i > 0)
{
strlcpy(g_settings.menu.driver, menu_ctx_drivers[i - 1]->ident, sizeof(g_settings.menu.driver));
driver.menu_ctx = (menu_ctx_driver_t*)menu_ctx_drivers[i - 1];
}
else
RARCH_WARN("Couldn't find any previous menu driver (current one: \"%s\").\n", g_settings.menu.driver);
}
void find_next_menu_driver(void)
{
int i = find_driver_index(RARCH_DRIVER_MENU, g_settings.menu.driver);
if (i >= 0 && menu_ctx_drivers[i + 1])
{
strlcpy(g_settings.menu.driver, menu_ctx_drivers[i + 1]->ident, sizeof(g_settings.menu.driver));
driver.menu_ctx = (menu_ctx_driver_t*)menu_ctx_drivers[i + 1];
}
else
RARCH_WARN("Couldn't find any next menu driver (current one: \"%s\").\n", g_settings.menu.driver);
}
void find_menu_driver(void)
{

View File

@ -527,8 +527,6 @@ bool driver_location_get_position(double *lat, double *lon, double *horiz_accura
void driver_location_set_interval(unsigned interval_msecs, unsigned interval_distance);
#ifdef HAVE_MENU
void find_prev_menu_driver(void);
void find_next_menu_driver(void);
void find_menu_driver(void);
#endif

View File

@ -3416,9 +3416,9 @@ static int menu_common_setting_set(unsigned id, unsigned action, rarch_setting_t
#ifdef HAVE_MENU
case MENU_SETTINGS_DRIVER_MENU:
if (action == MENU_ACTION_LEFT)
find_prev_menu_driver();
find_prev_driver(RARCH_DRIVER_MENU, g_settings.menu.driver, sizeof(g_settings.menu.driver));
else if (action == MENU_ACTION_RIGHT)
find_next_menu_driver();
find_next_driver(RARCH_DRIVER_MENU, g_settings.menu.driver, sizeof(g_settings.menu.driver));
break;
#endif
#if defined(GEKKO)