Merge pull request #2022 from fr500/master

Allow binding remotes and P1 on the same port
This commit is contained in:
Twinaphex 2015-08-01 08:29:28 +02:00
commit d22bec3b3b
4 changed files with 48 additions and 14 deletions

View File

@ -1712,13 +1712,13 @@ static bool config_load_file(const char *path, bool set_defaults)
if (!config_get_path(conf, "system_directory", if (!config_get_path(conf, "system_directory",
settings->system_directory, sizeof(settings->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'; *settings->system_directory = '\0';
} }
if (!strcmp(settings->system_directory, "default")) 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'; *settings->system_directory = '\0';
} }

View File

@ -754,7 +754,7 @@ bool rarch_environment_cb(unsigned cmd, void *data)
case RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY: case RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY:
if (!settings->system_directory || settings->system_directory[0] == '\0') 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, fill_pathname_basedir(buf, global->path.fullpath,
sizeof(buf)); sizeof(buf));

View File

@ -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*/ /* If built-in shield controller is detected bind the virtual and gpio devices to the same port*/
*port = 0; *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 ( else if (
strstr(device_name, "PLAYSTATION(R)3") || strstr(device_name, "PLAYSTATION(R)3") ||

View File

@ -37,6 +37,7 @@ enum
AUTODETECT_MATCH_NAME AUTODETECT_MATCH_NAME
}; };
#endif #endif
bool remote_is_bound = false;
static void input_autoconfigure_joypad_conf(config_file_t *conf, static void input_autoconfigure_joypad_conf(config_file_t *conf,
struct retro_keybind *binds) struct retro_keybind *binds)
@ -112,10 +113,12 @@ static void input_autoconfigure_joypad_add(
autoconfig_params_t *params) autoconfig_params_t *params)
{ {
char msg[PATH_MAX_LENGTH] = {0}; 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(); 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. /* This will be the case if input driver is reinitialized.
* No reason to spam autoconfigure messages every time. */ * No reason to spam autoconfigure messages every time. */
@ -129,15 +132,26 @@ static void input_autoconfigure_joypad_add(
input_autoconfigure_joypad_conf(conf, input_autoconfigure_joypad_conf(conf,
settings->input.autoconf_binds[params->idx]); settings->input.autoconf_binds[params->idx]);
if (buf[0] != '\0' || strcmp(buf, "")) if (!strcmp(device_type,"remote"))
snprintf(msg, sizeof(msg), "%s configured in port #%u.", {
buf, params->idx); snprintf(msg, sizeof(msg), "%s configured",
else params->name, params->idx);
snprintf(msg, sizeof(msg), "%s configured in port #%u.",
params->name, params->idx); if(!remote_is_bound)
if (!block_osd_spam)
rarch_main_msg_queue_push(msg, 0, 60, false); 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); RARCH_LOG("%s\n", msg);
} }