Turn it into char pointer array
This commit is contained in:
parent
9302e5627e
commit
b79f95668b
|
@ -2318,7 +2318,10 @@ void input_config_parse_joy_button(void *data, const char *prefix,
|
||||||
|
|
||||||
if (config_get_string(conf, key_label, &tmp_a))
|
if (config_get_string(conf, key_label, &tmp_a))
|
||||||
{
|
{
|
||||||
strlcpy(bind->joykey_label, tmp_a, sizeof(bind->joykey_label));
|
if (!string_is_empty(bind->joykey_label))
|
||||||
|
free(bind->joykey_label);
|
||||||
|
|
||||||
|
bind->joykey_label = strdup(tmp_a);
|
||||||
free(tmp_a);
|
free(tmp_a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2375,7 +2378,8 @@ static void input_config_get_bind_string_joykey(
|
||||||
|
|
||||||
if (GET_HAT_DIR(bind->joykey))
|
if (GET_HAT_DIR(bind->joykey))
|
||||||
{
|
{
|
||||||
if (!string_is_empty(bind->joykey_label) && label_show)
|
if (bind->joykey_label &&
|
||||||
|
!string_is_empty(bind->joykey_label) && label_show)
|
||||||
snprintf(buf, size, "%s %s ", prefix, bind->joykey_label);
|
snprintf(buf, size, "%s %s ", prefix, bind->joykey_label);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2405,7 +2409,8 @@ static void input_config_get_bind_string_joykey(
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!string_is_empty(bind->joykey_label) && label_show)
|
if (bind->joykey_label &&
|
||||||
|
!string_is_empty(bind->joykey_label) && label_show)
|
||||||
snprintf(buf, size, "%s%s (btn) ", prefix, bind->joykey_label);
|
snprintf(buf, size, "%s%s (btn) ", prefix, bind->joykey_label);
|
||||||
else
|
else
|
||||||
snprintf(buf, size, "%s%u (%s) ", prefix, (unsigned)bind->joykey,
|
snprintf(buf, size, "%s%u (%s) ", prefix, (unsigned)bind->joykey,
|
||||||
|
|
|
@ -114,7 +114,7 @@ struct retro_keybind
|
||||||
/* Used by input_{push,pop}_analog_dpad(). */
|
/* Used by input_{push,pop}_analog_dpad(). */
|
||||||
uint32_t orig_joyaxis;
|
uint32_t orig_joyaxis;
|
||||||
|
|
||||||
char joykey_label[64];
|
char *joykey_label;
|
||||||
char joyaxis_label[64];
|
char joyaxis_label[64];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -475,7 +475,10 @@ bool input_autoconfigure_connect(
|
||||||
{
|
{
|
||||||
input_autoconf_binds[state->idx][i].joykey = NO_BTN;
|
input_autoconf_binds[state->idx][i].joykey = NO_BTN;
|
||||||
input_autoconf_binds[state->idx][i].joyaxis = AXIS_NONE;
|
input_autoconf_binds[state->idx][i].joyaxis = AXIS_NONE;
|
||||||
input_autoconf_binds[state->idx][i].joykey_label[0] = '\0';
|
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';
|
input_autoconf_binds[state->idx][i].joyaxis_label[0] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue