mirror of
https://github.com/libretro/RetroArch.git
synced 2025-04-02 10:51:52 -04:00
Move pid/vid arrays out of settings struct and move them
to input_config
This commit is contained in:
parent
690b729474
commit
c871faa1f5
6 changed files with 60 additions and 15 deletions
|
@ -1165,6 +1165,7 @@ static void config_set_defaults(void)
|
||||||
memcpy(settings->input.binds[i], retro_keybinds_rest,
|
memcpy(settings->input.binds[i], retro_keybinds_rest,
|
||||||
sizeof(retro_keybinds_rest));
|
sizeof(retro_keybinds_rest));
|
||||||
|
|
||||||
|
input_config_reset();
|
||||||
input_remapping_set_defaults();
|
input_remapping_set_defaults();
|
||||||
input_autoconfigure_reset();
|
input_autoconfigure_reset();
|
||||||
|
|
||||||
|
@ -2874,15 +2875,18 @@ bool config_save_autoconf_profile(const char *path, unsigned user)
|
||||||
unsigned i;
|
unsigned i;
|
||||||
char buf[PATH_MAX_LENGTH];
|
char buf[PATH_MAX_LENGTH];
|
||||||
char autoconf_file[PATH_MAX_LENGTH];
|
char autoconf_file[PATH_MAX_LENGTH];
|
||||||
|
int32_t pid_user = 0;
|
||||||
|
int32_t vid_user = 0;
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
config_file_t *conf = NULL;
|
config_file_t *conf = NULL;
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
const char *autoconf_dir = settings->directory.autoconfig;
|
const char *autoconf_dir = settings->directory.autoconfig;
|
||||||
|
const char *joypad_ident = settings->input.joypad_driver;
|
||||||
|
|
||||||
buf[0] = autoconf_file[0] = '\0';
|
buf[0] = autoconf_file[0] = '\0';
|
||||||
|
|
||||||
fill_pathname_join(buf, autoconf_dir,
|
fill_pathname_join(buf, autoconf_dir,
|
||||||
settings->input.joypad_driver, sizeof(buf));
|
joypad_ident, sizeof(buf));
|
||||||
|
|
||||||
if(path_is_directory(buf))
|
if(path_is_directory(buf))
|
||||||
{
|
{
|
||||||
|
@ -2914,17 +2918,19 @@ bool config_save_autoconf_profile(const char *path, unsigned user)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
config_set_string(conf, "input_driver",
|
config_set_string(conf, "input_driver", joypad_ident);
|
||||||
settings->input.joypad_driver);
|
|
||||||
config_set_string(conf, "input_device",
|
config_set_string(conf, "input_device",
|
||||||
input_config_get_device_name(user));
|
input_config_get_device_name(user));
|
||||||
|
|
||||||
if(settings->input.vid[user] && settings->input.pid[user])
|
pid_user = input_config_get_pid(user);
|
||||||
|
vid_user = input_config_get_vid(user);
|
||||||
|
|
||||||
|
if(pid_user && vid_user)
|
||||||
{
|
{
|
||||||
config_set_int(conf, "input_vendor_id",
|
config_set_int(conf, "input_vendor_id",
|
||||||
settings->input.vid[user]);
|
vid_user);
|
||||||
config_set_int(conf, "input_product_id",
|
config_set_int(conf, "input_product_id",
|
||||||
settings->input.pid[user]);
|
pid_user);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < RARCH_FIRST_META_KEY; i++)
|
for (i = 0; i < RARCH_FIRST_META_KEY; i++)
|
||||||
|
|
|
@ -285,9 +285,6 @@ typedef struct settings
|
||||||
/* Set by autoconfiguration in joypad_autoconfig_dir.
|
/* Set by autoconfiguration in joypad_autoconfig_dir.
|
||||||
* Does not override main binds. */
|
* Does not override main binds. */
|
||||||
bool swap_override;
|
bool swap_override;
|
||||||
int vid[MAX_USERS];
|
|
||||||
int pid[MAX_USERS];
|
|
||||||
|
|
||||||
unsigned libretro_device[MAX_USERS];
|
unsigned libretro_device[MAX_USERS];
|
||||||
unsigned analog_dpad_mode[MAX_USERS];
|
unsigned analog_dpad_mode[MAX_USERS];
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,9 @@ static const char *bind_user_prefix[MAX_USERS] = {
|
||||||
"input_player16",
|
"input_player16",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int input_config_vid[MAX_USERS];
|
||||||
|
static int input_config_pid[MAX_USERS];
|
||||||
|
|
||||||
#define DECLARE_BIND(x, bind, desc) { true, 0, #x, desc, bind }
|
#define DECLARE_BIND(x, bind, desc) { true, 0, #x, desc, bind }
|
||||||
#define DECLARE_META_BIND(level, x, bind, desc) { true, level, #x, desc, bind }
|
#define DECLARE_META_BIND(level, x, bind, desc) { true, level, #x, desc, bind }
|
||||||
|
|
||||||
|
@ -532,3 +535,33 @@ const struct retro_keybind *input_config_get_bind_auto(unsigned port, unsigned i
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void input_config_set_pid(unsigned port, unsigned pid)
|
||||||
|
{
|
||||||
|
input_config_pid[port] = pid;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t input_config_get_pid(unsigned port)
|
||||||
|
{
|
||||||
|
return input_config_pid[port];
|
||||||
|
}
|
||||||
|
|
||||||
|
void input_config_set_vid(unsigned port, unsigned vid)
|
||||||
|
{
|
||||||
|
input_config_vid[port] = vid;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t input_config_get_vid(unsigned port)
|
||||||
|
{
|
||||||
|
return input_config_vid[port];
|
||||||
|
}
|
||||||
|
|
||||||
|
void input_config_reset(void)
|
||||||
|
{
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
|
for (i = 0; i < MAX_USERS; i++)
|
||||||
|
{
|
||||||
|
input_config_vid[i] = 0;
|
||||||
|
input_config_pid[i] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -77,4 +77,14 @@ const char *input_config_get_device_name(unsigned port);
|
||||||
|
|
||||||
const struct retro_keybind *input_config_get_bind_auto(unsigned port, unsigned id);
|
const struct retro_keybind *input_config_get_bind_auto(unsigned port, unsigned id);
|
||||||
|
|
||||||
|
void input_config_set_pid(unsigned port, unsigned pid);
|
||||||
|
|
||||||
|
int32_t input_config_get_pid(unsigned port);
|
||||||
|
|
||||||
|
void input_config_set_vid(unsigned port, unsigned vid);
|
||||||
|
|
||||||
|
int32_t input_config_get_vid(unsigned port);
|
||||||
|
|
||||||
|
void input_config_reset(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -654,8 +654,9 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info)
|
||||||
MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY,
|
MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY,
|
||||||
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||||
snprintf(tmp, sizeof(tmp), "Port #%d device VID/PID: %d/%d",
|
snprintf(tmp, sizeof(tmp), "Port #%d device VID/PID: %d/%d",
|
||||||
controller, settings->input.vid[controller],
|
controller,
|
||||||
settings->input.pid[controller]);
|
input_config_get_vid(controller),
|
||||||
|
input_config_get_pid(controller));
|
||||||
menu_entries_append_enum(info->list, tmp, "",
|
menu_entries_append_enum(info->list, tmp, "",
|
||||||
MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY,
|
MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY,
|
||||||
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||||
|
|
|
@ -467,10 +467,8 @@ bool input_autoconfigure_connect(
|
||||||
state->max_users = settings->input.max_users;
|
state->max_users = settings->input.max_users;
|
||||||
|
|
||||||
input_config_set_device_name(state->idx, state->name);
|
input_config_set_device_name(state->idx, state->name);
|
||||||
|
input_config_set_pid(state->idx, state->pid);
|
||||||
configuration_set_int(settings, settings->input.pid[state->idx], state->pid);
|
input_config_set_vid(state->idx, state->vid);
|
||||||
configuration_set_int(settings, settings->input.vid[state->idx], state->vid);
|
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; i < RARCH_BIND_LIST_END; i++)
|
for (i = 0; i < RARCH_BIND_LIST_END; i++)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue