Get rid of more boilerplate code in file_path_special.c

This commit is contained in:
LibretroAdmin 2022-08-02 18:05:51 +02:00
parent 556e6702ef
commit 6dd52d9bb1
5 changed files with 31 additions and 40 deletions

View File

@ -164,13 +164,6 @@ void fill_pathname_application_special(char *s,
fill_pathname_basedir(s, path_get(RARCH_PATH_CONFIG), len);
}
break;
case APPLICATION_SPECIAL_DIRECTORY_ASSETS_PKG:
{
settings_t *settings = config_get_ptr();
const char *dir_assets = settings->paths.directory_assets;
fill_pathname_join(s, dir_assets, "pkg", len);
}
break;
case APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_ICONS:
#ifdef HAVE_XMB
{
@ -348,19 +341,19 @@ void fill_pathname_application_special(char *s,
{
case RETRO_LANGUAGE_ARABIC:
case RETRO_LANGUAGE_PERSIAN:
fill_pathname_application_special(s1, sizeof(s1),
APPLICATION_SPECIAL_DIRECTORY_ASSETS_PKG);
fill_pathname_join(s1,
settings->paths.directory_assets, "pkg", sizeof(s1));
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(s1,
settings->paths.directory_assets, "pkg", sizeof(s1));
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(s1,
settings->paths.directory_assets, "pkg", sizeof(s1));
fill_pathname_join(s, s1, "korean-fallback-font.ttf", len);
break;
default:

View File

@ -120,9 +120,6 @@ enum application_special_type
{
APPLICATION_SPECIAL_NONE = 0,
APPLICATION_SPECIAL_DIRECTORY_CONFIG,
APPLICATION_SPECIAL_DIRECTORY_ASSETS_PKG,
APPLICATION_SPECIAL_DIRECTORY_ASSETS_PKG_AR_FONT,
APPLICATION_SPECIAL_DIRECTORY_ASSETS_PKG_CJK_FONT,
APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB,
APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_BG,
APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_ICONS,

View File

@ -2054,9 +2054,9 @@ bool gfx_widgets_init(
"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);
fill_pathname_join(p_dispwidget->assets_pkg_dir,
settings->paths.directory_assets, "pkg",
sizeof(p_dispwidget->assets_pkg_dir));
p_dispwidget->inited = true;
}

View File

@ -7749,21 +7749,21 @@ static void materialui_init_font(
{
case RETRO_LANGUAGE_ARABIC:
case RETRO_LANGUAGE_PERSIAN:
fill_pathname_application_special(s1, sizeof(s1),
APPLICATION_SPECIAL_DIRECTORY_ASSETS_PKG);
fill_pathname_join(s1,
settings->paths.directory_assets, "pkg", sizeof(s1));
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(s1,
settings->paths.directory_assets, "pkg", sizeof(s1));
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(s1,
settings->paths.directory_assets, "pkg", sizeof(s1));
fill_pathname_join(fontpath, s1, "korean-fallback-font.ttf",
sizeof(fontpath));
break;

View File

@ -8057,10 +8057,11 @@ static void ozone_set_layout(
{
char s1[PATH_MAX_LENGTH];
char font_path[PATH_MAX_LENGTH];
bool font_inited = false;
float scale_factor = ozone->last_scale_factor;
settings_t *settings = config_get_ptr();
bool font_inited = false;
float scale_factor = ozone->last_scale_factor;
s1[0] = '\0';
s1[0] = '\0';
/* Calculate dimensions */
ozone->dimensions.header_height = HEADER_HEIGHT * scale_factor;
@ -8119,19 +8120,19 @@ static void ozone_set_layout(
{
case RETRO_LANGUAGE_ARABIC:
case RETRO_LANGUAGE_PERSIAN:
fill_pathname_application_special(s1, sizeof(s1),
APPLICATION_SPECIAL_DIRECTORY_ASSETS_PKG);
fill_pathname_join(s1,
settings->paths.directory_assets, "pkg", sizeof(s1));
fill_pathname_join(font_path, s1, "fallback-font.ttf", sizeof(font_path));
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(s1,
settings->paths.directory_assets, "pkg", sizeof(s1));
fill_pathname_join(font_path, s1, "chinese-fallback-font.ttf", sizeof(font_path));
break;
case RETRO_LANGUAGE_KOREAN:
fill_pathname_application_special(s1, sizeof(s1),
APPLICATION_SPECIAL_DIRECTORY_ASSETS_PKG);
fill_pathname_join(s1,
settings->paths.directory_assets, "pkg", sizeof(s1));
fill_pathname_join(font_path, s1, "korean-fallback-font.ttf", sizeof(font_path));
break;
default:
@ -8146,19 +8147,19 @@ static void ozone_set_layout(
{
case RETRO_LANGUAGE_ARABIC:
case RETRO_LANGUAGE_PERSIAN:
fill_pathname_application_special(s1, sizeof(s1),
APPLICATION_SPECIAL_DIRECTORY_ASSETS_PKG);
fill_pathname_join(s1,
settings->paths.directory_assets, "pkg", sizeof(s1));
fill_pathname_join(font_path, s1, "fallback-font.ttf", sizeof(font_path));
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(s1,
settings->paths.directory_assets, "pkg", sizeof(s1));
fill_pathname_join(font_path, s1, "chinese-fallback-font.ttf", sizeof(font_path));
break;
case RETRO_LANGUAGE_KOREAN:
fill_pathname_application_special(s1, sizeof(s1),
APPLICATION_SPECIAL_DIRECTORY_ASSETS_PKG);
fill_pathname_join(s1,
settings->paths.directory_assets, "pkg", sizeof(s1));
fill_pathname_join(font_path, s1, "korean-fallback-font.ttf", sizeof(font_path));
break;
default: