From bf407606bc99ab87934e16f44d35cefd413d8184 Mon Sep 17 00:00:00 2001 From: aliaspider Date: Sat, 14 Nov 2015 22:21:24 +0100 Subject: [PATCH] (3DS) allow reading content path from argv. --- frontend/drivers/platform_ctr.c | 49 +++++++++------------------------ 1 file changed, 13 insertions(+), 36 deletions(-) diff --git a/frontend/drivers/platform_ctr.c b/frontend/drivers/platform_ctr.c index ba11f400cf..66963f995e 100644 --- a/frontend/drivers/platform_ctr.c +++ b/frontend/drivers/platform_ctr.c @@ -80,48 +80,25 @@ static void frontend_ctr_get_environment_settings(int *argc, char *argv[], fill_pathname_join(g_defaults.path.config, g_defaults.dir.port, "retroarch.cfg", sizeof(g_defaults.path.config)); -#if 0 - int i; - DEBUG_VAR(*argc); - for (i=0; i < *argc; i++) - DEBUG_STR(argv[i]); - DEBUG_HOLD(); -#endif - - *argc = 0; - #ifndef IS_SALAMANDER -#if 0 - if (argv[1] && (argv[1][0] != '\0')) + /* clean-up argc/argv */ + if(*argc) { - static char path[PATH_MAX_LENGTH]; - struct rarch_main_wrap *args = NULL; - - *path = '\0'; - args = (struct rarch_main_wrap*)params_data; - - if (args) + int i = *argc - 1; + *argc = 0; + while (i) { - strlcpy(path, argv[1], sizeof(path)); - - args->touched = true; - args->no_content = false; - args->verbose = false; - args->config_path = NULL; - args->sram_path = NULL; - args->state_path = NULL; - args->content_path = path; - args->libretro_path = NULL; - - RARCH_LOG("argv[0]: %s\n", argv[0]); - RARCH_LOG("argv[1]: %s\n", argv[1]); - RARCH_LOG("argv[2]: %s\n", argv[2]); - - RARCH_LOG("Auto-start game %s.\n", argv[1]); + if(argv[i] && argv[i][0]) + { + argv[1] = argv[i]; + argv[2] = NULL; + *argc = 2; + break; + } + i--; } } #endif -#endif } static void frontend_ctr_deinit(void *data)