Refactor menu_displaylist_parse_load_content_settings - should now

properly report count
This commit is contained in:
twinaphex 2019-12-02 22:50:33 +01:00
parent c490b06fe9
commit d2e83df498

View File

@ -1769,9 +1769,9 @@ static int menu_displaylist_parse_horizontal_list(
}
static int menu_displaylist_parse_load_content_settings(
menu_handle_t *menu,
menu_displaylist_info_t *info)
file_list_t *list)
{
unsigned count = 0;
settings_t *settings = config_get_ptr();
if (!rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
@ -1782,54 +1782,62 @@ static int menu_displaylist_parse_load_content_settings(
rarch_system_info_t *system = runloop_get_system_info();
if (settings->bools.quick_menu_show_resume_content)
menu_entries_append_enum(info->list,
if (menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RESUME_CONTENT),
msg_hash_to_str(MENU_ENUM_LABEL_RESUME_CONTENT),
MENU_ENUM_LABEL_RESUME_CONTENT,
MENU_SETTING_ACTION_RUN, 0, 0);
MENU_SETTING_ACTION_RUN, 0, 0) == 0)
count++;
if (settings->bools.quick_menu_show_restart_content)
menu_entries_append_enum(info->list,
if (menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RESTART_CONTENT),
msg_hash_to_str(MENU_ENUM_LABEL_RESTART_CONTENT),
MENU_ENUM_LABEL_RESTART_CONTENT,
MENU_SETTING_ACTION_RUN, 0, 0);
MENU_SETTING_ACTION_RUN, 0, 0) == 0)
count++;
if (settings->bools.quick_menu_show_close_content)
menu_entries_append_enum(info->list,
if (menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CLOSE_CONTENT),
msg_hash_to_str(MENU_ENUM_LABEL_CLOSE_CONTENT),
MENU_ENUM_LABEL_CLOSE_CONTENT,
MENU_SETTING_ACTION_CLOSE, 0, 0);
MENU_SETTING_ACTION_CLOSE, 0, 0) == 0)
count++;
if (settings->bools.quick_menu_show_take_screenshot)
{
menu_entries_append_enum(info->list,
if (menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_TAKE_SCREENSHOT),
msg_hash_to_str(MENU_ENUM_LABEL_TAKE_SCREENSHOT),
MENU_ENUM_LABEL_TAKE_SCREENSHOT,
MENU_SETTING_ACTION_SCREENSHOT, 0, 0);
MENU_SETTING_ACTION_SCREENSHOT, 0, 0) == 0)
count++;
}
if (settings->bools.quick_menu_show_save_load_state)
{
menu_displaylist_parse_settings_enum(info->list,
MENU_ENUM_LABEL_STATE_SLOT, PARSE_ONLY_INT, true);
if (menu_displaylist_parse_settings_enum(list,
MENU_ENUM_LABEL_STATE_SLOT, PARSE_ONLY_INT, true) == 0)
count++;
menu_entries_append_enum(info->list,
if (menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SAVE_STATE),
msg_hash_to_str(MENU_ENUM_LABEL_SAVE_STATE),
MENU_ENUM_LABEL_SAVE_STATE,
MENU_SETTING_ACTION_SAVESTATE, 0, 0);
MENU_SETTING_ACTION_SAVESTATE, 0, 0) == 0)
count++;
#ifdef HAVE_CHEEVOS
if (!rcheevos_hardcore_active)
#endif
{
menu_entries_append_enum(info->list,
if (menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LOAD_STATE),
msg_hash_to_str(MENU_ENUM_LABEL_LOAD_STATE),
MENU_ENUM_LABEL_LOAD_STATE,
MENU_SETTING_ACTION_LOADSTATE, 0, 0);
MENU_SETTING_ACTION_LOADSTATE, 0, 0) == 0)
count++;
}
}
@ -1840,26 +1848,29 @@ static int menu_displaylist_parse_load_content_settings(
if (!rcheevos_hardcore_active)
#endif
{
menu_entries_append_enum(info->list,
if (menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_UNDO_LOAD_STATE),
msg_hash_to_str(MENU_ENUM_LABEL_UNDO_LOAD_STATE),
MENU_ENUM_LABEL_UNDO_LOAD_STATE,
MENU_SETTING_ACTION_LOADSTATE, 0, 0);
MENU_SETTING_ACTION_LOADSTATE, 0, 0) == 0)
count++;
}
menu_entries_append_enum(info->list,
if (menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_UNDO_SAVE_STATE),
msg_hash_to_str(MENU_ENUM_LABEL_UNDO_SAVE_STATE),
MENU_ENUM_LABEL_UNDO_SAVE_STATE,
MENU_SETTING_ACTION_LOADSTATE, 0, 0);
MENU_SETTING_ACTION_LOADSTATE, 0, 0) == 0)
count++;
}
if (settings->bools.quick_menu_show_add_to_favorites)
{
menu_entries_append_enum(info->list,
if (menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ADD_TO_FAVORITES),
msg_hash_to_str(MENU_ENUM_LABEL_ADD_TO_FAVORITES),
MENU_ENUM_LABEL_ADD_TO_FAVORITES, FILE_TYPE_PLAYLIST_ENTRY, 0, 0);
MENU_ENUM_LABEL_ADD_TO_FAVORITES, FILE_TYPE_PLAYLIST_ENTRY, 0, 0) == 0)
count++;
}
if (string_is_not_equal(settings->arrays.record_driver, "null"))
@ -1868,126 +1879,144 @@ static int menu_displaylist_parse_load_content_settings(
{
if (settings->bools.quick_menu_show_start_recording && !settings->bools.kiosk_mode_enable)
{
menu_entries_append_enum(info->list,
if (menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QUICK_MENU_START_RECORDING),
msg_hash_to_str(MENU_ENUM_LABEL_QUICK_MENU_START_RECORDING),
MENU_ENUM_LABEL_QUICK_MENU_START_RECORDING, MENU_SETTING_ACTION, 0, 0);
MENU_ENUM_LABEL_QUICK_MENU_START_RECORDING, MENU_SETTING_ACTION, 0, 0) == 0)
count++;
}
if (settings->bools.quick_menu_show_start_streaming && !settings->bools.kiosk_mode_enable)
{
menu_entries_append_enum(info->list,
if (menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QUICK_MENU_START_STREAMING),
msg_hash_to_str(MENU_ENUM_LABEL_QUICK_MENU_START_STREAMING),
MENU_ENUM_LABEL_QUICK_MENU_START_STREAMING, MENU_SETTING_ACTION, 0, 0);
MENU_ENUM_LABEL_QUICK_MENU_START_STREAMING, MENU_SETTING_ACTION, 0, 0) == 0)
count++;
}
}
else
{
if (streaming_is_enabled())
menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QUICK_MENU_STOP_STREAMING),
msg_hash_to_str(MENU_ENUM_LABEL_QUICK_MENU_STOP_STREAMING),
MENU_ENUM_LABEL_QUICK_MENU_STOP_STREAMING, MENU_SETTING_ACTION, 0, 0);
{
if (menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QUICK_MENU_STOP_STREAMING),
msg_hash_to_str(MENU_ENUM_LABEL_QUICK_MENU_STOP_STREAMING),
MENU_ENUM_LABEL_QUICK_MENU_STOP_STREAMING, MENU_SETTING_ACTION, 0, 0) == 0)
count++;
}
else
menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QUICK_MENU_STOP_RECORDING),
msg_hash_to_str(MENU_ENUM_LABEL_QUICK_MENU_STOP_RECORDING),
MENU_ENUM_LABEL_QUICK_MENU_STOP_RECORDING, MENU_SETTING_ACTION, 0, 0);
{
if (menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QUICK_MENU_STOP_RECORDING),
msg_hash_to_str(MENU_ENUM_LABEL_QUICK_MENU_STOP_RECORDING),
MENU_ENUM_LABEL_QUICK_MENU_STOP_RECORDING, MENU_SETTING_ACTION, 0, 0) == 0)
count++;
}
}
}
if (settings->bools.quick_menu_show_options && !settings->bools.kiosk_mode_enable)
{
menu_entries_append_enum(info->list,
if (menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_OPTIONS),
msg_hash_to_str(MENU_ENUM_LABEL_CORE_OPTIONS),
MENU_ENUM_LABEL_CORE_OPTIONS,
MENU_SETTING_ACTION, 0, 0);
MENU_SETTING_ACTION, 0, 0) == 0)
count++;
}
if (settings->bools.menu_show_overlays && !settings->bools.kiosk_mode_enable)
{
menu_entries_append_enum(info->list,
if (menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ONSCREEN_OVERLAY_SETTINGS),
msg_hash_to_str(MENU_ENUM_LABEL_ONSCREEN_OVERLAY_SETTINGS),
MENU_ENUM_LABEL_ONSCREEN_OVERLAY_SETTINGS,
MENU_SETTING_ACTION, 0, 0);
MENU_SETTING_ACTION, 0, 0) == 0)
count++;
}
#ifdef HAVE_VIDEO_LAYOUT
if (settings->bools.menu_show_video_layout && !settings->bools.kiosk_mode_enable)
{
menu_entries_append_enum(info->list,
if (menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ONSCREEN_VIDEO_LAYOUT_SETTINGS),
msg_hash_to_str(MENU_ENUM_LABEL_ONSCREEN_VIDEO_LAYOUT_SETTINGS),
MENU_ENUM_LABEL_ONSCREEN_VIDEO_LAYOUT_SETTINGS,
MENU_SETTING_ACTION, 0, 0);
MENU_SETTING_ACTION, 0, 0) == 0)
count++;
}
#endif
if (settings->bools.menu_show_rewind && !settings->bools.kiosk_mode_enable)
{
menu_entries_append_enum(info->list,
if (menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_REWIND_SETTINGS),
msg_hash_to_str(MENU_ENUM_LABEL_REWIND_SETTINGS),
MENU_ENUM_LABEL_REWIND_SETTINGS,
MENU_SETTING_ACTION, 0, 0);
MENU_SETTING_ACTION, 0, 0) == 0)
count++;
}
if (settings->bools.menu_show_latency && !settings->bools.kiosk_mode_enable)
{
menu_entries_append_enum(info->list,
if (menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LATENCY_SETTINGS),
msg_hash_to_str(MENU_ENUM_LABEL_LATENCY_SETTINGS),
MENU_ENUM_LABEL_LATENCY_SETTINGS,
MENU_SETTING_ACTION, 0, 0);
MENU_SETTING_ACTION, 0, 0) == 0)
count++;
}
#if 0
menu_entries_append_enum(info->list,
if (menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_SETTINGS),
msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_SETTINGS),
MENU_ENUM_LABEL_NETPLAY_SETTINGS,
MENU_SETTING_ACTION, 0, 0);
MENU_SETTING_ACTION, 0, 0) == 0)
count++;
#endif
if (settings->bools.quick_menu_show_controls && !settings->bools.kiosk_mode_enable)
{
menu_entries_append_enum(info->list,
if (menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INPUT_REMAPPING_OPTIONS),
msg_hash_to_str(MENU_ENUM_LABEL_CORE_INPUT_REMAPPING_OPTIONS),
MENU_ENUM_LABEL_CORE_INPUT_REMAPPING_OPTIONS,
MENU_SETTING_ACTION, 0, 0);
MENU_SETTING_ACTION, 0, 0) == 0)
count++;
}
if (settings->bools.quick_menu_show_cheats)
{
menu_entries_append_enum(info->list,
if (menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_CHEAT_OPTIONS),
msg_hash_to_str(MENU_ENUM_LABEL_CORE_CHEAT_OPTIONS),
MENU_ENUM_LABEL_CORE_CHEAT_OPTIONS,
MENU_SETTING_ACTION, 0, 0);
MENU_SETTING_ACTION, 0, 0) == 0)
count++;
}
if ((!rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
&& system->disk_control_cb.get_num_images)
menu_entries_append_enum(info->list,
if (menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DISK_OPTIONS),
msg_hash_to_str(MENU_ENUM_LABEL_DISK_OPTIONS),
MENU_ENUM_LABEL_DISK_OPTIONS,
MENU_SETTING_ACTION_CORE_DISK_OPTIONS, 0, 0);
MENU_SETTING_ACTION_CORE_DISK_OPTIONS, 0, 0) == 0)
count++;
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
if (video_shader_any_supported())
{
if (settings->bools.quick_menu_show_shaders && !settings->bools.kiosk_mode_enable)
{
menu_entries_append_enum(info->list,
if (menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SHADER_OPTIONS),
msg_hash_to_str(MENU_ENUM_LABEL_SHADER_OPTIONS),
MENU_ENUM_LABEL_SHADER_OPTIONS,
MENU_SETTING_ACTION, 0, 0);
MENU_SETTING_ACTION, 0, 0) == 0)
count++;
}
}
#endif
@ -1996,40 +2025,38 @@ static int menu_displaylist_parse_load_content_settings(
settings->bools.quick_menu_show_save_game_overrides) &&
!settings->bools.kiosk_mode_enable)
{
menu_entries_append_enum(info->list,
if (menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QUICK_MENU_OVERRIDE_OPTIONS),
msg_hash_to_str(MENU_ENUM_LABEL_QUICK_MENU_OVERRIDE_OPTIONS),
MENU_ENUM_LABEL_QUICK_MENU_OVERRIDE_OPTIONS,
MENU_SETTING_ACTION, 0, 0);
MENU_SETTING_ACTION, 0, 0) == 0)
count++;
}
#ifdef HAVE_CHEEVOS
if (settings->bools.cheevos_enable)
{
menu_entries_append_enum(info->list,
if (menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ACHIEVEMENT_LIST),
msg_hash_to_str(MENU_ENUM_LABEL_ACHIEVEMENT_LIST),
MENU_ENUM_LABEL_ACHIEVEMENT_LIST,
MENU_SETTING_ACTION, 0, 0);
MENU_SETTING_ACTION, 0, 0) == 0)
count++;
}
#endif
if (settings->bools.quick_menu_show_information)
{
menu_entries_append_enum(info->list,
if (menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INFORMATION),
msg_hash_to_str(MENU_ENUM_LABEL_INFORMATION),
MENU_ENUM_LABEL_INFORMATION,
MENU_SETTING_ACTION, 0, 0);
MENU_SETTING_ACTION, 0, 0) == 0)
count++;
}
}
else
menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_ITEMS),
msg_hash_to_str(MENU_ENUM_LABEL_NO_ITEMS),
MENU_ENUM_LABEL_NO_ITEMS,
MENU_SETTING_NO_ITEM, 0, 0);
return 0;
return count;
}
static int menu_displaylist_parse_horizontal_content_actions(
@ -2050,7 +2077,14 @@ static int menu_displaylist_parse_horizontal_content_actions(
&& string_is_equal(menu->deferred_path, fullpath);
if (content_loaded)
menu_displaylist_parse_load_content_settings(menu, info);
{
if (menu_displaylist_parse_load_content_settings(info->list) == 0)
menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_ITEMS),
msg_hash_to_str(MENU_ENUM_LABEL_NO_ITEMS),
MENU_ENUM_LABEL_NO_ITEMS,
MENU_SETTING_NO_ITEM, 0, 0);
}
else
{
#ifdef HAVE_AUDIOMIXER
@ -7832,8 +7866,16 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
break;
case DISPLAYLIST_CONTENT_SETTINGS:
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
ret = menu_displaylist_parse_load_content_settings(menu, info);
count = menu_displaylist_parse_load_content_settings(info->list);
if (count == 0)
menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_ITEMS),
msg_hash_to_str(MENU_ENUM_LABEL_NO_ITEMS),
MENU_ENUM_LABEL_NO_ITEMS,
MENU_SETTING_NO_ITEM, 0, 0);
ret = 0;
info->need_refresh = true;
info->need_push = true;
break;