Fix Load Content (Detect Core)

This commit is contained in:
twinaphex 2015-06-07 23:26:29 +02:00
parent 079201841f
commit 44938ed1ef
5 changed files with 43 additions and 3 deletions

View File

@ -1965,6 +1965,7 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
need_push = true;
break;
case DISPLAYLIST_CORES_SUPPORTED:
case DISPLAYLIST_CORES_COLLECTION_SUPPORTED:
menu_list_clear(info->list);
need_sort = true;
need_refresh = true;
@ -1985,8 +1986,12 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
for (i = 0; i < list_size; i++)
{
menu_list_push(info->list, core_info[i].path, "",
MENU_FILE_CORE, 0);
if (type == DISPLAYLIST_CORES_COLLECTION_SUPPORTED)
menu_list_push(info->list, core_info[i].path, "",
MENU_FILE_CORE, 0);
else
menu_list_push(info->list, core_info[i].path, "detect_core_list_ok",
MENU_FILE_CORE, 0);
menu_list_set_alt_at_offset(info->list, i,
core_info[i].display_name);
}

View File

@ -44,6 +44,7 @@ enum
DISPLAYLIST_DEFAULT,
DISPLAYLIST_CORES,
DISPLAYLIST_CORES_SUPPORTED,
DISPLAYLIST_CORES_COLLECTION_SUPPORTED,
DISPLAYLIST_CORES_UPDATER,
DISPLAYLIST_CORES_DETECTED,
DISPLAYLIST_CORE_OPTIONS,

View File

@ -63,6 +63,11 @@ static int deferred_push_core_list_deferred(menu_displaylist_info_t *info)
return menu_displaylist_push_list(info, DISPLAYLIST_CORES_SUPPORTED);
}
static int deferred_push_core_collection_list_deferred(menu_displaylist_info_t *info)
{
return menu_displaylist_push_list(info, DISPLAYLIST_CORES_COLLECTION_SUPPORTED);
}
static int deferred_push_database_manager_list_deferred(menu_displaylist_info_t *info)
{
strlcpy(info->path_b, info->path, sizeof(info->path_b));
@ -511,9 +516,11 @@ static int menu_entries_cbs_init_bind_deferred_push_compare_type(menu_file_list_
cbs->action_deferred_push = deferred_push_management_options;
break;
case MENU_LABEL_DEFERRED_CORE_LIST:
case MENU_LABEL_DEFERRED_CORE_LIST_SET:
cbs->action_deferred_push = deferred_push_core_list_deferred;
break;
case MENU_LABEL_DEFERRED_CORE_LIST_SET:
cbs->action_deferred_push = deferred_push_core_collection_list_deferred;
break;
case MENU_LABEL_DEFERRED_VIDEO_FILTER:
cbs->action_deferred_push = deferred_push_video_filter;
break;

View File

@ -31,6 +31,7 @@
#include "../input/input_remapping.h"
/* FIXME - Global variables, refactor */
static char detect_content_path[PATH_MAX_LENGTH];
unsigned rdb_entry_start_game_selection_ptr;
size_t hack_shader_pass = 0;
#ifdef HAVE_NETWORKING
@ -60,6 +61,7 @@ static int action_ok_file_load_with_detect_core(const char *path,
if (!menu)
return -1;
menu_list_get_last_stack(menu->menu_list,
&menu_path, NULL, NULL);
@ -67,6 +69,9 @@ static int action_ok_file_load_with_detect_core(const char *path,
menu_path, path, label, menu->deferred_path,
sizeof(menu->deferred_path));
fill_pathname_join(detect_content_path, menu_path, path,
sizeof(detect_content_path));
if (ret == -1)
{
switch (hash_label)
@ -111,6 +116,24 @@ static int action_ok_file_load_with_detect_core(const char *path,
return ret;
}
static int action_ok_file_load_detect_core(const char *path,
const char *label, unsigned type, size_t idx)
{
menu_handle_t *menu = menu_driver_get_ptr();
settings_t *settings = config_get_ptr();
global_t *global = global_get_ptr();
if (!menu)
return -1;
strlcpy(global->fullpath, detect_content_path, sizeof(global->fullpath));
strlcpy(settings->libretro, path, sizeof(settings->libretro));
event_command(EVENT_CMD_LOAD_CORE);
menu_entries_common_load_content(false);
return -1;
}
static int action_ok_playlist_entry(const char *path,
const char *label, unsigned type, size_t idx)
{
@ -1542,6 +1565,9 @@ static int menu_entries_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs
case MENU_LABEL_DETECT_CORE_LIST:
cbs->action_ok = action_ok_push_content_list;
break;
case MENU_LABEL_DETECT_CORE_LIST_OK:
cbs->action_ok = action_ok_file_load_detect_core;
break;
case MENU_LABEL_HISTORY_LIST:
case MENU_LABEL_CURSOR_MANAGER_LIST:
case MENU_LABEL_DATABASE_MANAGER_LIST:

View File

@ -192,6 +192,7 @@ extern "C" {
#define MENU_LABEL_CONTENT_ACTIONS 0xa0d76970U
#define MENU_LABEL_DETECT_CORE_LIST 0xaa07c341U
#define MENU_LABEL_DETECT_CORE_LIST_OK 0xabba2a7aU
#define MENU_LABEL_LOAD_CONTENT 0x5745de1fU
#define MENU_LABEL_CORE_UPDATER_LIST 0x0372767dU
#define MENU_LABEL_RECORD_CONFIG 0x11c3daf9U