mirror of
https://github.com/libretro/RetroArch
synced 2025-01-29 09:32:52 +00:00
Revert "Attempt properly handling CLI options ..."
This reverts commit 6f8a1e8ab25d27ac22128522f642e9a97134746f.
This commit is contained in:
parent
3e72b89021
commit
2323cef8d1
54
retroarch.c
54
retroarch.c
@ -609,7 +609,6 @@ static void parse_input(int argc, char *argv[])
|
|||||||
const char *optstring = NULL;
|
const char *optstring = NULL;
|
||||||
global_t *global = global_get_ptr();
|
global_t *global = global_get_ptr();
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
bool explicit_menu = false;
|
|
||||||
|
|
||||||
const struct option opts[] = {
|
const struct option opts[] = {
|
||||||
#ifdef HAVE_DYNAMIC
|
#ifdef HAVE_DYNAMIC
|
||||||
@ -659,29 +658,7 @@ static void parse_input(int argc, char *argv[])
|
|||||||
{ NULL, 0, NULL, 0 }
|
{ NULL, 0, NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Handling the core type is finicky. Based on the arguments we pass in,
|
current_core_type = CORE_TYPE_PLAIN;
|
||||||
* we handle it differently.
|
|
||||||
* Some current cases which track desired behavior and how it is supposed to work:
|
|
||||||
*
|
|
||||||
* Dynamically linked RA:
|
|
||||||
* ./retroarch -> CORE_TYPE_DUMMY
|
|
||||||
* ./retroarch -v -> CORE_TYPE_DUMMY + verbose
|
|
||||||
* ./retroarch --menu -> CORE_TYPE_DUMMY
|
|
||||||
* ./retroarch --menu -v -> CORE_TYPE_DUMMY + verbose
|
|
||||||
* ./retroarch -L contentless-core -> CORE_TYPE_PLAIN
|
|
||||||
* ./retroarch -L content-core -> CORE_TYPE_PLAIN + FAIL (This currently crashes)
|
|
||||||
* ./retroarch [-L content-core] ROM -> CORE_TYPE_PLAIN
|
|
||||||
* ./retroarch <-L or ROM> --menu -> FAIL
|
|
||||||
*
|
|
||||||
* The heuristic here seems to be that if we use the -L CLI option or
|
|
||||||
* optind < argc at the end we should set CORE_TYPE_PLAIN.
|
|
||||||
* To handle --menu, we should ensure that CORE_TYPE_DUMMY is still set
|
|
||||||
* otherwise, fail early, since the CLI options are non-sensical.
|
|
||||||
* We could also simply ignore --menu in this case to be more friendly with
|
|
||||||
* bogus arguments.
|
|
||||||
*/
|
|
||||||
|
|
||||||
current_core_type = CORE_TYPE_DUMMY;
|
|
||||||
*global->subsystem = '\0';
|
*global->subsystem = '\0';
|
||||||
global->has_set.save_path = false;
|
global->has_set.save_path = false;
|
||||||
global->has_set.state_path = false;
|
global->has_set.state_path = false;
|
||||||
@ -707,6 +684,12 @@ static void parse_input(int argc, char *argv[])
|
|||||||
|
|
||||||
runloop_ctl(RUNLOOP_CTL_UNSET_OVERRIDES_ACTIVE, NULL);
|
runloop_ctl(RUNLOOP_CTL_UNSET_OVERRIDES_ACTIVE, NULL);
|
||||||
|
|
||||||
|
if (argc < 2)
|
||||||
|
{
|
||||||
|
current_core_type = CORE_TYPE_DUMMY;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Make sure we can call parse_input several times ... */
|
/* Make sure we can call parse_input several times ... */
|
||||||
optind = 0;
|
optind = 0;
|
||||||
optstring = "hs:fvS:A:c:U:DN:d:"
|
optstring = "hs:fvS:A:c:U:DN:d:"
|
||||||
@ -834,9 +817,6 @@ static void parse_input(int argc, char *argv[])
|
|||||||
runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH, optarg);
|
runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH, optarg);
|
||||||
global->has_set.libretro = true;
|
global->has_set.libretro = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We requested explicit core, so use PLAIN core type. */
|
|
||||||
current_core_type = CORE_TYPE_PLAIN;
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case 'P':
|
case 'P':
|
||||||
@ -924,7 +904,7 @@ static void parse_input(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case RA_OPT_MENU:
|
case RA_OPT_MENU:
|
||||||
explicit_menu = true;
|
current_core_type = CORE_TYPE_DUMMY;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef HAVE_NETPLAY
|
#ifdef HAVE_NETPLAY
|
||||||
@ -1015,24 +995,20 @@ static void parse_input(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (explicit_menu && current_core_type != CORE_TYPE_DUMMY)
|
if (rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
|
||||||
{
|
{
|
||||||
RARCH_ERR("--menu was used, but content file or libretro core was passed as well.\n");
|
if (optind < argc)
|
||||||
retro_fail(1, "parse_input()");
|
{
|
||||||
|
RARCH_ERR("--menu was used, but content file was passed as well.\n");
|
||||||
|
retro_fail(1, "parse_input()");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else if (!*global->subsystem && optind < argc)
|
||||||
if (!*global->subsystem && optind < argc)
|
|
||||||
{
|
{
|
||||||
/* We requested explicit ROM, so use PLAIN core type. */
|
|
||||||
current_core_type = CORE_TYPE_PLAIN;
|
|
||||||
rarch_ctl(RARCH_CTL_SET_PATHS, (void*)argv[optind]);
|
rarch_ctl(RARCH_CTL_SET_PATHS, (void*)argv[optind]);
|
||||||
}
|
}
|
||||||
else if (*global->subsystem && optind < argc)
|
else if (*global->subsystem && optind < argc)
|
||||||
{
|
|
||||||
/* We requested explicit ROM, so use PLAIN core type. */
|
|
||||||
current_core_type = CORE_TYPE_PLAIN;
|
|
||||||
set_special_paths(argv + optind, argc - optind);
|
set_special_paths(argv + optind, argc - optind);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
content_ctl(CONTENT_CTL_SET_DOES_NOT_NEED_CONTENT, NULL);
|
content_ctl(CONTENT_CTL_SET_DOES_NOT_NEED_CONTENT, NULL);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user