mirror of
https://github.com/libretro/RetroArch.git
synced 2024-12-03 13:51:02 +00:00
(gfx_widgets) Call fill_pathname_application_special outside of hot functions
(gfx widgets) Pre-assemble and store paths that are not subject to change
This commit is contained in:
parent
cd04f770b9
commit
f472e4d0de
@ -795,44 +795,33 @@ static void gfx_widgets_layout(
|
||||
/* Initialise fonts */
|
||||
if (string_is_empty(font_path))
|
||||
{
|
||||
char ozone_path[PATH_MAX_LENGTH];
|
||||
char font_file[PATH_MAX_LENGTH];
|
||||
/* Base path */
|
||||
fill_pathname_join(ozone_path, dir_assets, "ozone", sizeof(ozone_path));
|
||||
/* Create regular font */
|
||||
fill_pathname_join(font_file, ozone_path, "regular.ttf", sizeof(font_file));
|
||||
gfx_widgets_font_init(p_disp, p_dispwidget,
|
||||
&p_dispwidget->gfx_widget_fonts.regular,
|
||||
is_threaded, font_file, BASE_FONT_SIZE);
|
||||
|
||||
is_threaded, p_dispwidget->ozone_regular_font_path, BASE_FONT_SIZE);
|
||||
/* Create bold font */
|
||||
fill_pathname_join(font_file, ozone_path, "bold.ttf", sizeof(font_file));
|
||||
gfx_widgets_font_init(p_disp, p_dispwidget,
|
||||
&p_dispwidget->gfx_widget_fonts.bold,
|
||||
is_threaded, font_file, BASE_FONT_SIZE);
|
||||
is_threaded, p_dispwidget->ozone_bold_font_path, BASE_FONT_SIZE);
|
||||
|
||||
/* Create msg_queue font */
|
||||
switch (*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE))
|
||||
{
|
||||
case RETRO_LANGUAGE_ARABIC:
|
||||
case RETRO_LANGUAGE_PERSIAN:
|
||||
fill_pathname_application_special(font_file, sizeof(font_file),
|
||||
APPLICATION_SPECIAL_DIRECTORY_ASSETS_PKG);
|
||||
fill_pathname_join(font_file, font_file, "fallback-font.ttf", sizeof(font_file));
|
||||
fill_pathname_join(font_file, p_dispwidget->assets_pkg_dir, "fallback-font.ttf", sizeof(font_file));
|
||||
break;
|
||||
case RETRO_LANGUAGE_CHINESE_SIMPLIFIED:
|
||||
case RETRO_LANGUAGE_CHINESE_TRADITIONAL:
|
||||
fill_pathname_application_special(font_file, sizeof(font_file),
|
||||
APPLICATION_SPECIAL_DIRECTORY_ASSETS_PKG);
|
||||
fill_pathname_join(font_file, font_file, "chinese-fallback-font.ttf", sizeof(font_file));
|
||||
fill_pathname_join(font_file, p_dispwidget->assets_pkg_dir, "chinese-fallback-font.ttf", sizeof(font_file));
|
||||
break;
|
||||
case RETRO_LANGUAGE_KOREAN:
|
||||
fill_pathname_application_special(font_file, sizeof(font_file),
|
||||
APPLICATION_SPECIAL_DIRECTORY_ASSETS_PKG);
|
||||
fill_pathname_join(font_file, font_file, "korean-fallback-font.ttf", sizeof(font_file));
|
||||
fill_pathname_join(font_file, p_dispwidget->assets_pkg_dir, "korean-fallback-font.ttf", sizeof(font_file));
|
||||
break;
|
||||
default:
|
||||
fill_pathname_join(font_file, ozone_path, "regular.ttf", sizeof(font_file));
|
||||
strlcpy(font_file, p_dispwidget->ozone_regular_font_path, sizeof(font_file));
|
||||
break;
|
||||
}
|
||||
gfx_widgets_font_init(p_disp, p_dispwidget,
|
||||
&p_dispwidget->gfx_widget_fonts.msg_queue,
|
||||
@ -1890,34 +1879,6 @@ static void gfx_widgets_context_reset(
|
||||
const char *dir_assets, char *font_path)
|
||||
{
|
||||
size_t i;
|
||||
char xmb_path[PATH_MAX_LENGTH];
|
||||
char monochrome_png_path[PATH_MAX_LENGTH];
|
||||
char gfx_widgets_path[PATH_MAX_LENGTH];
|
||||
char theme_path[PATH_MAX_LENGTH];
|
||||
fill_pathname_join(
|
||||
gfx_widgets_path,
|
||||
dir_assets,
|
||||
"menu_widgets",
|
||||
sizeof(gfx_widgets_path)
|
||||
);
|
||||
fill_pathname_join(
|
||||
xmb_path,
|
||||
dir_assets,
|
||||
"xmb",
|
||||
sizeof(xmb_path)
|
||||
);
|
||||
fill_pathname_join(
|
||||
theme_path,
|
||||
xmb_path,
|
||||
"monochrome",
|
||||
sizeof(theme_path)
|
||||
);
|
||||
fill_pathname_join(
|
||||
monochrome_png_path,
|
||||
theme_path,
|
||||
"png",
|
||||
sizeof(monochrome_png_path)
|
||||
);
|
||||
|
||||
/* Load textures */
|
||||
/* Icons */
|
||||
@ -1925,7 +1886,7 @@ static void gfx_widgets_context_reset(
|
||||
{
|
||||
gfx_display_reset_textures_list(
|
||||
gfx_widgets_icons_names[i],
|
||||
monochrome_png_path,
|
||||
p_dispwidget->monochrome_png_path,
|
||||
&p_dispwidget->gfx_widgets_icons_textures[i],
|
||||
TEXTURE_FILTER_MIPMAP_LINEAR,
|
||||
NULL,
|
||||
@ -1935,21 +1896,21 @@ static void gfx_widgets_context_reset(
|
||||
/* Message queue */
|
||||
gfx_display_reset_textures_list(
|
||||
"msg_queue_icon.png",
|
||||
gfx_widgets_path,
|
||||
p_dispwidget->gfx_widgets_path,
|
||||
&p_dispwidget->msg_queue_icon,
|
||||
TEXTURE_FILTER_LINEAR,
|
||||
NULL,
|
||||
NULL);
|
||||
gfx_display_reset_textures_list(
|
||||
"msg_queue_icon_outline.png",
|
||||
gfx_widgets_path,
|
||||
p_dispwidget->gfx_widgets_path,
|
||||
&p_dispwidget->msg_queue_icon_outline,
|
||||
TEXTURE_FILTER_LINEAR,
|
||||
NULL,
|
||||
NULL);
|
||||
gfx_display_reset_textures_list(
|
||||
"msg_queue_icon_rect.png",
|
||||
gfx_widgets_path,
|
||||
p_dispwidget->gfx_widgets_path,
|
||||
&p_dispwidget->msg_queue_icon_rect,
|
||||
TEXTURE_FILTER_NEAREST,
|
||||
NULL,
|
||||
@ -1967,7 +1928,8 @@ static void gfx_widgets_context_reset(
|
||||
if (widget->context_reset)
|
||||
widget->context_reset(is_threaded, width, height,
|
||||
fullscreen, dir_assets, font_path,
|
||||
monochrome_png_path, gfx_widgets_path);
|
||||
p_dispwidget->monochrome_png_path,
|
||||
p_dispwidget->gfx_widgets_path);
|
||||
}
|
||||
|
||||
/* Update scaling/dimensions */
|
||||
@ -2035,6 +1997,7 @@ bool gfx_widgets_init(
|
||||
|
||||
if (!p_dispwidget->inited)
|
||||
{
|
||||
char theme_path[PATH_MAX_LENGTH];
|
||||
p_dispwidget->gfx_widgets_frame_count = 0;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(widgets); i++)
|
||||
@ -2056,6 +2019,45 @@ bool gfx_widgets_init(
|
||||
p_dispwidget->current_msgs_lock = slock_new();
|
||||
#endif
|
||||
|
||||
fill_pathname_join(
|
||||
p_dispwidget->gfx_widgets_path,
|
||||
dir_assets,
|
||||
"menu_widgets",
|
||||
sizeof(p_dispwidget->gfx_widgets_path)
|
||||
);
|
||||
fill_pathname_join(
|
||||
p_dispwidget->xmb_path,
|
||||
dir_assets,
|
||||
"xmb",
|
||||
sizeof(p_dispwidget->xmb_path)
|
||||
);
|
||||
/* Base path */
|
||||
fill_pathname_join(p_dispwidget->ozone_path,
|
||||
dir_assets,
|
||||
"ozone",
|
||||
sizeof(p_dispwidget->ozone_path));
|
||||
fill_pathname_join(p_dispwidget->ozone_regular_font_path,
|
||||
p_dispwidget->ozone_path, "regular.ttf",
|
||||
sizeof(p_dispwidget->ozone_regular_font_path));
|
||||
fill_pathname_join(p_dispwidget->ozone_bold_font_path,
|
||||
p_dispwidget->ozone_path, "bold.ttf",
|
||||
sizeof(p_dispwidget->ozone_bold_font_path));
|
||||
fill_pathname_join(
|
||||
theme_path,
|
||||
p_dispwidget->xmb_path,
|
||||
"monochrome",
|
||||
sizeof(theme_path)
|
||||
);
|
||||
fill_pathname_join(
|
||||
p_dispwidget->monochrome_png_path,
|
||||
theme_path,
|
||||
"png",
|
||||
sizeof(p_dispwidget->monochrome_png_path)
|
||||
);
|
||||
fill_pathname_application_special(
|
||||
p_dispwidget->assets_pkg_dir, sizeof(p_dispwidget->assets_pkg_dir),
|
||||
APPLICATION_SPECIAL_DIRECTORY_ASSETS_PKG);
|
||||
|
||||
p_dispwidget->inited = true;
|
||||
}
|
||||
|
||||
|
@ -215,6 +215,14 @@ typedef struct dispgfx_widget
|
||||
unsigned ai_service_overlay_height;
|
||||
#endif
|
||||
|
||||
char assets_pkg_dir[PATH_MAX_LENGTH];
|
||||
char xmb_path[PATH_MAX_LENGTH]; /* TODO/FIXME - decouple from XMB */
|
||||
char ozone_path[PATH_MAX_LENGTH]; /* TODO/FIXME - decouple from Ozone */
|
||||
char ozone_regular_font_path[PATH_MAX_LENGTH]; /* TODO/FIXME - decouple from Ozone */
|
||||
char ozone_bold_font_path[PATH_MAX_LENGTH]; /* TODO/FIXME - decouple from Ozone */
|
||||
|
||||
char monochrome_png_path[PATH_MAX_LENGTH];
|
||||
char gfx_widgets_path[PATH_MAX_LENGTH];
|
||||
char gfx_widgets_status_text[255];
|
||||
|
||||
/* There can only be one message animation at a time to
|
||||
|
@ -563,6 +563,7 @@ struct ozone_handle
|
||||
char assets_path[PATH_MAX_LENGTH];
|
||||
char png_path[PATH_MAX_LENGTH];
|
||||
char icons_path[PATH_MAX_LENGTH];
|
||||
char icons_path_default[PATH_MAX_LENGTH];
|
||||
char tab_path[PATH_MAX_LENGTH];
|
||||
char fullscreen_thumbnail_label[255];
|
||||
|
||||
@ -4445,14 +4446,10 @@ static ozone_node_t *ozone_alloc_node(void)
|
||||
static void ozone_context_reset_horizontal_list(ozone_handle_t *ozone)
|
||||
{
|
||||
unsigned i;
|
||||
char icons_path_default[PATH_MAX_LENGTH];
|
||||
size_t list_size = ozone_list_get_size(ozone, MENU_LIST_HORIZONTAL);
|
||||
|
||||
RHMAP_FREE(ozone->playlist_db_node_map);
|
||||
|
||||
fill_pathname_join(icons_path_default, ozone->icons_path,
|
||||
"default", sizeof(icons_path_default));
|
||||
|
||||
for (i = 0; i < list_size; i++)
|
||||
{
|
||||
const char *path = NULL;
|
||||
@ -4516,7 +4513,7 @@ static void ozone_context_reset_horizontal_list(ozone_handle_t *ozone)
|
||||
|
||||
/* If the content icon doesn't exist, return default-content */
|
||||
if (!path_is_valid(content_texturepath))
|
||||
fill_pathname_join_delim(content_texturepath, icons_path_default,
|
||||
fill_pathname_join_delim(content_texturepath, ozone->icons_path_default,
|
||||
"content.png", '-', sizeof(content_texturepath));
|
||||
|
||||
if (image_texture_load(&ti, content_texturepath))
|
||||
@ -7845,6 +7842,8 @@ static void *ozone_init(void **userdata, bool video_is_threaded)
|
||||
fill_pathname_application_special(ozone->icons_path,
|
||||
sizeof(ozone->icons_path),
|
||||
APPLICATION_SPECIAL_DIRECTORY_ASSETS_OZONE_ICONS);
|
||||
fill_pathname_join(ozone->icons_path_default, ozone->icons_path,
|
||||
"default", sizeof(ozone->icons_path_default));
|
||||
|
||||
ozone_last_use_preferred_system_color_theme = settings->bools.menu_use_preferred_system_color_theme;
|
||||
p_anim->updatetime_cb = ozone_menu_animation_update_time;
|
||||
|
Loading…
Reference in New Issue
Block a user