Make fonts path configurable

By user request.
This commit is contained in:
Stephen Miller 2026-02-12 19:43:43 -06:00
parent 1c620dafbc
commit 184fb62d66
3 changed files with 17 additions and 1 deletions

View File

@ -147,6 +147,7 @@ static ConfigEntry<string> isSideTrophy("right");
static ConfigEntry<bool> isConnectedToNetwork(false);
static bool enableDiscordRPC = false;
static std::filesystem::path sys_modules_path = {};
static std::filesystem::path fonts_path = {};
// Input
static ConfigEntry<int> cursorState(HideCursorState::Idle);
@ -237,6 +238,17 @@ void setSysModulesPath(const std::filesystem::path& path) {
sys_modules_path = path;
}
std::filesystem::path getFontsPath() {
if (fonts_path.empty()) {
return Common::FS::GetUserPath(Common::FS::PathType::FontsDir);
}
return fonts_path;
}
void setFontsPath(const std::filesystem::path& path) {
fonts_path = path;
}
int getVolumeSlider() {
return volumeSlider.get();
}
@ -888,6 +900,7 @@ void load(const std::filesystem::path& path, bool is_game_specific) {
isConnectedToNetwork.setFromToml(general, "isConnectedToNetwork", is_game_specific);
defaultControllerID.setFromToml(general, "defaultControllerID", is_game_specific);
sys_modules_path = toml::find_fs_path_or(general, "sysModulesPath", sys_modules_path);
fonts_path = toml::find_fs_path_or(general, "fontsPath", fonts_path);
}
if (data.contains("Input")) {
@ -1161,6 +1174,7 @@ void save(const std::filesystem::path& path, bool is_game_specific) {
// Non game-specific entries
data["General"]["enableDiscordRPC"] = enableDiscordRPC;
data["General"]["sysModulesPath"] = string{fmt::UTF(sys_modules_path.u8string()).data};
data["General"]["fontsPath"] = string{fmt::UTF(fonts_path.u8string()).data};
data["GUI"]["installDirs"] = install_dirs;
data["GUI"]["installDirsEnabled"] = install_dirs_enabled;
data["GUI"]["saveDataPath"] = string{fmt::UTF(save_data_path.u8string()).data};

View File

@ -153,6 +153,8 @@ 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 getFontsPath();
void setFontsPath(const std::filesystem::path& path);
enum UsbBackendType : int { Real, SkylandersPortal, InfinityBase, DimensionsToypad };
int getUsbDeviceBackend();

View File

@ -370,7 +370,7 @@ void Emulator::Run(std::filesystem::path file, std::vector<std::string> args,
VideoCore::SetOutputDir(mount_captures_dir, id);
// Mount system fonts
const auto& fonts_dir = Common::FS::GetUserPath(Common::FS::PathType::FontsDir);
const auto& fonts_dir = Config::getFontsPath();
if (!std::filesystem::exists(fonts_dir)) {
std::filesystem::create_directory(fonts_dir);
}