Merge pull request #9051 from jdgleaver/set-core-association

Quick Menu: Add 'Set Core Association' option
This commit is contained in:
Twinaphex 2019-07-03 18:03:48 +02:00 committed by GitHub
commit c3418793cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 94 additions and 16 deletions

View File

@ -300,6 +300,7 @@ static bool quick_menu_show_undo_save_load_state = true;
static bool quick_menu_show_add_to_favorites = true;
static bool quick_menu_show_start_recording = true;
static bool quick_menu_show_start_streaming = true;
static bool quick_menu_show_set_core_association = true;
static bool quick_menu_show_reset_core_association = true;
static bool quick_menu_show_options = true;
static bool quick_menu_show_controls = true;

View File

@ -1456,6 +1456,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
SETTING_BOOL("quick_menu_show_add_to_favorites", &settings->bools.quick_menu_show_add_to_favorites, true, quick_menu_show_add_to_favorites, false);
SETTING_BOOL("quick_menu_show_start_recording", &settings->bools.quick_menu_show_start_recording, true, quick_menu_show_start_recording, false);
SETTING_BOOL("quick_menu_show_start_streaming", &settings->bools.quick_menu_show_start_streaming, true, quick_menu_show_start_streaming, false);
SETTING_BOOL("quick_menu_show_set_core_association", &settings->bools.quick_menu_show_set_core_association, true, quick_menu_show_set_core_association, false);
SETTING_BOOL("quick_menu_show_reset_core_association", &settings->bools.quick_menu_show_reset_core_association, true, quick_menu_show_reset_core_association, false);
SETTING_BOOL("quick_menu_show_options", &settings->bools.quick_menu_show_options, true, quick_menu_show_options, false);
SETTING_BOOL("quick_menu_show_controls", &settings->bools.quick_menu_show_controls, true, quick_menu_show_controls, false);

View File

@ -206,6 +206,7 @@ typedef struct settings
bool quick_menu_show_add_to_favorites;
bool quick_menu_show_start_recording;
bool quick_menu_show_start_streaming;
bool quick_menu_show_set_core_association;
bool quick_menu_show_reset_core_association;
bool quick_menu_show_options;
bool quick_menu_show_controls;

View File

