This commit is contained in:
twinaphex 2016-02-05 14:06:43 +01:00
parent 188029373f
commit 8fc2a05a70
4 changed files with 38 additions and 19 deletions

View File

@ -108,7 +108,8 @@ static int input_try_autoconfigure_joypad_from_conf(config_file_t *conf,
} }
else else
{ {
if (!string_is_empty(ident) && !strncmp(params->name, ident, strlen(ident))) if (!string_is_empty(ident)
&& !strncmp(params->name, ident, strlen(ident)))
{ {
score += 1; score += 1;
#if 0 #if 0
@ -117,12 +118,14 @@ static int input_try_autoconfigure_joypad_from_conf(config_file_t *conf,
} }
} }
#if 0 #if 0
RARCH_LOG("Autodetect: configuration file: %s score: %d\n", conf->path, score); RARCH_LOG("Autodetect: configuration file: %s score: %d\n",
conf->path, score);
#endif #endif
return score; return score;
} }
static void input_autoconfigure_joypad_add(config_file_t *conf, autoconfig_params_t *params) static void input_autoconfigure_joypad_add(config_file_t *conf,
autoconfig_params_t *params)
{ {
bool block_osd_spam; bool block_osd_spam;
static bool remote_is_bound = false; static bool remote_is_bound = false;
@ -131,8 +134,10 @@ static void input_autoconfigure_joypad_add(config_file_t *conf, autoconfig_param
char device_type[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_device_display_name", display_name, sizeof(display_name)); config_get_array(conf, "input_device_display_name",
config_get_array(conf, "input_device_type", device_type, sizeof(device_type)); display_name, sizeof(display_name));
config_get_array(conf, "input_device_type", device_type,
sizeof(device_type));
if (!settings) if (!settings)
return; return;
@ -213,7 +218,8 @@ static bool input_autoconfigure_joypad_from_conf_dir(
list = dir_list_new(path, "cfg", false, false); list = dir_list_new(path, "cfg", false, false);
if (!list || !list->size) if (!list || !list->size)
list = dir_list_new(settings->input.autoconfig_dir, "cfg", false, false); list = dir_list_new(settings->input.autoconfig_dir,
"cfg", false, false);
if(!list) if(!list)
return false; return false;
@ -323,8 +329,10 @@ bool input_config_autoconfigure_joypad(autoconfig_params_t *params)
{ {
char msg[PATH_MAX_LENGTH]; char msg[PATH_MAX_LENGTH];
RARCH_LOG("Autodetect: no profiles found for %s (%d/%d)", params->name, params->vid, params->pid); RARCH_LOG("Autodetect: no profiles found for %s (%d/%d)",
snprintf(msg, sizeof(msg), "%s (%ld/%ld) not configured", params->name, (long)params->vid, (long)params->pid); params->name, params->vid, params->pid);
snprintf(msg, sizeof(msg), "%s (%ld/%ld) not configured",
params->name, (long)params->vid, (long)params->pid);
runloop_msg_queue_push(msg, 0, 60, false); runloop_msg_queue_push(msg, 0, 60, false);
} }
return ret; return ret;

View File

@ -40,7 +40,7 @@ static hid_driver_t *hid_drivers[] = {
NULL, NULL,
}; };
static const void *hid_data; static const void *hid_data = NULL;
/** /**
* hid_driver_find_handle: * hid_driver_find_handle:

View File

@ -70,8 +70,8 @@ typedef struct input_overlay_state
uint32_t keys[RETROK_LAST / 32 + 1]; uint32_t keys[RETROK_LAST / 32 + 1];
} input_overlay_state_t; } input_overlay_state_t;
static input_overlay_t *overlay_ptr;
static input_overlay_state_t overlay_st_ptr; static input_overlay_state_t overlay_st_ptr;
static input_overlay_t *overlay_ptr = NULL;
/** /**
* input_overlay_scale: * input_overlay_scale:

View File

@ -45,8 +45,11 @@ bool input_remapping_load_file(void *data, const char *path)
{ {
char buf[64] = {0}; char buf[64] = {0};
char key_ident[RARCH_FIRST_CUSTOM_BIND + 4][128] = {{0}}; char key_ident[RARCH_FIRST_CUSTOM_BIND + 4][128] = {{0}};
char key_strings[RARCH_FIRST_CUSTOM_BIND + 4][128] = { "b", "y", "select", "start", char key_strings[RARCH_FIRST_CUSTOM_BIND + 4][128] =
"up", "down", "left", "right", "a", "x", "l", "r", "l2", "r2", "l3", "r3", "l_x", "l_y", "r_x", "r_y" }; { "b", "y", "select", "start",
"up", "down", "left", "right",
"a", "x", "l", "r", "l2", "r2",
"l3", "r3", "l_x", "l_y", "r_x", "r_y" };
snprintf(buf, sizeof(buf), "input_player%u", i + 1); snprintf(buf, sizeof(buf), "input_player%u", i + 1);
@ -54,8 +57,10 @@ bool input_remapping_load_file(void *data, const char *path)
{ {
int key_remap = -1; int key_remap = -1;
fill_pathname_join_delim(key_ident[j], buf, key_strings[j], '_', sizeof(key_ident[j])); fill_pathname_join_delim(key_ident[j], buf,
if (config_get_int(conf, key_ident[j], &key_remap) && key_remap < RARCH_FIRST_CUSTOM_BIND) key_strings[j], '_', sizeof(key_ident[j]));
if (config_get_int(conf, key_ident[j], &key_remap)
&& key_remap < RARCH_FIRST_CUSTOM_BIND)
settings->input.remap_ids[i][j] = key_remap; settings->input.remap_ids[i][j] = key_remap;
} }
@ -69,8 +74,10 @@ bool input_remapping_load_file(void *data, const char *path)
buf, buf,
key_strings[RARCH_FIRST_CUSTOM_BIND + j]); key_strings[RARCH_FIRST_CUSTOM_BIND + j]);
if (config_get_int(conf, key_ident[RARCH_FIRST_CUSTOM_BIND + j], &key_remap) && (key_remap < 4)) if (config_get_int(conf, key_ident[RARCH_FIRST_CUSTOM_BIND + j],
settings->input.remap_ids[i][RARCH_FIRST_CUSTOM_BIND + j] = key_remap; &key_remap) && (key_remap < 4))
settings->input.remap_ids[i][RARCH_FIRST_CUSTOM_BIND + j] =
key_remap;
} }
} }
@ -113,14 +120,18 @@ bool input_remapping_save_file(const char *path)
for (i = 0; i < settings->input.max_users; i++) for (i = 0; i < settings->input.max_users; i++)
{ {
char key_ident[RARCH_FIRST_CUSTOM_BIND + 4][128] = {{0}}; char key_ident[RARCH_FIRST_CUSTOM_BIND + 4][128] = {{0}};
char key_strings[RARCH_FIRST_CUSTOM_BIND + 4][128] = { "b", "y", "select", "start", char key_strings[RARCH_FIRST_CUSTOM_BIND + 4][128] = {
"up", "down", "left", "right", "a", "x", "l", "r", "l2", "r2", "l3", "r3", "l_x", "l_y", "r_x", "r_y" }; "b", "y", "select", "start",
"up", "down", "left", "right",
"a", "x", "l", "r", "l2", "r2",
"l3", "r3", "l_x", "l_y", "r_x", "r_y" };
snprintf(buf, sizeof(buf), "input_player%u", i + 1); snprintf(buf, sizeof(buf), "input_player%u", i + 1);
for (j = 0; j < RARCH_FIRST_CUSTOM_BIND + 4; j++) for (j = 0; j < RARCH_FIRST_CUSTOM_BIND + 4; j++)
{ {
fill_pathname_join_delim(key_ident[j], buf, key_strings[j], '_', sizeof(key_ident[j])); fill_pathname_join_delim(key_ident[j], buf,
key_strings[j], '_', sizeof(key_ident[j]));
config_set_int(conf, key_ident[j], settings->input.remap_ids[i][j]); config_set_int(conf, key_ident[j], settings->input.remap_ids[i][j]);
} }
} }