mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-02-05 02:58:04 +00:00
Implement joypad driver settings options too
This commit is contained in:
parent
ec2242db02
commit
85ac84cb08
@ -19,6 +19,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <string/string_list.h>
|
||||||
#include "../general.h"
|
#include "../general.h"
|
||||||
|
|
||||||
rarch_joypad_driver_t *joypad_drivers[] = {
|
rarch_joypad_driver_t *joypad_drivers[] = {
|
||||||
@ -70,6 +71,34 @@ rarch_joypad_driver_t *joypad_drivers[] = {
|
|||||||
NULL,
|
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[] = {
|
const struct input_key_map input_config_key_map[] = {
|
||||||
{ "left", RETROK_LEFT },
|
{ "left", RETROK_LEFT },
|
||||||
{ "right", RETROK_RIGHT },
|
{ "right", RETROK_RIGHT },
|
||||||
|
@ -42,6 +42,8 @@ struct rarch_joypad_driver
|
|||||||
|
|
||||||
typedef struct rarch_joypad_driver rarch_joypad_driver_t;
|
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,
|
/* If ident points to NULL or a zero-length string,
|
||||||
* equivalent to calling input_joypad_init_first(). */
|
* equivalent to calling input_joypad_init_first(). */
|
||||||
const rarch_joypad_driver_t *input_joypad_init_driver(const char *ident);
|
const rarch_joypad_driver_t *input_joypad_init_driver(const char *ident);
|
||||||
|
@ -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);
|
settings_data_list_current_add_flags(list, list_info, SD_FLAG_IS_DRIVER);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CONFIG_STRING(
|
CONFIG_STRING_OPTIONS(
|
||||||
g_settings.input.joypad_driver,
|
g_settings.input.joypad_driver,
|
||||||
"input_joypad_driver",
|
"input_joypad_driver",
|
||||||
"Joypad Driver",
|
"Joypad Driver",
|
||||||
config_get_default_joypad(),
|
config_get_default_joypad(),
|
||||||
|
config_get_joypad_driver_options(),
|
||||||
group_info.name,
|
group_info.name,
|
||||||
subgroup_info.name,
|
subgroup_info.name,
|
||||||
NULL,
|
NULL,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user