diff --git a/input/input_joypad_driver.c b/input/input_joypad_driver.c index 96c3086e4c..406318d158 100644 --- a/input/input_joypad_driver.c +++ b/input/input_joypad_driver.c @@ -18,10 +18,9 @@ #include #include -#include - #include "input_keymaps.h" #include "../general.h" +#include "../string_list_special.h" static input_device_driver_t *joypad_drivers[] = { #ifdef __CELLOS_LV2__ @@ -107,39 +106,7 @@ const char *joypad_driver_find_ident(int idx) **/ const char* config_get_joypad_driver_options(void) { - union string_list_elem_attr attr; - unsigned i; - char *options = NULL; - int options_len = 0; - struct string_list *options_l = string_list_new(); - - attr.i = 0; - - if (!options_l) - return NULL; - - for (i = 0; joypad_drivers[i]; i++) - { - const char *opt = joypad_drivers[i]->ident; - options_len += strlen(opt) + 1; - string_list_append(options_l, opt, attr); - } - - options = (char*)calloc(options_len, sizeof(char)); - - if (!options) - { - string_list_free(options_l); - options_l = NULL; - return NULL; - } - - string_list_join_concat(options, options_len, options_l, "|"); - - string_list_free(options_l); - options_l = NULL; - - return options; + return string_list_special_new(STRING_LIST_INPUT_JOYPAD_DRIVERS); } /** diff --git a/string_list_special.c b/string_list_special.c index e874a7248a..39fb3267f1 100644 --- a/string_list_special.c +++ b/string_list_special.c @@ -28,6 +28,7 @@ #include "gfx/video_driver.h" #include "input/input_driver.h" +#include "input/input_joypad_driver.h" #include "audio/audio_driver.h" const char *string_list_special_new(enum string_list_type type) @@ -47,6 +48,7 @@ const char *string_list_special_new(enum string_list_type type) { case STRING_LIST_MENU_DRIVERS: #ifdef HAVE_MENU +#ifndef IS_JOYCONFIG for (i = 0; menu_driver_find_handle(i); i++) { const char *opt = menu_driver_find_ident(i); @@ -55,6 +57,7 @@ const char *string_list_special_new(enum string_list_type type) string_list_append(s, opt, attr); } break; +#endif #endif case STRING_LIST_CAMERA_DRIVERS: #ifdef HAVE_CAMERA @@ -68,6 +71,7 @@ const char *string_list_special_new(enum string_list_type type) break; #endif case STRING_LIST_AUDIO_DRIVERS: +#ifndef IS_JOYCONFIG for (i = 0; audio_driver_find_handle(i); i++) { const char *opt = audio_driver_find_ident(i); @@ -75,8 +79,10 @@ const char *string_list_special_new(enum string_list_type type) string_list_append(s, opt, attr); } +#endif break; case STRING_LIST_VIDEO_DRIVERS: +#ifndef IS_JOYCONFIG for (i = 0; video_driver_find_handle(i); i++) { const char *opt = video_driver_find_ident(i); @@ -84,13 +90,25 @@ const char *string_list_special_new(enum string_list_type type) string_list_append(s, opt, attr); } +#endif break; case STRING_LIST_INPUT_DRIVERS: +#ifndef IS_JOYCONFIG for (i = 0; input_driver_find_handle(i); i++) { const char *opt = input_driver_find_ident(i); len += strlen(opt) + 1; + string_list_append(s, opt, attr); + } +#endif + break; + case STRING_LIST_INPUT_JOYPAD_DRIVERS: + for (i = 0; joypad_driver_find_handle(i); i++) + { + const char *opt = joypad_driver_find_ident(i); + len += strlen(opt) + 1; + string_list_append(s, opt, attr); } break; diff --git a/string_list_special.h b/string_list_special.h index 601e2c1f2d..853889475a 100644 --- a/string_list_special.h +++ b/string_list_special.h @@ -23,7 +23,8 @@ enum string_list_type STRING_LIST_CAMERA_DRIVERS, STRING_LIST_AUDIO_DRIVERS, STRING_LIST_VIDEO_DRIVERS, - STRING_LIST_INPUT_DRIVERS + STRING_LIST_INPUT_DRIVERS, + STRING_LIST_INPUT_JOYPAD_DRIVERS }; const char *string_list_special_new(enum string_list_type type); diff --git a/tools/retroarch-joyconfig-griffin.c b/tools/retroarch-joyconfig-griffin.c index 4ad54e7b82..baf256b04c 100644 --- a/tools/retroarch-joyconfig-griffin.c +++ b/tools/retroarch-joyconfig-griffin.c @@ -24,6 +24,8 @@ #include "../libretro-common/file/retro_file.c" #include "../libretro-common/file/retro_stat.c" +#include "../string_list_special.c" + #if defined(__linux) && !defined(ANDROID) #include "../input/drivers/linuxraw_input.c" #include "../input/drivers_joypad/linuxraw_joypad.c"