1
0
mirror of https://github.com/libretro/RetroArch synced 2025-02-17 06:40:57 +00:00

(Menu) Create shared.h that is used for rgui/rmenu/rmenu XUI - removes

duplicate code
This commit is contained in:
twinaphex 2014-09-03 01:51:29 +02:00
parent 6bc7e3452e
commit 71deb904d4
4 changed files with 155 additions and 374 deletions

@ -36,6 +36,8 @@
#include "../../../screenshot.h"
#include "../../../gfx/fonts/bitmap.h"
#include "shared.h"
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL)
#define HAVE_SHADER_MANAGER
#endif
@ -303,132 +305,11 @@ static void rgui_render(void)
menu_type_is = driver.menu_ctx->backend->type_is(menu_type);
#if 0
RARCH_LOG("Dir is: %s\n", dir);
RARCH_LOG("Dir is: %s\n", label);
#endif
if (menu_type == MENU_SETTINGS_CORE)
snprintf(title, sizeof(title), "CORE SELECTION %s", dir);
else if (menu_type == MENU_SETTINGS_DEFERRED_CORE)
snprintf(title, sizeof(title), "DETECTED CORES %s", dir);
else if (menu_type == MENU_SETTINGS_CONFIG)
snprintf(title, sizeof(title), "CONFIG %s", dir);
else if (menu_type == MENU_SETTINGS_DISK_APPEND)
snprintf(title, sizeof(title), "DISK APPEND %s", dir);
else if (menu_type == MENU_SETTINGS_VIDEO_OPTIONS)
strlcpy(title, "VIDEO OPTIONS", sizeof(title));
else if (menu_type == MENU_SETTINGS_INPUT_OPTIONS ||
menu_type == MENU_SETTINGS_CUSTOM_BIND ||
menu_type == MENU_SETTINGS_CUSTOM_BIND_KEYBOARD)
strlcpy(title, "INPUT OPTIONS", sizeof(title));
else if (menu_type == MENU_SETTINGS_OVERLAY_OPTIONS)
strlcpy(title, "OVERLAY OPTIONS", sizeof(title));
else if (menu_type == MENU_SETTINGS_NETPLAY_OPTIONS)
strlcpy(title, "NETPLAY OPTIONS", sizeof(title));
else if (menu_type == MENU_SETTINGS_USER_OPTIONS)
strlcpy(title, "USER OPTIONS", sizeof(title));
else if (menu_type == MENU_SETTINGS_PATH_OPTIONS)
strlcpy(title, "PATH OPTIONS", sizeof(title));
else if (menu_type == MENU_SETTINGS_OPTIONS)
strlcpy(title, "SETTINGS", sizeof(title));
else if (menu_type == MENU_SETTINGS_DRIVERS)
strlcpy(title, "DRIVER OPTIONS", sizeof(title));
else if (menu_type == MENU_SETTINGS_PERFORMANCE_COUNTERS)
strlcpy(title, "PERFORMANCE COUNTERS", sizeof(title));
else if (menu_type == MENU_SETTINGS_PERFORMANCE_COUNTERS_LIBRETRO)
strlcpy(title, "CORE PERFORMANCE COUNTERS", sizeof(title));
else if (menu_type == MENU_SETTINGS_PERFORMANCE_COUNTERS_FRONTEND)
strlcpy(title, "FRONTEND PERFORMANCE COUNTERS", sizeof(title));
#ifdef HAVE_SHADER_MANAGER
else if (menu_type == MENU_SETTINGS_SHADER_OPTIONS)
strlcpy(title, "SHADER OPTIONS", sizeof(title));
else if (menu_type == MENU_SETTINGS_SHADER_PARAMETERS)
strlcpy(title, "SHADER PARAMETERS (CURRENT)", sizeof(title));
else if (menu_type == MENU_SETTINGS_SHADER_PRESET_PARAMETERS)
strlcpy(title, "SHADER PARAMETERS (MENU PRESET)", sizeof(title));
#endif
else if (menu_type == MENU_SETTINGS_FONT_OPTIONS)
strlcpy(title, "FONT OPTIONS", sizeof(title));
else if (!strcmp(dir, "General Options"))
strlcpy(title, "GENERAL OPTIONS", sizeof(title));
else if (menu_type == MENU_SETTINGS_AUDIO_OPTIONS)
strlcpy(title, "AUDIO OPTIONS", sizeof(title));
else if (menu_type == MENU_SETTINGS_DISK_OPTIONS)
strlcpy(title, "DISK OPTIONS", sizeof(title));
else if (menu_type == MENU_SETTINGS_CORE_OPTIONS)
strlcpy(title, "CORE OPTIONS", sizeof(title));
else if (menu_type == MENU_SETTINGS_CORE_INFO)
strlcpy(title, "CORE INFO", sizeof(title));
else if (menu_type == MENU_SETTINGS_PRIVACY_OPTIONS)
strlcpy(title, "PRIVACY OPTIONS", sizeof(title));
#ifdef HAVE_SHADER_MANAGER
else if (menu_type_is == MENU_SETTINGS_SHADER_OPTIONS)
snprintf(title, sizeof(title), "SHADER %s", dir);
#endif
else if (menu_type == MENU_SETTINGS_PATH_OPTIONS ||
menu_type == MENU_SETTINGS_OPTIONS ||
menu_type == MENU_SETTINGS_CUSTOM_VIEWPORT ||
!strcmp(label, "custom_viewport_2") ||
!strcmp(label, "help") ||
menu_type == MENU_SETTINGS)
snprintf(title, sizeof(title), "MENU %s", dir);
else if (menu_type == MENU_SETTINGS_OPEN_HISTORY)
strlcpy(title, "LOAD HISTORY", sizeof(title));
else if (!strcmp(label, "info_screen"))
strlcpy(title, "INFO", sizeof(title));
#ifdef HAVE_OVERLAY
else if (menu_type == MENU_SETTINGS_OVERLAY_PRESET)
snprintf(title, sizeof(title), "OVERLAY %s", dir);
#endif
else if (menu_type == MENU_SETTINGS_VIDEO_SOFTFILTER)
snprintf(title, sizeof(title), "FILTER %s", dir);
else if (menu_type == MENU_SETTINGS_AUDIO_DSP_FILTER)
snprintf(title, sizeof(title), "DSP FILTER %s", dir);
else if (menu_type == MENU_BROWSER_DIR_PATH)
snprintf(title, sizeof(title), "BROWSER DIR %s", dir);
else if (menu_type == MENU_CONTENT_DIR_PATH)
snprintf(title, sizeof(title), "CONTENT DIR %s", dir);
else if (menu_type == MENU_SCREENSHOT_DIR_PATH)
snprintf(title, sizeof(title), "SCREENSHOT DIR %s", dir);
else if (menu_type == MENU_AUTOCONFIG_DIR_PATH)
snprintf(title, sizeof(title), "AUTOCONFIG DIR %s", dir);
else if (menu_type == MENU_SHADER_DIR_PATH)
snprintf(title, sizeof(title), "SHADER DIR %s", dir);
else if (menu_type == MENU_FILTER_DIR_PATH)
snprintf(title, sizeof(title), "FILTER DIR %s", dir);
else if (menu_type == MENU_DSP_FILTER_DIR_PATH)
snprintf(title, sizeof(title), "DSP FILTER DIR %s", dir);
else if (menu_type == MENU_SAVESTATE_DIR_PATH)
snprintf(title, sizeof(title), "SAVESTATE DIR %s", dir);
#ifdef HAVE_DYNAMIC
else if (menu_type == MENU_LIBRETRO_DIR_PATH)
snprintf(title, sizeof(title), "LIBRETRO DIR %s", dir);
#endif
else if (menu_type == MENU_CONFIG_DIR_PATH)
snprintf(title, sizeof(title), "CONFIG DIR %s", dir);
else if (menu_type == MENU_SAVEFILE_DIR_PATH)
snprintf(title, sizeof(title), "SAVEFILE DIR %s", dir);
#ifdef HAVE_OVERLAY
else if (menu_type == MENU_OVERLAY_DIR_PATH)
snprintf(title, sizeof(title), "OVERLAY DIR %s", dir);
#endif
else if (menu_type == MENU_SYSTEM_DIR_PATH)
snprintf(title, sizeof(title), "SYSTEM DIR %s", dir);
else if (menu_type == MENU_ASSETS_DIR_PATH)
snprintf(title, sizeof(title), "ASSETS DIR %s", dir);
else
{
if (driver.menu->defer_core)
snprintf(title, sizeof(title), "CONTENT %s", dir);
else
{
const char *core_name = driver.menu->info.library_name;
if (!core_name)
core_name = g_extern.system.info.library_name;
if (!core_name)
core_name = "No Core";
snprintf(title, sizeof(title), "CONTENT (%s) %s", core_name, dir);
}
}
get_title(label, dir, menu_type, menu_type_is,
title, sizeof(title));
char title_buf[256];
menu_ticker_line(title_buf, RGUI_TERM_WIDTH - 3,
@ -463,13 +344,14 @@ static void rgui_render(void)
{
char message[256], type_str[256];
const char *path = NULL;
const char *label = NULL;
const char *entry_label = NULL;
unsigned type = 0;
file_list_get_at_offset(driver.menu->selection_buf, i, &path,
&label, &type);
&entry_label, &type);
rarch_setting_t *setting = (rarch_setting_t*)setting_data_find_setting(
setting_data_get_list(),
driver.menu->selection_buf->list[i].label);
unsigned w = 19;
(void)setting;
if (menu_type == MENU_SETTINGS_PERFORMANCE_COUNTERS)
@ -519,8 +401,7 @@ static void rgui_render(void)
else
#endif
/* Pretty-print libretro cores from menu. */
if (
menu_type == MENU_SETTINGS_CORE ||
if (menu_type == MENU_SETTINGS_CORE ||
menu_type == MENU_SETTINGS_DEFERRED_CORE)
{
if (type == MENU_FILE_PLAIN)

@ -37,6 +37,8 @@
#include "../../../screenshot.h"
#include "../../../gfx/fonts/bitmap.h"
#include "shared.h"
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL)
#define HAVE_SHADER_MANAGER
#endif
@ -165,129 +167,8 @@ static void rmenu_render(void)
&& driver.menu_ctx->backend->type_is)
menu_type_is = driver.menu_ctx->backend->type_is(menu_type);
if (menu_type == MENU_SETTINGS_CORE)
snprintf(title, sizeof(title), "CORE SELECTION %s", dir);
else if (menu_type == MENU_SETTINGS_DEFERRED_CORE)
snprintf(title, sizeof(title), "DETECTED CORES %s", dir);
else if (menu_type == MENU_SETTINGS_CONFIG)
snprintf(title, sizeof(title), "CONFIG %s", dir);
else if (menu_type == MENU_SETTINGS_DISK_APPEND)
snprintf(title, sizeof(title), "DISK APPEND %s", dir);
else if (menu_type == MENU_SETTINGS_VIDEO_OPTIONS)
strlcpy(title, "VIDEO OPTIONS", sizeof(title));
else if (menu_type == MENU_SETTINGS_DRIVERS)
strlcpy(title, "DRIVER OPTIONS", sizeof(title));
else if (menu_type == MENU_SETTINGS_PERFORMANCE_COUNTERS)
strlcpy(title, "PERFORMANCE COUNTERS", sizeof(title));
else if (menu_type == MENU_SETTINGS_PERFORMANCE_COUNTERS_LIBRETRO)
strlcpy(title, "CORE PERFORMANCE COUNTERS", sizeof(title));
else if (menu_type == MENU_SETTINGS_PERFORMANCE_COUNTERS_FRONTEND)
strlcpy(title, "FRONTEND PERFORMANCE COUNTERS", sizeof(title));
#ifdef HAVE_SHADER_MANAGER
else if (menu_type == MENU_SETTINGS_SHADER_OPTIONS)
strlcpy(title, "SHADER OPTIONS", sizeof(title));
else if (menu_type == MENU_SETTINGS_SHADER_PARAMETERS)
strlcpy(title, "SHADER PARAMETERS (CURRENT)", sizeof(title));
else if (menu_type == MENU_SETTINGS_SHADER_PRESET_PARAMETERS)
strlcpy(title, "SHADER PARAMETERS (MENU PRESET)", sizeof(title));
#endif
else if (menu_type == MENU_SETTINGS_AUDIO_OPTIONS)
strlcpy(title, "AUDIO OPTIONS", sizeof(title));
else if (menu_type == MENU_SETTINGS_OVERLAY_OPTIONS)
strlcpy(title, "OVERLAY OPTIONS", sizeof(title));
else if (menu_type == MENU_SETTINGS_NETPLAY_OPTIONS)
strlcpy(title, "NETPLAY OPTIONS", sizeof(title));
else if (menu_type == MENU_SETTINGS_USER_OPTIONS)
strlcpy(title, "USER OPTIONS", sizeof(title));
else if (menu_type == MENU_SETTINGS_FONT_OPTIONS)
strlcpy(title, "FONT OPTIONS", sizeof(title));
else if (!strcmp(dir, "General Options"))
strlcpy(title, "GENERAL OPTIONS", sizeof(title));
else if (menu_type == MENU_SETTINGS_PATH_OPTIONS)
strlcpy(title, "PATH OPTIONS", sizeof(title));
else if (menu_type == MENU_SETTINGS_OPTIONS)
strlcpy(title, "SETTINGS", sizeof(title));
else if (menu_type == MENU_SETTINGS_INPUT_OPTIONS)
strlcpy(title, "INPUT OPTIONS", sizeof(title));
else if (menu_type == MENU_SETTINGS_DISK_OPTIONS)
strlcpy(title, "DISK OPTIONS", sizeof(title));
else if (menu_type == MENU_SETTINGS_CORE_OPTIONS)
strlcpy(title, "CORE OPTIONS", sizeof(title));
else if (menu_type == MENU_SETTINGS_CORE_INFO)
strlcpy(title, "CORE INFO", sizeof(title));
else if (menu_type == MENU_SETTINGS_PRIVACY_OPTIONS)
strlcpy(title, "PRIVACY OPTIONS", sizeof(title));
#ifdef HAVE_SHADER_MANAGER
else if (menu_type_is == MENU_SETTINGS_SHADER_OPTIONS)
snprintf(title, sizeof(title), "SHADER %s", dir);
#endif
else if ((menu_type == MENU_SETTINGS_INPUT_OPTIONS) ||
(menu_type == MENU_SETTINGS_PATH_OPTIONS) ||
(menu_type == MENU_SETTINGS_OPTIONS) ||
(menu_type == MENU_SETTINGS_CUSTOM_VIEWPORT ||
!strcmp(label, "custom_viewport_2")) ||
menu_type == MENU_SETTINGS_CUSTOM_BIND ||
!strcmp(label, "help") ||
menu_type == MENU_SETTINGS)
snprintf(title, sizeof(title), "MENU %s", dir);
else if (menu_type == MENU_SETTINGS_OPEN_HISTORY)
strlcpy(title, "LOAD HISTORY", sizeof(title));
else if (!strcmp(label, "info_screen"))
strlcpy(title, "INFO", sizeof(title));
#ifdef HAVE_OVERLAY
else if (menu_type == MENU_SETTINGS_OVERLAY_PRESET)
snprintf(title, sizeof(title), "OVERLAY %s", dir);
#endif
else if (menu_type == MENU_SETTINGS_VIDEO_SOFTFILTER)
snprintf(title, sizeof(title), "FILTER %s", dir);
else if (menu_type == MENU_SETTINGS_AUDIO_DSP_FILTER)
snprintf(title, sizeof(title), "DSP FILTER %s", dir);
else if (menu_type == MENU_BROWSER_DIR_PATH)
snprintf(title, sizeof(title), "BROWSER DIR %s", dir);
else if (menu_type == MENU_CONTENT_DIR_PATH)
snprintf(title, sizeof(title), "CONTENT DIR %s", dir);
else if (menu_type == MENU_SCREENSHOT_DIR_PATH)
snprintf(title, sizeof(title), "SCREENSHOT DIR %s", dir);
else if (menu_type == MENU_AUTOCONFIG_DIR_PATH)
snprintf(title, sizeof(title), "AUTOCONFIG DIR %s", dir);
else if (menu_type == MENU_SHADER_DIR_PATH)
snprintf(title, sizeof(title), "SHADER DIR %s", dir);
else if (menu_type == MENU_FILTER_DIR_PATH)
snprintf(title, sizeof(title), "FILTER DIR %s", dir);
else if (menu_type == MENU_DSP_FILTER_DIR_PATH)
snprintf(title, sizeof(title), "DSP FILTER DIR %s", dir);
else if (menu_type == MENU_SAVESTATE_DIR_PATH)
snprintf(title, sizeof(title), "SAVESTATE DIR %s", dir);
#ifdef HAVE_DYNAMIC
else if (menu_type == MENU_LIBRETRO_DIR_PATH)
snprintf(title, sizeof(title), "LIBRETRO DIR %s", dir);
#endif
else if (menu_type == MENU_CONFIG_DIR_PATH)
snprintf(title, sizeof(title), "CONFIG DIR %s", dir);
else if (menu_type == MENU_SAVEFILE_DIR_PATH)
snprintf(title, sizeof(title), "SAVEFILE DIR %s", dir);
#ifdef HAVE_OVERLAY
else if (menu_type == MENU_OVERLAY_DIR_PATH)
snprintf(title, sizeof(title), "OVERLAY DIR %s", dir);
#endif
else if (menu_type == MENU_SYSTEM_DIR_PATH)
snprintf(title, sizeof(title), "SYSTEM DIR %s", dir);
else if (menu_type == MENU_ASSETS_DIR_PATH)
snprintf(title, sizeof(title), "ASSETS DIR %s", dir);
else
{
if (menu->defer_core)
snprintf(title, sizeof(title), "CONTENT %s", dir);
else
{
const char *core_name = menu->info.library_name;
if (!core_name)
core_name = g_extern.system.info.library_name;
if (!core_name)
core_name = "No Core";
snprintf(title, sizeof(title), "CONTENT (%s) %s", core_name, dir);
}
}
get_title(label, dir, menu_type, menu_type_is,
title, sizeof(title));
char title_buf[256];
menu_ticker_line(title_buf, RMENU_TERM_WIDTH,
@ -337,9 +218,10 @@ static void rmenu_render(void)
for (i = begin; i < end; i++, j++)
{
const char *path = NULL;
const char *label = NULL;
const char *entry_label = NULL;
unsigned type = 0;
file_list_get_at_offset(menu->selection_buf, i, &path, &label, &type);
file_list_get_at_offset(menu->selection_buf, i,
&path, &entry_label, &type);
char message[256];
char type_str[256];

@ -29,6 +29,8 @@
#include "../../../message_queue.h"
#include "../../../general.h"
#include "shared.h"
#define XUI_CONTROL_NAVIGATE_OK (XUI_CONTROL_NAVIGATE_RIGHT + 1)
#define FONT_WIDTH 5
@ -407,125 +409,8 @@ static void rmenu_xui_render(void)
&& driver.menu_ctx->backend->type_is)
menu_type_is = driver.menu_ctx->backend->type_is(menu_type);
if (menu_type == MENU_SETTINGS_CORE)
snprintf(title, sizeof(title), "CORE SELECTION %s", dir);
else if (menu_type == MENU_SETTINGS_DEFERRED_CORE)
snprintf(title, sizeof(title), "DETECTED CORES %s", dir);
else if (menu_type == MENU_SETTINGS_CONFIG)
snprintf(title, sizeof(title), "CONFIG %s", dir);
else if (menu_type == MENU_SETTINGS_DISK_APPEND)
snprintf(title, sizeof(title), "DISK APPEND %s", dir);
else if (menu_type == MENU_SETTINGS_VIDEO_OPTIONS)
strlcpy(title, "VIDEO OPTIONS", sizeof(title));
else if (menu_type == MENU_SETTINGS_INPUT_OPTIONS)
strlcpy(title, "INPUT OPTIONS", sizeof(title));
else if (menu_type == MENU_SETTINGS_OVERLAY_OPTIONS)
strlcpy(title, "OVERLAY OPTIONS", sizeof(title));
else if (menu_type == MENU_SETTINGS_NETPLAY_OPTIONS)
strlcpy(title, "NETPLAY OPTIONS", sizeof(title));
else if (menu_type == MENU_SETTINGS_USER_OPTIONS)
strlcpy(title, "USER OPTIONS", sizeof(title));
else if (menu_type == MENU_SETTINGS_PATH_OPTIONS)
strlcpy(title, "PATH OPTIONS", sizeof(title));
else if (menu_type == MENU_SETTINGS_OPTIONS)
strlcpy(title, "SETTINGS", sizeof(title));
else if (menu_type == MENU_SETTINGS_DRIVERS)
strlcpy(title, "DRIVER OPTIONS", sizeof(title));
else if (menu_type == MENU_SETTINGS_PERFORMANCE_COUNTERS)
strlcpy(title, "PERFORMANCE COUNTERS", sizeof(title));
else if (menu_type == MENU_SETTINGS_PERFORMANCE_COUNTERS_LIBRETRO)
strlcpy(title, "CORE PERFORMANCE COUNTERS", sizeof(title));
else if (menu_type == MENU_SETTINGS_PERFORMANCE_COUNTERS_FRONTEND)
strlcpy(title, "FRONTEND PERFORMANCE COUNTERS", sizeof(title));
#ifdef HAVE_SHADER_MANAGER
else if (menu_type == MENU_SETTINGS_SHADER_OPTIONS)
strlcpy(title, "SHADER OPTIONS", sizeof(title));
#endif
else if (menu_type == MENU_SETTINGS_FONT_OPTIONS)
strlcpy(title, "FONT OPTIONS", sizeof(title));
else if (!strcmp(dir, "General Options"))
strlcpy(title, "GENERAL OPTIONS", sizeof(title));
else if (menu_type == MENU_SETTINGS_AUDIO_OPTIONS)
strlcpy(title, "AUDIO OPTIONS", sizeof(title));
else if (menu_type == MENU_SETTINGS_DISK_OPTIONS)
strlcpy(title, "DISK OPTIONS", sizeof(title));
else if (menu_type == MENU_SETTINGS_CORE_OPTIONS)
strlcpy(title, "CORE OPTIONS", sizeof(title));
else if (menu_type == MENU_SETTINGS_CORE_INFO)
strlcpy(title, "CORE INFO", sizeof(title));
else if (menu_type == MENU_SETTINGS_PRIVACY_OPTIONS)
strlcpy(title, "PRIVACY OPTIONS", sizeof(title));
#ifdef HAVE_SHADER_MANAGER
else if (menu_type_is == MENU_SETTINGS_SHADER_OPTIONS)
snprintf(title, sizeof(title), "SHADER %s", dir);
#endif
else if ((menu_type == MENU_SETTINGS_INPUT_OPTIONS) ||
(menu_type == MENU_SETTINGS_PATH_OPTIONS) ||
(menu_type == MENU_SETTINGS_OPTIONS) ||
(menu_type == MENU_SETTINGS_CUSTOM_VIEWPORT ||
!strcmp(label, "custom_viewport_2")) ||
menu_type == MENU_SETTINGS_CUSTOM_BIND ||
!strcmp(label, "help") ||
menu_type == MENU_SETTINGS)
snprintf(title, sizeof(title), "MENU %s", dir);
else if (menu_type == MENU_SETTINGS_OPEN_HISTORY)
strlcpy(title, "LOAD HISTORY", sizeof(title));
else if (!strcmp(label, "info_screen"))
strlcpy(title, "INFO", sizeof(title));
#ifdef HAVE_OVERLAY
else if (menu_type == MENU_SETTINGS_OVERLAY_PRESET)
snprintf(title, sizeof(title), "OVERLAY %s", dir);
#endif
else if (menu_type == MENU_SETTINGS_VIDEO_SOFTFILTER)
snprintf(title, sizeof(title), "FILTER %s", dir);
else if (menu_type == MENU_SETTINGS_AUDIO_DSP_FILTER)
snprintf(title, sizeof(title), "DSP FILTER %s", dir);
else if (menu_type == MENU_BROWSER_DIR_PATH)
snprintf(title, sizeof(title), "BROWSER DIR %s", dir);
else if (menu_type == MENU_CONTENT_DIR_PATH)
snprintf(title, sizeof(title), "CONTENT DIR %s", dir);
else if (menu_type == MENU_SCREENSHOT_DIR_PATH)
snprintf(title, sizeof(title), "SCREENSHOT DIR %s", dir);
else if (menu_type == MENU_AUTOCONFIG_DIR_PATH)
snprintf(title, sizeof(title), "AUTOCONFIG DIR %s", dir);
else if (menu_type == MENU_SHADER_DIR_PATH)
snprintf(title, sizeof(title), "SHADER DIR %s", dir);
else if (menu_type == MENU_FILTER_DIR_PATH)
snprintf(title, sizeof(title), "FILTER DIR %s", dir);
else if (menu_type == MENU_DSP_FILTER_DIR_PATH)
snprintf(title, sizeof(title), "DSP_FILTER DIR %s", dir);
else if (menu_type == MENU_SAVESTATE_DIR_PATH)
snprintf(title, sizeof(title), "SAVESTATE DIR %s", dir);
#ifdef HAVE_DYNAMIC
else if (menu_type == MENU_LIBRETRO_DIR_PATH)
snprintf(title, sizeof(title), "LIBRETRO DIR %s", dir);
#endif
else if (menu_type == MENU_CONFIG_DIR_PATH)
snprintf(title, sizeof(title), "CONFIG DIR %s", dir);
else if (menu_type == MENU_SAVEFILE_DIR_PATH)
snprintf(title, sizeof(title), "SAVEFILE DIR %s", dir);
#ifdef HAVE_OVERLAY
else if (menu_type == MENU_OVERLAY_DIR_PATH)
snprintf(title, sizeof(title), "OVERLAY DIR %s", dir);
#endif
else if (menu_type == MENU_SYSTEM_DIR_PATH)
snprintf(title, sizeof(title), "SYSTEM DIR %s", dir);
else if (menu_type == MENU_ASSETS_DIR_PATH)
snprintf(title, sizeof(title), "ASSETS DIR %s", dir);
else
{
if (driver.menu->defer_core)
snprintf(title, sizeof(title), "CONTENT %s", dir);
else
{
const char *core_name = driver.menu->info.library_name;
if (!core_name)
core_name = g_extern.system.info.library_name;
if (!core_name)
core_name = "No Core";
snprintf(title, sizeof(title), "CONTENT (%s) %s", core_name, dir);
}
}
get_title(label, dir, menu_type, menu_type_is,
title, sizeof(title));
mbstowcs(strw_buffer, title, sizeof(strw_buffer) / sizeof(wchar_t));
XuiTextElementSetText(m_menutitle, strw_buffer);
@ -563,10 +448,10 @@ static void rmenu_xui_render(void)
for (i = begin; i < end; i++/*, y += FONT_HEIGHT_STRIDE */)
{
const char *path = NULL;
const char *path = NULL;
const char *entry_label = NULL;
unsigned type = 0;
file_list_get_at_offset(driver.menu->selection_buf, i,
&path, &label, &type);
&path, &entry_label, &type);
char message[256];
char type_str[256];

133
frontend/menu/disp/shared.h Normal file

@ -0,0 +1,133 @@
#ifndef _DISP_SHARED_H
#define _DISP_SHARED_H
static void get_title(const char *label, const char *dir,
unsigned menu_type, unsigned menu_type_is,
char *title, size_t sizeof_title)
{
if (!strcmp(label, "core_list"))
snprintf(title, sizeof_title, "CORE SELECTION %s", dir);
else if (menu_type == MENU_SETTINGS_DEFERRED_CORE)
snprintf(title, sizeof_title, "DETECTED CORES %s", dir);
else if (menu_type == MENU_SETTINGS_CONFIG)
snprintf(title, sizeof_title, "CONFIG %s", dir);
else if (menu_type == MENU_SETTINGS_DISK_APPEND)
snprintf(title, sizeof_title, "DISK APPEND %s", dir);
else if (menu_type == MENU_SETTINGS_VIDEO_OPTIONS)
strlcpy(title, "VIDEO OPTIONS", sizeof_title);
else if (menu_type == MENU_SETTINGS_INPUT_OPTIONS ||
menu_type == MENU_SETTINGS_CUSTOM_BIND ||
menu_type == MENU_SETTINGS_CUSTOM_BIND_KEYBOARD)
strlcpy(title, "INPUT OPTIONS", sizeof_title);
else if (menu_type == MENU_SETTINGS_OVERLAY_OPTIONS)
strlcpy(title, "OVERLAY OPTIONS", sizeof_title);
else if (menu_type == MENU_SETTINGS_NETPLAY_OPTIONS)
strlcpy(title, "NETPLAY OPTIONS", sizeof_title);
else if (menu_type == MENU_SETTINGS_USER_OPTIONS)
strlcpy(title, "USER OPTIONS", sizeof_title);
else if (menu_type == MENU_SETTINGS_PATH_OPTIONS)
strlcpy(title, "PATH OPTIONS", sizeof_title);
else if (menu_type == MENU_SETTINGS_OPTIONS)
strlcpy(title, "SETTINGS", sizeof_title);
else if (menu_type == MENU_SETTINGS_DRIVERS)
strlcpy(title, "DRIVER OPTIONS", sizeof_title);
else if (menu_type == MENU_SETTINGS_PERFORMANCE_COUNTERS)
strlcpy(title, "PERFORMANCE COUNTERS", sizeof_title);
else if (menu_type == MENU_SETTINGS_PERFORMANCE_COUNTERS_LIBRETRO)
strlcpy(title, "CORE PERFORMANCE COUNTERS", sizeof_title);
else if (menu_type == MENU_SETTINGS_PERFORMANCE_COUNTERS_FRONTEND)
strlcpy(title, "FRONTEND PERFORMANCE COUNTERS", sizeof_title);
#ifdef HAVE_SHADER_MANAGER
else if (menu_type == MENU_SETTINGS_SHADER_OPTIONS)
strlcpy(title, "SHADER OPTIONS", sizeof_title);
else if (menu_type == MENU_SETTINGS_SHADER_PARAMETERS)
strlcpy(title, "SHADER PARAMETERS (CURRENT)", sizeof_title);
else if (menu_type == MENU_SETTINGS_SHADER_PRESET_PARAMETERS)
strlcpy(title, "SHADER PARAMETERS (MENU PRESET)", sizeof_title);
#endif
else if (menu_type == MENU_SETTINGS_FONT_OPTIONS)
strlcpy(title, "FONT OPTIONS", sizeof_title);
else if (!strcmp(dir, "General Options"))
strlcpy(title, "GENERAL OPTIONS", sizeof_title);
else if (menu_type == MENU_SETTINGS_AUDIO_OPTIONS)
strlcpy(title, "AUDIO OPTIONS", sizeof_title);
else if (menu_type == MENU_SETTINGS_DISK_OPTIONS)
strlcpy(title, "DISK OPTIONS", sizeof_title);
else if (menu_type == MENU_SETTINGS_CORE_OPTIONS)
strlcpy(title, "CORE OPTIONS", sizeof_title);
else if (!strcmp(label, "core_information"))
strlcpy(title, "CORE INFO", sizeof_title);
else if (menu_type == MENU_SETTINGS_PRIVACY_OPTIONS)
strlcpy(title, "PRIVACY OPTIONS", sizeof_title);
#ifdef HAVE_SHADER_MANAGER
else if (menu_type_is == MENU_SETTINGS_SHADER_OPTIONS)
snprintf(title, sizeof_title, "SHADER %s", dir);
#endif
else if (menu_type == MENU_SETTINGS_PATH_OPTIONS ||
menu_type == MENU_SETTINGS_OPTIONS ||
menu_type == MENU_SETTINGS_CUSTOM_VIEWPORT ||
!strcmp(label, "custom_viewport_2") ||
!strcmp(label, "help") ||
menu_type == MENU_SETTINGS)
snprintf(title, sizeof_title, "MENU %s", dir);
else if (!strcmp(label, "history_list"))
strlcpy(title, "LOAD HISTORY", sizeof_title);
else if (!strcmp(label, "info_screen"))
strlcpy(title, "INFO", sizeof_title);
#ifdef HAVE_OVERLAY
else if (menu_type == MENU_SETTINGS_OVERLAY_PRESET)
snprintf(title, sizeof_title, "OVERLAY %s", dir);
#endif
else if (menu_type == MENU_SETTINGS_VIDEO_SOFTFILTER)
snprintf(title, sizeof_title, "FILTER %s", dir);
else if (menu_type == MENU_SETTINGS_AUDIO_DSP_FILTER)
snprintf(title, sizeof_title, "DSP FILTER %s", dir);
else if (!strcmp(label, "rgui_browser_directory"))
snprintf(title, sizeof_title, "BROWSER DIR %s", dir);
else if (menu_type == MENU_CONTENT_DIR_PATH)
snprintf(title, sizeof_title, "CONTENT DIR %s", dir);
else if (menu_type == MENU_SCREENSHOT_DIR_PATH)
snprintf(title, sizeof_title, "SCREENSHOT DIR %s", dir);
else if (menu_type == MENU_AUTOCONFIG_DIR_PATH)
snprintf(title, sizeof_title, "AUTOCONFIG DIR %s", dir);
else if (menu_type == MENU_SHADER_DIR_PATH)
snprintf(title, sizeof_title, "SHADER DIR %s", dir);
else if (menu_type == MENU_FILTER_DIR_PATH)
snprintf(title, sizeof_title, "FILTER DIR %s", dir);
else if (menu_type == MENU_DSP_FILTER_DIR_PATH)
snprintf(title, sizeof_title, "DSP FILTER DIR %s", dir);
else if (menu_type == MENU_SAVESTATE_DIR_PATH)
snprintf(title, sizeof_title, "SAVESTATE DIR %s", dir);
#ifdef HAVE_DYNAMIC
else if (menu_type == MENU_LIBRETRO_DIR_PATH)
snprintf(title, sizeof_title, "LIBRETRO DIR %s", dir);
#endif
else if (menu_type == MENU_CONFIG_DIR_PATH)
snprintf(title, sizeof_title, "CONFIG DIR %s", dir);
else if (menu_type == MENU_SAVEFILE_DIR_PATH)
snprintf(title, sizeof_title, "SAVEFILE DIR %s", dir);
#ifdef HAVE_OVERLAY
else if (menu_type == MENU_OVERLAY_DIR_PATH)
snprintf(title, sizeof_title, "OVERLAY DIR %s", dir);
#endif
else if (menu_type == MENU_SYSTEM_DIR_PATH)
snprintf(title, sizeof_title, "SYSTEM DIR %s", dir);
else if (menu_type == MENU_ASSETS_DIR_PATH)
snprintf(title, sizeof_title, "ASSETS DIR %s", dir);
else
{
if (driver.menu->defer_core)
snprintf(title, sizeof_title, "CONTENT %s", dir);
else
{
const char *core_name = driver.menu->info.library_name;
if (!core_name)
core_name = g_extern.system.info.library_name;
if (!core_name)
core_name = "No Core";
snprintf(title, sizeof_title, "CONTENT (%s) %s", core_name, dir);
}
}
}
#endif