Start downscaling on file_path_special.c

This commit is contained in:
LibretroAdmin 2022-08-02 17:54:38 +02:00
parent 70ca20fbf9
commit 556e6702ef
3 changed files with 55 additions and 104 deletions

View File

@ -151,14 +151,6 @@ void fill_pathname_application_special(char *s,
{ {
switch (type) switch (type)
{ {
case APPLICATION_SPECIAL_DIRECTORY_AUTOCONFIG:
{
settings_t *settings = config_get_ptr();
const char *dir_autoconfig = settings->paths.directory_autoconfig;
const char *joypad_driver = settings->arrays.input_joypad_driver;
fill_pathname_join(s, dir_autoconfig, joypad_driver, len);
}
break;
case APPLICATION_SPECIAL_DIRECTORY_CONFIG: case APPLICATION_SPECIAL_DIRECTORY_CONFIG:
{ {
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
@ -234,16 +226,17 @@ void fill_pathname_application_special(char *s,
} }
else if (string_is_equal(menu_ident, "glui")) else if (string_is_equal(menu_ident, "glui"))
{ {
fill_pathname_application_special(s1, sizeof(s1), const char *dir_assets = settings->paths.directory_assets;
APPLICATION_SPECIAL_DIRECTORY_ASSETS_MATERIALUI); fill_pathname_join(s1, dir_assets, "glui", sizeof(s1));
if (!string_is_empty(s1)) if (!string_is_empty(s1))
strlcat(s1, "/sounds", sizeof(s1)); strlcat(s1, "/sounds", sizeof(s1));
} }
else if (string_is_equal(menu_ident, "ozone")) else if (string_is_equal(menu_ident, "ozone"))
{ {
fill_pathname_application_special(s1, sizeof(s1), const char *dir_assets = settings->paths.directory_assets;
APPLICATION_SPECIAL_DIRECTORY_ASSETS_OZONE); fill_pathname_join(s1, dir_assets, "ozone",
sizeof(s1));
if (!string_is_empty(s1)) if (!string_is_empty(s1))
strlcat(s1, "/sounds", sizeof(s1)); strlcat(s1, "/sounds", sizeof(s1));
@ -264,32 +257,16 @@ void fill_pathname_application_special(char *s,
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
const char *menu_ident = settings->arrays.menu_driver; const char *menu_ident = settings->arrays.menu_driver;
if (string_is_equal(menu_ident, "xmb")) if (string_is_equal(menu_ident, "xmb"))
fill_pathname_application_special(s, len, APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_ICONS); fill_pathname_application_special(s, len, APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_ICONS);
else if (string_is_equal(menu_ident, "glui")) else if ( string_is_equal(menu_ident, "ozone")
{ || string_is_equal(menu_ident, "glui"))
/* Type APPLICATION_SPECIAL_DIRECTORY_ASSETS_MATERIALUI_ICONS
* contains no core system icons so we use the icon directory
* from ozone here */
fill_pathname_application_special(s, len, APPLICATION_SPECIAL_DIRECTORY_ASSETS_OZONE_ICONS);
}
else if (string_is_equal(menu_ident, "ozone"))
fill_pathname_application_special(s, len, APPLICATION_SPECIAL_DIRECTORY_ASSETS_OZONE_ICONS); fill_pathname_application_special(s, len, APPLICATION_SPECIAL_DIRECTORY_ASSETS_OZONE_ICONS);
else if (len) else if (len)
s[0] = '\0'; s[0] = '\0';
#endif #endif
} }
break;
case APPLICATION_SPECIAL_DIRECTORY_ASSETS_OZONE:
#ifdef HAVE_OZONE
{
settings_t *settings = config_get_ptr();
const char *dir_assets = settings->paths.directory_assets;
fill_pathname_join(s, dir_assets, "ozone",
len);
}
#endif
break; break;
case APPLICATION_SPECIAL_DIRECTORY_ASSETS_OZONE_ICONS: case APPLICATION_SPECIAL_DIRECTORY_ASSETS_OZONE_ICONS:
#ifdef HAVE_OZONE #ifdef HAVE_OZONE
@ -337,10 +314,8 @@ void fill_pathname_application_special(char *s,
char rgui_dir[PATH_MAX_LENGTH]; char rgui_dir[PATH_MAX_LENGTH];
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
const char *dir_assets = settings->paths.directory_assets; const char *dir_assets = settings->paths.directory_assets;
fill_pathname_join(rgui_dir, dir_assets, "rgui", fill_pathname_join(rgui_dir, dir_assets, "rgui", sizeof(rgui_dir));
sizeof(rgui_dir)); fill_pathname_join(s, rgui_dir, "font", len);
fill_pathname_join(s,
rgui_dir, "font", len);
} }
#endif #endif
break; break;
@ -352,57 +327,7 @@ void fill_pathname_application_special(char *s,
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
const char *dir_assets = settings->paths.directory_assets; const char *dir_assets = settings->paths.directory_assets;
fill_pathname_join(s1, dir_assets, "xmb", sizeof(s1)); fill_pathname_join(s1, dir_assets, "xmb", sizeof(s1));
fill_pathname_join(s, fill_pathname_join(s, s1, xmb_theme_ident(), len);
s1, xmb_theme_ident(), len);
}
#endif
break;
case APPLICATION_SPECIAL_DIRECTORY_ASSETS_MATERIALUI:
#ifdef HAVE_MATERIALUI
{
settings_t *settings = config_get_ptr();
const char *dir_assets = settings->paths.directory_assets;
fill_pathname_join(s, dir_assets, "glui", len);
}
#endif
break;
case APPLICATION_SPECIAL_DIRECTORY_ASSETS_MATERIALUI_ICONS:
#ifdef HAVE_MATERIALUI
fill_pathname_application_special(s, len,
APPLICATION_SPECIAL_DIRECTORY_ASSETS_MATERIALUI);
#endif
break;
case APPLICATION_SPECIAL_DIRECTORY_ASSETS_MATERIALUI_FONT:
#ifdef HAVE_MATERIALUI
{
char s1[PATH_MAX_LENGTH];
s1[0] = '\0';
switch (*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE))
{
case RETRO_LANGUAGE_ARABIC:
case RETRO_LANGUAGE_PERSIAN:
fill_pathname_application_special(s1, sizeof(s1),
APPLICATION_SPECIAL_DIRECTORY_ASSETS_PKG);
fill_pathname_join(s, s1, "fallback-font.ttf", len);
break;
case RETRO_LANGUAGE_CHINESE_SIMPLIFIED:
case RETRO_LANGUAGE_CHINESE_TRADITIONAL:
fill_pathname_application_special(s1, sizeof(s1),
APPLICATION_SPECIAL_DIRECTORY_ASSETS_PKG);
fill_pathname_join(s, s1, "chinese-fallback-font.ttf", len);
break;
case RETRO_LANGUAGE_KOREAN:
fill_pathname_application_special(s1, sizeof(s1),
APPLICATION_SPECIAL_DIRECTORY_ASSETS_PKG);
fill_pathname_join(s, s1, "korean-fallback-font.ttf", len);
break;
default:
fill_pathname_application_special(s1, sizeof(s1),
APPLICATION_SPECIAL_DIRECTORY_ASSETS_MATERIALUI);
fill_pathname_join(s, s1, FILE_PATH_TTF_FONT, len);
}
} }
#endif #endif
break; break;

View File

@ -119,19 +119,14 @@ RETRO_BEGIN_DECLS
enum application_special_type enum application_special_type
{ {
APPLICATION_SPECIAL_NONE = 0, APPLICATION_SPECIAL_NONE = 0,
APPLICATION_SPECIAL_DIRECTORY_AUTOCONFIG,
APPLICATION_SPECIAL_DIRECTORY_CONFIG, APPLICATION_SPECIAL_DIRECTORY_CONFIG,
APPLICATION_SPECIAL_DIRECTORY_ASSETS_PKG, APPLICATION_SPECIAL_DIRECTORY_ASSETS_PKG,
APPLICATION_SPECIAL_DIRECTORY_ASSETS_PKG_AR_FONT, APPLICATION_SPECIAL_DIRECTORY_ASSETS_PKG_AR_FONT,
APPLICATION_SPECIAL_DIRECTORY_ASSETS_PKG_CJK_FONT, APPLICATION_SPECIAL_DIRECTORY_ASSETS_PKG_CJK_FONT,
APPLICATION_SPECIAL_DIRECTORY_ASSETS_MATERIALUI,
APPLICATION_SPECIAL_DIRECTORY_ASSETS_MATERIALUI_FONT,
APPLICATION_SPECIAL_DIRECTORY_ASSETS_MATERIALUI_ICONS,
APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB, APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB,
APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_BG, APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_BG,
APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_ICONS, APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_ICONS,
APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_FONT, APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_FONT,
APPLICATION_SPECIAL_DIRECTORY_ASSETS_OZONE,
APPLICATION_SPECIAL_DIRECTORY_ASSETS_OZONE_ICONS, APPLICATION_SPECIAL_DIRECTORY_ASSETS_OZONE_ICONS,
APPLICATION_SPECIAL_DIRECTORY_ASSETS_RGUI_FONT, APPLICATION_SPECIAL_DIRECTORY_ASSETS_RGUI_FONT,
APPLICATION_SPECIAL_DIRECTORY_ASSETS_SOUNDS, APPLICATION_SPECIAL_DIRECTORY_ASSETS_SOUNDS,

View File

@ -7729,6 +7729,8 @@ static void materialui_init_font(
{ {
char fontpath[PATH_MAX_LENGTH]; char fontpath[PATH_MAX_LENGTH];
const char *wideglyph_str = msg_hash_get_wideglyph_str(); const char *wideglyph_str = msg_hash_get_wideglyph_str();
settings_t *settings = config_get_ptr();
const char *dir_assets = settings->paths.directory_assets;
fontpath[0] = '\0'; fontpath[0] = '\0';
/* We assume the average glyph aspect ratio is close to 3:4 */ /* We assume the average glyph aspect ratio is close to 3:4 */
@ -7739,8 +7741,40 @@ static void materialui_init_font(
gfx_display_font_free(font_data->font); gfx_display_font_free(font_data->font);
font_data->font = NULL; font_data->font = NULL;
} }
fill_pathname_application_special( {
fontpath, sizeof(fontpath), APPLICATION_SPECIAL_DIRECTORY_ASSETS_MATERIALUI_FONT); char s1[PATH_MAX_LENGTH];
s1[0] = '\0';
switch (*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE))
{
case RETRO_LANGUAGE_ARABIC:
case RETRO_LANGUAGE_PERSIAN:
fill_pathname_application_special(s1, sizeof(s1),
APPLICATION_SPECIAL_DIRECTORY_ASSETS_PKG);
fill_pathname_join(fontpath, s1, "fallback-font.ttf",
sizeof(fontpath));
break;
case RETRO_LANGUAGE_CHINESE_SIMPLIFIED:
case RETRO_LANGUAGE_CHINESE_TRADITIONAL:
fill_pathname_application_special(s1, sizeof(s1),
APPLICATION_SPECIAL_DIRECTORY_ASSETS_PKG);
fill_pathname_join(fontpath, s1, "chinese-fallback-font.ttf",
sizeof(fontpath));
break;
case RETRO_LANGUAGE_KOREAN:
fill_pathname_application_special(s1, sizeof(s1),
APPLICATION_SPECIAL_DIRECTORY_ASSETS_PKG);
fill_pathname_join(fontpath, s1, "korean-fallback-font.ttf",
sizeof(fontpath));
break;
default:
fill_pathname_join(s1, dir_assets, "glui", sizeof(s1));
fill_pathname_join(fontpath, s1, FILE_PATH_TTF_FONT,
sizeof(fontpath));
break;
}
}
font_data->font = gfx_display_font_file(p_disp, font_data->font = gfx_display_font_file(p_disp,
fontpath, font_size, video_is_threaded); fontpath, font_size, video_is_threaded);
@ -7926,6 +7960,7 @@ static void *materialui_init(void **userdata, bool video_is_threaded)
gfx_display_t *p_disp = disp_get_ptr(); gfx_display_t *p_disp = disp_get_ptr();
menu_handle_t *menu = (menu_handle_t*) menu_handle_t *menu = (menu_handle_t*)
calloc(1, sizeof(*menu)); calloc(1, sizeof(*menu));
const char *dir_assets = NULL;
if (!menu) if (!menu)
return NULL; return NULL;
@ -7936,17 +7971,15 @@ static void *materialui_init(void **userdata, bool video_is_threaded)
return NULL; return NULL;
} }
mui = (materialui_handle_t*) dir_assets = settings->paths.directory_assets;
calloc(1, sizeof(materialui_handle_t));
if (!mui) if (!(mui = (materialui_handle_t*)calloc(1, sizeof(materialui_handle_t))))
goto error; goto error;
*userdata = mui; *userdata = mui;
/* Initialise thumbnail path data */ /* Initialise thumbnail path data */
mui->thumbnail_path_data = gfx_thumbnail_path_init(); if (!(mui->thumbnail_path_data = gfx_thumbnail_path_init()))
if (!mui->thumbnail_path_data)
goto error; goto error;
/* Get DPI/screen-size-aware base unit size for /* Get DPI/screen-size-aware base unit size for
@ -7986,8 +8019,7 @@ static void *materialui_init(void **userdata, bool video_is_threaded)
materialui_prepare_colors(mui, (enum materialui_color_theme)mui->color_theme); materialui_prepare_colors(mui, (enum materialui_color_theme)mui->color_theme);
/* Initialise screensaver */ /* Initialise screensaver */
mui->screensaver = menu_screensaver_init(); if (!(mui->screensaver = menu_screensaver_init()))
if (!mui->screensaver)
goto error; goto error;
/* Initial ticker configuration */ /* Initial ticker configuration */
@ -8052,14 +8084,13 @@ static void *materialui_init(void **userdata, bool video_is_threaded)
fill_pathname_application_special(mui->sysicons_path, fill_pathname_application_special(mui->sysicons_path,
sizeof(mui->sysicons_path), sizeof(mui->sysicons_path),
APPLICATION_SPECIAL_DIRECTORY_ASSETS_OZONE_ICONS); APPLICATION_SPECIAL_DIRECTORY_ASSETS_OZONE_ICONS);
fill_pathname_application_special(mui->icons_path, fill_pathname_join(mui->icons_path, dir_assets, "glui",
sizeof(mui->icons_path), sizeof(mui->icons_path));
APPLICATION_SPECIAL_DIRECTORY_ASSETS_MATERIALUI);
p_anim->updatetime_cb = materialui_menu_animation_update_time; p_anim->updatetime_cb = materialui_menu_animation_update_time;
/* set word_wrap function pointer */ /* set word_wrap function pointer */
mui->word_wrap = msg_hash_get_wideglyph_str() ? word_wrap_wideglyph : word_wrap; mui->word_wrap = msg_hash_get_wideglyph_str() ? word_wrap_wideglyph : word_wrap;
return menu; return menu;
error: error: