mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
(Menu) Create menu_setting_start_toggle
This commit is contained in:
parent
4153190c56
commit
a79e403273
@ -1261,7 +1261,38 @@ static int menu_setting_ok_toggle(unsigned type,
|
||||
const char *dir, const char *label,
|
||||
unsigned action)
|
||||
{
|
||||
if (
|
||||
if (type >= MENU_SETTINGS_BIND_BEGIN &&
|
||||
type <= MENU_SETTINGS_BIND_ALL_LAST)
|
||||
{
|
||||
struct retro_keybind *bind = (struct retro_keybind*)
|
||||
&g_settings.input.binds[driver.menu->current_pad]
|
||||
[type - MENU_SETTINGS_BIND_BEGIN];
|
||||
|
||||
driver.menu->binds.begin = type;
|
||||
driver.menu->binds.last = type;
|
||||
driver.menu->binds.target = bind;
|
||||
driver.menu->binds.player = driver.menu->current_pad;
|
||||
file_list_push(driver.menu->menu_stack, "", "",
|
||||
driver.menu->bind_mode_keyboard ?
|
||||
MENU_SETTINGS_CUSTOM_BIND_KEYBOARD : MENU_SETTINGS_CUSTOM_BIND,
|
||||
driver.menu->selection_ptr);
|
||||
|
||||
if (driver.menu->bind_mode_keyboard)
|
||||
{
|
||||
driver.menu->binds.timeout_end = rarch_get_time_usec() +
|
||||
MENU_KEYBOARD_BIND_TIMEOUT_SECONDS * 1000000;
|
||||
input_keyboard_wait_keys(driver.menu,
|
||||
menu_custom_bind_keyboard_cb);
|
||||
}
|
||||
else
|
||||
{
|
||||
menu_poll_bind_get_rested_axes(&driver.menu->binds);
|
||||
menu_poll_bind_state(&driver.menu->binds);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
else if (
|
||||
!strcmp(label, "load_content") ||
|
||||
!strcmp(label, "detect_core_list")
|
||||
)
|
||||
@ -1315,6 +1346,34 @@ static int menu_setting_ok_toggle(unsigned type,
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int menu_setting_start_toggle(unsigned type,
|
||||
const char *dir, const char *label,
|
||||
unsigned action)
|
||||
{
|
||||
if (type >= MENU_SETTINGS_BIND_BEGIN &&
|
||||
type <= MENU_SETTINGS_BIND_ALL_LAST)
|
||||
{
|
||||
struct retro_keybind *bind = (struct retro_keybind*)
|
||||
&g_settings.input.binds[driver.menu->current_pad]
|
||||
[type - MENU_SETTINGS_BIND_BEGIN];
|
||||
|
||||
if (driver.menu->bind_mode_keyboard)
|
||||
{
|
||||
const struct retro_keybind *def_binds = driver.menu->current_pad ?
|
||||
retro_keybinds_rest : retro_keybinds_1;
|
||||
bind->key = def_binds[type - MENU_SETTINGS_BIND_BEGIN].key;
|
||||
}
|
||||
else
|
||||
{
|
||||
bind->joykey = NO_BTN;
|
||||
bind->joyaxis = AXIS_NONE;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int menu_setting_toggle(unsigned type,
|
||||
const char *dir, const char *label,
|
||||
unsigned action)
|
||||
@ -1324,6 +1383,9 @@ static int menu_setting_toggle(unsigned type,
|
||||
if (action == MENU_ACTION_OK &&
|
||||
menu_setting_ok_toggle(type, dir, label, action) == 0)
|
||||
return 0;
|
||||
else if (action == MENU_ACTION_START &&
|
||||
menu_setting_start_toggle(type, dir, label, action) == 0)
|
||||
return 0;
|
||||
else if ((type >= MENU_SETTINGS_SHADER_FILTER) &&
|
||||
(type <= MENU_SETTINGS_SHADER_LAST))
|
||||
{
|
||||
@ -1348,52 +1410,6 @@ static int menu_setting_toggle(unsigned type,
|
||||
return menu_common_setting_set_perf(type, action, counters,
|
||||
type - MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN);
|
||||
}
|
||||
else if (type >= MENU_SETTINGS_BIND_BEGIN &&
|
||||
type <= MENU_SETTINGS_BIND_ALL_LAST)
|
||||
{
|
||||
struct retro_keybind *bind = (struct retro_keybind*)
|
||||
&g_settings.input.binds[driver.menu->current_pad]
|
||||
[type - MENU_SETTINGS_BIND_BEGIN];
|
||||
|
||||
if (action == MENU_ACTION_OK)
|
||||
{
|
||||
driver.menu->binds.begin = type;
|
||||
driver.menu->binds.last = type;
|
||||
driver.menu->binds.target = bind;
|
||||
driver.menu->binds.player = driver.menu->current_pad;
|
||||
file_list_push(driver.menu->menu_stack, "", "",
|
||||
driver.menu->bind_mode_keyboard ?
|
||||
MENU_SETTINGS_CUSTOM_BIND_KEYBOARD : MENU_SETTINGS_CUSTOM_BIND,
|
||||
driver.menu->selection_ptr);
|
||||
|
||||
if (driver.menu->bind_mode_keyboard)
|
||||
{
|
||||
driver.menu->binds.timeout_end = rarch_get_time_usec() +
|
||||
MENU_KEYBOARD_BIND_TIMEOUT_SECONDS * 1000000;
|
||||
input_keyboard_wait_keys(driver.menu,
|
||||
menu_custom_bind_keyboard_cb);
|
||||
}
|
||||
else
|
||||
{
|
||||
menu_poll_bind_get_rested_axes(&driver.menu->binds);
|
||||
menu_poll_bind_state(&driver.menu->binds);
|
||||
}
|
||||
}
|
||||
else if (action == MENU_ACTION_START)
|
||||
{
|
||||
if (driver.menu->bind_mode_keyboard)
|
||||
{
|
||||
const struct retro_keybind *def_binds = driver.menu->current_pad ?
|
||||
retro_keybinds_rest : retro_keybinds_1;
|
||||
bind->key = def_binds[type - MENU_SETTINGS_BIND_BEGIN].key;
|
||||
}
|
||||
else
|
||||
{
|
||||
bind->joykey = NO_BTN;
|
||||
bind->joyaxis = AXIS_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (driver.menu_ctx && driver.menu_ctx->backend)
|
||||
return menu_setting_set(type, action);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user