mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-24 00:20:01 +00:00
parent
ce34c4bba8
commit
23c8150b6e
52
retroarch.c
52
retroarch.c
@ -609,6 +609,7 @@ static void parse_input(int argc, char *argv[])
|
||||
const char *optstring = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool explicit_menu = false;
|
||||
|
||||
const struct option opts[] = {
|
||||
#ifdef HAVE_DYNAMIC
|
||||
@ -658,7 +659,29 @@ static void parse_input(int argc, char *argv[])
|
||||
{ NULL, 0, NULL, 0 }
|
||||
};
|
||||
|
||||
current_core_type = CORE_TYPE_PLAIN;
|
||||
/* Handling the core type is finicky. Based on the arguments we pass in,
|
||||
* 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->has_set.save_path = false;
|
||||
global->has_set.state_path = false;
|
||||
@ -684,12 +707,6 @@ static void parse_input(int argc, char *argv[])
|
||||
|
||||
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 ... */
|
||||
optind = 0;
|
||||
optstring = "hs:fvS:A:c:U:DN:d:"
|
||||
@ -817,6 +834,9 @@ static void parse_input(int argc, char *argv[])
|
||||
runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH, optarg);
|
||||
global->has_set.libretro = true;
|
||||
}
|
||||
|
||||
/* We requested explicit core, so use PLAIN core type. */
|
||||
current_core_type = CORE_TYPE_PLAIN;
|
||||
break;
|
||||
#endif
|
||||
case 'P':
|
||||
@ -904,7 +924,7 @@ static void parse_input(int argc, char *argv[])
|
||||
break;
|
||||
|
||||
case RA_OPT_MENU:
|
||||
current_core_type = CORE_TYPE_DUMMY;
|
||||
explicit_menu = true;
|
||||
break;
|
||||
|
||||
#ifdef HAVE_NETPLAY
|
||||
@ -995,20 +1015,24 @@ static void parse_input(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
if (rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
|
||||
if (explicit_menu && current_core_type != CORE_TYPE_DUMMY)
|
||||
{
|
||||
if (optind < argc)
|
||||
{
|
||||
RARCH_ERR("--menu was used, but content file was passed as well.\n");
|
||||
RARCH_ERR("--menu was used, but content file or libretro core 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]);
|
||||
}
|
||||
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);
|
||||
}
|
||||
else
|
||||
content_ctl(CONTENT_CTL_SET_DOES_NOT_NEED_CONTENT, NULL);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user