(Load Content -> Collection) Already loaded core will appear in

supported cores list as 'top core'/'current core'.
This commit is contained in:
twinaphex 2016-12-13 06:32:46 +01:00
parent 12cb854d4a
commit d57083197e
4 changed files with 64 additions and 4 deletions

View File

@ -349,6 +349,8 @@ MSG_HASH(MENU_ENUM_LABEL_FILE_BROWSER_CORE_DETECTED,
"file_browser_core_detected")
MSG_HASH(MENU_ENUM_LABEL_FILE_BROWSER_CORE_SELECT_FROM_COLLECTION,
"file_browser_core_select_from_collection")
MSG_HASH(MENU_ENUM_LABEL_FILE_BROWSER_CORE_SELECT_FROM_COLLECTION_CURRENT_CORE,
"file_browser_core_select_from_collection_current_core")
MSG_HASH(MENU_ENUM_LABEL_FILE_BROWSER_DIRECTORY,
"file_browser_directory")
MSG_HASH(MENU_ENUM_LABEL_FILE_BROWSER_IMAGE,

View File

@ -1889,6 +1889,47 @@ static int action_ok_core_deferred_set(const char *path,
return menu_cbs_exit();
}
static int action_ok_core_deferred_set_current_core(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
size_t selection;
char core_display_name[PATH_MAX_LENGTH];
const char *entry_path = NULL;
const char *entry_label = NULL;
const char *entry_crc32 = NULL;
const char *db_name = NULL;
playlist_t *playlist = NULL;
core_display_name[0] = '\0';
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
return menu_cbs_exit();
menu_driver_ctl(RARCH_MENU_CTL_PLAYLIST_GET, &playlist);
retro_assert(playlist != NULL);
core_info_get_name(path, core_display_name, sizeof(core_display_name));
idx = rdb_entry_start_game_selection_ptr;
playlist_get_index(playlist, idx,
&entry_path, &entry_label, NULL, NULL, &entry_crc32, &db_name);
playlist_update(playlist, idx,
entry_path, entry_label,
path , core_display_name,
entry_crc32,
db_name);
playlist_write_file(playlist);
menu_entries_pop_stack(&selection, 0, 1);
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection);
return 0;
}
static int action_ok_deferred_list_stub(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
@ -3643,6 +3684,9 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_FILE_BROWSER_CORE_SELECT_FROM_COLLECTION:
BIND_ACTION_OK(cbs, action_ok_core_deferred_set);
break;
case MENU_ENUM_LABEL_FILE_BROWSER_CORE_SELECT_FROM_COLLECTION_CURRENT_CORE:
BIND_ACTION_OK(cbs, action_ok_core_deferred_set_current_core);
break;
case MENU_ENUM_LABEL_START_CORE:
BIND_ACTION_OK(cbs, action_ok_start_core);
break;

View File

@ -77,7 +77,9 @@
#include "../tasks/tasks_internal.h"
static char new_path_entry[4096] = {0};
static char new_lbl_entry[4096] = {0};
static char new_entry[4096] = {0};
enum menu_displaylist_ctl_state new_type = 0;
#ifdef HAVE_NETWORKING
static void print_buf_lines(file_list_t *list, char *buf,
@ -3869,12 +3871,14 @@ static bool menu_displaylist_push_list_process(menu_displaylist_info_t *info)
{
menu_entries_prepend(info->list,
new_path_entry,
new_entry,
MENU_ENUM_LABEL_DETECT_CORE_LIST_OK_CURRENT_CORE,
new_lbl_entry,
new_type,
FILE_TYPE_CORE, 0, 0);
menu_entries_set_alt_at_offset(info->list, 0,
new_entry);
new_type = 0;
new_lbl_entry[0] = '\0';
new_path_entry[0] = '\0';
new_entry[0] = '\0';
}
@ -5938,11 +5942,20 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
for (i = 0; i < cores_names_size; i++)
{
if ( !path_is_empty(RARCH_PATH_CORE) &&
string_is_equal(cores_paths->elems[i].data, path_get(RARCH_PATH_CORE))
&& type != DISPLAYLIST_CORES_COLLECTION_SUPPORTED)
string_is_equal(cores_paths->elems[i].data, path_get(RARCH_PATH_CORE)))
{
strlcpy(new_path_entry, cores_paths->elems[i].data, sizeof(new_path_entry));
snprintf(new_entry, sizeof(new_entry), "Current core (%s)", cores_names->elems[i].data);
if (type == DISPLAYLIST_CORES_COLLECTION_SUPPORTED)
{
new_lbl_entry[0] = '\0';
new_type = MENU_ENUM_LABEL_FILE_BROWSER_CORE_SELECT_FROM_COLLECTION_CURRENT_CORE;
}
else
{
strlcpy(new_lbl_entry, cores_paths->elems[i].data, sizeof(new_lbl_entry));
new_type = MENU_ENUM_LABEL_DETECT_CORE_LIST_OK_CURRENT_CORE;
}
}
else
{

View File

@ -674,6 +674,7 @@ enum msg_hash_enums
MENU_ENUM_LABEL_FILE_BROWSER_FONT,
MENU_ENUM_LABEL_FILE_BROWSER_RDB,
MENU_ENUM_LABEL_FILE_BROWSER_CORE_SELECT_FROM_COLLECTION,
MENU_ENUM_LABEL_FILE_BROWSER_CORE_SELECT_FROM_COLLECTION_CURRENT_CORE,
MENU_ENUM_LABEL_FILE_BROWSER_CORE_DETECTED,
MENU_ENUM_LABEL_FILE_BROWSER_IMAGE,
MENU_ENUM_LABEL_FILE_BROWSER_IMAGE_OPEN_WITH_VIEWER,