Implement joypad driver settings options too

This commit is contained in:
twinaphex 2014-11-26 21:56:53 +01:00
parent ec2242db02
commit 85ac84cb08
3 changed files with 33 additions and 1 deletions

View File

@ -19,6 +19,7 @@
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <string/string_list.h>
#include "../general.h"
rarch_joypad_driver_t *joypad_drivers[] = {
@ -70,6 +71,34 @@ rarch_joypad_driver_t *joypad_drivers[] = {
NULL,
};
const char* config_get_joypad_driver_options(void)
{
union string_list_elem_attr attr;
char *options = NULL;
int option_k = 0;
int options_len = 0;
struct string_list *options_l = NULL;
attr.i = 0;
options_l = (struct string_list*)string_list_new();
for (option_k = 0; joypad_drivers[option_k]; option_k++)
{
const char *opt = joypad_drivers[option_k]->ident;
options_len += strlen(opt) + 1;
string_list_append(options_l, opt, attr);
}
options = (char*)calloc(options_len, sizeof(char));
string_list_join_concat(options, options_len, options_l, "|");
string_list_free(options_l);
options_l = NULL;
return options;
}
const struct input_key_map input_config_key_map[] = {
{ "left", RETROK_LEFT },
{ "right", RETROK_RIGHT },

View File

@ -42,6 +42,8 @@ struct rarch_joypad_driver
typedef struct rarch_joypad_driver rarch_joypad_driver_t;
const char* config_get_joypad_driver_options(void);
/* If ident points to NULL or a zero-length string,
* equivalent to calling input_joypad_init_first(). */
const rarch_joypad_driver_t *input_joypad_init_driver(const char *ident);

View File

@ -3075,11 +3075,12 @@ static bool setting_data_append_list_driver_options(
settings_data_list_current_add_flags(list, list_info, SD_FLAG_IS_DRIVER);
#endif
CONFIG_STRING(
CONFIG_STRING_OPTIONS(
g_settings.input.joypad_driver,
"input_joypad_driver",
"Joypad Driver",
config_get_default_joypad(),
config_get_joypad_driver_options(),
group_info.name,
subgroup_info.name,
NULL,