1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-05 09:48:42 +00:00

Split up representation cbs into separate file

This commit is contained in:
twinaphex 2015-02-27 02:50:19 +01:00
parent 51071a3e46
commit 37306bcdc6
5 changed files with 922 additions and 870 deletions

View File

@ -317,6 +317,7 @@ ifeq ($(HAVE_MENU_COMMON), 1)
menu/menu_entries_cbs_start.o \
menu/menu_entries_cbs_toggle.o \
menu/menu_entries_cbs_deferred_push.o \
menu/menu_entries_cbs_representation.o \
menu/menu_entries_cbs.o \
menu/menu_list.o \
menu/menu_animation.o

View File

@ -684,6 +684,7 @@ MENU
#include "../menu/menu_entries_cbs_start.c"
#include "../menu/menu_entries_cbs_toggle.c"
#include "../menu/menu_entries_cbs_deferred_push.c"
#include "../menu/menu_entries_cbs_representation.c"
#include "../menu/menu_entries_cbs.c"
#include "../menu/menu_shader.c"
#include "../menu/menu_texture.c"

View File

@ -917,727 +917,6 @@ static int action_select_default(unsigned type, const char *label,
return 0;
}
static void menu_action_setting_disp_set_label_cheat_num_passes(
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)
{
*w = 19;
strlcpy(path_buf, path, path_buf_size);
snprintf(type_str, type_str_size, "%u", g_extern.cheat->buf_size);
}
static void menu_action_setting_disp_set_label_remap_file_load(
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)
{
*w = 19;
strlcpy(path_buf, path, path_buf_size);
fill_pathname_base(type_str, g_settings.input.remapping_path,
type_str_size);
}
static void menu_action_setting_disp_set_label_configurations(
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)
{
*w = 19;
strlcpy(path_buf, path, path_buf_size);
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);
}
static void menu_action_setting_disp_set_label_shader_filter_pass(
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)
{
unsigned pass = 0;
static const char *modes[] = {
"Don't care",
"Linear",
"Nearest"
};
menu_handle_t *menu = menu_driver_resolve();
if (!menu)
return;
(void)pass;
(void)modes;
(void)menu;
*type_str = '\0';
*w = 19;
strlcpy(path_buf, path, path_buf_size);
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL)
if (!menu->shader)
return;
pass = (type - MENU_SETTINGS_SHADER_PASS_FILTER_0);
strlcpy(type_str, modes[menu->shader->pass[pass].filter],
type_str_size);
#endif
}
static void menu_action_setting_disp_set_label_filter(
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)
{
*type_str = '\0';
*w = 19;
strlcpy(path_buf, path, path_buf_size);
strlcpy(type_str, "N/A", type_str_size);
if (*g_settings.video.softfilter_plugin)
strlcpy(type_str, path_basename(g_settings.video.softfilter_plugin),
type_str_size);
}
static void menu_action_setting_disp_set_label_shader_num_passes(
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)
{
menu_handle_t *menu = menu_driver_resolve();
if (!menu)
return;
(void)menu;
*type_str = '\0';
*w = 19;
strlcpy(path_buf, path, path_buf_size);
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL)
snprintf(type_str, type_str_size, "%u", menu->shader->passes);
#endif
}
static void menu_action_setting_disp_set_label_shader_pass(
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)
{
unsigned pass = (type - MENU_SETTINGS_SHADER_PASS_0);
menu_handle_t *menu = menu_driver_resolve();
if (!menu)
return;
(void)pass;
(void)menu;
*type_str = '\0';
*w = 19;
strlcpy(path_buf, path, path_buf_size);
strlcpy(type_str, "N/A", type_str_size);
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL)
if (*menu->shader->pass[pass].source.path)
fill_pathname_base(type_str,
menu->shader->pass[pass].source.path, type_str_size);
#endif
}
static void menu_action_setting_disp_set_label_shader_default_filter(
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)
{
*type_str = '\0';
*w = 19;
snprintf(type_str, type_str_size, "%s",
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)
shader = video_shader_driver_get_current_shader();
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
menu_handle_t *menu = menu_driver_resolve();
if (!menu)
return;
(void)menu;
*type_str = '\0';
*w = 19;
strlcpy(path_buf, path, path_buf_size);
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL)
if (!menu->shader)
return;
param = &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,
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)
{
unsigned pass = 0;
unsigned scale_value = 0;
menu_handle_t *menu = menu_driver_resolve();
if (!menu)
return;
*type_str = '\0';
*w = 19;
strlcpy(path_buf, path, path_buf_size);
(void)pass;
(void)scale_value;
(void)menu;
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL)
if (!menu->shader)
return;
pass = (type - MENU_SETTINGS_SHADER_PASS_SCALE_0);
scale_value = menu->shader->pass[pass].fbo.scale_x;
if (!scale_value)
strlcpy(type_str, "Don't care", type_str_size);
else
snprintf(type_str, type_str_size, "%ux", scale_value);
#endif
}
static void menu_action_setting_disp_set_label_menu_file_core(
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)
{
const char *alt = NULL;
strlcpy(type_str, "(CORE)", type_str_size);
menu_list_get_alt_at_offset(list, i, &alt);
*w = strlen(type_str);
if (alt)
strlcpy(path_buf, alt, path_buf_size);
}
static void menu_action_setting_disp_set_label_input_desc(
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)
{
unsigned inp_desc_index_offset = type - MENU_SETTINGS_INPUT_DESC_BEGIN;
unsigned inp_desc_user = inp_desc_index_offset /
RARCH_FIRST_CUSTOM_BIND;
unsigned inp_desc_button_index_offset = inp_desc_index_offset -
(inp_desc_user * RARCH_FIRST_CUSTOM_BIND);
unsigned remap_id = g_settings.input.remap_ids
[inp_desc_user][inp_desc_button_index_offset];
snprintf(type_str, type_str_size, "%s",
g_settings.input.binds[inp_desc_user][remap_id].desc);
*w = 19;
strlcpy(path_buf, path, path_buf_size);
}
static void menu_action_setting_disp_set_label_cheat(
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)
{
unsigned cheat_index = type - MENU_SETTINGS_CHEAT_BEGIN;
if (cheat_index < g_extern.cheat->buf_size)
snprintf(type_str, type_str_size, "%s : (%s)",
(g_extern.cheat->cheats[cheat_index].code != NULL)
? g_extern.cheat->cheats[cheat_index].code : "N/A",
g_extern.cheat->cheats[cheat_index].state ? "ON" : "OFF"
);
*w = 19;
strlcpy(path_buf, path, path_buf_size);
}
static void menu_action_setting_disp_set_label_perf_counters(
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)
{
const struct retro_perf_counter **counters =
(const struct retro_perf_counter **)perf_counters_rarch;
unsigned offset = type - MENU_SETTINGS_PERF_COUNTERS_BEGIN;
*type_str = '\0';
*w = 19;
strlcpy(path_buf, path, path_buf_size);
if (!counters[offset])
return;
if (!counters[offset]->call_cnt)
return;
snprintf(type_str, type_str_size,
#ifdef _WIN32
"%I64u ticks, %I64u runs.",
#else
"%llu ticks, %llu runs.",
#endif
((unsigned long long)counters[offset]->total /
(unsigned long long)counters[offset]->call_cnt),
(unsigned long long)counters[offset]->call_cnt);
}
static void menu_action_setting_disp_set_label_libretro_perf_counters(
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)
{
const struct retro_perf_counter **counters =
(const struct retro_perf_counter **)perf_counters_libretro;
unsigned offset = type - MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN;
*type_str = '\0';
*w = 19;
strlcpy(path_buf, path, path_buf_size);
if (!counters[offset])
return;
if (!counters[offset]->call_cnt)
return;
snprintf(type_str, type_str_size,
#ifdef _WIN32
"%I64u ticks, %I64u runs.",
#else
"%llu ticks, %llu runs.",
#endif
((unsigned long long)counters[offset]->total /
(unsigned long long)counters[offset]->call_cnt),
(unsigned long long)counters[offset]->call_cnt);
}
static void menu_action_setting_disp_set_label_menu_more(
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)
{
strlcpy(type_str, "...", type_str_size);
*w = 19;
strlcpy(path_buf, path, path_buf_size);
}
static void menu_action_setting_disp_set_label_menu_disk_index(
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)
{
const struct retro_disk_control_callback *control =
(const struct retro_disk_control_callback*)
&g_extern.system.disk_control;
unsigned images = 0, current = 0;
*w = 19;
*type_str = '\0';
strlcpy(path_buf, path, path_buf_size);
if (!control)
return;
images = control->get_num_images();
current = control->get_image_index();
if (current >= images)
strlcpy(type_str, "No Disk", type_str_size);
else
snprintf(type_str, type_str_size, "%u", current + 1);
}
static void menu_action_setting_disp_set_label_menu_video_resolution(
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)
{
unsigned width = 0, height = 0;
*w = 19;
*type_str = '\0';
(void)width;
(void)height;
if (driver.video_data && driver.video_poke &&
driver.video_poke->get_video_output_size)
{
driver.video_poke->get_video_output_size(driver.video_data,
&width, &height);
snprintf(type_str, type_str_size, "%ux%u", width, height);
}
else
strlcpy(type_str, "N/A", type_str_size);
}
static void menu_action_setting_generic_disp_set_label(
unsigned *w, char *type_str, size_t type_str_size,
const char *path, const char *label,
char *path_buf, size_t path_buf_size)
{
*type_str = '\0';
if (label)
strlcpy(type_str, label, type_str_size);
*w = strlen(type_str);
strlcpy(path_buf, path, path_buf_size);
}
static void menu_action_setting_disp_set_label_menu_file_plain(
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)
{
menu_action_setting_generic_disp_set_label(w, type_str, type_str_size,
path, "(FILE)", path_buf, path_buf_size);
}
static void menu_action_setting_disp_set_label_menu_file_use_directory(
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)
{
menu_action_setting_generic_disp_set_label(w, type_str, type_str_size,
path, NULL, path_buf, path_buf_size);
}
static void menu_action_setting_disp_set_label_menu_file_directory(
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)
{
menu_action_setting_generic_disp_set_label(w, type_str, type_str_size,
path, "(DIR)", path_buf, path_buf_size);
}
static void menu_action_setting_disp_set_label_menu_file_carchive(
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)
{
menu_action_setting_generic_disp_set_label(w, type_str, type_str_size,
path, "(COMP)", path_buf, path_buf_size);
}
static void menu_action_setting_disp_set_label_menu_file_shader(
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)
{
menu_action_setting_generic_disp_set_label(w, type_str, type_str_size,
path, "(SHADER)", path_buf, path_buf_size);
}
static void menu_action_setting_disp_set_label_menu_file_shader_preset(
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)
{
menu_action_setting_generic_disp_set_label(w, type_str, type_str_size,
path, "(PRESET)", path_buf, path_buf_size);
}
static void menu_action_setting_disp_set_label_menu_file_in_carchive(
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)
{
menu_action_setting_generic_disp_set_label(w, type_str, type_str_size,
path, "(CFILE)", path_buf, path_buf_size);
}
static void menu_action_setting_disp_set_label_menu_file_overlay(
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)
{
menu_action_setting_generic_disp_set_label(w, type_str, type_str_size,
path, "(OVERLAY)", path_buf, path_buf_size);
}
static void menu_action_setting_disp_set_label_menu_file_config(
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)
{
menu_action_setting_generic_disp_set_label(w, type_str, type_str_size,
path, "(CONFIG)", path_buf, path_buf_size);
}
static void menu_action_setting_disp_set_label_menu_file_font(
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)
{
menu_action_setting_generic_disp_set_label(w, type_str, type_str_size,
path, "(FONT)", path_buf, path_buf_size);
}
static void menu_action_setting_disp_set_label_menu_file_filter(
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)
{
menu_action_setting_generic_disp_set_label(w, type_str, type_str_size,
path, "(FILTER)", path_buf, path_buf_size);
}
static void menu_action_setting_disp_set_label_menu_file_url(
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)
{
menu_action_setting_generic_disp_set_label(w, type_str, type_str_size,
path, "(URL)", path_buf, path_buf_size);
}
static void menu_action_setting_disp_set_label_menu_file_rdb(
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)
{
menu_action_setting_generic_disp_set_label(w, type_str, type_str_size,
path, "(RDB)", path_buf, path_buf_size);
}
static void menu_action_setting_disp_set_label_menu_file_cursor(
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)
{
menu_action_setting_generic_disp_set_label(w, type_str, type_str_size,
path, "(CURSOR)", path_buf, path_buf_size);
}
static void menu_action_setting_disp_set_label_menu_file_cheat(
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)
{
menu_action_setting_generic_disp_set_label(w, type_str, type_str_size,
path, "(CHEAT)", path_buf, path_buf_size);
}
static void menu_action_setting_disp_set_label(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)
{
*type_str = '\0';
*w = 19;
if (!strcmp(label, "performance_counters"))
*w = strlen(label);
if (!strcmp(label, "history_list"))
*w = strlen(label);
if (type >= MENU_SETTINGS_CORE_OPTION_START)
strlcpy(
type_str,
core_option_get_val(g_extern.system.core_options,
type - MENU_SETTINGS_CORE_OPTION_START),
type_str_size);
else
setting_data_get_label(list, type_str,
type_str_size, w, type, label, entry_label, i);
strlcpy(path_buf, path, path_buf_size);
}
static void menu_entries_cbs_init_bind_select(menu_file_list_cbs_t *cbs,
const char *path, const char *label, unsigned type, size_t idx,
const char *elem0, const char *elem1)
@ -1709,155 +988,6 @@ static void menu_entries_cbs_init_bind_iterate(menu_file_list_cbs_t *cbs,
cbs->action_iterate = action_iterate_main;
}
static void menu_entries_cbs_init_bind_get_string_representation(menu_file_list_cbs_t *cbs,
const char *path, const char *label, unsigned type, size_t idx,
const char *elem0, const char *elem1)
{
if (!cbs)
return;
if (type >= MENU_SETTINGS_INPUT_DESC_BEGIN
&& type <= MENU_SETTINGS_INPUT_DESC_END)
cbs->action_get_representation =
menu_action_setting_disp_set_label_input_desc;
else if (type >= MENU_SETTINGS_CHEAT_BEGIN
&& type <= MENU_SETTINGS_CHEAT_END)
cbs->action_get_representation =
menu_action_setting_disp_set_label_cheat;
else if (type >= MENU_SETTINGS_PERF_COUNTERS_BEGIN
&& type <= MENU_SETTINGS_PERF_COUNTERS_END)
cbs->action_get_representation =
menu_action_setting_disp_set_label_perf_counters;
else if (type >= MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN
&& 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;
else if (!strcmp(label, "remap_file_load"))
cbs->action_get_representation =
menu_action_setting_disp_set_label_remap_file_load;
else if (!strcmp(label, "video_shader_filter_pass"))
cbs->action_get_representation =
menu_action_setting_disp_set_label_shader_filter_pass;
else if (!strcmp(label, "video_shader_scale_pass"))
cbs->action_get_representation =
menu_action_setting_disp_set_label_shader_scale_pass;
else if (!strcmp(label, "video_shader_num_passes"))
cbs->action_get_representation =
menu_action_setting_disp_set_label_shader_num_passes;
else if (!strcmp(label, "video_shader_pass"))
cbs->action_get_representation =
menu_action_setting_disp_set_label_shader_pass;
else if (!strcmp(label, "video_shader_default_filter"))
cbs->action_get_representation =
menu_action_setting_disp_set_label_shader_default_filter;
else if (!strcmp(label, "video_filter"))
cbs->action_get_representation =
menu_action_setting_disp_set_label_filter;
else if (!strcmp(label, "configurations"))
cbs->action_get_representation =
menu_action_setting_disp_set_label_configurations;
else
{
switch (type)
{
case MENU_FILE_CORE:
cbs->action_get_representation =
menu_action_setting_disp_set_label_menu_file_core;
break;
case MENU_FILE_PLAIN:
cbs->action_get_representation =
menu_action_setting_disp_set_label_menu_file_plain;
break;
case MENU_FILE_USE_DIRECTORY:
cbs->action_get_representation =
menu_action_setting_disp_set_label_menu_file_use_directory;
break;
case MENU_FILE_DIRECTORY:
cbs->action_get_representation =
menu_action_setting_disp_set_label_menu_file_directory;
break;
case MENU_FILE_CARCHIVE:
cbs->action_get_representation =
menu_action_setting_disp_set_label_menu_file_carchive;
break;
case MENU_FILE_OVERLAY:
cbs->action_get_representation =
menu_action_setting_disp_set_label_menu_file_overlay;
break;
case MENU_FILE_FONT:
cbs->action_get_representation =
menu_action_setting_disp_set_label_menu_file_font;
break;
case MENU_FILE_SHADER:
cbs->action_get_representation =
menu_action_setting_disp_set_label_menu_file_shader;
break;
case MENU_FILE_SHADER_PRESET:
cbs->action_get_representation =
menu_action_setting_disp_set_label_menu_file_shader_preset;
break;
case MENU_FILE_CONFIG:
cbs->action_get_representation =
menu_action_setting_disp_set_label_menu_file_config;
break;
case MENU_FILE_IN_CARCHIVE:
cbs->action_get_representation =
menu_action_setting_disp_set_label_menu_file_in_carchive;
break;
case MENU_FILE_VIDEOFILTER:
case MENU_FILE_AUDIOFILTER:
cbs->action_get_representation =
menu_action_setting_disp_set_label_menu_file_filter;
break;
case MENU_FILE_DOWNLOAD_CORE:
cbs->action_get_representation =
menu_action_setting_disp_set_label_menu_file_url;
break;
case MENU_FILE_RDB:
cbs->action_get_representation =
menu_action_setting_disp_set_label_menu_file_rdb;
break;
case MENU_FILE_CURSOR:
cbs->action_get_representation =
menu_action_setting_disp_set_label_menu_file_cursor;
break;
case MENU_FILE_CHEAT:
cbs->action_get_representation =
menu_action_setting_disp_set_label_menu_file_cheat;
break;
case MENU_SETTING_SUBGROUP:
case MENU_SETTINGS_CUSTOM_VIEWPORT:
case MENU_SETTINGS_CUSTOM_BIND_ALL:
case MENU_SETTINGS_CUSTOM_BIND_DEFAULT_ALL:
cbs->action_get_representation =
menu_action_setting_disp_set_label_menu_more;
break;
case MENU_SETTINGS_CORE_DISK_OPTIONS_DISK_INDEX:
cbs->action_get_representation =
menu_action_setting_disp_set_label_menu_disk_index;
break;
case MENU_SETTINGS_VIDEO_RESOLUTION:
cbs->action_get_representation =
menu_action_setting_disp_set_label_menu_video_resolution;
break;
default:
cbs->action_get_representation = menu_action_setting_disp_set_label;
break;
}
}
}
void menu_entries_cbs_init(void *data,
const char *path, const char *label,
unsigned type, size_t idx)

View File

@ -34,6 +34,10 @@ void menu_entries_common_load_content(bool persist);
int menu_entries_common_is_settings_entry(const char *label);
void menu_entries_cbs_init_bind_get_string_representation(menu_file_list_cbs_t *cbs,
const char *path, const char *label, unsigned type, size_t idx,
const char *elem0, const char *elem1);
void menu_entries_cbs_init_bind_start(menu_file_list_cbs_t *cbs,
const char *path, const char *label, unsigned type, size_t idx,
const char *elem0, const char *elem1);

View File

@ -0,0 +1,916 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2011-2015 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <file/file_path.h>
#include "menu.h"
#include "menu_entries_cbs.h"
#include "menu_setting.h"
#include "menu_input.h"
#include "menu_entries.h"
#include "menu_shader.h"
#include "menu_navigation.h"
#include "../file_ext.h"
#include "../file_extract.h"
#include "../file_ops.h"
#include "../config.def.h"
#include "../cheats.h"
#include "../retroarch.h"
#include "../performance.h"
#ifdef HAVE_NETWORKING
#include "../net_http.h"
#endif
#ifdef HAVE_LIBRETRODB
#include "../database_info.h"
#endif
#include "menu_database.h"
#include "../input/input_autodetect.h"
#include "../input/input_remapping.h"
#include "../gfx/video_viewport.h"
static void menu_action_setting_disp_set_label_cheat_num_passes(
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)
{
*w = 19;
strlcpy(path_buf, path, path_buf_size);
snprintf(type_str, type_str_size, "%u", g_extern.cheat->buf_size);
}
static void menu_action_setting_disp_set_label_remap_file_load(
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)
{
*w = 19;
strlcpy(path_buf, path, path_buf_size);
fill_pathname_base(type_str, g_settings.input.remapping_path,
type_str_size);
}
static void menu_action_setting_disp_set_label_configurations(
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)
{
*w = 19;
strlcpy(path_buf, path, path_buf_size);
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);
}
static void menu_action_setting_disp_set_label_shader_filter_pass(
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)
{
unsigned pass = 0;
static const char *modes[] = {
"Don't care",
"Linear",
"Nearest"
};
menu_handle_t *menu = menu_driver_resolve();
if (!menu)
return;
(void)pass;
(void)modes;
(void)menu;
*type_str = '\0';
*w = 19;
strlcpy(path_buf, path, path_buf_size);
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL)
if (!menu->shader)
return;
pass = (type - MENU_SETTINGS_SHADER_PASS_FILTER_0);
strlcpy(type_str, modes[menu->shader->pass[pass].filter],
type_str_size);
#endif
}
static void menu_action_setting_disp_set_label_filter(
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)
{
*type_str = '\0';
*w = 19;
strlcpy(path_buf, path, path_buf_size);
strlcpy(type_str, "N/A", type_str_size);
if (*g_settings.video.softfilter_plugin)
strlcpy(type_str, path_basename(g_settings.video.softfilter_plugin),
type_str_size);
}
static void menu_action_setting_disp_set_label_shader_num_passes(
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)
{
menu_handle_t *menu = menu_driver_resolve();
if (!menu)
return;
(void)menu;
*type_str = '\0';
*w = 19;
strlcpy(path_buf, path, path_buf_size);
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL)
snprintf(type_str, type_str_size, "%u", menu->shader->passes);
#endif
}
static void menu_action_setting_disp_set_label_shader_pass(
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)
{
unsigned pass = (type - MENU_SETTINGS_SHADER_PASS_0);
menu_handle_t *menu = menu_driver_resolve();
if (!menu)
return;
(void)pass;
(void)menu;
*type_str = '\0';
*w = 19;
strlcpy(path_buf, path, path_buf_size);
strlcpy(type_str, "N/A", type_str_size);
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL)
if (*menu->shader->pass[pass].source.path)
fill_pathname_base(type_str,
menu->shader->pass[pass].source.path, type_str_size);
#endif
}
static void menu_action_setting_disp_set_label_shader_default_filter(
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)
{
*type_str = '\0';
*w = 19;
snprintf(type_str, type_str_size, "%s",
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)
shader = video_shader_driver_get_current_shader();
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
menu_handle_t *menu = menu_driver_resolve();
if (!menu)
return;
(void)menu;
*type_str = '\0';
*w = 19;
strlcpy(path_buf, path, path_buf_size);
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL)
if (!menu->shader)
return;
param = &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,
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)
{
unsigned pass = 0;
unsigned scale_value = 0;
menu_handle_t *menu = menu_driver_resolve();
if (!menu)
return;
*type_str = '\0';
*w = 19;
strlcpy(path_buf, path, path_buf_size);
(void)pass;
(void)scale_value;
(void)menu;
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL)
if (!menu->shader)
return;
pass = (type - MENU_SETTINGS_SHADER_PASS_SCALE_0);
scale_value = menu->shader->pass[pass].fbo.scale_x;
if (!scale_value)
strlcpy(type_str, "Don't care", type_str_size);
else
snprintf(type_str, type_str_size, "%ux", scale_value);
#endif
}
static void menu_action_setting_disp_set_label_menu_file_core(
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)
{
const char *alt = NULL;
strlcpy(type_str, "(CORE)", type_str_size);
menu_list_get_alt_at_offset(list, i, &alt);
*w = strlen(type_str);
if (alt)
strlcpy(path_buf, alt, path_buf_size);
}
static void menu_action_setting_disp_set_label_input_desc(
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)
{
unsigned inp_desc_index_offset = type - MENU_SETTINGS_INPUT_DESC_BEGIN;
unsigned inp_desc_user = inp_desc_index_offset /
RARCH_FIRST_CUSTOM_BIND;
unsigned inp_desc_button_index_offset = inp_desc_index_offset -
(inp_desc_user * RARCH_FIRST_CUSTOM_BIND);
unsigned remap_id = g_settings.input.remap_ids
[inp_desc_user][inp_desc_button_index_offset];
snprintf(type_str, type_str_size, "%s",
g_settings.input.binds[inp_desc_user][remap_id].desc);
*w = 19;
strlcpy(path_buf, path, path_buf_size);
}
static void menu_action_setting_disp_set_label_cheat(
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)
{
unsigned cheat_index = type - MENU_SETTINGS_CHEAT_BEGIN;
if (cheat_index < g_extern.cheat->buf_size)
snprintf(type_str, type_str_size, "%s : (%s)",
(g_extern.cheat->cheats[cheat_index].code != NULL)
? g_extern.cheat->cheats[cheat_index].code : "N/A",
g_extern.cheat->cheats[cheat_index].state ? "ON" : "OFF"
);
*w = 19;
strlcpy(path_buf, path, path_buf_size);
}
static void menu_action_setting_disp_set_label_perf_counters(
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)
{
const struct retro_perf_counter **counters =
(const struct retro_perf_counter **)perf_counters_rarch;
unsigned offset = type - MENU_SETTINGS_PERF_COUNTERS_BEGIN;
*type_str = '\0';
*w = 19;
strlcpy(path_buf, path, path_buf_size);
if (!counters[offset])
return;
if (!counters[offset]->call_cnt)
return;
snprintf(type_str, type_str_size,
#ifdef _WIN32
"%I64u ticks, %I64u runs.",
#else
"%llu ticks, %llu runs.",
#endif
((unsigned long long)counters[offset]->total /
(unsigned long long)counters[offset]->call_cnt),
(unsigned long long)counters[offset]->call_cnt);
}
static void menu_action_setting_disp_set_label_libretro_perf_counters(
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)
{
const struct retro_perf_counter **counters =
(const struct retro_perf_counter **)perf_counters_libretro;
unsigned offset = type - MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN;
*type_str = '\0';
*w = 19;
strlcpy(path_buf, path, path_buf_size);
if (!counters[offset])
return;
if (!counters[offset]->call_cnt)
return;
snprintf(type_str, type_str_size,
#ifdef _WIN32
"%I64u ticks, %I64u runs.",
#else
"%llu ticks, %llu runs.",
#endif
((unsigned long long)counters[offset]->total /
(unsigned long long)counters[offset]->call_cnt),
(unsigned long long)counters[offset]->call_cnt);
}
static void menu_action_setting_disp_set_label_menu_more(
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)
{
strlcpy(type_str, "...", type_str_size);
*w = 19;
strlcpy(path_buf, path, path_buf_size);
}
static void menu_action_setting_disp_set_label_menu_disk_index(
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)
{
const struct retro_disk_control_callback *control =
(const struct retro_disk_control_callback*)
&g_extern.system.disk_control;
unsigned images = 0, current = 0;
*w = 19;
*type_str = '\0';
strlcpy(path_buf, path, path_buf_size);
if (!control)
return;
images = control->get_num_images();
current = control->get_image_index();
if (current >= images)
strlcpy(type_str, "No Disk", type_str_size);
else
snprintf(type_str, type_str_size, "%u", current + 1);
}
static void menu_action_setting_disp_set_label_menu_video_resolution(
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)
{
unsigned width = 0, height = 0;
*w = 19;
*type_str = '\0';
(void)width;
(void)height;
if (driver.video_data && driver.video_poke &&
driver.video_poke->get_video_output_size)
{
driver.video_poke->get_video_output_size(driver.video_data,
&width, &height);
snprintf(type_str, type_str_size, "%ux%u", width, height);
}
else
strlcpy(type_str, "N/A", type_str_size);
}
static void menu_action_setting_generic_disp_set_label(
unsigned *w, char *type_str, size_t type_str_size,
const char *path, const char *label,
char *path_buf, size_t path_buf_size)
{
*type_str = '\0';
if (label)
strlcpy(type_str, label, type_str_size);
*w = strlen(type_str);
strlcpy(path_buf, path, path_buf_size);
}
static void menu_action_setting_disp_set_label_menu_file_plain(
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)
{
menu_action_setting_generic_disp_set_label(w, type_str, type_str_size,
path, "(FILE)", path_buf, path_buf_size);
}
static void menu_action_setting_disp_set_label_menu_file_use_directory(
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)
{
menu_action_setting_generic_disp_set_label(w, type_str, type_str_size,
path, NULL, path_buf, path_buf_size);
}
static void menu_action_setting_disp_set_label_menu_file_directory(
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)
{
menu_action_setting_generic_disp_set_label(w, type_str, type_str_size,
path, "(DIR)", path_buf, path_buf_size);
}
static void menu_action_setting_disp_set_label_menu_file_carchive(
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)
{
menu_action_setting_generic_disp_set_label(w, type_str, type_str_size,
path, "(COMP)", path_buf, path_buf_size);
}
static void menu_action_setting_disp_set_label_menu_file_shader(
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)
{
menu_action_setting_generic_disp_set_label(w, type_str, type_str_size,
path, "(SHADER)", path_buf, path_buf_size);
}
static void menu_action_setting_disp_set_label_menu_file_shader_preset(
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)
{
menu_action_setting_generic_disp_set_label(w, type_str, type_str_size,
path, "(PRESET)", path_buf, path_buf_size);
}
static void menu_action_setting_disp_set_label_menu_file_in_carchive(
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)
{
menu_action_setting_generic_disp_set_label(w, type_str, type_str_size,
path, "(CFILE)", path_buf, path_buf_size);
}
static void menu_action_setting_disp_set_label_menu_file_overlay(
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)
{
menu_action_setting_generic_disp_set_label(w, type_str, type_str_size,
path, "(OVERLAY)", path_buf, path_buf_size);
}
static void menu_action_setting_disp_set_label_menu_file_config(
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)
{
menu_action_setting_generic_disp_set_label(w, type_str, type_str_size,
path, "(CONFIG)", path_buf, path_buf_size);
}
static void menu_action_setting_disp_set_label_menu_file_font(
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)
{
menu_action_setting_generic_disp_set_label(w, type_str, type_str_size,
path, "(FONT)", path_buf, path_buf_size);
}
static void menu_action_setting_disp_set_label_menu_file_filter(
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)
{
menu_action_setting_generic_disp_set_label(w, type_str, type_str_size,
path, "(FILTER)", path_buf, path_buf_size);
}
static void menu_action_setting_disp_set_label_menu_file_url(
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)
{
menu_action_setting_generic_disp_set_label(w, type_str, type_str_size,
path, "(URL)", path_buf, path_buf_size);
}
static void menu_action_setting_disp_set_label_menu_file_rdb(
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)
{
menu_action_setting_generic_disp_set_label(w, type_str, type_str_size,
path, "(RDB)", path_buf, path_buf_size);
}
static void menu_action_setting_disp_set_label_menu_file_cursor(
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)
{
menu_action_setting_generic_disp_set_label(w, type_str, type_str_size,
path, "(CURSOR)", path_buf, path_buf_size);
}
static void menu_action_setting_disp_set_label_menu_file_cheat(
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)
{
menu_action_setting_generic_disp_set_label(w, type_str, type_str_size,
path, "(CHEAT)", path_buf, path_buf_size);
}
static void menu_action_setting_disp_set_label(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)
{
*type_str = '\0';
*w = 19;
if (!strcmp(label, "performance_counters"))
*w = strlen(label);
if (!strcmp(label, "history_list"))
*w = strlen(label);
if (type >= MENU_SETTINGS_CORE_OPTION_START)
strlcpy(
type_str,
core_option_get_val(g_extern.system.core_options,
type - MENU_SETTINGS_CORE_OPTION_START),
type_str_size);
else
setting_data_get_label(list, type_str,
type_str_size, w, type, label, entry_label, i);
strlcpy(path_buf, path, path_buf_size);
}
void menu_entries_cbs_init_bind_get_string_representation(menu_file_list_cbs_t *cbs,
const char *path, const char *label, unsigned type, size_t idx,
const char *elem0, const char *elem1)
{
if (!cbs)
return;
if (type >= MENU_SETTINGS_INPUT_DESC_BEGIN
&& type <= MENU_SETTINGS_INPUT_DESC_END)
cbs->action_get_representation =
menu_action_setting_disp_set_label_input_desc;
else if (type >= MENU_SETTINGS_CHEAT_BEGIN
&& type <= MENU_SETTINGS_CHEAT_END)
cbs->action_get_representation =
menu_action_setting_disp_set_label_cheat;
else if (type >= MENU_SETTINGS_PERF_COUNTERS_BEGIN
&& type <= MENU_SETTINGS_PERF_COUNTERS_END)
cbs->action_get_representation =
menu_action_setting_disp_set_label_perf_counters;
else if (type >= MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN
&& 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;
else if (!strcmp(label, "remap_file_load"))
cbs->action_get_representation =
menu_action_setting_disp_set_label_remap_file_load;
else if (!strcmp(label, "video_shader_filter_pass"))
cbs->action_get_representation =
menu_action_setting_disp_set_label_shader_filter_pass;
else if (!strcmp(label, "video_shader_scale_pass"))
cbs->action_get_representation =
menu_action_setting_disp_set_label_shader_scale_pass;
else if (!strcmp(label, "video_shader_num_passes"))
cbs->action_get_representation =
menu_action_setting_disp_set_label_shader_num_passes;
else if (!strcmp(label, "video_shader_pass"))
cbs->action_get_representation =
menu_action_setting_disp_set_label_shader_pass;
else if (!strcmp(label, "video_shader_default_filter"))
cbs->action_get_representation =
menu_action_setting_disp_set_label_shader_default_filter;
else if (!strcmp(label, "video_filter"))
cbs->action_get_representation =
menu_action_setting_disp_set_label_filter;
else if (!strcmp(label, "configurations"))
cbs->action_get_representation =
menu_action_setting_disp_set_label_configurations;
else
{
switch (type)
{
case MENU_FILE_CORE:
cbs->action_get_representation =
menu_action_setting_disp_set_label_menu_file_core;
break;
case MENU_FILE_PLAIN:
cbs->action_get_representation =
menu_action_setting_disp_set_label_menu_file_plain;
break;
case MENU_FILE_USE_DIRECTORY:
cbs->action_get_representation =
menu_action_setting_disp_set_label_menu_file_use_directory;
break;
case MENU_FILE_DIRECTORY:
cbs->action_get_representation =
menu_action_setting_disp_set_label_menu_file_directory;
break;
case MENU_FILE_CARCHIVE:
cbs->action_get_representation =
menu_action_setting_disp_set_label_menu_file_carchive;
break;
case MENU_FILE_OVERLAY:
cbs->action_get_representation =
menu_action_setting_disp_set_label_menu_file_overlay;
break;
case MENU_FILE_FONT:
cbs->action_get_representation =
menu_action_setting_disp_set_label_menu_file_font;
break;
case MENU_FILE_SHADER:
cbs->action_get_representation =
menu_action_setting_disp_set_label_menu_file_shader;
break;
case MENU_FILE_SHADER_PRESET:
cbs->action_get_representation =
menu_action_setting_disp_set_label_menu_file_shader_preset;
break;
case MENU_FILE_CONFIG:
cbs->action_get_representation =
menu_action_setting_disp_set_label_menu_file_config;
break;
case MENU_FILE_IN_CARCHIVE:
cbs->action_get_representation =
menu_action_setting_disp_set_label_menu_file_in_carchive;
break;
case MENU_FILE_VIDEOFILTER:
case MENU_FILE_AUDIOFILTER:
cbs->action_get_representation =
menu_action_setting_disp_set_label_menu_file_filter;
break;
case MENU_FILE_DOWNLOAD_CORE:
cbs->action_get_representation =
menu_action_setting_disp_set_label_menu_file_url;
break;
case MENU_FILE_RDB:
cbs->action_get_representation =
menu_action_setting_disp_set_label_menu_file_rdb;
break;
case MENU_FILE_CURSOR:
cbs->action_get_representation =
menu_action_setting_disp_set_label_menu_file_cursor;
break;
case MENU_FILE_CHEAT:
cbs->action_get_representation =
menu_action_setting_disp_set_label_menu_file_cheat;
break;
case MENU_SETTING_SUBGROUP:
case MENU_SETTINGS_CUSTOM_VIEWPORT:
case MENU_SETTINGS_CUSTOM_BIND_ALL:
case MENU_SETTINGS_CUSTOM_BIND_DEFAULT_ALL:
cbs->action_get_representation =
menu_action_setting_disp_set_label_menu_more;
break;
case MENU_SETTINGS_CORE_DISK_OPTIONS_DISK_INDEX:
cbs->action_get_representation =
menu_action_setting_disp_set_label_menu_disk_index;
break;
case MENU_SETTINGS_VIDEO_RESOLUTION:
cbs->action_get_representation =
menu_action_setting_disp_set_label_menu_video_resolution;
break;
default:
cbs->action_get_representation = menu_action_setting_disp_set_label;
break;
}
}
}