Turn into char pointer array

This commit is contained in:
twinaphex 2017-09-27 20:11:44 +02:00
parent b79f95668b
commit fcf6228dce
3 changed files with 12 additions and 5 deletions

View File

@ -2364,7 +2364,10 @@ void input_config_parse_joy_axis(void *data, const char *prefix,
if (config_get_string(conf, key_label, &tmp_a))
{
strlcpy(bind->joyaxis_label, tmp_a, sizeof(bind->joyaxis_label));
if (bind->joyaxis_label &&
!string_is_empty(bind->joyaxis_label))
free(bind->joyaxis_label);
bind->joyaxis_label = strdup(tmp_a);
free(tmp_a);
}
}
@ -2423,7 +2426,8 @@ static void input_config_get_bind_string_joyaxis(char *buf, const char *prefix,
{
settings_t *settings = config_get_ptr();
if (!string_is_empty(bind->joyaxis_label)
if (bind->joyaxis_label &&
!string_is_empty(bind->joyaxis_label)
&& settings->bools.input_descriptor_label_show)
snprintf(buf, size, "%s%s (axis) ", prefix, bind->joyaxis_label);
else

View File

@ -115,7 +115,7 @@ struct retro_keybind
uint32_t orig_joyaxis;
char *joykey_label;
char joyaxis_label[64];
char *joyaxis_label;
};
typedef struct rarch_joypad_info

View File

@ -478,8 +478,11 @@ bool input_autoconfigure_connect(
if (input_autoconf_binds[state->idx][i].joykey_label
&& !string_is_empty(input_autoconf_binds[state->idx][i].joykey_label))
free(input_autoconf_binds[state->idx][i].joykey_label);
input_autoconf_binds[state->idx][i].joykey_label = NULL;
input_autoconf_binds[state->idx][i].joyaxis_label[0] = '\0';
if (input_autoconf_binds[state->idx][i].joyaxis_label
&& !string_is_empty(input_autoconf_binds[state->idx][i].joyaxis_label))
free(input_autoconf_binds[state->idx][i].joyaxis_label);
input_autoconf_binds[state->idx][i].joykey_label = NULL;
input_autoconf_binds[state->idx][i].joyaxis_label = NULL;
}
input_autoconfigured[state->idx] = false;