Merge pull request #1238 from jeapostrophe/master

Moving function
This commit is contained in:
Twinaphex 2014-11-11 18:34:55 +01:00
commit 7fde71b2ee
3 changed files with 27 additions and 24 deletions

View File

@ -189,6 +189,30 @@ static const input_driver_t *input_drivers[] = {
NULL,
};
// JM: This is a very painful function to write, especially because
// we'll have to do it to all the drivers.
const char* config_get_input_driver_options(void) {
int input_option_k = 0;
int input_options_len = 0;
while (input_drivers[input_option_k]) {
const char *opt = input_drivers[input_option_k]->ident;
input_options_len += strlen(opt) + 1;
input_option_k++;
}
uint offset = 0;
char *input_options = (char*)calloc(input_options_len, sizeof(char));
for (int i = 0; i < input_option_k; i++) {
const char *opt = input_drivers[i]->ident;
strlcpy(input_options + offset, opt, input_options_len - offset);
offset += strlen(opt);
input_options[offset] = '|';
offset += 1;
}
input_options[input_options_len] = '\0';
return input_options;
}
static const input_osk_driver_t *osk_drivers[] = {
#ifdef __CELLOS_LV2__
&input_ps3_osk,

View File

@ -675,6 +675,8 @@ extern input_driver_t input_qnx;
extern input_driver_t input_rwebinput;
extern input_driver_t input_null;
const char* config_get_input_driver_options(void);
extern camera_driver_t camera_v4l2;
extern camera_driver_t camera_android;
extern camera_driver_t camera_rwebcam;

View File

@ -14,6 +14,7 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "driver.h"
#include "settings_data.h"
#include "dynamic.h"
#include <file/file_path.h>
@ -2883,30 +2884,6 @@ static bool setting_data_append_list_main_menu_options(
return true;
}
// JM: This is a very painful function to write, especially because
// we'll have to do it to all the drivers.
const char* config_get_input_driver_options(void) {
int input_option_k = 0;
int input_options_len = 0;
while (input_drivers[input_option_k]) {
const char *opt = input_drivers[input_option_k]->ident;
input_options_len += strlen(opt) + 1;
input_option_k++;
}
uint offset = 0;
char *input_options = (char*)calloc(input_options_len, sizeof(char));
for (int i = 0; i < input_option_k; i++) {
const char *opt = input_drivers[i]->ident;
strlcpy(input_options + offset, opt, input_options_len - offset);
offset += strlen(opt);
input_options[offset] = '|';
offset += 1;
}
input_options[input_options_len] = '\0';
return input_options;
}
static bool setting_data_append_list_driver_options(
rarch_setting_t **list,
rarch_setting_info_t *list_info)