mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-04-29 15:33:35 -06:00
Add system font path management functions and refactor font directory retrieval
This commit is contained in:
parent
e3d401cf37
commit
a6484150bf
@ -4,6 +4,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <filesystem>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
#include "types.h"
|
||||
|
||||
@ -153,6 +156,13 @@ void setConnectedToNetwork(bool enable, bool is_game_specific = false);
|
||||
void setUserName(const std::string& name, bool is_game_specific = false);
|
||||
std::filesystem::path getSysModulesPath();
|
||||
void setSysModulesPath(const std::filesystem::path& path);
|
||||
std::filesystem::path getSysFontPath();
|
||||
void setSysFontPath(const std::filesystem::path& path);
|
||||
std::optional<std::filesystem::path> getSystemFontOverride(std::string_view key);
|
||||
std::string getSystemFontFallbackName();
|
||||
void setSystemFontFallbackName(const std::string& name);
|
||||
void setSystemFontOverride(std::string_view key, const std::filesystem::path& path);
|
||||
void clearSystemFontOverrides();
|
||||
|
||||
enum UsbBackendType : int { Real, SkylandersPortal, InfinityBase, DimensionsToypad };
|
||||
int getUsbDeviceBackend();
|
||||
|
||||
@ -10,7 +10,6 @@
|
||||
#include FT_OUTLINE_H
|
||||
#include FT_TRUETYPE_TABLES_H
|
||||
|
||||
#include "core/emulator_settings.h"
|
||||
#include "core/libraries/font/fontft_internal.h"
|
||||
|
||||
namespace Libraries::Font::Internal {
|
||||
@ -1560,7 +1559,7 @@ static std::optional<std::filesystem::path> FindChildDirContainingFile(
|
||||
}
|
||||
|
||||
std::filesystem::path GetSysFontBaseDir() {
|
||||
std::filesystem::path base = EmulatorSettings::GetInstance()->GetSysFontsDir();
|
||||
std::filesystem::path base = Config::getSysFontPath();
|
||||
std::error_code ec;
|
||||
if (base.empty()) {
|
||||
LOG_ERROR(Lib_Font, "SystemFonts: SysFontPath not set");
|
||||
@ -1572,9 +1571,11 @@ std::filesystem::path GetSysFontBaseDir() {
|
||||
}
|
||||
|
||||
{
|
||||
const auto preferred = base / "font";
|
||||
if (DirectoryContainsAnyFontFiles(preferred)) {
|
||||
return preferred;
|
||||
const auto font_dir = base / "font";
|
||||
const auto font2_dir = base / "font2";
|
||||
if (DirectoryContainsAnyFontFiles(font_dir) ||
|
||||
DirectoryContainsAnyFontFiles(font2_dir)) {
|
||||
return base;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1993,7 +1994,7 @@ std::string ReportSystemFaceRequest(FontState& st, Libraries::Font::OrbisFontHan
|
||||
}
|
||||
if (!st.system_requested) {
|
||||
st.system_requested = true;
|
||||
const auto configured = EmulatorSettings::GetInstance()->GetSysFontsDir();
|
||||
const auto configured = Config::getSysFontPath();
|
||||
return fmt::format("SystemFace: handle={} requested internal font but sysFontPath ('{}') "
|
||||
"could not be loaded",
|
||||
static_cast<const void*>(handle), configured.string());
|
||||
|
||||
Loading…
Reference in New Issue
Block a user