Move more core option functionality to runloop.c

This commit is contained in:
twinaphex 2015-12-07 14:13:07 +01:00
parent 4eb669429f
commit 098d983587
3 changed files with 41 additions and 15 deletions

View File

@ -687,32 +687,29 @@ bool rarch_environment_cb(unsigned cmd, void *data)
case RETRO_ENVIRONMENT_GET_VARIABLE:
{
struct retro_variable *var = (struct retro_variable*)data;
RARCH_LOG("Environ GET_VARIABLE %s:\n", var->key);
if (system && system->core_options)
core_option_get(system->core_options, var);
else
var->value = NULL;
if (!runloop_ctl(RUNLOOP_CTL_CORE_OPTIONS_GET, data))
{
struct retro_variable *var = (struct retro_variable*)data;
RARCH_LOG("Environ GET_VARIABLE %s:\n", var->key);
if (var)
var->value = NULL;
RARCH_LOG("\t%s\n", var->value ? var->value : "N/A");
}
RARCH_LOG("\t%s\n", var->value ? var->value : "N/A");
break;
}
case RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE:
*(bool*)data = system->core_options ?
core_option_updated(system->core_options) : false;
*(bool*)data = runloop_ctl(RUNLOOP_CTL_IS_CORE_OPTION_UPDATED, NULL);
break;
case RETRO_ENVIRONMENT_SET_VARIABLES:
{
RARCH_LOG("Environ SET_VARIABLES.\n");
if (system && system->core_options)
{
core_option_flush(system->core_options);
core_option_free(system->core_options);
}
runloop_ctl(RUNLOOP_CTL_CORE_OPTIONS_DEINIT, NULL);
{
char *game_options_path = NULL;

View File

@ -921,6 +921,31 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
case RUNLOOP_CTL_DATA_DEINIT:
rarch_task_deinit();
break;
case RUNLOOP_CTL_IS_CORE_OPTION_UPDATED:
return system->core_options ?
core_option_updated(system->core_options) : false;
case RUNLOOP_CTL_CORE_OPTIONS_GET:
{
struct retro_variable *var = (struct retro_variable*)data;
if (!system || !system->core_options || !var)
return false;
RARCH_LOG("Environ GET_VARIABLE %s:\n", var->key);
core_option_get(system->core_options, var);
RARCH_LOG("\t%s\n", var->value ? var->value : "N/A");
}
return true;
case RUNLOOP_CTL_CORE_OPTIONS_DEINIT:
if (!system->core_options)
return false;
core_option_flush(system->core_options);
core_option_free(system->core_options);
system->core_options = NULL;
return true;
case RUNLOOP_CTL_NONE:
default:
return false;
}

View File

@ -28,7 +28,8 @@ extern "C" {
enum runloop_ctl_state
{
RUNLOOP_CTL_SET_FRAME_LIMIT = 0,
RUNLOOP_CTL_NONE = 0,
RUNLOOP_CTL_SET_FRAME_LIMIT,
RUNLOOP_CTL_UNSET_FRAME_LIMIT,
RUNLOOP_CTL_SHOULD_SET_FRAME_LIMIT,
RUNLOOP_CTL_SET_FRAME_TIME_LAST,
@ -85,6 +86,9 @@ enum runloop_ctl_state
RUNLOOP_CTL_MSG_QUEUE_LOCK,
RUNLOOP_CTL_MSG_QUEUE_UNLOCK,
RUNLOOP_CTL_MSG_QUEUE_FREE,
RUNLOOP_CTL_IS_CORE_OPTION_UPDATED,
RUNLOOP_CTL_CORE_OPTIONS_GET,
RUNLOOP_CTL_CORE_OPTIONS_DEINIT,
RUNLOOP_CTL_SYSTEM_INFO_INIT,
RUNLOOP_CTL_SYSTEM_INFO_FREE,
RUNLOOP_CTL_PREPARE_DUMMY