mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-24 19:56:06 +00:00
(Menu) Create menu_action_setting_driver and have Lakka and RGUI both
use it
This commit is contained in:
parent
33750bc046
commit
85f0db5bad
@ -262,20 +262,6 @@ void menu_common_setting_set_current_string(
|
||||
setting->change_handler(setting);
|
||||
}
|
||||
|
||||
static void handle_driver(const char *label, char *driver,
|
||||
size_t sizeof_driver, unsigned action)
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
case MENU_ACTION_LEFT:
|
||||
find_prev_driver(label, driver, sizeof_driver);
|
||||
break;
|
||||
case MENU_ACTION_RIGHT:
|
||||
find_next_driver(label, driver, sizeof_driver);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void handle_setting(rarch_setting_t *setting,
|
||||
unsigned id, const char *label, unsigned action)
|
||||
{
|
||||
@ -300,7 +286,9 @@ static void handle_setting(rarch_setting_t *setting,
|
||||
setting->default_value.string, setting->name, id, action);
|
||||
else if (setting->type == ST_STRING)
|
||||
{
|
||||
if (id == MENU_FILE_LINEFEED || id == MENU_FILE_LINEFEED_SWITCH)
|
||||
if (
|
||||
(setting->flags & SD_FLAG_ALLOW_INPUT) ||
|
||||
id == MENU_FILE_LINEFEED_SWITCH)
|
||||
{
|
||||
if (action == MENU_ACTION_OK)
|
||||
menu_key_start_line(driver.menu, setting->short_description,
|
||||
@ -308,16 +296,8 @@ static void handle_setting(rarch_setting_t *setting,
|
||||
else if (action == MENU_ACTION_START)
|
||||
*setting->value.string = '\0';
|
||||
}
|
||||
else if (!strcmp(setting->name, "audio_resampler_driver"))
|
||||
{
|
||||
if (action == MENU_ACTION_LEFT)
|
||||
find_prev_resampler_driver();
|
||||
else if (action == MENU_ACTION_RIGHT)
|
||||
find_next_resampler_driver();
|
||||
}
|
||||
else if (id == MENU_FILE_DRIVER)
|
||||
handle_driver(setting->name, setting->value.string,
|
||||
setting->size, action);
|
||||
else
|
||||
menu_action_setting_driver(setting, action);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -356,15 +356,19 @@ static int menu_lakka_iterate(unsigned action)
|
||||
case MENU_ACTION_RIGHT:
|
||||
case MENU_ACTION_OK:
|
||||
case MENU_ACTION_START:
|
||||
if (active_subitem->setting->type == ST_BOOL)
|
||||
menu_action_setting_boolean(
|
||||
active_subitem->setting, action);
|
||||
else if (active_subitem->setting->type == ST_UINT)
|
||||
menu_action_setting_unsigned_integer(
|
||||
active_subitem->setting, 0, action);
|
||||
else if (active_subitem->setting->type == ST_FLOAT)
|
||||
menu_action_setting_fraction(
|
||||
active_subitem->setting, action);
|
||||
{
|
||||
rarch_setting_t *setting = (rarch_setting_t*)
|
||||
active_subitem->setting;
|
||||
|
||||
if (setting->type == ST_BOOL)
|
||||
menu_action_setting_boolean(setting, action);
|
||||
else if (setting->type == ST_UINT)
|
||||
menu_action_setting_unsigned_integer(setting, 0, action);
|
||||
else if (setting->type == ST_FLOAT)
|
||||
menu_action_setting_fraction(setting, action);
|
||||
else if (setting->type == ST_STRING)
|
||||
menu_action_setting_driver(setting, action);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -189,3 +189,31 @@ void menu_action_setting_fraction(
|
||||
if (setting->change_handler)
|
||||
setting->change_handler(setting);
|
||||
}
|
||||
|
||||
void menu_action_setting_driver(
|
||||
rarch_setting_t *setting, unsigned action)
|
||||
{
|
||||
if (!strcmp(setting->name, "audio_resampler_driver"))
|
||||
{
|
||||
if (action == MENU_ACTION_LEFT)
|
||||
find_prev_resampler_driver();
|
||||
else if (action == MENU_ACTION_RIGHT)
|
||||
find_next_resampler_driver();
|
||||
}
|
||||
else if (setting->flags & SD_FLAG_IS_DRIVER)
|
||||
{
|
||||
const char *label = setting->name;
|
||||
char *driver = (char*)setting->value.string;
|
||||
size_t sizeof_driver = setting->size;
|
||||
|
||||
switch (action)
|
||||
{
|
||||
case MENU_ACTION_LEFT:
|
||||
find_prev_driver(label, driver, sizeof_driver);
|
||||
break;
|
||||
case MENU_ACTION_RIGHT:
|
||||
find_next_driver(label, driver, sizeof_driver);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,4 +28,7 @@ void menu_action_setting_fraction(
|
||||
void menu_action_setting_unsigned_integer(
|
||||
rarch_setting_t *setting, unsigned id, unsigned action);
|
||||
|
||||
void menu_action_setting_driver(
|
||||
rarch_setting_t *setting, unsigned action);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user