From 184fb62d661aaaa91ea1193be067f776225d57fd Mon Sep 17 00:00:00 2001 From: Stephen Miller <56742918+StevenMiller123@users.noreply.github.com> Date: Thu, 12 Feb 2026 19:43:43 -0600 Subject: [PATCH] Make fonts path configurable By user request. --- src/common/config.cpp | 14 ++++++++++++++ src/common/config.h | 2 ++ src/emulator.cpp | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/common/config.cpp b/src/common/config.cpp index 657943c95..a5eea0a64 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -147,6 +147,7 @@ static ConfigEntry isSideTrophy("right"); static ConfigEntry isConnectedToNetwork(false); static bool enableDiscordRPC = false; static std::filesystem::path sys_modules_path = {}; +static std::filesystem::path fonts_path = {}; // Input static ConfigEntry 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}; diff --git a/src/common/config.h b/src/common/config.h index 036d04c99..a9e0f7010 100644 --- a/src/common/config.h +++ b/src/common/config.h @@ -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(); diff --git a/src/emulator.cpp b/src/emulator.cpp index 4a1473abe..87ce82326 100644 --- a/src/emulator.cpp +++ b/src/emulator.cpp @@ -370,7 +370,7 @@ void Emulator::Run(std::filesystem::path file, std::vector 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); }