1
0
mirror of https://github.com/libretro/RetroArch synced 2025-03-30 16:20:27 +00:00

Add core_info_ctl actions

This commit is contained in:
twinaphex 2016-02-07 02:37:57 +01:00
parent 7a01fb1616
commit 490c023fe3
16 changed files with 51 additions and 59 deletions

@ -894,8 +894,8 @@ static bool event_update_system_info(struct retro_system_info *_info,
libretro_get_system_info(settings->libretro, _info,
load_no_content);
#endif
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_GET, &core_info);
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &core_info_list);
core_info_ctl(CORE_INFO_CTL_CURRENT_CORE_GET, &core_info);
core_info_ctl(CORE_INFO_CTL_LIST_GET, &core_info_list);
if (!core_info_list)
return false;
@ -1274,13 +1274,13 @@ bool event_cmd_ctl(enum event_command cmd, void *data)
settings->content_history_size);
break;
case EVENT_CMD_CORE_INFO_DEINIT:
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_FREE, NULL);
core_info_ctl(CORE_INFO_CTL_LIST_DEINIT, NULL);
break;
case EVENT_CMD_CORE_INFO_INIT:
event_cmd_ctl(EVENT_CMD_CORE_INFO_DEINIT, NULL);
if (*settings->libretro_directory)
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_INIT, NULL);
core_info_ctl(CORE_INFO_CTL_LIST_INIT, NULL);
break;
case EVENT_CMD_CORE_DEINIT:
{

@ -484,7 +484,7 @@ bool core_info_does_support_file(const core_info_t *core, const char *path)
const char *core_info_list_get_all_extensions(void)
{
core_info_list_t *list = NULL;
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &list);
core_info_ctl(CORE_INFO_CTL_LIST_GET, &list);
if (!list)
return NULL;
return list->all_ext;
@ -662,10 +662,29 @@ void core_info_list_get_missing_firmware(
bool core_info_ctl(enum core_info_state state, void *data)
{
static core_info_t *core_info_current = NULL;
static core_info_list_t *core_info_curr_list = NULL;
switch (state)
{
case CORE_INFO_CTL_CURRENT_CORE_FREE:
if (core_info_current)
free(core_info_current);
core_info_current = NULL;
return true;
case CORE_INFO_CTL_CURRENT_CORE_INIT:
core_info_current = (core_info_t*)calloc(1, sizeof(core_info_t));
if (!core_info_current)
return false;
return true;
case CORE_INFO_CTL_CURRENT_CORE_GET:
{
core_info_t **core = (core_info_t**)data;
if (!core)
return false;
*core = core_info_current;
}
return true;
case CORE_INFO_CTL_LIST_DEINIT:
if (core_info_curr_list)
core_info_list_free(core_info_curr_list);

@ -29,7 +29,10 @@ enum core_info_state
CORE_INFO_CTL_NONE = 0,
CORE_INFO_CTL_LIST_DEINIT,
CORE_INFO_CTL_LIST_INIT,
CORE_INFO_CTL_LIST_GET
CORE_INFO_CTL_LIST_GET,
CORE_INFO_CTL_CURRENT_CORE_FREE,
CORE_INFO_CTL_CURRENT_CORE_INIT,
CORE_INFO_CTL_CURRENT_CORE_GET
};
typedef struct

@ -1068,7 +1068,7 @@ static void menu_action_setting_disp_set_label(file_list_t* list,
char buf[PATH_MAX_LENGTH];
core_info_list_t *list = NULL;
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &list);
core_info_ctl(CORE_INFO_CTL_LIST_GET, &list);
if (core_info_list_get_display_name(list, s, buf, sizeof(buf)))
strlcpy(s, buf, len);

@ -299,7 +299,7 @@ static int playlist_association_left(unsigned type, const char *label,
const char *path = path_basename(label);
core_info_list_t *list = NULL;
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &list);
core_info_ctl(CORE_INFO_CTL_LIST_GET, &list);
if (!list)
return -1;

@ -478,7 +478,7 @@ static int file_load_with_detect_core_wrapper(size_t idx, size_t entry_idx,
fill_pathname_join(menu_path_new, menu->scratch2_buf, menu->scratch_buf,
sizeof(menu_path_new));
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &list);
core_info_ctl(CORE_INFO_CTL_LIST_GET, &list);
def_info.data = list;
def_info.dir = menu_path_new;
@ -640,7 +640,7 @@ static int action_ok_playlist_entry(const char *path,
bool found_associated_core = menu_playlist_find_associated_core(
path_base, new_core_path, sizeof(new_core_path));
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &list);
core_info_ctl(CORE_INFO_CTL_LIST_GET, &list);
if (!(core_info = core_info_find(list, new_core_path)))
found_associated_core = false;
@ -2041,7 +2041,7 @@ static int action_ok_load_archive_detect_core(const char *path,
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &idx))
return false;
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &list);
core_info_ctl(CORE_INFO_CTL_LIST_GET, &list);
def_info.data = list;
def_info.dir = menu_path;

@ -316,7 +316,7 @@ static int playlist_association_right(unsigned type, const char *label,
const char *path = path_basename(label);
core_info_list_t *list = NULL;
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &list);
core_info_ctl(CORE_INFO_CTL_LIST_GET, &list);
if (!list)
return -1;

@ -271,7 +271,7 @@ static int action_start_playlist_association(unsigned type, const char *label)
settings_t *settings = config_get_ptr();
const char *path = path_basename(label);
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &list);
core_info_ctl(CORE_INFO_CTL_LIST_GET, &list);
if (!list)
return -1;

