Start implementing wraparound for changing drivers
This commit is contained in:
parent
23eb3fa2ad
commit
9b442f9711
7
driver.c
7
driver.c
|
@ -133,6 +133,11 @@ int find_driver_index(const char * label, const char *drv)
|
|||
return -1;
|
||||
}
|
||||
|
||||
bool find_first_driver(const char *label, char *str, size_t sizeof_str)
|
||||
{
|
||||
find_driver_nonempty(label, 0, str, sizeof_str);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* find_prev_driver:
|
||||
|
@ -167,7 +172,7 @@ bool find_prev_driver(const char *label, char *str, size_t sizeof_str)
|
|||
bool find_next_driver(const char *label, char *str, size_t sizeof_str)
|
||||
{
|
||||
int i = find_driver_index(label, str);
|
||||
if (i >= 0)
|
||||
if (i >= 0 && (strcmp(str, "null") != 0))
|
||||
find_driver_nonempty(label, i + 1, str, sizeof_str);
|
||||
else
|
||||
{
|
||||
|
|
2
driver.h
2
driver.h
|
@ -322,6 +322,8 @@ void init_drivers_pre(void);
|
|||
**/
|
||||
void uninit_drivers(int flags);
|
||||
|
||||
bool find_first_driver(const char *label, char *str, size_t sizeof_str);
|
||||
|
||||
/**
|
||||
* find_prev_driver:
|
||||
* @label : string of driver type to be found.
|
||||
|
|
|
@ -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, false);
|
||||
setting->action_toggle(setting, action, true);
|
||||
break;
|
||||
case MENU_ACTION_OK:
|
||||
if (setting->action_ok)
|
||||
|
|
|
@ -756,10 +756,20 @@ static int setting_data_string_action_toggle_driver(void *data,
|
|||
switch (action)
|
||||
{
|
||||
case MENU_ACTION_LEFT:
|
||||
find_prev_driver(setting->name, setting->value.string, setting->size);
|
||||
if (!find_prev_driver(setting->name, setting->value.string, setting->size))
|
||||
{
|
||||
#if 0
|
||||
if (wraparound)
|
||||
find_last_driver(setting->name, setting->value.string, setting->size);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case MENU_ACTION_RIGHT:
|
||||
find_next_driver(setting->name, setting->value.string, setting->size);
|
||||
if (!find_next_driver(setting->name, setting->value.string, setting->size))
|
||||
{
|
||||
if (wraparound)
|
||||
find_first_driver(setting->name, setting->value.string, setting->size);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue