mirror of
https://github.com/libretro/RetroArch
synced 2025-03-25 16:44:01 +00:00
Merge pull request #2022 from fr500/master
Allow binding remotes and P1 on the same port
This commit is contained in:
commit
d22bec3b3b
@ -1712,13 +1712,13 @@ static bool config_load_file(const char *path, bool set_defaults)
|
||||
if (!config_get_path(conf, "system_directory",
|
||||
settings->system_directory, sizeof(settings->system_directory)))
|
||||
{
|
||||
RARCH_WARN("SYSTEM DIR is empty, fill assume CONTENT DIR\n");
|
||||
RARCH_WARN("SYSTEM DIR is empty, assume CONTENT DIR\n");
|
||||
*settings->system_directory = '\0';
|
||||
}
|
||||
|
||||
if (!strcmp(settings->system_directory, "default"))
|
||||
{
|
||||
RARCH_WARN("SYSTEM DIR is empty, fill assume CONTENT DIR\n");
|
||||
RARCH_WARN("SYSTEM DIR is empty, assume CONTENT DIR\n");
|
||||
*settings->system_directory = '\0';
|
||||
}
|
||||
|
||||
|
@ -754,7 +754,7 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
||||
case RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY:
|
||||
if (!settings->system_directory || settings->system_directory[0] == '\0')
|
||||
{
|
||||
RARCH_WARN("SYSTEM DIR is empty, fill assume CONTENT DIR %s\n",global->path.fullpath);
|
||||
RARCH_WARN("SYSTEM DIR is empty, assume CONTENT DIR %s\n",global->path.fullpath);
|
||||
fill_pathname_basedir(buf, global->path.fullpath,
|
||||
sizeof(buf));
|
||||
|
||||
|
@ -654,7 +654,27 @@ static void handle_hotplug(android_input_t *android,
|
||||
{
|
||||
/* If built-in shield controller is detected bind the virtual and gpio devices to the same port*/
|
||||
*port = 0;
|
||||
strlcpy(name_buf, "Generic GPIO Device", sizeof(name_buf));
|
||||
strlcpy(name_buf, "Generic I/O Device", sizeof(name_buf));
|
||||
}
|
||||
else if (strstr(device_name, "Amazon Fire TV Remote")
|
||||
|| strstr(device_name, "Nexus Remote")
|
||||
|| strstr(device_name, "SHIELD Remote"))
|
||||
{
|
||||
/* hack for remote control type devices, set them always to port 0 */
|
||||
*port = 0;
|
||||
strlcpy(name_buf, device_name, sizeof(name_buf));
|
||||
}
|
||||
else if ( *port==1 && ( strstr(android->pad_states[0].name,"Amazon Fire TV Remote")
|
||||
|| strstr(android->pad_states[0].name,"Nexus Remote")
|
||||
|| strstr(android->pad_states[0].name,"SHIELD Remote")))
|
||||
{
|
||||
/* and then when we are binding a new controller in port 1 and one of those remotes
|
||||
* was bound to port 0, bind the device as port 0 too, it causes all the controllers to
|
||||
* rebind on the first button press but at least the remotes can be used to navigate
|
||||
* the user interface
|
||||
*/
|
||||
*port = 0;
|
||||
strlcpy(name_buf, device_name, sizeof(name_buf));
|
||||
}
|
||||
else if (
|
||||
strstr(device_name, "PLAYSTATION(R)3") ||
|
||||
|
@ -37,6 +37,7 @@ enum
|
||||
AUTODETECT_MATCH_NAME
|
||||
};
|
||||
#endif
|
||||
bool remote_is_bound = false;
|
||||
|
||||
static void input_autoconfigure_joypad_conf(config_file_t *conf,
|
||||
struct retro_keybind *binds)
|
||||
@ -112,10 +113,12 @@ static void input_autoconfigure_joypad_add(
|
||||
autoconfig_params_t *params)
|
||||
{
|
||||
char msg[PATH_MAX_LENGTH] = {0};
|
||||
char buf[PATH_MAX_LENGTH] = {0};
|
||||
char display_name[PATH_MAX_LENGTH] = {0};
|
||||
char device_type[PATH_MAX_LENGTH] = {0};
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
config_get_array(conf, "input_display_name", buf, sizeof(buf));
|
||||
config_get_array(conf, "input_device_display_name", display_name, sizeof(display_name));
|
||||
config_get_array(conf, "input_device_type", device_type, sizeof(device_type));
|
||||
|
||||
/* This will be the case if input driver is reinitialized.
|
||||
* No reason to spam autoconfigure messages every time. */
|
||||
@ -129,15 +132,26 @@ static void input_autoconfigure_joypad_add(
|
||||
input_autoconfigure_joypad_conf(conf,
|
||||
settings->input.autoconf_binds[params->idx]);
|
||||
|
||||
if (buf[0] != '\0' || strcmp(buf, ""))
|
||||
snprintf(msg, sizeof(msg), "%s configured in port #%u.",
|
||||
buf, params->idx);
|
||||
else
|
||||
snprintf(msg, sizeof(msg), "%s configured in port #%u.",
|
||||
params->name, params->idx);
|
||||
|
||||
if (!block_osd_spam)
|
||||
if (!strcmp(device_type,"remote"))
|
||||
{
|
||||
snprintf(msg, sizeof(msg), "%s configured",
|
||||
params->name, params->idx);
|
||||
|
||||
if(!remote_is_bound)
|
||||
rarch_main_msg_queue_push(msg, 0, 60, false);
|
||||
remote_is_bound = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (display_name[0] != '\0' || strcmp(display_name, ""))
|
||||
snprintf(msg, sizeof(msg), "%s configured in port #%u.",
|
||||
display_name, params->idx);
|
||||
else
|
||||
snprintf(msg, sizeof(msg), "%s configured in port #%u.",
|
||||
params->name, params->idx);
|
||||
if (!block_osd_spam)
|
||||
rarch_main_msg_queue_push(msg, 0, 60, false);
|
||||
}
|
||||
|
||||
RARCH_LOG("%s\n", msg);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user