mirror of
https://github.com/libretro/RetroArch.git
synced 2025-04-02 10:51:52 -04:00
Move input.device_name_index to task_autodetect and move it
outside of settings struct
This commit is contained in:
parent
c871faa1f5
commit
f4e5f896a2
5 changed files with 20 additions and 16 deletions
|
@ -292,7 +292,6 @@ typedef struct settings
|
|||
float axis_threshold;
|
||||
unsigned joypad_map[MAX_USERS];
|
||||
unsigned device[MAX_USERS];
|
||||
unsigned device_name_index[MAX_USERS];
|
||||
bool autodetect_enable;
|
||||
|
||||
unsigned turbo_period;
|
||||
|
|
|
@ -648,8 +648,9 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info)
|
|||
if (input_is_autoconfigured(controller))
|
||||
{
|
||||
snprintf(tmp, sizeof(tmp), "Port #%d device name: %s (#%d)",
|
||||
controller, input_config_get_device_name(controller),
|
||||
settings->input.device_name_index[controller]);
|
||||
controller,
|
||||
input_config_get_device_name(controller),
|
||||
input_autoconfigure_get_device_name_index(controller));
|
||||
menu_entries_append_enum(info->list, tmp, "",
|
||||
MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY,
|
||||
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||
|
|
|
@ -1430,7 +1430,7 @@ static void get_string_representation_bind_device(void * data, char *s,
|
|||
snprintf(s, len,
|
||||
"%s (#%u)",
|
||||
device_name,
|
||||
settings->input.device_name_index[map]);
|
||||
input_autoconfigure_get_device_name_index(map));
|
||||
else
|
||||
snprintf(s, len,
|
||||
"%s (%s #%u)",
|
||||
|
|
|
@ -52,18 +52,16 @@ typedef struct autoconfig_params
|
|||
|
||||
static bool input_autoconfigured[MAX_USERS];
|
||||
static struct retro_keybind input_autoconf_binds[MAX_USERS][RARCH_BIND_LIST_END];
|
||||
static unsigned input_device_name_index[MAX_USERS];
|
||||
|
||||
/* Adds an index for devices with the same name,
|
||||
* so they can be identified in the GUI. */
|
||||
static void input_autoconfigure_joypad_reindex_devices(autoconfig_params_t *params)
|
||||
{
|
||||
unsigned i;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
for(i = 0; i < params->max_users; i++)
|
||||
{
|
||||
configuration_set_uint(settings, settings->input.device_name_index[i], 0);
|
||||
}
|
||||
input_device_name_index[i] = 0;
|
||||
|
||||
for(i = 0; i < params->max_users; i++)
|
||||
{
|
||||
|
@ -74,11 +72,8 @@ static void input_autoconfigure_joypad_reindex_devices(autoconfig_params_t *para
|
|||
for(j = 0; j < params->max_users; j++)
|
||||
{
|
||||
if(string_is_equal(tmp, input_config_get_device_name(j))
|
||||
&& settings->input.device_name_index[i] == 0)
|
||||
{
|
||||
configuration_set_uint(settings, settings->input.device_name_index[j], k);
|
||||
k++;
|
||||
}
|
||||
&& input_device_name_index[i] == 0)
|
||||
input_device_name_index[j] = k++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -421,7 +416,8 @@ void input_autoconfigure_reset(void)
|
|||
input_autoconf_binds[i][j].joykey = NO_BTN;
|
||||
input_autoconf_binds[i][j].joyaxis = AXIS_NONE;
|
||||
}
|
||||
input_autoconfigured[i] = 0;
|
||||
input_device_name_index[i] = 0;
|
||||
input_autoconfigured[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -430,6 +426,11 @@ bool input_is_autoconfigured(unsigned i)
|
|||
return input_autoconfigured[i];
|
||||
}
|
||||
|
||||
unsigned input_autoconfigure_get_device_name_index(unsigned i)
|
||||
{
|
||||
return input_device_name_index[i];
|
||||
}
|
||||
|
||||
bool input_autoconfigure_connect(
|
||||
const char *name,
|
||||
const char *display_name,
|
||||
|
@ -442,6 +443,7 @@ bool input_autoconfigure_connect(
|
|||
retro_task_t *task = (retro_task_t*)calloc(1, sizeof(*task));
|
||||
autoconfig_params_t *state = (autoconfig_params_t*)calloc(1, sizeof(*state));
|
||||
settings_t *settings = config_get_ptr();
|
||||
const char *dir_autoconf = settings->directory.autoconfig;
|
||||
|
||||
if (!task || !state || !settings->input.autodetect_enable)
|
||||
goto error;
|
||||
|
@ -456,9 +458,9 @@ bool input_autoconfigure_connect(
|
|||
if (!string_is_empty(driver))
|
||||
strlcpy(state->driver, driver, sizeof(state->driver));
|
||||
|
||||
if (!string_is_empty(settings->directory.autoconfig))
|
||||
if (!string_is_empty(dir_autoconf))
|
||||
strlcpy(state->autoconfig_directory,
|
||||
settings->directory.autoconfig,
|
||||
dir_autoconf,
|
||||
sizeof(state->autoconfig_directory));
|
||||
|
||||
state->idx = idx;
|
||||
|
|
|
@ -226,6 +226,8 @@ input_autoconfigure_get_specific_bind(unsigned i, unsigned j);
|
|||
|
||||
struct retro_keybind *input_autoconfigure_get_binds(unsigned i);
|
||||
|
||||
unsigned input_autoconfigure_get_device_name_index(unsigned i);
|
||||
|
||||
void input_autoconfigure_reset(void);
|
||||
|
||||
bool input_autoconfigure_connect(
|
||||
|
|
Loading…
Add table
Reference in a new issue