From fd94cbdefe5a9282f34654e089018836811abe0c Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 25 Jan 2016 05:45:37 +0100 Subject: [PATCH] Move rarch_main_init_wrap to frontend.c and turn it into a static function --- frontend/frontend.c | 71 +++++++++++++++++++++++++++++++++++++++++++++ retroarch.c | 70 -------------------------------------------- retroarch.h | 12 -------- 3 files changed, 71 insertions(+), 82 deletions(-) diff --git a/frontend/frontend.c b/frontend/frontend.c index 296c176f43..c206570460 100644 --- a/frontend/frontend.c +++ b/frontend/frontend.c @@ -176,6 +176,77 @@ static void history_playlist_push(content_playlist_t *playlist, NULL); } +/** + * rarch_main_init_wrap: + * @args : Input arguments. + * @argc : Count of arguments. + * @argv : Arguments. + * + * Generates an @argc and @argv pair based on @args + * of type rarch_main_wrap. + **/ +static void rarch_main_init_wrap( + const struct rarch_main_wrap *args, + int *argc, char **argv) +{ +#ifdef HAVE_FILE_LOGGER + int i; +#endif + + *argc = 0; + argv[(*argc)++] = strdup("retroarch"); + + if (!args->no_content) + { + if (args->content_path) + { + RARCH_LOG("Using content: %s.\n", args->content_path); + argv[(*argc)++] = strdup(args->content_path); + } + else + { +#ifdef HAVE_MENU + RARCH_LOG("No content, starting dummy core.\n"); + argv[(*argc)++] = strdup("--menu"); +#endif + } + } + + if (args->sram_path) + { + argv[(*argc)++] = strdup("-s"); + argv[(*argc)++] = strdup(args->sram_path); + } + + if (args->state_path) + { + argv[(*argc)++] = strdup("-S"); + argv[(*argc)++] = strdup(args->state_path); + } + + if (args->config_path) + { + argv[(*argc)++] = strdup("-c"); + argv[(*argc)++] = strdup(args->config_path); + } + +#ifdef HAVE_DYNAMIC + if (args->libretro_path) + { + argv[(*argc)++] = strdup("-L"); + argv[(*argc)++] = strdup(args->libretro_path); + } +#endif + + if (args->verbose) + argv[(*argc)++] = strdup("-v"); + +#ifdef HAVE_FILE_LOGGER + for (i = 0; i < *argc; i++) + RARCH_LOG("arg #%d: %s\n", i, argv[i]); +#endif +} + /** * main_load_content: * @argc : Argument count. diff --git a/retroarch.c b/retroarch.c index 7c480a3ec6..7c178b9909 100644 --- a/retroarch.c +++ b/retroarch.c @@ -1199,76 +1199,6 @@ error: return 1; } -/** - * rarch_main_init_wrap: - * @args : Input arguments. - * @argc : Count of arguments. - * @argv : Arguments. - * - * Generates an @argc and @argv pair based on @args - * of type rarch_main_wrap. - **/ -void rarch_main_init_wrap(const struct rarch_main_wrap *args, - int *argc, char **argv) -{ -#ifdef HAVE_FILE_LOGGER - int i; -#endif - - *argc = 0; - argv[(*argc)++] = strdup("retroarch"); - - if (!args->no_content) - { - if (args->content_path) - { - RARCH_LOG("Using content: %s.\n", args->content_path); - argv[(*argc)++] = strdup(args->content_path); - } - else - { -#ifdef HAVE_MENU - RARCH_LOG("No content, starting dummy core.\n"); - argv[(*argc)++] = strdup("--menu"); -#endif - } - } - - if (args->sram_path) - { - argv[(*argc)++] = strdup("-s"); - argv[(*argc)++] = strdup(args->sram_path); - } - - if (args->state_path) - { - argv[(*argc)++] = strdup("-S"); - argv[(*argc)++] = strdup(args->state_path); - } - - if (args->config_path) - { - argv[(*argc)++] = strdup("-c"); - argv[(*argc)++] = strdup(args->config_path); - } - -#ifdef HAVE_DYNAMIC - if (args->libretro_path) - { - argv[(*argc)++] = strdup("-L"); - argv[(*argc)++] = strdup(args->libretro_path); - } -#endif - - if (args->verbose) - argv[(*argc)++] = strdup("-v"); - -#ifdef HAVE_FILE_LOGGER - for (i = 0; i < *argc; i++) - RARCH_LOG("arg #%d: %s\n", i, argv[i]); -#endif -} - #define FAIL_CPU(simd_type) do { \ RARCH_ERR(simd_type " code is compiled in, but CPU does not support this feature. Cannot continue.\n"); \ retro_fail(1, "validate_cpu_features()"); \ diff --git a/retroarch.h b/retroarch.h index 7255db4b42..22863d2bca 100644 --- a/retroarch.h +++ b/retroarch.h @@ -180,18 +180,6 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data); **/ int rarch_main_init(int argc, char *argv[]); -/** - * rarch_main_init_wrap: - * @args : Input arguments. - * @argc : Count of arguments. - * @argv : Arguments. - * - * Generates an @argc and @argv pair based on @args - * of type rarch_main_wrap. - **/ -void rarch_main_init_wrap(const struct rarch_main_wrap *args, - int *argc, char **argv); - /** * rarch_main_deinit: *