mirror of
https://github.com/libretro/RetroArch
synced 2025-04-01 04:20:27 +00:00
Refactor menu_entries_get_core_title
This commit is contained in:
parent
323a06f41f
commit
9925da95ae
@ -460,14 +460,10 @@ static void glui_frame(void)
|
||||
|
||||
glui_draw_scrollbar(gl);
|
||||
|
||||
if (settings->menu.core_enable)
|
||||
{
|
||||
menu_entries_get_core_title(title_msg, sizeof(title_msg));
|
||||
|
||||
if (menu_entries_get_core_title(title_msg, sizeof(title_msg)) == 0)
|
||||
glui_blit_line(glui->margin,
|
||||
height - glui->line_height, title_msg,
|
||||
title_color, TEXT_ALIGN_LEFT);
|
||||
}
|
||||
|
||||
if (settings->menu.timedate_enable)
|
||||
{
|
||||
|
@ -480,14 +480,11 @@ static void rgui_render(void)
|
||||
RGUI_TERM_START_X + (RGUI_TERM_WIDTH - strlen(title_buf)) * FONT_WIDTH_STRIDE / 2,
|
||||
RGUI_TERM_START_X, title_buf, TITLE_COLOR(settings));
|
||||
|
||||
if (settings->menu.core_enable)
|
||||
{
|
||||
menu_entries_get_core_title(title_msg, sizeof(title_msg));
|
||||
if (menu_entries_get_core_title(title_msg, sizeof(title_msg)) == 0)
|
||||
blit_line(menu,
|
||||
RGUI_TERM_START_X,
|
||||
(RGUI_TERM_HEIGHT * FONT_HEIGHT_STRIDE) +
|
||||
RGUI_TERM_START_Y + 2, title_msg, hover_color);
|
||||
}
|
||||
|
||||
if (settings->menu.timedate_enable)
|
||||
{
|
||||
|
@ -158,9 +158,11 @@ HRESULT CRetroArchMain::OnInit(XUIMessageInit * pInitData, BOOL& bHandled)
|
||||
{
|
||||
char str[PATH_MAX_LENGTH] = {0};
|
||||
|
||||
menu_entries_get_core_title(str, sizeof(str));
|
||||
mbstowcs(strw_buffer, str, sizeof(strw_buffer) / sizeof(wchar_t));
|
||||
XuiTextElementSetText(m_menutitlebottom, strw_buffer);
|
||||
if (menu_entries_get_core_title(str, sizeof(str)) == 0)
|
||||
{
|
||||
mbstowcs(strw_buffer, str, sizeof(strw_buffer) / sizeof(wchar_t));
|
||||
XuiTextElementSetText(m_menutitlebottom, strw_buffer);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -565,10 +567,11 @@ static void rmenu_xui_render(void)
|
||||
|
||||
if (XuiHandleIsValid(m_menutitle))
|
||||
{
|
||||
menu_entries_get_core_title(title, sizeof(title));
|
||||
|
||||
mbstowcs(strw_buffer, title, sizeof(strw_buffer) / sizeof(wchar_t));
|
||||
XuiTextElementSetText(m_menutitlebottom, strw_buffer);
|
||||
if (menu_entries_get_core_title(title, sizeof(title)) == 0)
|
||||
{
|
||||
mbstowcs(strw_buffer, title, sizeof(strw_buffer) / sizeof(wchar_t));
|
||||
XuiTextElementSetText(m_menutitlebottom, strw_buffer);
|
||||
}
|
||||
}
|
||||
|
||||
end = menu_entries_get_end();
|
||||
|
@ -1618,12 +1618,9 @@ static void xmb_frame(void)
|
||||
xmb->margins.title.top, 1, 1, TEXT_ALIGN_RIGHT);
|
||||
}
|
||||
|
||||
if (settings->menu.core_enable)
|
||||
{
|
||||
menu_entries_get_core_title(title_msg, sizeof(title_msg));
|
||||
if (menu_entries_get_core_title(title_msg, sizeof(title_msg)) == 0)
|
||||
xmb_draw_text(menu, xmb, title_msg, xmb->margins.title.left,
|
||||
height - xmb->margins.title.bottom, 1, 1, TEXT_ALIGN_LEFT);
|
||||
}
|
||||
|
||||
depth = xmb_list_get_size(menu, MENU_LIST_PLAIN);
|
||||
|
||||
|
@ -131,13 +131,23 @@ bool menu_entries_show_back(void)
|
||||
|
||||
/* Sets 's' to the name of the current core
|
||||
* (shown at the top of the UI). */
|
||||
void menu_entries_get_core_title(char *s, size_t len)
|
||||
int menu_entries_get_core_title(char *s, size_t len)
|
||||
{
|
||||
const char *core_name = NULL;
|
||||
const char *core_version = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
const char *core_name = global ? global->menu.info.library_name : NULL;
|
||||
const char *core_version = global ? global->menu.info.library_version : NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
rarch_system_info_t *info = rarch_system_info_get_ptr();
|
||||
|
||||
if (!settings->menu.core_enable)
|
||||
return -1;
|
||||
|
||||
if (global)
|
||||
{
|
||||
core_name = global->menu.info.library_name;
|
||||
core_version = global->menu.info.library_version;
|
||||
}
|
||||
|
||||
if (!core_name || core_name[0] == '\0')
|
||||
core_name = info->info.library_name;
|
||||
if (!core_name || core_name[0] == '\0')
|
||||
@ -150,6 +160,8 @@ void menu_entries_get_core_title(char *s, size_t len)
|
||||
|
||||
snprintf(s, len, "%s - %s %s", PACKAGE_VERSION,
|
||||
core_name, core_version);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool menu_entries_get_nonblocking_refresh(void)
|
||||
|
@ -52,7 +52,7 @@ int menu_entries_get_title(char *title, size_t title_len);
|
||||
|
||||
bool menu_entries_show_back(void);
|
||||
|
||||
void menu_entries_get_core_title(char *title_msg, size_t title_msg_len);
|
||||
int menu_entries_get_core_title(char *title_msg, size_t title_msg_len);
|
||||
|
||||
menu_entries_t *menu_entries_get_ptr(void);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user