(menu displaylist) Cleanups

This commit is contained in:
twinaphex 2019-04-23 23:59:05 +02:00
parent e7cb5ccdee
commit 22ac50d39c

View File

@ -978,92 +978,6 @@ error:
return 0; return 0;
} }
static int menu_displaylist_parse_shader_options(menu_displaylist_info_t *info)
{
unsigned i;
struct video_shader *shader = menu_shader_get();
unsigned pass_count = shader ? shader->passes : 0;
menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SHADER_APPLY_CHANGES),
msg_hash_to_str(MENU_ENUM_LABEL_SHADER_APPLY_CHANGES),
MENU_ENUM_LABEL_SHADER_APPLY_CHANGES,
MENU_SETTING_ACTION, 0, 0);
if (frontend_driver_can_watch_for_changes())
{
menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SHADER_WATCH_FOR_CHANGES),
msg_hash_to_str(MENU_ENUM_LABEL_SHADER_WATCH_FOR_CHANGES),
MENU_ENUM_LABEL_SHADER_WATCH_FOR_CHANGES,
0, 0, 0);
}
menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET),
msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_PRESET),
MENU_ENUM_LABEL_VIDEO_SHADER_PRESET,
FILE_TYPE_PATH, 0, 0);
menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_AS),
msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_SAVE_AS),
MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_SAVE_AS,
MENU_SETTING_ACTION, 0, 0);
menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_CORE),
msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_SAVE_CORE),
MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_SAVE_CORE,
MENU_SETTING_ACTION, 0, 0);
menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_PARENT),
msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_SAVE_PARENT),
MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_SAVE_PARENT,
MENU_SETTING_ACTION, 0, 0);
menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_GAME),
msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_SAVE_GAME),
MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_SAVE_GAME,
MENU_SETTING_ACTION, 0, 0);
menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PARAMETERS),
msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_PARAMETERS),
MENU_ENUM_LABEL_VIDEO_SHADER_PARAMETERS,
MENU_SETTING_ACTION, 0, 0);
menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_NUM_PASSES),
msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_NUM_PASSES),
MENU_ENUM_LABEL_VIDEO_SHADER_NUM_PASSES,
0, 0, 0);
for (i = 0; i < pass_count; i++)
{
char buf_tmp[64];
char buf[128];
buf[0] = buf_tmp[0] = '\0';
snprintf(buf_tmp, sizeof(buf_tmp),
"%s #%u", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SHADER), i);
menu_entries_append_enum(info->list, buf_tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_PASS),
MENU_ENUM_LABEL_VIDEO_SHADER_PASS,
MENU_SETTINGS_SHADER_PASS_0 + i, 0, 0);
snprintf(buf, sizeof(buf), "%s %s", buf_tmp, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_FILTER));
menu_entries_append_enum(info->list, buf,
msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_FILTER_PASS),
MENU_ENUM_LABEL_VIDEO_SHADER_FILTER_PASS,
MENU_SETTINGS_SHADER_PASS_FILTER_0 + i, 0, 0);
snprintf(buf, sizeof(buf), "%s %s", buf_tmp, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SCALE));
menu_entries_append_enum(info->list, buf,
msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_SCALE_PASS),
MENU_ENUM_LABEL_VIDEO_SHADER_SCALE_PASS,
MENU_SETTINGS_SHADER_PASS_SCALE_0 + i, 0, 0);
}
return 0;
}
#ifdef HAVE_LIBRETRODB #ifdef HAVE_LIBRETRODB
static int create_string_list_rdb_entry_string( static int create_string_list_rdb_entry_string(
enum msg_hash_enums enum_idx, enum msg_hash_enums enum_idx,
@ -4499,42 +4413,48 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
snprintf(lbl_play_looped, sizeof(lbl_play_looped), "mixer_stream_%d_action_play_looped", id); snprintf(lbl_play_looped, sizeof(lbl_play_looped), "mixer_stream_%d_action_play_looped", id);
snprintf(lbl_play_sequential, sizeof(lbl_play_sequential), "mixer_stream_%d_action_play_sequential", id); snprintf(lbl_play_sequential, sizeof(lbl_play_sequential), "mixer_stream_%d_action_play_sequential", id);
menu_entries_append_enum(info->list, if (menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_PLAY), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_PLAY),
lbl_play, lbl_play,
MSG_UNKNOWN, MSG_UNKNOWN,
(MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_PLAY_BEGIN + id), (MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_PLAY_BEGIN + id),
0, 0); 0, 0))
menu_entries_append_enum(info->list, count++;
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_PLAY_LOOPED), if (menu_entries_append_enum(info->list,
lbl_play_looped, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_PLAY_LOOPED),
MSG_UNKNOWN, lbl_play_looped,
(MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_PLAY_LOOPED_BEGIN + id), MSG_UNKNOWN,
0, 0); (MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_PLAY_LOOPED_BEGIN + id),
menu_entries_append_enum(info->list, 0, 0))
count++;
if (menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_PLAY_SEQUENTIAL), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_PLAY_SEQUENTIAL),
lbl_play_sequential, lbl_play_sequential,
MSG_UNKNOWN, MSG_UNKNOWN,
(MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_PLAY_SEQUENTIAL_BEGIN + id), (MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_PLAY_SEQUENTIAL_BEGIN + id),
0, 0); 0, 0))
menu_entries_append_enum(info->list, count++;
if (menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_STOP), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_STOP),
lbl_stop, lbl_stop,
MSG_UNKNOWN, MSG_UNKNOWN,
(MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_STOP_BEGIN + id), (MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_STOP_BEGIN + id),
0, 0); 0, 0))
menu_entries_append_enum(info->list, count++;
if (menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_REMOVE), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_REMOVE),
lbl_remove, lbl_remove,
MSG_UNKNOWN, MSG_UNKNOWN,
(MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_REMOVE_BEGIN + id), (MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_REMOVE_BEGIN + id),
0, 0); 0, 0))
menu_entries_append_enum(info->list, count++;
if (menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_VOLUME), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_VOLUME),
lbl_volume, lbl_volume,
MSG_UNKNOWN, MSG_UNKNOWN,
(MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_VOLUME_BEGIN + id), (MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_VOLUME_BEGIN + id),
0, 0); 0, 0))
count++;
} }
info->need_push = true; info->need_push = true;
@ -4619,7 +4539,108 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
break; break;
case DISPLAYLIST_OPTIONS_SHADERS: case DISPLAYLIST_OPTIONS_SHADERS:
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
ret = menu_displaylist_parse_shader_options(info); {
unsigned i;
struct video_shader *shader = menu_shader_get();
unsigned pass_count = shader ? shader->passes : 0;
if (menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SHADER_APPLY_CHANGES),
msg_hash_to_str(MENU_ENUM_LABEL_SHADER_APPLY_CHANGES),
MENU_ENUM_LABEL_SHADER_APPLY_CHANGES,
MENU_SETTING_ACTION, 0, 0))
count++;
if (frontend_driver_can_watch_for_changes())
{
if (menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SHADER_WATCH_FOR_CHANGES),
msg_hash_to_str(MENU_ENUM_LABEL_SHADER_WATCH_FOR_CHANGES),
MENU_ENUM_LABEL_SHADER_WATCH_FOR_CHANGES,
0, 0, 0))
count++;
}
if (menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET),
msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_PRESET),
MENU_ENUM_LABEL_VIDEO_SHADER_PRESET,
FILE_TYPE_PATH, 0, 0))
count++;
if (menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_AS),
msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_SAVE_AS),
MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_SAVE_AS,
MENU_SETTING_ACTION, 0, 0))
count++;
if (menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_CORE),
msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_SAVE_CORE),
MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_SAVE_CORE,
MENU_SETTING_ACTION, 0, 0))
count++;
if (menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_PARENT),
msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_SAVE_PARENT),
MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_SAVE_PARENT,
MENU_SETTING_ACTION, 0, 0))
count++;
if (menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_GAME),
msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_SAVE_GAME),
MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_SAVE_GAME,
MENU_SETTING_ACTION, 0, 0))
count++;
if (menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PARAMETERS),
msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_PARAMETERS),
MENU_ENUM_LABEL_VIDEO_SHADER_PARAMETERS,
MENU_SETTING_ACTION, 0, 0))
count++;
if (menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_NUM_PASSES),
msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_NUM_PASSES),
MENU_ENUM_LABEL_VIDEO_SHADER_NUM_PASSES,
0, 0, 0))
count++;
for (i = 0; i < pass_count; i++)
{
char buf_tmp[64];
char buf[128];
buf[0] = buf_tmp[0] = '\0';
snprintf(buf_tmp, sizeof(buf_tmp),
"%s #%u", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SHADER), i);
if (menu_entries_append_enum(info->list, buf_tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_PASS),
MENU_ENUM_LABEL_VIDEO_SHADER_PASS,
MENU_SETTINGS_SHADER_PASS_0 + i, 0, 0))
count++;
snprintf(buf, sizeof(buf), "%s %s", buf_tmp, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_FILTER));
if (menu_entries_append_enum(info->list, buf,
msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_FILTER_PASS),
MENU_ENUM_LABEL_VIDEO_SHADER_FILTER_PASS,
MENU_SETTINGS_SHADER_PASS_FILTER_0 + i, 0, 0))
count++;
snprintf(buf, sizeof(buf), "%s %s", buf_tmp, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SCALE));
if (menu_entries_append_enum(info->list, buf,
msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_SCALE_PASS),
MENU_ENUM_LABEL_VIDEO_SHADER_SCALE_PASS,
MENU_SETTINGS_SHADER_PASS_SCALE_0 + i, 0, 0))
count++;
}
}
if (count == 0)
menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_ENTRIES_TO_DISPLAY),
msg_hash_to_str(MENU_ENUM_LABEL_NO_ENTRIES_TO_DISPLAY),
MENU_ENUM_LABEL_NO_ENTRIES_TO_DISPLAY,
FILE_TYPE_NONE, 0, 0);
info->need_push = true; info->need_push = true;
break; break;