@ -1067,6 +1067,8 @@ MSG_HASH(MENU_ENUM_LABEL_ADD_TO_FAVORITES,
"favorites_add")
MSG_HASH(MENU_ENUM_LABEL_ADD_TO_FAVORITES_PLAYLIST,
"favorites_add_playlist")
MSG_HASH(MENU_ENUM_LABEL_SET_CORE_ASSOCIATION,
"set_core_association")
MSG_HASH(MENU_ENUM_LABEL_RESET_CORE_ASSOCIATION,
"reset_core_association")
MSG_HASH(MENU_ENUM_LABEL_DOWNLOAD_PL_ENTRY_THUMBNAILS,
@ -1631,6 +1633,8 @@ MSG_HASH(MENU_ENUM_LABEL_QUICK_MENU_SHOW_START_RECORDING,
"quick_menu_show_start_recording")
MSG_HASH(MENU_ENUM_LABEL_QUICK_MENU_SHOW_START_STREAMING,
"quick_menu_show_start_streaming")
MSG_HASH(MENU_ENUM_LABEL_QUICK_MENU_SHOW_SET_CORE_ASSOCIATION,
"quick_menu_show_set_core_association")
MSG_HASH(MENU_ENUM_LABEL_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION,
"quick_menu_show_reset_core_association")
MSG_HASH(MENU_ENUM_LABEL_QUICK_MENU_SHOW_OPTIONS,

View File

@ -2546,6 +2546,10 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_DOWNLOAD_PL_ENTRY_THUMBNAILS,
"Download screenshot/box art/title screen thumbnail images for current content. Updates any existing thumbnails."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_SET_CORE_ASSOCIATION,
"Set Core Association"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RESET_CORE_ASSOCIATION,
"Reset Core Association"
@ -4363,6 +4367,10 @@ MSG_HASH(
MSG_ADDED_TO_FAVORITES,
"Added to favorites"
)
MSG_HASH(
MSG_SET_CORE_ASSOCIATION,
"Core set: "
)
MSG_HASH(
MSG_RESET_CORE_ASSOCIATION,
"Playlist entry core association has been reset."
@ -6899,6 +6907,14 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_START_STREAMING,
"Show/hide the 'Start Streaming' option."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_SET_CORE_ASSOCIATION,
"Show Set Core Association"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SET_CORE_ASSOCIATION,
"Show/hide the 'Set Core Association' option."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION,
"Show Reset Core Association"

View File

@ -2727,11 +2727,15 @@ static int action_ok_core_deferred_set(const char *new_core_path,
{
char ext_name[255];
char core_display_name[PATH_MAX_LENGTH];
char msg[PATH_MAX_LENGTH];
settings_t *settings = config_get_ptr();
menu_handle_t *menu = NULL;
size_t selection = menu_navigation_get_selection();
struct playlist_entry entry = {0};
ext_name[0] = '\0';
core_display_name[0] = '\0';
msg[0] = '\0';
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
return menu_cbs_exit();
@ -2739,8 +2743,6 @@ static int action_ok_core_deferred_set(const char *new_core_path,
if (!frontend_driver_get_core_extension(ext_name, sizeof(ext_name)))
return menu_cbs_exit();
core_display_name[0] = '\0';
core_info_get_name(new_core_path,
core_display_name, sizeof(core_display_name),
settings->paths.path_libretro_info,
@ -2749,20 +2751,20 @@ static int action_ok_core_deferred_set(const char *new_core_path,
settings->bools.show_hidden_files,
true);
{
struct playlist_entry entry = {0};
/* the update function reads our entry
* as const, so these casts are safe */
entry.core_path = (char*)new_core_path;
entry.core_name = core_display_name;
/* the update function reads our entry
* as const, so these casts are safe */
entry.label = (char*)content_label;
entry.core_path = (char*)new_core_path;
entry.core_name = core_display_name;
command_playlist_update_write(
NULL,
menu->scratchpad.unsigned_var,
&entry);
command_playlist_update_write(
NULL,
menu->scratchpad.unsigned_var,
&entry);
}
/* Provide visual feedback */
strlcpy(msg, msg_hash_to_str(MSG_SET_CORE_ASSOCIATION), sizeof(msg));
strlcat(msg, core_display_name, sizeof(msg));
runloop_msg_queue_push(msg, 1, 100, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
menu_entries_pop_stack(&selection, 0, 1);
menu_navigation_set_selection(selection);
@ -3904,6 +3906,19 @@ default_action_ok_cmd_func(action_ok_disk_cycle_tray_status, CMD_EVENT_DISK_EJ
default_action_ok_cmd_func(action_ok_shader_apply_changes, CMD_EVENT_SHADERS_APPLY_CHANGES)
default_action_ok_cmd_func(action_ok_show_wimp, CMD_EVENT_UI_COMPANION_TOGGLE)
static int action_ok_set_core_association(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
menu_handle_t *menu = NULL;
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
return menu_cbs_exit();
return generic_action_ok_displaylist_push(path, NULL,
NULL, 0, menu->rpl_entry_selection_ptr, entry_idx,
ACTION_OK_DL_DEFERRED_CORE_LIST_SET);
}
static int action_ok_reset_core_association(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
@ -5745,6 +5760,9 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_ADD_TO_FAVORITES_PLAYLIST:
BIND_ACTION_OK(cbs, action_ok_add_to_favorites_playlist);
break;
case MENU_ENUM_LABEL_SET_CORE_ASSOCIATION:
BIND_ACTION_OK(cbs, action_ok_set_core_association);
break;
case MENU_ENUM_LABEL_RESET_CORE_ASSOCIATION:
BIND_ACTION_OK(cbs, action_ok_reset_core_association);
break;

View File

@ -460,6 +460,7 @@ default_sublabel_macro(action_bind_sublabel_quick_menu_show_undo_save_load_state
default_sublabel_macro(action_bind_sublabel_quick_menu_show_add_to_favorites, MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_ADD_TO_FAVORITES)
default_sublabel_macro(action_bind_sublabel_quick_menu_show_start_recording, MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_START_RECORDING)
default_sublabel_macro(action_bind_sublabel_quick_menu_show_start_streaming, MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_START_STREAMING)
default_sublabel_macro(action_bind_sublabel_quick_menu_show_set_core_association, MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SET_CORE_ASSOCIATION)
default_sublabel_macro(action_bind_sublabel_quick_menu_show_reset_core_association, MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION)
default_sublabel_macro(action_bind_sublabel_quick_menu_show_options, MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_OPTIONS)
default_sublabel_macro(action_bind_sublabel_quick_menu_show_controls, MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_CONTROLS)
@ -1335,6 +1336,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_QUICK_MENU_SHOW_START_STREAMING:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_quick_menu_show_start_streaming);
break;
case MENU_ENUM_LABEL_QUICK_MENU_SHOW_SET_CORE_ASSOCIATION:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_quick_menu_show_set_core_association);
break;
case MENU_ENUM_LABEL_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_quick_menu_show_reset_core_association);
break;

View File

@ -174,6 +174,7 @@ default_title_macro(action_get_title_goto_image, MENU_ENUM_LABEL_
default_title_macro(action_get_title_goto_music, MENU_ENUM_LABEL_VALUE_GOTO_MUSIC)
default_title_macro(action_get_title_goto_video, MENU_ENUM_LABEL_VALUE_GOTO_VIDEO)
default_title_macro(action_get_title_collection, MENU_ENUM_LABEL_VALUE_PLAYLISTS_TAB)
default_title_macro(action_get_title_deferred_core_list, MENU_ENUM_LABEL_VALUE_SUPPORTED_CORES)
default_fill_title_macro(action_get_title_disk_image_append, MENU_ENUM_LABEL_VALUE_DISK_IMAGE_APPEND)
default_fill_title_macro(action_get_title_cheat_file_load, MENU_ENUM_LABEL_VALUE_CHEAT_FILE)
@ -186,7 +187,6 @@ default_fill_title_macro(action_get_title_core_directory, MENU_ENUM_LABEL_
default_fill_title_macro(action_get_title_core_info_directory, MENU_ENUM_LABEL_VALUE_LIBRETRO_INFO_PATH)
default_fill_title_macro(action_get_title_audio_filter, MENU_ENUM_LABEL_VALUE_AUDIO_FILTER_DIR)
default_fill_title_macro(action_get_title_video_shader_preset, MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_TWO)
default_fill_title_macro(action_get_title_deferred_core_list, MENU_ENUM_LABEL_VALUE_SUPPORTED_CORES)
default_fill_title_macro(action_get_title_configurations, MENU_ENUM_LABEL_VALUE_CONFIG)
default_fill_title_macro(action_get_title_content_database_directory, MENU_ENUM_LABEL_VALUE_CONTENT_DATABASE_DIRECTORY)
default_fill_title_macro(action_get_title_savestate_directory, MENU_ENUM_LABEL_VALUE_SAVESTATE_DIRECTORY)
@ -650,6 +650,7 @@ static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs,
BIND_ACTION_GET_TITLE(cbs, action_get_title_list_rdb_entry_max_users);
break;
case MENU_ENUM_LABEL_DEFERRED_CORE_LIST:
case MENU_ENUM_LABEL_DEFERRED_CORE_LIST_SET:
BIND_ACTION_GET_TITLE(cbs, action_get_title_deferred_core_list);
break;
case MENU_ENUM_LABEL_CONFIGURATIONS:
@ -1004,6 +1005,7 @@ static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs,
BIND_ACTION_GET_TITLE(cbs, action_get_title_list_rdb_entry_max_users);
break;
case MENU_LABEL_DEFERRED_CORE_LIST:
case MENU_LABEL_DEFERRED_CORE_LIST_SET:
BIND_ACTION_GET_TITLE(cbs, action_get_title_deferred_core_list);
break;
case MENU_LABEL_CONFIGURATIONS:

View File

@ -2691,7 +2691,8 @@ static void materialui_list_insert(void *userdata,
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_THUMBNAILS_UPDATER_LIST)) ||
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_PL_THUMBNAILS_UPDATER_LIST)) ||
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_UPDATER_SETTINGS)) ||
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DOWNLOAD_CORE_CONTENT_DIRS))
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DOWNLOAD_CORE_CONTENT_DIRS)) ||
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_SET_CORE_ASSOCIATION))
)
{
node->texture_switch2_index = MUI_TEXTURE_SETTINGS;

View File

@ -110,6 +110,7 @@ menu_texture_item ozone_entries_icon_get_texture(ozone_handle_t *ozone,
case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_SAVE_CORE:
case MENU_ENUM_LABEL_SAVE_CURRENT_CONFIG_OVERRIDE_CORE:
case MENU_ENUM_LABEL_REMAP_FILE_SAVE_CORE:
case MENU_ENUM_LABEL_SET_CORE_ASSOCIATION:
return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_CORE];
case MENU_ENUM_LABEL_LOAD_CONTENT_LIST:
case MENU_ENUM_LABEL_SCAN_FILE:

View File

@ -2230,6 +2230,7 @@ static uintptr_t stripes_icon_get_id(stripes_handle_t *stripes,
case MENU_SETTING_ACTION_CORE_INFORMATION:
return stripes->textures.list[STRIPES_TEXTURE_CORE_INFO];
case MENU_SETTING_ACTION_CORE_OPTIONS:
case MENU_ENUM_LABEL_SET_CORE_ASSOCIATION:
return stripes->textures.list[STRIPES_TEXTURE_CORE_OPTIONS];
case MENU_SETTING_ACTION_CORE_INPUT_REMAPPING_OPTIONS:
return stripes->textures.list[STRIPES_TEXTURE_INPUT_REMAPPING_OPTIONS];

View File

@ -2408,6 +2408,7 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb,
case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_SAVE_CORE:
case MENU_ENUM_LABEL_SAVE_CURRENT_CONFIG_OVERRIDE_CORE:
case MENU_ENUM_LABEL_REMAP_FILE_SAVE_CORE:
case MENU_ENUM_LABEL_SET_CORE_ASSOCIATION:
return xmb->textures.list[XMB_TEXTURE_CORE];
case MENU_ENUM_LABEL_LOAD_CONTENT_LIST:
case MENU_ENUM_LABEL_SCAN_FILE:

View File

@ -2094,6 +2094,14 @@ static int menu_displaylist_parse_horizontal_content_actions(
MENU_ENUM_LABEL_ADD_TO_FAVORITES_PLAYLIST, FILE_TYPE_PLAYLIST_ENTRY, 0, 0);
}
if (settings->bools.quick_menu_show_set_core_association && !settings->bools.kiosk_mode_enable)
{
menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SET_CORE_ASSOCIATION),
msg_hash_to_str(MENU_ENUM_LABEL_SET_CORE_ASSOCIATION),
MENU_ENUM_LABEL_SET_CORE_ASSOCIATION, FILE_TYPE_PLAYLIST_ENTRY, 0, 0);
}
if (settings->bools.quick_menu_show_reset_core_association && !settings->bools.kiosk_mode_enable)
{
menu_entries_append_enum(info->list,
@ -4544,6 +4552,7 @@ unsigned menu_displaylist_build_list(file_list_t *list, enum menu_displaylist_ct
{MENU_ENUM_LABEL_QUICK_MENU_SHOW_ADD_TO_FAVORITES, PARSE_ONLY_BOOL},
{MENU_ENUM_LABEL_QUICK_MENU_SHOW_START_RECORDING, PARSE_ONLY_BOOL},
{MENU_ENUM_LABEL_QUICK_MENU_SHOW_START_STREAMING, PARSE_ONLY_BOOL},
{MENU_ENUM_LABEL_QUICK_MENU_SHOW_SET_CORE_ASSOCIATION, PARSE_ONLY_BOOL},
{MENU_ENUM_LABEL_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, PARSE_ONLY_BOOL},
{MENU_ENUM_LABEL_QUICK_MENU_SHOW_OPTIONS, PARSE_ONLY_BOOL},
{MENU_ENUM_LABEL_QUICK_MENU_SHOW_CONTROLS, PARSE_ONLY_BOOL},

View File

@ -12894,6 +12894,21 @@ static bool setting_append_list(
general_read_handler,
SD_FLAG_NONE);
CONFIG_BOOL(
list, list_info,
&settings->bools.quick_menu_show_set_core_association,
MENU_ENUM_LABEL_QUICK_MENU_SHOW_SET_CORE_ASSOCIATION,
MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_SET_CORE_ASSOCIATION,
quick_menu_show_set_core_association,
MENU_ENUM_LABEL_VALUE_OFF,
MENU_ENUM_LABEL_VALUE_ON,
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler,
SD_FLAG_NONE);
CONFIG_BOOL(
list, list_info,
&settings->bools.quick_menu_show_reset_core_association,

View File

@ -201,6 +201,7 @@ enum msg_hash_enums
MSG_RESAMPLER_QUALITY_HIGHEST,
MSG_DISCORD_CONNECTION_REQUEST,
MSG_ADDED_TO_FAVORITES,
MSG_SET_CORE_ASSOCIATION,
MSG_RESET_CORE_ASSOCIATION,
MSG_CORE_ASSOCIATION_RESET,
MSG_AUTODETECT,
@ -959,6 +960,7 @@ enum msg_hash_enums
MENU_LABEL(QUICK_MENU_SHOW_ADD_TO_FAVORITES),
MENU_LABEL(QUICK_MENU_SHOW_START_RECORDING),
MENU_LABEL(QUICK_MENU_SHOW_START_STREAMING),
MENU_LABEL(QUICK_MENU_SHOW_SET_CORE_ASSOCIATION),
MENU_LABEL(QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION),
MENU_LABEL(QUICK_MENU_SHOW_OPTIONS),
MENU_LABEL(QUICK_MENU_SHOW_CONTROLS),
@ -1035,6 +1037,7 @@ enum msg_hash_enums
MENU_LABEL(GOTO_VIDEO),
MENU_LABEL(ADD_TO_FAVORITES),
MENU_LABEL(ADD_TO_FAVORITES_PLAYLIST),
MENU_LABEL(SET_CORE_ASSOCIATION),
MENU_LABEL(RESET_CORE_ASSOCIATION),
MENU_LABEL(MENU_THROTTLE_FRAMERATE),
MENU_LABEL(NO_ACHIEVEMENTS_TO_DISPLAY),