diff --git a/config.def.h b/config.def.h index 7ecc3dec5f..47edc81f5e 100644 --- a/config.def.h +++ b/config.def.h @@ -712,13 +712,13 @@ static const bool playlist_sort_alphabetical = true; /* File format to use when writing playlists to disk */ static const bool playlist_use_old_format = false; -/* Always show currently associated core next to each playlist entry */ -static const bool playlist_show_core_name = false; +/* Specify when to display 'core name' inline on playlist entries */ +static const unsigned playlist_show_inline_core_name = PLAYLIST_INLINE_CORE_DISPLAY_HIST_FAV; static const bool playlist_show_sublabels = false; /* Specifies which runtime record to use on playlist sublabels */ -static unsigned playlist_sublabel_runtime_type = PLAYLIST_RUNTIME_PER_CORE; +static const unsigned playlist_sublabel_runtime_type = PLAYLIST_RUNTIME_PER_CORE; /* Show Menu start-up screen on boot. */ static const bool default_menu_show_start_screen = true; diff --git a/configuration.c b/configuration.c index 1e8b0b4f06..9e3970d7f3 100644 --- a/configuration.c +++ b/configuration.c @@ -1581,7 +1581,6 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings, SETTING_BOOL("content_runtime_log", &settings->bools.content_runtime_log, true, content_runtime_log, false); SETTING_BOOL("content_runtime_log_aggregate", &settings->bools.content_runtime_log_aggregate, true, content_runtime_log_aggregate, false); SETTING_BOOL("playlist_show_sublabels", &settings->bools.playlist_show_sublabels, true, playlist_show_sublabels, false); - SETTING_BOOL("playlist_show_core_name", &settings->bools.playlist_show_core_name, true, playlist_show_core_name, false); SETTING_BOOL("playlist_sort_alphabetical", &settings->bools.playlist_sort_alphabetical, true, playlist_sort_alphabetical, false); SETTING_BOOL("quit_press_twice", &settings->bools.quit_press_twice, true, quit_press_twice, false); @@ -1763,6 +1762,7 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings, SETTING_UINT("libnx_overclock", &settings->uints.libnx_overclock, true, SWITCH_DEFAULT_CPU_PROFILE, false); #endif + SETTING_UINT("playlist_show_inline_core_name", &settings->uints.playlist_show_inline_core_name, true, playlist_show_inline_core_name, false); SETTING_UINT("playlist_sublabel_runtime_type", &settings->uints.playlist_sublabel_runtime_type, true, playlist_sublabel_runtime_type, false); *size = count; diff --git a/configuration.h b/configuration.h index 25c82a2094..ece38ba873 100644 --- a/configuration.h +++ b/configuration.h @@ -311,7 +311,6 @@ typedef struct settings bool content_runtime_log; bool content_runtime_log_aggregate; - bool playlist_show_core_name; bool playlist_sort_alphabetical; bool playlist_show_sublabels; @@ -439,6 +438,7 @@ typedef struct settings unsigned menu_rgui_internal_upscale_level; unsigned menu_ticker_type; + unsigned playlist_show_inline_core_name; unsigned playlist_sublabel_runtime_type; unsigned camera_width; diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index 943e2deefa..cc5a39e2b2 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -1791,8 +1791,8 @@ MSG_HASH(MENU_ENUM_LABEL_CONTENT_RUNTIME_LOG, "content_runtime_log") MSG_HASH(MENU_ENUM_LABEL_CONTENT_RUNTIME_LOG_AGGREGATE, "content_runtime_log_aggregate") -MSG_HASH(MENU_ENUM_LABEL_PLAYLIST_SHOW_CORE_NAME, - "playlist_show_core_name") +MSG_HASH(MENU_ENUM_LABEL_PLAYLIST_SHOW_INLINE_CORE_NAME, + "playlist_show_inline_core_name") MSG_HASH(MENU_ENUM_LABEL_PLAYLIST_SORT_ALPHABETICAL, "playlist_sort_alphabetical") MSG_HASH(MENU_ENUM_LABEL_PLAYLIST_SHOW_SUBLABELS, diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 15b06040b6..593431f297 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -8259,12 +8259,24 @@ MSG_HASH( "Save playlists using old format" ) MSG_HASH( - MENU_ENUM_LABEL_VALUE_PLAYLIST_SHOW_CORE_NAME, - "Always show associated cores in playlists" + MENU_ENUM_LABEL_VALUE_PLAYLIST_SHOW_INLINE_CORE_NAME, + "Show associated cores in playlists" ) MSG_HASH( - MENU_ENUM_SUBLABEL_PLAYLIST_SHOW_CORE_NAME, - "Labels each playlist entry with the currently associated core (if any)." + MENU_ENUM_SUBLABEL_PLAYLIST_SHOW_INLINE_CORE_NAME, + "Specify when to tag playlist entries with the currently associated core (if any). NOTE: This setting is ignored when playlist sublabels are enabled." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_INLINE_CORE_DISPLAY_HIST_FAV, + "History & Favorites" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_INLINE_CORE_DISPLAY_ALWAYS, + "Always" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_INLINE_CORE_DISPLAY_NEVER, + "Never" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_SORT_ALPHABETICAL, diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index 368e229b89..2c168f2a4d 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -527,7 +527,7 @@ default_sublabel_macro(action_bind_sublabel_playlist_sublabel_runtime_type, default_sublabel_macro(action_bind_sublabel_menu_rgui_internal_upscale_level, MENU_ENUM_SUBLABEL_MENU_RGUI_INTERNAL_UPSCALE_LEVEL) default_sublabel_macro(action_bind_sublabel_menu_ticker_type, MENU_ENUM_SUBLABEL_MENU_TICKER_TYPE) default_sublabel_macro(action_bind_sublabel_menu_ticker_speed, MENU_ENUM_SUBLABEL_MENU_TICKER_SPEED) -default_sublabel_macro(action_bind_sublabel_playlist_show_core_name, MENU_ENUM_SUBLABEL_PLAYLIST_SHOW_CORE_NAME) +default_sublabel_macro(action_bind_sublabel_playlist_show_inline_core_name, MENU_ENUM_SUBLABEL_PLAYLIST_SHOW_INLINE_CORE_NAME) default_sublabel_macro(action_bind_sublabel_playlist_sort_alphabetical, MENU_ENUM_SUBLABEL_PLAYLIST_SORT_ALPHABETICAL) default_sublabel_macro(action_bind_sublabel_menu_rgui_full_width_layout, MENU_ENUM_SUBLABEL_MENU_RGUI_FULL_WIDTH_LAYOUT) default_sublabel_macro(action_bind_sublabel_help_send_debug_info, MENU_ENUM_SUBLABEL_HELP_SEND_DEBUG_INFO) @@ -2397,8 +2397,8 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_MENU_TICKER_SPEED: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_ticker_speed); break; - case MENU_ENUM_LABEL_PLAYLIST_SHOW_CORE_NAME: - BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_playlist_show_core_name); + case MENU_ENUM_LABEL_PLAYLIST_SHOW_INLINE_CORE_NAME: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_playlist_show_inline_core_name); break; case MENU_ENUM_LABEL_PLAYLIST_SORT_ALPHABETICAL: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_playlist_sort_alphabetical); diff --git a/menu/menu_defines.h b/menu/menu_defines.h index 6c73366c29..1df7ab91e9 100644 --- a/menu/menu_defines.h +++ b/menu/menu_defines.h @@ -310,6 +310,14 @@ enum playlist_sublabel_runtime PLAYLIST_RUNTIME_LAST }; +enum playlist_inline_core_display_type +{ + PLAYLIST_INLINE_CORE_DISPLAY_HIST_FAV = 0, + PLAYLIST_INLINE_CORE_DISPLAY_ALWAYS, + PLAYLIST_INLINE_CORE_DISPLAY_NEVER, + PLAYLIST_INLINE_CORE_DISPLAY_LAST +}; + typedef uintptr_t menu_texture_item; typedef struct menu_display_ctx_clearcolor diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index f0ab1f374c..09800384fa 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -1294,6 +1294,7 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info, settings_t *settings = config_get_ptr(); bool is_rgui = string_is_equal(settings->arrays.menu_driver, "rgui"); bool get_runtime = false; + bool show_inline_core_name = false; char label_spacer[PL_LABEL_SPACER_MAXLEN]; label_spacer[0] = '\0'; @@ -1314,13 +1315,22 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info, string_is_equal(path_playlist, "video_history")); } - /* Get spacer for menu entry labels () */ - if (is_rgui) - strlcpy(label_spacer, PL_LABEL_SPACER_RGUI, sizeof(label_spacer)); - else if (string_is_equal(settings->arrays.menu_driver, "ozone")) - strlcpy(label_spacer, PL_LABEL_SPACER_OZONE, sizeof(label_spacer)); - else - strlcpy(label_spacer, PL_LABEL_SPACER_DEFAULT, sizeof(label_spacer)); + /* Check whether core name should be added to playlist entries */ + if (!settings->bools.playlist_show_sublabels && + ((settings->uints.playlist_show_inline_core_name == PLAYLIST_INLINE_CORE_DISPLAY_ALWAYS) || + (!is_collection && !(settings->uints.playlist_show_inline_core_name == PLAYLIST_INLINE_CORE_DISPLAY_NEVER)))) + { + show_inline_core_name = true; + + /* Get spacer for menu entry labels () + * > Note: Only required when showing inline core names */ + if (is_rgui) + strlcpy(label_spacer, PL_LABEL_SPACER_RGUI, sizeof(label_spacer)); + else if (string_is_equal(settings->arrays.menu_driver, "ozone")) + strlcpy(label_spacer, PL_LABEL_SPACER_OZONE, sizeof(label_spacer)); + else + strlcpy(label_spacer, PL_LABEL_SPACER_DEFAULT, sizeof(label_spacer)); + } /* Inform menu driver of current system name */ if (!string_is_empty(info->path)) @@ -1416,27 +1426,20 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info, /* Standard playlist entry * > Base menu entry label is always playlist label * > If playlist label is NULL, fallback to playlist entry file name - * > If playlist sublabels are enabled, no further additions - * are required - * > If playlist sublabels are disabled: - * > If this is *not* a standard collection (i.e. a history list or - * favourites) *or* 'show core name' is enabled, add currently - * associated core (if set) */ + * > If required, add currently associated core (if any), otherwise + * no further action is necessary */ if (string_is_empty(label)) fill_short_pathname_representation(menu_entry_label, path, sizeof(menu_entry_label)); else strlcpy(menu_entry_label, label, sizeof(menu_entry_label)); - if (!settings->bools.playlist_show_sublabels) + if (show_inline_core_name) { - if (!is_collection || settings->bools.playlist_show_core_name) + if (!string_is_empty(core_name) && !string_is_equal(core_name, file_path_str(FILE_PATH_DETECT))) { - if (!string_is_empty(core_name) && !string_is_equal(core_name, file_path_str(FILE_PATH_DETECT))) - { - strlcat(menu_entry_label, label_spacer, sizeof(menu_entry_label)); - strlcat(menu_entry_label, core_name, sizeof(menu_entry_label)); - } + strlcat(menu_entry_label, label_spacer, sizeof(menu_entry_label)); + strlcat(menu_entry_label, core_name, sizeof(menu_entry_label)); } } @@ -5347,15 +5350,15 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist ret = menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_PLAYLIST_USE_OLD_FORMAT, PARSE_ONLY_BOOL, false); + ret = menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_PLAYLIST_SHOW_INLINE_CORE_NAME, + PARSE_ONLY_UINT, false); ret = menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_PLAYLIST_SHOW_SUBLABELS, PARSE_ONLY_BOOL, false); - ret = menu_displaylist_parse_settings_enum(menu, info, - MENU_ENUM_LABEL_PLAYLIST_SUBLABEL_RUNTIME_TYPE, - PARSE_ONLY_UINT, false); ret = menu_displaylist_parse_settings_enum(menu, info, - MENU_ENUM_LABEL_PLAYLIST_SHOW_CORE_NAME, - PARSE_ONLY_BOOL, false); + MENU_ENUM_LABEL_PLAYLIST_SUBLABEL_RUNTIME_TYPE, + PARSE_ONLY_UINT, false); menu_displaylist_parse_playlist_associations(info); info->need_push = true; diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 5094d995d2..381f158f61 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -1322,6 +1322,36 @@ static void setting_get_string_representation_uint_playlist_sublabel_runtime_typ } } +static void setting_get_string_representation_uint_playlist_inline_core_display_type( + rarch_setting_t *setting, + char *s, size_t len) +{ + if (!setting) + return; + + switch (*setting->value.target.unsigned_integer) + { + case PLAYLIST_INLINE_CORE_DISPLAY_HIST_FAV: + strlcpy(s, + msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_PLAYLIST_INLINE_CORE_DISPLAY_HIST_FAV), + len); + break; + case PLAYLIST_INLINE_CORE_DISPLAY_ALWAYS: + strlcpy(s, + msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_PLAYLIST_INLINE_CORE_DISPLAY_ALWAYS), + len); + break; + case PLAYLIST_INLINE_CORE_DISPLAY_NEVER: + strlcpy(s, + msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_PLAYLIST_INLINE_CORE_DISPLAY_NEVER), + len); + break; + } +} + static int setting_action_left_analog_dpad_mode(rarch_setting_t *setting, bool wraparound) { unsigned port = 0; @@ -9939,21 +9969,21 @@ static bool setting_append_list( &setting_get_string_representation_uint_playlist_sublabel_runtime_type; menu_settings_list_current_add_range(list, list_info, 0, PLAYLIST_RUNTIME_LAST-1, 1, true, true); - CONFIG_BOOL( + CONFIG_UINT( list, list_info, - &settings->bools.playlist_show_core_name, - MENU_ENUM_LABEL_PLAYLIST_SHOW_CORE_NAME, - MENU_ENUM_LABEL_VALUE_PLAYLIST_SHOW_CORE_NAME, - playlist_show_core_name, - MENU_ENUM_LABEL_VALUE_OFF, - MENU_ENUM_LABEL_VALUE_ON, + &settings->uints.playlist_show_inline_core_name, + MENU_ENUM_LABEL_PLAYLIST_SHOW_INLINE_CORE_NAME, + MENU_ENUM_LABEL_VALUE_PLAYLIST_SHOW_INLINE_CORE_NAME, + playlist_show_inline_core_name, &group_info, &subgroup_info, parent_group, general_write_handler, - general_read_handler, - SD_FLAG_NONE - ); + general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; + (*list)[list_info->index - 1].get_string_representation = + &setting_get_string_representation_uint_playlist_inline_core_display_type; + menu_settings_list_current_add_range(list, list_info, 0, PLAYLIST_INLINE_CORE_DISPLAY_LAST-1, 1, true, true); END_SUB_GROUP(list, list_info, parent_group); diff --git a/msg_hash.h b/msg_hash.h index 6f01683423..822674efd4 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -2278,11 +2278,15 @@ enum msg_hash_enums MENU_LABEL(CONTENT_RUNTIME_LOG), MENU_LABEL(CONTENT_RUNTIME_LOG_AGGREGATE), - MENU_LABEL(PLAYLIST_SHOW_CORE_NAME), + MENU_LABEL(PLAYLIST_SHOW_INLINE_CORE_NAME), MENU_LABEL(PLAYLIST_SORT_ALPHABETICAL), MENU_LABEL(PLAYLIST_SHOW_SUBLABELS), MENU_LABEL(PLAYLIST_SUBLABEL_RUNTIME_TYPE), + MENU_ENUM_LABEL_VALUE_PLAYLIST_INLINE_CORE_DISPLAY_HIST_FAV, + MENU_ENUM_LABEL_VALUE_PLAYLIST_INLINE_CORE_DISPLAY_ALWAYS, + MENU_ENUM_LABEL_VALUE_PLAYLIST_INLINE_CORE_DISPLAY_NEVER, + MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_CORE, MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_RUNTIME, MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED,