diff --git a/audio/audio_resampler_driver.c b/audio/audio_resampler_driver.c index 40949a5f12..97241acfda 100644 --- a/audio/audio_resampler_driver.c +++ b/audio/audio_resampler_driver.c @@ -21,7 +21,7 @@ #include #include #ifndef DONT_HAVE_STRING_LIST -#include +#include "../string_list_special.h" #endif static const rarch_resampler_t *resampler_drivers[] = { @@ -99,40 +99,7 @@ const char *audio_resampler_driver_find_ident(int idx) **/ const char* config_get_audio_resampler_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; resampler_drivers[i]; i++) - { - const char *opt = resampler_drivers[i]->ident; - - options_len += strlen(opt) + 1; - string_list_append(options_l, opt, attr); - } - - options = (char*)calloc(options_len, sizeof(char)); - - if (!options) - { - options = NULL; - goto done; - } - - string_list_join_concat(options, options_len, options_l, "|"); - -done: - string_list_free(options_l); - options_l = NULL; - - return options; + return string_list_special_new(STRING_LIST_AUDIO_RESAMPLER_DRIVERS); } #endif diff --git a/input/input_hid_driver.c b/input/input_hid_driver.c index 97db84095e..98ab1f0005 100644 --- a/input/input_hid_driver.c +++ b/input/input_hid_driver.c @@ -18,10 +18,11 @@ #include #include -#include - #include "input_hid_driver.h" #include "../general.h" +#ifndef IS_JOYCONFIG +#include "../string_list_special.h" +#endif static hid_driver_t *hid_drivers[] = { #if defined(__APPLE__) && defined(IOS) @@ -70,6 +71,7 @@ const char *hid_driver_find_ident(int idx) return drv->ident; } +#ifndef IS_JOYCONFIG /** * config_get_hid_driver_options: * @@ -79,41 +81,9 @@ const char *hid_driver_find_ident(int idx) **/ const char* config_get_hid_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; hid_drivers[i]; i++) - { - const char *opt = hid_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_HID_DRIVERS); } +#endif /** * input_hid_init_first: diff --git a/string_list_special.c b/string_list_special.c index 3fe7461c30..f1ca547270 100644 --- a/string_list_special.c +++ b/string_list_special.c @@ -32,8 +32,10 @@ #include "gfx/video_driver.h" #include "input/input_driver.h" +#include "input/input_hid_driver.h" #include "input/input_joypad_driver.h" #include "audio/audio_driver.h" +#include "audio/audio_resampler_driver.h" #include "record/record_driver.h" const char *string_list_special_new(enum string_list_type type) @@ -92,6 +94,15 @@ const char *string_list_special_new(enum string_list_type type) string_list_append(s, opt, attr); } break; + case STRING_LIST_AUDIO_RESAMPLER_DRIVERS: + for (i = 0; audio_resampler_driver_find_handle(i); i++) + { + const char *opt = audio_resampler_driver_find_ident(i); + len += strlen(opt) + 1; + + string_list_append(s, opt, attr); + } + break; case STRING_LIST_VIDEO_DRIVERS: for (i = 0; video_driver_find_handle(i); i++) { @@ -110,6 +121,15 @@ const char *string_list_special_new(enum string_list_type type) string_list_append(s, opt, attr); } break; + case STRING_LIST_INPUT_HID_DRIVERS: + for (i = 0; hid_driver_find_handle(i); i++) + { + const char *opt = hid_driver_find_ident(i); + len += strlen(opt) + 1; + + string_list_append(s, opt, attr); + } + break; case STRING_LIST_INPUT_JOYPAD_DRIVERS: for (i = 0; joypad_driver_find_handle(i); i++) { diff --git a/string_list_special.h b/string_list_special.h index 05849441de..d5d8e4c8fe 100644 --- a/string_list_special.h +++ b/string_list_special.h @@ -23,10 +23,12 @@ enum string_list_type STRING_LIST_CAMERA_DRIVERS, STRING_LIST_LOCATION_DRIVERS, STRING_LIST_AUDIO_DRIVERS, + STRING_LIST_AUDIO_RESAMPLER_DRIVERS, STRING_LIST_VIDEO_DRIVERS, STRING_LIST_INPUT_DRIVERS, - STRING_LIST_RECORD_DRIVERS, - STRING_LIST_INPUT_JOYPAD_DRIVERS + STRING_LIST_INPUT_JOYPAD_DRIVERS, + STRING_LIST_INPUT_HID_DRIVERS, + STRING_LIST_RECORD_DRIVERS }; const char *string_list_special_new(enum string_list_type type);