mirror of
https://github.com/libretro/RetroArch.git
synced 2025-02-17 07:58:55 +00:00
Add back stdin features - pt. 1
This commit is contained in:
parent
d7ebb49fd0
commit
d3a9b04223
44
retroarch.c
44
retroarch.c
@ -1318,11 +1318,55 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
|
||||
static bool rarch_error_on_init = false;
|
||||
static bool rarch_block_config_read = false;
|
||||
static bool rarch_force_fullscreen = false;
|
||||
static bool rarch_stdin_claimed = false;
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
switch(state)
|
||||
{
|
||||
case RARCH_CTL_IS_STDIN_CLAIMED:
|
||||
return rarch_stdin_claimed;
|
||||
case RARCH_CTL_SET_STDIN_CLAIMED:
|
||||
rarch_stdin_claimed = true;
|
||||
break;
|
||||
case RARCH_CTL_UNSET_STDIN_CLAIMED:
|
||||
rarch_stdin_claimed = true;
|
||||
break;
|
||||
case RARCH_CTL_VERIFY_STDIN_PATHS:
|
||||
if (!*global->name.savefile)
|
||||
{
|
||||
RARCH_ERR("Need savefile path argument (--save) when reading rom from stdin.\n");
|
||||
print_help("retroarch");
|
||||
retro_fail(1, "verify_stdin_paths()");
|
||||
}
|
||||
else if (!*global->name.savestate)
|
||||
{
|
||||
RARCH_ERR("Need savestate path argument (--savestate) when reading rom from stdin.\n");
|
||||
print_help("retroarch");
|
||||
retro_fail(1, "verify_stdin_paths()");
|
||||
}
|
||||
|
||||
if (path_is_directory(global->name.savefile))
|
||||
{
|
||||
RARCH_ERR("Cannot specify directory for path argument (--save) when reading from stdin.\n");
|
||||
print_help("retroarch");
|
||||
retro_fail(1, "verify_stdin_paths()");
|
||||
}
|
||||
else if (path_is_directory(global->name.savestate))
|
||||
{
|
||||
RARCH_ERR("Cannot specify directory for path argument (--savestate) when reading from stdin.\n");
|
||||
print_help("retroarch");
|
||||
retro_fail(1, "verify_stdin_paths()");
|
||||
}
|
||||
else if (path_is_directory(global->path.config))
|
||||
{
|
||||
RARCH_ERR("Cannot specify directory for config file (--config) when reading from stdin.\n");
|
||||
print_help("retroarch");
|
||||
retro_fail(1, "verify_stdin_paths()");
|
||||
}
|
||||
|
||||
rarch_ctl(RARCH_CTL_SET_STDIN_CLAIMED, NULL);
|
||||
break;
|
||||
case RARCH_CTL_SET_PATHS:
|
||||
set_basename((const char*)data);
|
||||
|
||||
|
@ -110,6 +110,14 @@ enum rarch_ctl_state
|
||||
|
||||
RARCH_CTL_SET_PATHS_REDIRECT,
|
||||
|
||||
RARCH_CTL_IS_STDIN_CLAIMED,
|
||||
|
||||
RARCH_CTL_SET_STDIN_CLAIMED,
|
||||
|
||||
RARCH_CTL_UNSET_STDIN_CLAIMED,
|
||||
|
||||
RARCH_CTL_VERIFY_STDIN_PATHS,
|
||||
|
||||
RARCH_CTL_SET_SRAM_ENABLE,
|
||||
|
||||
RARCH_CTL_SET_PATHS,
|
||||
|
Loading…
x
Reference in New Issue
Block a user