Move core options variable

This commit is contained in:
twinaphex 2016-04-06 02:30:20 +02:00
parent f42911cab7
commit dba04c73e4
8 changed files with 109 additions and 98 deletions

View File

@ -576,6 +576,7 @@ void uninit_libretro_sym(struct retro_core_t *current_core)
runloop_ctl(RUNLOOP_CTL_CORE_OPTIONS_DEINIT, NULL);
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_FREE, NULL);
runloop_ctl(RUNLOOP_CTL_FRAME_TIME_FREE, NULL);
camera_driver_ctl(RARCH_CAMERA_CTL_UNSET_ACTIVE, NULL);
location_driver_ctl(RARCH_LOCATION_CTL_UNSET_ACTIVE, NULL);

View File

@ -310,7 +310,6 @@ bool core_ctl(enum core_ctl_state state, void *data)
case CORE_CTL_RETRO_DEINIT:
core.retro_deinit();
uninit_libretro_sym(&core);
runloop_ctl(RUNLOOP_CTL_FRAME_TIME_FREE, NULL);
break;
case CORE_CTL_RETRO_UNLOAD_GAME:
video_driver_ctl(RARCH_DISPLAY_CTL_DEINIT_HW_CONTEXT, NULL);

View File

@ -27,6 +27,7 @@
#include "../../input/input_config.h"
#include "../../core_info.h"
#include "../../core_options.h"
#include "../../cheats.h"
#include "../../general.h"
#include "../../performance.h"
@ -1068,11 +1069,8 @@ static void menu_action_setting_disp_set_label(file_list_t* list,
const char *path,
char *s2, size_t len2)
{
rarch_system_info_t *system = NULL;
uint32_t hash_label = menu_hash_calculate(label);
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
*s = '\0';
*w = 19;
@ -1137,17 +1135,19 @@ static void menu_action_setting_disp_set_label(file_list_t* list,
}
else if (type >= MENU_SETTINGS_CORE_OPTION_START)
{
core_option_manager_t *coreopts = NULL;
const char *core_opt = NULL;
if (!system)
return;
core_opt = core_option_get_val(system->core_options,
if (runloop_ctl(RUNLOOP_CTL_COREOPTS_GET, &coreopts))
{
core_opt = core_option_get_val(coreopts,
type - MENU_SETTINGS_CORE_OPTION_START);
strlcpy(s, "", len);
strlcpy(s, "", len);
if (core_opt)
strlcpy(s, core_opt, len);
if (core_opt)
strlcpy(s, core_opt, len);
}
}
else
menu_setting_get_label(list, s,

View File

@ -25,6 +25,7 @@
#include "../menu_hash.h"
#include "../../core_info.h"
#include "../../core_options.h"
#include "../../cheats.h"
#include "../../general.h"
#include "../../retroarch.h"
@ -255,12 +256,10 @@ static int action_start_core_setting(unsigned type,
const char *label)
{
unsigned idx = type - MENU_SETTINGS_CORE_OPTION_START;
rarch_system_info_t *system = NULL;
core_option_manager_t *coreopts = NULL;
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
if (system)
core_option_set_default(system->core_options, idx);
if (runloop_ctl(RUNLOOP_CTL_COREOPTS_GET, &coreopts))
core_option_set_default(coreopts, idx);
return 0;
}

View File

@ -45,6 +45,7 @@
#include "../list_special.h"
#include "../performance.h"
#include "../core_info.h"
#include "../core_options.h"
#ifdef HAVE_CHEEVOS
#include "../cheevos.h"
@ -2934,7 +2935,6 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
video_shader_ctx_t shader_info;
#endif
int ret = 0;
rarch_system_info_t *system = NULL;
core_info_list_t *list = NULL;
menu_handle_t *menu = NULL;
settings_t *settings = NULL;
@ -2958,7 +2958,6 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
settings = config_get_ptr();
core_info_ctl(CORE_INFO_CTL_LIST_GET, &list);
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
disp_list.info = info;
disp_list.type = type;
@ -3153,75 +3152,78 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
info->need_push = true;
break;
case DISPLAYLIST_MAIN_MENU:
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
{
rarch_system_info_t *system = NULL;
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
if (!rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
if (!rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
menu_displaylist_parse_settings(menu, info,
menu_hash_to_str(MENU_LABEL_CONTENT_SETTINGS),
PARSE_ACTION, false);
menu_displaylist_parse_settings(menu, info,
menu_hash_to_str(MENU_LABEL_CONTENT_SETTINGS),
PARSE_ACTION, false);
menu_displaylist_parse_settings(menu, info,
menu_hash_to_str(MENU_LABEL_START_CORE), PARSE_ACTION, false);
menu_hash_to_str(MENU_LABEL_START_CORE), PARSE_ACTION, false);
#ifndef HAVE_DYNAMIC
if (frontend_driver_has_fork())
if (frontend_driver_has_fork())
#endif
{
menu_displaylist_parse_settings(menu, info,
menu_hash_to_str(MENU_LABEL_CORE_LIST), PARSE_ACTION, false);
}
{
menu_displaylist_parse_settings(menu, info,
menu_hash_to_str(MENU_LABEL_CORE_LIST), PARSE_ACTION, false);
}
menu_displaylist_parse_settings(menu, info,
menu_hash_to_str(MENU_LABEL_LOAD_CONTENT_LIST),
PARSE_ACTION, false);
menu_displaylist_parse_settings(menu, info,
menu_hash_to_str(MENU_LABEL_LOAD_CONTENT_HISTORY),
PARSE_ACTION, false);
menu_displaylist_parse_settings(menu, info,
menu_hash_to_str(MENU_LABEL_LOAD_CONTENT_LIST),
PARSE_ACTION, false);
menu_displaylist_parse_settings(menu, info,
menu_hash_to_str(MENU_LABEL_LOAD_CONTENT_HISTORY),
PARSE_ACTION, false);
#if defined(HAVE_NETWORKING)
#if defined(HAVE_LIBRETRODB)
menu_displaylist_parse_settings(menu, info,
menu_hash_to_str(MENU_LABEL_ADD_CONTENT_LIST),
PARSE_ACTION, false);
menu_displaylist_parse_settings(menu, info,
menu_hash_to_str(MENU_LABEL_ADD_CONTENT_LIST),
PARSE_ACTION, false);
#endif
menu_displaylist_parse_settings(menu, info,
menu_hash_to_str(MENU_LABEL_ONLINE_UPDATER),
PARSE_ACTION, false);
menu_displaylist_parse_settings(menu, info,
menu_hash_to_str(MENU_LABEL_ONLINE_UPDATER),
PARSE_ACTION, false);
#endif
menu_displaylist_parse_settings(menu, info,
menu_hash_to_str(MENU_LABEL_SETTINGS), PARSE_ACTION, false);
menu_displaylist_parse_settings(menu, info,
menu_hash_to_str(MENU_LABEL_INFORMATION_LIST),
PARSE_ACTION, false);
menu_displaylist_parse_settings(menu, info,
menu_hash_to_str(MENU_LABEL_SETTINGS), PARSE_ACTION, false);
menu_displaylist_parse_settings(menu, info,
menu_hash_to_str(MENU_LABEL_INFORMATION_LIST),
PARSE_ACTION, false);
#ifndef HAVE_DYNAMIC
menu_displaylist_parse_settings(menu, info,
menu_hash_to_str(MENU_LABEL_RESTART_RETROARCH),
PARSE_ACTION, false);
menu_displaylist_parse_settings(menu, info,
menu_hash_to_str(MENU_LABEL_RESTART_RETROARCH),
PARSE_ACTION, false);
#endif
menu_displaylist_parse_settings(menu, info,
menu_hash_to_str(MENU_LABEL_CONFIGURATIONS),
PARSE_ACTION, false);
menu_displaylist_parse_settings(menu, info,
menu_hash_to_str(MENU_LABEL_SAVE_CURRENT_CONFIG),
PARSE_ACTION, false);
menu_displaylist_parse_settings(menu, info,
menu_hash_to_str(MENU_LABEL_SAVE_NEW_CONFIG),
PARSE_ACTION, false);
menu_displaylist_parse_settings(menu, info,
menu_hash_to_str(MENU_LABEL_HELP_LIST),
PARSE_ACTION, false);
menu_displaylist_parse_settings(menu, info,
menu_hash_to_str(MENU_LABEL_CONFIGURATIONS),
PARSE_ACTION, false);
menu_displaylist_parse_settings(menu, info,
menu_hash_to_str(MENU_LABEL_SAVE_CURRENT_CONFIG),
PARSE_ACTION, false);
menu_displaylist_parse_settings(menu, info,
menu_hash_to_str(MENU_LABEL_SAVE_NEW_CONFIG),
PARSE_ACTION, false);
menu_displaylist_parse_settings(menu, info,
menu_hash_to_str(MENU_LABEL_HELP_LIST),
PARSE_ACTION, false);
#if !defined(IOS)
menu_displaylist_parse_settings(menu, info,
menu_hash_to_str(MENU_LABEL_QUIT_RETROARCH),
PARSE_ACTION, false);
menu_displaylist_parse_settings(menu, info,
menu_hash_to_str(MENU_LABEL_QUIT_RETROARCH),
PARSE_ACTION, false);
#endif
#if defined(HAVE_LAKKA)
menu_displaylist_parse_settings(menu, info,
menu_hash_to_str(MENU_LABEL_SHUTDOWN),
PARSE_ACTION, false);
menu_displaylist_parse_settings(menu, info,
menu_hash_to_str(MENU_LABEL_REBOOT),
PARSE_ACTION, false);
menu_displaylist_parse_settings(menu, info,
menu_hash_to_str(MENU_LABEL_SHUTDOWN),
PARSE_ACTION, false);
menu_displaylist_parse_settings(menu, info,
menu_hash_to_str(MENU_LABEL_REBOOT),
PARSE_ACTION, false);
#endif
info->need_push = true;
info->need_push = true;
}
break;
case DISPLAYLIST_PLAYLIST_SETTINGS_LIST:
ret = menu_displaylist_parse_settings(menu, info,
@ -3733,9 +3735,13 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
}
else
{
core_option_manager_t *coreopts = NULL;
runloop_ctl(RUNLOOP_CTL_COREOPTS_GET, &coreopts);
for (i = 0; i < opts; i++)
menu_entries_push(info->list,
core_option_get_desc(system->core_options, i), "",
core_option_get_desc(coreopts, i), "",
MENU_SETTINGS_CORE_OPTION_START + i, 0, 0);
}
}

View File

@ -37,6 +37,7 @@
#endif
#include "autosave.h"
#include "core_info.h"
#include "core_options.h"
#include "cheats.h"
#include "configuration.h"
#include "performance.h"
@ -429,6 +430,7 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
static bool runloop_perfcnt_enable = false;
static bool runloop_overrides_active = false;
static bool runloop_game_options_active = false;
static core_option_manager_t *runloop_core_options = NULL;
#ifdef HAVE_THREADS
static slock_t *runloop_msg_queue_lock = NULL;
#endif
@ -465,11 +467,19 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
unsigned *idx = (unsigned*)data;
if (!idx)
return false;
*idx = core_option_size(runloop_system.core_options);
*idx = core_option_size(runloop_core_options);
}
break;
case RUNLOOP_CTL_HAS_CORE_OPTIONS:
return runloop_system.core_options;
return runloop_core_options;
case RUNLOOP_CTL_COREOPTS_GET:
{
core_option_manager_t **coreopts = (core_option_manager_t**)data;
if (!coreopts)
return false;
*coreopts = runloop_core_options;
}
break;
case RUNLOOP_CTL_SYSTEM_INFO_GET:
{
rarch_system_info_t **system = (rarch_system_info_t**)data;
@ -479,18 +489,11 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
}
break;
case RUNLOOP_CTL_SYSTEM_INFO_FREE:
if (runloop_system.core_options)
{
core_option_flush(runloop_system.core_options);
core_option_free(runloop_system.core_options);
}
runloop_system.core_options = NULL;
/* No longer valid. */
if (runloop_system.subsystem.data)
free(runloop_system.subsystem.data);
runloop_system.subsystem.data = NULL;
runloop_system.subsystem.data = NULL;
if (runloop_system.ports.data)
free(runloop_system.ports.data);
runloop_system.subsystem.size = 0;
@ -1067,15 +1070,15 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
task_queue_ctl(TASK_QUEUE_CTL_DEINIT, NULL);
break;
case RUNLOOP_CTL_IS_CORE_OPTION_UPDATED:
if (!runloop_system.core_options)
if (!runloop_core_options)
return false;
return core_option_updated(runloop_system.core_options);
return core_option_updated(runloop_core_options);
case RUNLOOP_CTL_CORE_OPTION_PREV:
{
unsigned *idx = (unsigned*)data;
if (!idx)
return false;
core_option_prev(runloop_system.core_options, *idx);
core_option_prev(runloop_core_options, *idx);
if (ui_companion_is_on_foreground())
ui_companion_driver_notify_refresh();
}
@ -1085,7 +1088,7 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
unsigned *idx = (unsigned*)data;
if (!idx)
return false;
core_option_next(runloop_system.core_options, *idx);
core_option_next(runloop_core_options, *idx);
if (ui_companion_is_on_foreground())
ui_companion_driver_notify_refresh();
}
@ -1094,11 +1097,11 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
{
struct retro_variable *var = (struct retro_variable*)data;
if (!runloop_system.core_options || !var)
if (!runloop_core_options || !var)
return false;
RARCH_LOG("Environ GET_VARIABLE %s:\n", var->key);
core_option_get(runloop_system.core_options, var);
core_option_get(runloop_core_options, var);
RARCH_LOG("\t%s\n", var->value ? var->value : "N/A");
}
break;
@ -1126,42 +1129,45 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
if(ret)
{
runloop_ctl(RUNLOOP_CTL_SET_GAME_OPTIONS_ACTIVE, NULL);
runloop_system.core_options =
runloop_core_options =
core_option_new(game_options_path, vars);
free(game_options_path);
}
else
{
runloop_ctl(RUNLOOP_CTL_UNSET_GAME_OPTIONS_ACTIVE, NULL);
runloop_system.core_options =
runloop_core_options =
core_option_new(options_path, vars);
}
}
break;
case RUNLOOP_CTL_CORE_OPTIONS_FREE:
if (runloop_core_options)
core_option_free(runloop_core_options);
runloop_core_options = NULL;
break;
case RUNLOOP_CTL_CORE_OPTIONS_DEINIT:
{
global_t *global = global_get_ptr();
if (!global || !runloop_system.core_options)
if (!runloop_core_options)
return false;
/* check if game options file was just created and flush
to that file instead */
if(!string_is_empty(global->path.core_options_path))
if(global && !string_is_empty(global->path.core_options_path))
{
core_option_flush_game_specific(runloop_system.core_options,
core_option_flush_game_specific(runloop_core_options,
global->path.core_options_path);
global->path.core_options_path[0] = '\0';
}
else
core_option_flush(runloop_system.core_options);
core_option_free(runloop_system.core_options);
core_option_flush(runloop_core_options);
if (runloop_ctl(RUNLOOP_CTL_IS_GAME_OPTIONS_ACTIVE, NULL))
runloop_ctl(RUNLOOP_CTL_UNSET_GAME_OPTIONS_ACTIVE, NULL);
runloop_system.core_options = NULL;
runloop_ctl(RUNLOOP_CTL_CORE_OPTIONS_FREE, NULL);
}
break;
case RUNLOOP_CTL_KEY_EVENT_GET:

View File

@ -118,11 +118,13 @@ enum runloop_ctl_state
RUNLOOP_CTL_HAS_CORE_OPTIONS,
RUNLOOP_CTL_GET_CORE_OPTION_SIZE,
RUNLOOP_CTL_IS_CORE_OPTION_UPDATED,
RUNLOOP_CTL_COREOPTS_GET,
RUNLOOP_CTL_CORE_OPTION_PREV,
RUNLOOP_CTL_CORE_OPTION_NEXT,
RUNLOOP_CTL_CORE_OPTIONS_GET,
RUNLOOP_CTL_CORE_OPTIONS_INIT,
RUNLOOP_CTL_CORE_OPTIONS_DEINIT,
RUNLOOP_CTL_CORE_OPTIONS_FREE,
RUNLOOP_CTL_SHADER_DIR_DEINIT,
RUNLOOP_CTL_SHADER_DIR_INIT,
RUNLOOP_CTL_SYSTEM_INFO_GET,

View File

@ -19,7 +19,6 @@
#include <retro_miscellaneous.h>
#include "driver.h"
#include "core_options.h"
#include "libretro.h"
#ifndef MAX_USERS
@ -43,7 +42,6 @@ typedef struct rarch_system_info
struct retro_disk_control_callback disk_control_cb;
struct retro_location_callback location_cb;
core_option_manager_t *core_options;
struct
{