Add setting 'Max Users'
This commit is contained in:
parent
9bc4ffb69b
commit
45cdb15de4
|
@ -362,6 +362,8 @@ struct settings
|
||||||
char keyboard_layout[64];
|
char keyboard_layout[64];
|
||||||
struct retro_keybind binds[MAX_PLAYERS][RARCH_BIND_LIST_END];
|
struct retro_keybind binds[MAX_PLAYERS][RARCH_BIND_LIST_END];
|
||||||
|
|
||||||
|
unsigned max_users;
|
||||||
|
|
||||||
/* Set by autoconfiguration in joypad_autoconfig_dir.
|
/* Set by autoconfiguration in joypad_autoconfig_dir.
|
||||||
* Does not override main binds. */
|
* Does not override main binds. */
|
||||||
struct retro_keybind autoconf_binds[MAX_PLAYERS][RARCH_BIND_LIST_END];
|
struct retro_keybind autoconf_binds[MAX_PLAYERS][RARCH_BIND_LIST_END];
|
||||||
|
|
|
@ -169,7 +169,7 @@ void menu_poll_bind_state(struct menu_bind_state *state)
|
||||||
if (joypad->poll)
|
if (joypad->poll)
|
||||||
joypad->poll();
|
joypad->poll();
|
||||||
|
|
||||||
for (i = 0; i < MAX_PLAYERS; i++)
|
for (i = 0; i < g_settings.input.max_users; i++)
|
||||||
{
|
{
|
||||||
for (b = 0; b < MENU_MAX_BUTTONS; b++)
|
for (b = 0; b < MENU_MAX_BUTTONS; b++)
|
||||||
state->state[i].buttons[b] = input_joypad_button_raw(joypad, i, b);
|
state->state[i].buttons[b] = input_joypad_button_raw(joypad, i, b);
|
||||||
|
@ -206,7 +206,7 @@ void menu_poll_bind_get_rested_axes(struct menu_bind_state *state)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < MAX_PLAYERS; i++)
|
for (i = 0; i < g_settings.input.max_users; i++)
|
||||||
for (a = 0; a < MENU_MAX_AXES; a++)
|
for (a = 0; a < MENU_MAX_AXES; a++)
|
||||||
state->axis_state[i].rested_axes[a] =
|
state->axis_state[i].rested_axes[a] =
|
||||||
input_joypad_axis_raw(joypad, i, a);
|
input_joypad_axis_raw(joypad, i, a);
|
||||||
|
@ -290,7 +290,7 @@ bool menu_poll_find_trigger(struct menu_bind_state *state,
|
||||||
if (!state || !new_state)
|
if (!state || !new_state)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (i = 0; i < MAX_PLAYERS; i++)
|
for (i = 0; i < g_settings.input.max_users; i++)
|
||||||
{
|
{
|
||||||
if (menu_poll_find_trigger_pad(state, new_state, i))
|
if (menu_poll_find_trigger_pad(state, new_state, i))
|
||||||
{
|
{
|
||||||
|
|
|
@ -308,6 +308,9 @@
|
||||||
# Joypad driver. (Valid: linuxraw, sdl, dinput)
|
# Joypad driver. (Valid: linuxraw, sdl, dinput)
|
||||||
# input_joypad_driver =
|
# input_joypad_driver =
|
||||||
|
|
||||||
|
# Maximum amount of users supported by RetroArch.
|
||||||
|
# input_max_users = 16
|
||||||
|
|
||||||
# Keyboard layout for input driver if applicable (udev/evdev for now).
|
# Keyboard layout for input driver if applicable (udev/evdev for now).
|
||||||
# Syntax is either just layout (e.g. "no"), or a layout and variant separated with colon ("no:nodeadkeys").
|
# Syntax is either just layout (e.g. "no"), or a layout and variant separated with colon ("no:nodeadkeys").
|
||||||
# input_keyboard_layout =
|
# input_keyboard_layout =
|
||||||
|
|
|
@ -599,7 +599,7 @@ static inline retro_input_t input_keys_pressed(void)
|
||||||
(g_settings.input.analog_dpad_mode[0] == ANALOG_DPAD_NONE) ?
|
(g_settings.input.analog_dpad_mode[0] == ANALOG_DPAD_NONE) ?
|
||||||
ANALOG_DPAD_LSTICK : g_settings.input.analog_dpad_mode[0]);
|
ANALOG_DPAD_LSTICK : g_settings.input.analog_dpad_mode[0]);
|
||||||
|
|
||||||
for (i = 0; i < MAX_PLAYERS; i++)
|
for (i = 0; i < g_settings.input.max_users; i++)
|
||||||
{
|
{
|
||||||
input_push_analog_dpad(g_settings.input.autoconf_binds[i],
|
input_push_analog_dpad(g_settings.input.autoconf_binds[i],
|
||||||
g_settings.input.analog_dpad_mode[i]);
|
g_settings.input.analog_dpad_mode[i]);
|
||||||
|
@ -635,7 +635,7 @@ static inline retro_input_t input_keys_pressed(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
input_pop_analog_dpad((struct retro_keybind*)binds[0]);
|
input_pop_analog_dpad((struct retro_keybind*)binds[0]);
|
||||||
for (i = 0; i < MAX_PLAYERS; i++)
|
for (i = 0; i < g_settings.input.max_users; i++)
|
||||||
input_pop_analog_dpad(g_settings.input.autoconf_binds[i]);
|
input_pop_analog_dpad(g_settings.input.autoconf_binds[i]);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -730,7 +730,7 @@ int rarch_main_iterate(void)
|
||||||
driver_camera_poll();
|
driver_camera_poll();
|
||||||
|
|
||||||
/* Update binds for analog dpad modes. */
|
/* Update binds for analog dpad modes. */
|
||||||
for (i = 0; i < MAX_PLAYERS; i++)
|
for (i = 0; i < g_settings.input.max_users; i++)
|
||||||
{
|
{
|
||||||
if (!g_settings.input.analog_dpad_mode[i])
|
if (!g_settings.input.analog_dpad_mode[i])
|
||||||
continue;
|
continue;
|
||||||
|
@ -748,7 +748,7 @@ int rarch_main_iterate(void)
|
||||||
/* Run libretro for one frame. */
|
/* Run libretro for one frame. */
|
||||||
pretro_run();
|
pretro_run();
|
||||||
|
|
||||||
for (i = 0; i < MAX_PLAYERS; i++)
|
for (i = 0; i < g_settings.input.max_users; i++)
|
||||||
{
|
{
|
||||||
if (!g_settings.input.analog_dpad_mode[i])
|
if (!g_settings.input.analog_dpad_mode[i])
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -445,6 +445,7 @@ static void config_set_defaults(void)
|
||||||
g_settings.input.autoconfig_descriptor_label_show = true;
|
g_settings.input.autoconfig_descriptor_label_show = true;
|
||||||
g_settings.input.input_descriptor_label_show = input_descriptor_label_show;
|
g_settings.input.input_descriptor_label_show = input_descriptor_label_show;
|
||||||
g_settings.input.input_descriptor_hide_unbound = input_descriptor_hide_unbound;
|
g_settings.input.input_descriptor_hide_unbound = input_descriptor_hide_unbound;
|
||||||
|
g_settings.input.max_users = MAX_PLAYERS;
|
||||||
|
|
||||||
rarch_assert(sizeof(g_settings.input.binds[0]) >= sizeof(retro_keybinds_1));
|
rarch_assert(sizeof(g_settings.input.binds[0]) >= sizeof(retro_keybinds_1));
|
||||||
rarch_assert(sizeof(g_settings.input.binds[1]) >= sizeof(retro_keybinds_rest));
|
rarch_assert(sizeof(g_settings.input.binds[1]) >= sizeof(retro_keybinds_rest));
|
||||||
|
@ -1005,6 +1006,7 @@ static bool config_load_file(const char *path, bool set_defaults)
|
||||||
CONFIG_GET_FLOAT(input.axis_threshold, "input_axis_threshold");
|
CONFIG_GET_FLOAT(input.axis_threshold, "input_axis_threshold");
|
||||||
CONFIG_GET_BOOL(input.netplay_client_swap_input,
|
CONFIG_GET_BOOL(input.netplay_client_swap_input,
|
||||||
"netplay_client_swap_input");
|
"netplay_client_swap_input");
|
||||||
|
CONFIG_GET_INT(input.max_users, "input_max_users");
|
||||||
CONFIG_GET_BOOL(input.input_descriptor_label_show,
|
CONFIG_GET_BOOL(input.input_descriptor_label_show,
|
||||||
"input_descriptor_label_show");
|
"input_descriptor_label_show");
|
||||||
CONFIG_GET_BOOL(input.input_descriptor_hide_unbound,
|
CONFIG_GET_BOOL(input.input_descriptor_hide_unbound,
|
||||||
|
@ -1571,6 +1573,7 @@ bool config_save_file(const char *path)
|
||||||
|
|
||||||
RARCH_LOG("Saving config at path: \"%s\"\n", path);
|
RARCH_LOG("Saving config at path: \"%s\"\n", path);
|
||||||
|
|
||||||
|
config_set_int(conf, "input_max_users", g_settings.input.max_users);
|
||||||
config_set_float(conf, "input_axis_threshold",
|
config_set_float(conf, "input_axis_threshold",
|
||||||
g_settings.input.axis_threshold);
|
g_settings.input.axis_threshold);
|
||||||
config_set_bool(conf, "netplay_client_swap_input",
|
config_set_bool(conf, "netplay_client_swap_input",
|
||||||
|
|
|
@ -589,13 +589,13 @@ static int setting_data_action_toggle_bind_device(void *data, unsigned action)
|
||||||
switch (action)
|
switch (action)
|
||||||
{
|
{
|
||||||
case MENU_ACTION_LEFT:
|
case MENU_ACTION_LEFT:
|
||||||
if ((*p) >= MAX_PLAYERS)
|
if ((*p) >= g_settings.input.max_users)
|
||||||
*p = MAX_PLAYERS - 1;
|
*p = g_settings.input.max_users - 1;
|
||||||
else if ((*p) > 0)
|
else if ((*p) > 0)
|
||||||
(*p)--;
|
(*p)--;
|
||||||
break;
|
break;
|
||||||
case MENU_ACTION_RIGHT:
|
case MENU_ACTION_RIGHT:
|
||||||
if (*p < MAX_PLAYERS)
|
if (*p < g_settings.input.max_users)
|
||||||
(*p)++;
|
(*p)++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2282,7 +2282,7 @@ static void get_string_representation_bind_device(void * data, char *type_str,
|
||||||
|
|
||||||
map = g_settings.input.joypad_map[setting->index_offset];
|
map = g_settings.input.joypad_map[setting->index_offset];
|
||||||
|
|
||||||
if (map < MAX_PLAYERS)
|
if (map < g_settings.input.max_users)
|
||||||
{
|
{
|
||||||
const char *device_name =
|
const char *device_name =
|
||||||
g_settings.input.device_names[map];
|
g_settings.input.device_names[map];
|
||||||
|
@ -4285,6 +4285,17 @@ static bool setting_data_append_list_input_options(
|
||||||
START_GROUP(group_info, "Input Options");
|
START_GROUP(group_info, "Input Options");
|
||||||
START_SUB_GROUP(list, list_info, "State", group_info.name, subgroup_info);
|
START_SUB_GROUP(list, list_info, "State", group_info.name, subgroup_info);
|
||||||
|
|
||||||
|
CONFIG_UINT(
|
||||||
|
g_settings.input.max_users,
|
||||||
|
"input_max_users",
|
||||||
|
"Max Users",
|
||||||
|
MAX_PLAYERS,
|
||||||
|
group_info.name,
|
||||||
|
subgroup_info.name,
|
||||||
|
general_write_handler,
|
||||||
|
general_read_handler);
|
||||||
|
settings_list_current_add_range(list, list_info, 1, MAX_PLAYERS, 1, true, true);
|
||||||
|
|
||||||
CONFIG_BOOL(
|
CONFIG_BOOL(
|
||||||
g_settings.input.autodetect_enable,
|
g_settings.input.autodetect_enable,
|
||||||
"input_autodetect_enable",
|
"input_autodetect_enable",
|
||||||
|
@ -4354,7 +4365,7 @@ static bool setting_data_append_list_input_options(
|
||||||
general_write_handler,
|
general_write_handler,
|
||||||
general_read_handler);
|
general_read_handler);
|
||||||
|
|
||||||
for (user = 0; user < MAX_PLAYERS; user ++)
|
for (user = 0; user < g_settings.input.max_users; user ++)
|
||||||
{
|
{
|
||||||
/* These constants match the string lengths.
|
/* These constants match the string lengths.
|
||||||
* Keep them up to date or you'll get some really obvious bugs.
|
* Keep them up to date or you'll get some really obvious bugs.
|
||||||
|
@ -4520,7 +4531,7 @@ static bool setting_data_append_list_input_options(
|
||||||
}
|
}
|
||||||
END_SUB_GROUP(list, list_info);
|
END_SUB_GROUP(list, list_info);
|
||||||
|
|
||||||
for (user = 0; user < MAX_PLAYERS; user++)
|
for (user = 0; user < g_settings.input.max_users; user++)
|
||||||
{
|
{
|
||||||
/* This constants matches the string length.
|
/* This constants matches the string length.
|
||||||
* Keep it up to date or you'll get some really obvious bugs.
|
* Keep it up to date or you'll get some really obvious bugs.
|
||||||
|
|
Loading…
Reference in New Issue