mirror of
https://github.com/libretro/RetroArch
synced 2025-02-28 12:40:23 +00:00
Refactor input_try_autoconfigure_joypad - certain pads (like Xarcade
Tankstick) have two player pads on one device and have separate buttons/keys per pad - so we need to query first for a name with the 'index' appended at the end - and a more generic 'name' afterwards
This commit is contained in:
parent
7730e872f8
commit
5f42c1281b
@ -1186,31 +1186,42 @@ static bool input_try_autoconfigure_joypad_from_conf(config_file_t *conf, unsign
|
|||||||
if (!conf)
|
if (!conf)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
char ident[1024];
|
char ident[1024], ident_idx[1024];
|
||||||
char input_driver[1024];
|
char input_driver[1024];
|
||||||
|
bool cond_found_idx, cond_found_general;
|
||||||
|
|
||||||
*ident = *input_driver = '\0';
|
*ident = *input_driver = '\0';
|
||||||
|
|
||||||
config_get_array(conf, "input_device", ident, sizeof(ident));
|
config_get_array(conf, "input_device", ident, sizeof(ident));
|
||||||
config_get_array(conf, "input_driver", input_driver, sizeof(input_driver));
|
config_get_array(conf, "input_driver", input_driver, sizeof(input_driver));
|
||||||
|
|
||||||
if (!strcmp(ident, name) && !strcmp(driver, input_driver))
|
snprintf(ident_idx, sizeof(ident_idx), "%s_p%d", ident, index);
|
||||||
{
|
|
||||||
g_settings.input.autoconfigured[index] = true;
|
|
||||||
input_autoconfigure_joypad_conf(conf, g_settings.input.autoconf_binds[index]);
|
|
||||||
|
|
||||||
char msg[512];
|
RARCH_LOG("ident_idx: %s\n", ident_idx);
|
||||||
snprintf(msg, sizeof(msg), "Joypad port #%u (%s) configured.",
|
|
||||||
index, name);
|
|
||||||
|
|
||||||
if (!block_osd_spam)
|
cond_found_idx = !strcmp(ident_idx, name);
|
||||||
msg_queue_push(g_extern.msg_queue, msg, 0, 60);
|
cond_found_general = !strcmp(ident, name) && !strcmp(driver, input_driver);
|
||||||
RARCH_LOG("%s\n", msg);
|
|
||||||
|
|
||||||
return true;
|
if (cond_found_idx)
|
||||||
}
|
goto found;
|
||||||
|
else if (cond_found_general)
|
||||||
|
goto found;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
found:
|
||||||
|
g_settings.input.autoconfigured[index] = true;
|
||||||
|
input_autoconfigure_joypad_conf(conf, g_settings.input.autoconf_binds[index]);
|
||||||
|
|
||||||
|
char msg[512];
|
||||||
|
snprintf(msg, sizeof(msg), "Joypad port #%u (%s) configured.",
|
||||||
|
index, name);
|
||||||
|
|
||||||
|
if (!block_osd_spam)
|
||||||
|
msg_queue_push(g_extern.msg_queue, msg, 0, 60);
|
||||||
|
RARCH_LOG("%s\n", msg);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void input_config_autoconfigure_joypad(unsigned index, const char *name, const char *driver)
|
void input_config_autoconfigure_joypad(unsigned index, const char *name, const char *driver)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user