mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 12:32:52 +00:00
Don't limit available input devices to user count.
This commit is contained in:
parent
bc4bbe79aa
commit
0d189ae067
@ -26,6 +26,8 @@ RETRO_BEGIN_DECLS
|
||||
|
||||
#define MAX_USERS 16
|
||||
|
||||
#define MAX_INPUT_DEVICES 16
|
||||
|
||||
#define RARCH_FIRST_CUSTOM_BIND 16
|
||||
#define RARCH_FIRST_LIGHTGUN_BIND RARCH_ANALOG_BIND_LIST_END
|
||||
#define RARCH_FIRST_MISC_CUSTOM_BIND RARCH_LIGHTGUN_BIND_LIST_END
|
||||
|
@ -233,7 +233,7 @@ static const uint8_t buttons[] = {
|
||||
static uint16_t input_config_vid[MAX_USERS];
|
||||
static uint16_t input_config_pid[MAX_USERS];
|
||||
|
||||
char input_device_names[MAX_USERS][64];
|
||||
char input_device_names[MAX_INPUT_DEVICES][64];
|
||||
struct retro_keybind input_config_binds[MAX_USERS][RARCH_BIND_LIST_END];
|
||||
struct retro_keybind input_autoconf_binds[MAX_USERS][RARCH_BIND_LIST_END];
|
||||
const struct retro_keybind *libretro_input_binds[MAX_USERS];
|
||||
@ -2691,6 +2691,18 @@ void input_config_get_bind_string(char *buf, const struct retro_keybind *bind,
|
||||
strlcat(buf, "---", size);
|
||||
}
|
||||
|
||||
unsigned input_config_get_device_count()
|
||||
{
|
||||
unsigned num_devices;
|
||||
for ( num_devices = 0; num_devices < MAX_INPUT_DEVICES; ++num_devices )
|
||||
{
|
||||
const char *device_name = input_config_get_device_name(num_devices);
|
||||
if ( string_is_empty(device_name) )
|
||||
break;
|
||||
}
|
||||
return num_devices;
|
||||
}
|
||||
|
||||
const char *input_config_get_device_name(unsigned port)
|
||||
{
|
||||
if (string_is_empty(input_device_names[port]))
|
||||
|
@ -761,6 +761,8 @@ void input_config_set_device_name(unsigned port, const char *name);
|
||||
|
||||
void input_config_clear_device_name(unsigned port);
|
||||
|
||||
unsigned input_config_get_device_count();
|
||||
|
||||
unsigned *input_config_get_device_ptr(unsigned port);
|
||||
|
||||
unsigned input_config_get_device(unsigned port);
|
||||
|
@ -1305,7 +1305,7 @@ static int setting_action_left_bind_device(void *data, bool wraparound)
|
||||
{
|
||||
unsigned index_offset;
|
||||
unsigned *p = NULL;
|
||||
unsigned max_users = *(input_driver_get_uint(INPUT_ACTION_MAX_USERS));
|
||||
unsigned max_devices = input_config_get_device_count();
|
||||
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
@ -1316,8 +1316,8 @@ static int setting_action_left_bind_device(void *data, bool wraparound)
|
||||
|
||||
p = &settings->uints.input_joypad_map[index_offset];
|
||||
|
||||
if ((*p) >= max_users)
|
||||
*p = max_users - 1;
|
||||
if ((*p) >= max_devices)
|
||||
*p = max_devices - 1;
|
||||
else if ((*p) > 0)
|
||||
(*p)--;
|
||||
|
||||
@ -1328,7 +1328,7 @@ static int setting_action_right_bind_device(void *data, bool wraparound)
|
||||
{
|
||||
unsigned index_offset;
|
||||
unsigned *p = NULL;
|
||||
unsigned max_users = *(input_driver_get_uint(INPUT_ACTION_MAX_USERS));
|
||||
unsigned max_devices = input_config_get_device_count();
|
||||
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
@ -1339,7 +1339,7 @@ static int setting_action_right_bind_device(void *data, bool wraparound)
|
||||
|
||||
p = &settings->uints.input_joypad_map[index_offset];
|
||||
|
||||
if (*p < max_users)
|
||||
if (*p < max_devices)
|
||||
(*p)++;
|
||||
|
||||
return 0;
|
||||
@ -1497,7 +1497,7 @@ static void get_string_representation_bind_device(void * data, char *s,
|
||||
size_t len)
|
||||
{
|
||||
unsigned index_offset, map = 0;
|
||||
unsigned max_users = *(input_driver_get_uint(INPUT_ACTION_MAX_USERS));
|
||||
unsigned max_devices = input_config_get_device_count();
|
||||
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
@ -1507,7 +1507,7 @@ static void get_string_representation_bind_device(void * data, char *s,
|
||||
index_offset = setting->index_offset;
|
||||
map = settings->uints.input_joypad_map[index_offset];
|
||||
|
||||
if (map < max_users)
|
||||
if (map < max_devices)
|
||||
{
|
||||
const char *device_name = input_config_get_device_name(map);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user