mirror of
https://github.com/libretro/RetroArch
synced 2025-03-20 19:21:27 +00:00
Move core options variable
This commit is contained in:
parent
f42911cab7
commit
dba04c73e4
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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,11 +1135,12 @@ 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);
|
||||
@ -1149,6 +1148,7 @@ static void menu_action_setting_disp_set_label(file_list_t* list,
|
||||
if (core_opt)
|
||||
strlcpy(s, core_opt, len);
|
||||
}
|
||||
}
|
||||
else
|
||||
menu_setting_get_label(list, s,
|
||||
len, w, type, label, entry_label, i);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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,6 +3152,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
info->need_push = true;
|
||||
break;
|
||||
case DISPLAYLIST_MAIN_MENU:
|
||||
{
|
||||
rarch_system_info_t *system = NULL;
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
|
||||
|
||||
if (!rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
|
||||
@ -3222,6 +3223,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
PARSE_ACTION, false);
|
||||
#endif
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
54
runloop.c
54
runloop.c
@ -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,13 +489,6 @@ 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)
|
||||
@ -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:
|
||||
|
@ -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,
|
||||
|
2
system.h
2
system.h
@ -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
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user