Change retroarch_main_init

This commit is contained in:
twinaphex 2016-05-11 20:50:34 +02:00
parent 0e972b9804
commit a082198d4b
3 changed files with 17 additions and 15 deletions

View File

@ -892,7 +892,7 @@ bool content_load(content_ctx_info_t *info)
wrap_args->argc = *rarch_argc_ptr;
wrap_args->argv = rarch_argv_ptr;
if (!rarch_ctl(RARCH_CTL_MAIN_INIT, wrap_args))
if (!retroarch_main_init(wrap_args->argc, wrap_args->argv))
{
retval = false;
goto error;

View File

@ -1220,7 +1220,7 @@ bool retroarch_validate_game_options(char *s, size_t len, bool mkdir)
*
* Returns: 0 on success, otherwise 1 if there was an error.
**/
static int retroarch_main_init(int argc, char *argv[])
bool retroarch_main_init(int argc, char *argv[])
{
int sjlj_ret;
bool *verbosity = NULL;
@ -1230,7 +1230,7 @@ static int retroarch_main_init(int argc, char *argv[])
if ((sjlj_ret = setjmp(error_sjlj_context)) > 0)
{
RARCH_ERR("Fatal error received in: \"%s\"\n", error_string);
return sjlj_ret;
return false;
}
rarch_ctl(RARCH_CTL_SET_ERROR_ON_INIT, NULL);
@ -1315,12 +1315,13 @@ static int retroarch_main_init(int argc, char *argv[])
rarch_ctl(RARCH_CTL_UNSET_ERROR_ON_INIT, NULL);
rarch_ctl(RARCH_CTL_SET_INITED, NULL);
return 0;
return true;
error:
command_event(CMD_EVENT_CORE_DEINIT, NULL);
rarch_ctl(RARCH_CTL_UNSET_INITED, NULL);
return 1;
return false;
}
#define FAIL_CPU(simd_type) do { \
@ -1416,13 +1417,6 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
rarch_ctl(RARCH_CTL_UNSET_INITED, NULL);
break;
case RARCH_CTL_MAIN_INIT:
{
struct rarch_main_wrap *wrap = (struct rarch_main_wrap*)data;
if (retroarch_main_init(wrap->argc, wrap->argv))
return false;
}
break;
case RARCH_CTL_INIT:
rarch_ctl(RARCH_CTL_DEINIT, NULL);
retroarch_init_state();

View File

@ -60,9 +60,6 @@ enum rarch_ctl_state
/* Initialize all drivers. */
RARCH_CTL_INIT,
/* Initializes RetroArch. */
RARCH_CTL_MAIN_INIT,
/* Deinitializes RetroArch. */
RARCH_CTL_MAIN_DEINIT,
@ -180,6 +177,17 @@ void retroarch_fill_pathnames(void);
**/
void retroarch_fail(int error_code, const char *error);
/**
* retroarch_main_init:
* @argc : Count of (commandline) arguments.
* @argv : (Commandline) arguments.
*
* Initializes the program.
*
* Returns: 1 (true) on success, otherwise false (0) if there was an error.
**/
bool retroarch_main_init(int argc, char *argv[]);
#ifdef __cplusplus
}
#endif