@ -1333,7 +1333,7 @@ static int mui_list_push(void *data, void *userdata,
menu_hash_to_str(MENU_LABEL_LOAD_CONTENT),
MENU_SETTING_ACTION, 0, 0);
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &list);
core_info_ctl(CORE_INFO_CTL_LIST_GET, &list);
if (core_info_list_num_info_files(list))
{
menu_entries_push(info->list,

@ -675,7 +675,7 @@ static int zarch_zui_render_lay_root_load(zui_t *zui, zui_tabbed_t *tabbed)
if (!zui->load_dlist)
{
core_info_t *core_info = NULL;
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_GET, &core_info);
core_info_ctl(CORE_INFO_CTL_CURRENT_CORE_GET, &core_info);
zui->load_dlist = dir_list_new(zui->load_cwd, core_info->supported_extensions, true, true);
dir_list_sort(zui->load_dlist, true);
@ -752,7 +752,7 @@ static int zarch_zui_render_lay_root_load(zui_t *zui, zui_tabbed_t *tabbed)
zui->pick_supported = 0;
strncpy(zui->pick_content, path, sizeof(zui->pick_content)-1);
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &list);
core_info_ctl(CORE_INFO_CTL_LIST_GET, &list);
core_info_list_get_supported_cores(list, path,
&zui->pick_cores, &zui->pick_supported);

@ -277,7 +277,7 @@ static bool menu_content_find_first_core(void *data)
* going to use the current core to load this. */
if (menu_label_hash == MENU_LABEL_LOAD_CONTENT)
{
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_GET, (void*)&info);
core_info_ctl(CORE_INFO_CTL_CURRENT_CORE_GET, (void*)&info);
if (info)
{
RARCH_LOG("Use the current core (%s) to load this content...\n",

@ -163,7 +163,7 @@ static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info)
settings_t *settings = config_get_ptr();
core_info_t *core_info = NULL;
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_GET, &core_info);
core_info_ctl(CORE_INFO_CTL_CURRENT_CORE_GET, &core_info);
if (!core_info || !core_info->config_data)
{
@ -271,7 +271,7 @@ static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info)
{
core_info_list_t *list = NULL;
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &list);
core_info_ctl(CORE_INFO_CTL_LIST_GET, &list);
core_info_list_update_missing_firmware(list, core_info->path,
settings->system_directory);
@ -2194,7 +2194,7 @@ static int menu_displaylist_parse_generic(menu_displaylist_info_t *info, bool ho
settings_t *settings = config_get_ptr();
uint32_t hash_label = menu_hash_calculate(info->label);
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &list);
core_info_ctl(CORE_INFO_CTL_LIST_GET, &list);
(void)device;
@ -2539,7 +2539,7 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
rarch_system_info_t *system = NULL;
core_info_list_t *list = NULL;
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &list);
core_info_ctl(CORE_INFO_CTL_LIST_GET, &list);
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
if (menu_driver_list_push(info, type))

@ -27,6 +27,7 @@
#include "menu_shader.h"
#include "../content.h"
#include "../core_info.h"
#include "../general.h"
#include "../system.h"
#include "../defaults.h"
@ -173,8 +174,8 @@ static void menu_free(menu_handle_t *menu)
event_cmd_ctl(EVENT_CMD_HISTORY_DEINIT, NULL);
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_FREE, NULL);
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_FREE, NULL);
core_info_ctl(CORE_INFO_CTL_LIST_DEINIT, NULL);
core_info_ctl(CORE_INFO_CTL_CURRENT_CORE_FREE, NULL);
free(menu);
}
@ -233,7 +234,7 @@ static void *menu_init(const void *data)
if (!menu_entries_ctl(MENU_ENTRIES_CTL_INIT, NULL))
goto error;
if (!runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_INIT, NULL))
if (!core_info_ctl(CORE_INFO_CTL_CURRENT_CORE_INIT, NULL))
goto error;
#ifdef HAVE_SHADER_MANAGER

