mirror of
https://github.com/libretro/RetroArch
synced 2025-03-28 19:20:35 +00:00
Cleanups
This commit is contained in:
parent
93118a560f
commit
6f6e8ae9cd
@ -4142,6 +4142,79 @@ static void menu_action_setting_disp_set_label_shader_default_filter(
|
||||
g_settings.video.smooth ? "Linear" : "Nearest");
|
||||
}
|
||||
|
||||
static void menu_action_setting_disp_set_label_shader_parameter(
|
||||
file_list_t* list,
|
||||
unsigned *w, unsigned type, unsigned i,
|
||||
const char *label,
|
||||
char *type_str, size_t type_str_size,
|
||||
const char *entry_label,
|
||||
const char *path,
|
||||
char *path_buf, size_t path_buf_size)
|
||||
{
|
||||
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL)
|
||||
const struct video_shader_parameter *param = NULL;
|
||||
struct video_shader *shader = NULL;
|
||||
#endif
|
||||
|
||||
if (!driver.video_poke)
|
||||
return;
|
||||
if (!driver.video_data)
|
||||
return;
|
||||
|
||||
*type_str = '\0';
|
||||
*w = 19;
|
||||
strlcpy(path_buf, path, path_buf_size);
|
||||
|
||||
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL)
|
||||
if (!driver.video_poke->get_current_shader)
|
||||
return;
|
||||
|
||||
shader = driver.video_poke->get_current_shader(driver.video_data);
|
||||
|
||||
if (!shader)
|
||||
return;
|
||||
|
||||
param = &shader->parameters[type - MENU_SETTINGS_SHADER_PARAMETER_0];
|
||||
|
||||
if (!param)
|
||||
return;
|
||||
|
||||
snprintf(type_str, type_str_size, "%.2f [%.2f %.2f]",
|
||||
param->current, param->minimum, param->maximum);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void menu_action_setting_disp_set_label_shader_preset_parameter(
|
||||
file_list_t* list,
|
||||
unsigned *w, unsigned type, unsigned i,
|
||||
const char *label,
|
||||
char *type_str, size_t type_str_size,
|
||||
const char *entry_label,
|
||||
const char *path,
|
||||
char *path_buf, size_t path_buf_size)
|
||||
{
|
||||
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL)
|
||||
const struct video_shader_parameter *param = NULL;
|
||||
#endif
|
||||
|
||||
*type_str = '\0';
|
||||
*w = 19;
|
||||
strlcpy(path_buf, path, path_buf_size);
|
||||
|
||||
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL)
|
||||
if (!driver.menu->shader)
|
||||
return;
|
||||
|
||||
param = &driver.menu->shader->parameters[type - MENU_SETTINGS_SHADER_PRESET_PARAMETER_0];
|
||||
|
||||
if (!param)
|
||||
return;
|
||||
|
||||
snprintf(type_str, type_str_size, "%.2f [%.2f %.2f]",
|
||||
param->current, param->minimum, param->maximum);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void menu_action_setting_disp_set_label_shader_scale_pass(
|
||||
file_list_t* list,
|
||||
unsigned *w, unsigned type, unsigned i,
|
||||
@ -5138,6 +5211,14 @@ static void menu_entries_cbs_init_bind_get_string_representation(menu_file_list_
|
||||
&& type <= MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_END)
|
||||
cbs->action_get_representation =
|
||||
menu_action_setting_disp_set_label_libretro_perf_counters;
|
||||
else if (type >= MENU_SETTINGS_SHADER_PRESET_PARAMETER_0
|
||||
&& type <= MENU_SETTINGS_SHADER_PRESET_PARAMETER_LAST)
|
||||
cbs->action_get_representation =
|
||||
menu_action_setting_disp_set_label_shader_preset_parameter;
|
||||
else if (type >= MENU_SETTINGS_SHADER_PARAMETER_0
|
||||
&& type <= MENU_SETTINGS_SHADER_PARAMETER_LAST)
|
||||
cbs->action_get_representation =
|
||||
menu_action_setting_disp_set_label_shader_parameter;
|
||||
else if (!strcmp(label, "cheat_num_passes"))
|
||||
cbs->action_get_representation =
|
||||
menu_action_setting_disp_set_label_cheat_num_passes;
|
||||
|
@ -2818,69 +2818,29 @@ void setting_data_get_label(void *data, char *type_str,
|
||||
size_t type_str_size, unsigned *w, unsigned type,
|
||||
const char *menu_label, const char *label, unsigned idx)
|
||||
{
|
||||
rarch_setting_t *setting_data = NULL;
|
||||
rarch_setting_t *setting = NULL;
|
||||
|
||||
if (!driver.menu || !driver.menu->menu_list || !label)
|
||||
return;
|
||||
|
||||
#if defined(HAVE_CG) || defined(HAVE_HLSL) || defined(HAVE_GLSL)
|
||||
if ((!strcmp(menu_label, "Shader Options") ||
|
||||
!strcmp(menu_label, "video_shader_parameters") ||
|
||||
!strcmp(menu_label, "video_shader_preset_parameters"))
|
||||
)
|
||||
setting_data = (rarch_setting_t*)driver.menu->list_settings;
|
||||
setting = (rarch_setting_t*)setting_data_find_setting(setting_data,
|
||||
driver.menu->menu_list->selection_buf->list[idx].label);
|
||||
|
||||
if (!setting)
|
||||
return;
|
||||
|
||||
if (!strcmp(setting->name, "configurations"))
|
||||
{
|
||||
if (type >= MENU_SETTINGS_SHADER_PARAMETER_0
|
||||
&& type <= MENU_SETTINGS_SHADER_PARAMETER_LAST)
|
||||
{
|
||||
struct video_shader *shader = NULL;
|
||||
if (driver.video_poke && driver.video_data && driver.video_poke->get_current_shader)
|
||||
shader = driver.video_poke->get_current_shader(driver.video_data);
|
||||
|
||||
if (shader)
|
||||
{
|
||||
const struct video_shader_parameter *param =
|
||||
&shader->parameters[type - MENU_SETTINGS_SHADER_PARAMETER_0];
|
||||
snprintf(type_str, type_str_size, "%.2f [%.2f %.2f]",
|
||||
param->current, param->minimum, param->maximum);
|
||||
}
|
||||
}
|
||||
else if (type >= MENU_SETTINGS_SHADER_PRESET_PARAMETER_0
|
||||
&& type <= MENU_SETTINGS_SHADER_PRESET_PARAMETER_LAST)
|
||||
{
|
||||
if (driver.menu->shader)
|
||||
{
|
||||
const struct video_shader_parameter *param =
|
||||
&driver.menu->shader->parameters[type - MENU_SETTINGS_SHADER_PRESET_PARAMETER_0];
|
||||
snprintf(type_str, type_str_size, "%.2f [%.2f %.2f]",
|
||||
param->current, param->minimum, param->maximum);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
rarch_setting_t *setting_data = NULL;
|
||||
rarch_setting_t *setting = NULL;
|
||||
|
||||
if (!driver.menu || !driver.menu->menu_list)
|
||||
return;
|
||||
|
||||
setting_data = (rarch_setting_t*)driver.menu->list_settings;
|
||||
setting = (rarch_setting_t*)setting_data_find_setting(setting_data,
|
||||
driver.menu->menu_list->selection_buf->list[idx].label);
|
||||
|
||||
if (!setting)
|
||||
return;
|
||||
|
||||
if (!strcmp(setting->name, "configurations"))
|
||||
{
|
||||
if (*g_extern.config_path)
|
||||
fill_pathname_base(type_str, g_extern.config_path,
|
||||
type_str_size);
|
||||
else
|
||||
strlcpy(type_str, "<default>", type_str_size);
|
||||
}
|
||||
if (*g_extern.config_path)
|
||||
fill_pathname_base(type_str, g_extern.config_path,
|
||||
type_str_size);
|
||||
else
|
||||
setting_data_get_string_representation(setting, type_str, type_str_size);
|
||||
strlcpy(type_str, "<default>", type_str_size);
|
||||
}
|
||||
else
|
||||
setting_data_get_string_representation(setting, type_str, type_str_size);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user