@ -435,7 +435,6 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
#ifdef HAVE_THREADS
static slock_t *runloop_msg_queue_lock = NULL;
#endif
static core_info_t *core_info_current = NULL;
static msg_queue_t *runloop_msg_queue = NULL;
settings_t *settings = config_get_ptr();
@ -487,30 +486,6 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
return true;
case RUNLOOP_CTL_HAS_CORE_OPTIONS:
return runloop_system.core_options;
case RUNLOOP_CTL_CURRENT_CORE_LIST_FREE:
return core_info_ctl(CORE_INFO_CTL_LIST_DEINIT, NULL);
case RUNLOOP_CTL_CURRENT_CORE_LIST_INIT:
return core_info_ctl(CORE_INFO_CTL_LIST_INIT, NULL);
case RUNLOOP_CTL_CURRENT_CORE_LIST_GET:
return core_info_ctl(CORE_INFO_CTL_LIST_GET, data);
case RUNLOOP_CTL_CURRENT_CORE_FREE:
if (core_info_current)
free(core_info_current);
core_info_current = NULL;
return true;
case RUNLOOP_CTL_CURRENT_CORE_INIT:
core_info_current = (core_info_t*)calloc(1, sizeof(core_info_t));
if (!core_info_current)
return false;
return true;
case RUNLOOP_CTL_CURRENT_CORE_GET:
{
core_info_t **core = (core_info_t**)data;
if (!core)
return false;
*core = core_info_current;
}
return true;
case RUNLOOP_CTL_SYSTEM_INFO_GET:
{
rarch_system_info_t **system = (rarch_system_info_t**)data;

@ -72,12 +72,6 @@ enum runloop_ctl_state
RUNLOOP_CTL_SET_PERFCNT_ENABLE,
RUNLOOP_CTL_UNSET_PERFCNT_ENABLE,
RUNLOOP_CTL_IS_PERFCNT_ENABLE,
RUNLOOP_CTL_CURRENT_CORE_LIST_FREE,
RUNLOOP_CTL_CURRENT_CORE_LIST_INIT,
RUNLOOP_CTL_CURRENT_CORE_LIST_GET,
RUNLOOP_CTL_CURRENT_CORE_FREE,
RUNLOOP_CTL_CURRENT_CORE_INIT,
RUNLOOP_CTL_CURRENT_CORE_GET,
RUNLOOP_CTL_FRONTEND_KEY_EVENT_GET,
RUNLOOP_CTL_KEY_EVENT_GET,
RUNLOOP_CTL_DATA_DEINIT,

@ -152,7 +152,7 @@ struct string_list *string_list_new_special(enum string_list_type type,
}
break;
case STRING_LIST_SUPPORTED_CORES_PATHS:
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &core_info_list);
core_info_ctl(CORE_INFO_CTL_LIST_GET, &core_info_list);
core_info_list_get_supported_cores(core_info_list,
(const char*)data, &core_info, list_size);
@ -174,7 +174,7 @@ struct string_list *string_list_new_special(enum string_list_type type,
}
break;
case STRING_LIST_CORES_PATHS:
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &core_info_list);
core_info_ctl(CORE_INFO_CTL_LIST_GET, &core_info_list);
for (i = 0; i < core_info_list_num_info_files(core_info_list); i++)
{
@ -190,7 +190,7 @@ struct string_list *string_list_new_special(enum string_list_type type,
}
break;
case STRING_LIST_SUPPORTED_CORES_NAMES:
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &core_info_list);
core_info_ctl(CORE_INFO_CTL_LIST_GET, &core_info_list);
core_info_list_get_supported_cores(core_info_list,
(const char*)data, &core_info, list_size);
@ -211,7 +211,7 @@ struct string_list *string_list_new_special(enum string_list_type type,
}
break;
case STRING_LIST_CORES_NAMES:
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &core_info_list);
core_info_ctl(CORE_INFO_CTL_LIST_GET, &core_info_list);
for (i = 0; i < core_info_list_num_info_files(core_info_list); i++)
{
const char *opt = NULL;