diff --git a/src/common/config.cpp b/src/common/config.cpp index 930bae897..3c6590563 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -145,12 +145,6 @@ static ConfigEntry> userNames({ static ConfigEntry useUnifiedInputConfig(true); -// Debug -static ConfigEntry showFpsCounter(false); - -// Settings -ConfigEntry m_language(1); // english - // Keys static string trophyKey = ""; @@ -209,22 +203,6 @@ std::string getUserName(int id) { return userNames.get()[id]; } -bool getShowFpsCounter() { - return showFpsCounter.get(); -} - -void setShowFpsCounter(bool enable, bool is_game_specific) { - showFpsCounter.set(enable, is_game_specific); -} - -void setLanguage(u32 language, bool is_game_specific) { - m_language.set(language, is_game_specific); -} - -u32 GetLanguage() { - return m_language.get(); -} - void load(const std::filesystem::path& path, bool is_game_specific) { // If the configuration file does not exist, create it and return, unless it is game specific std::error_code error; @@ -260,15 +238,9 @@ void load(const std::filesystem::path& path, bool is_game_specific) { string current_version = {}; if (data.contains("Debug")) { const toml::value& debug = data.at("Debug"); - showFpsCounter.setFromToml(debug, "showFpsCounter", is_game_specific); current_version = toml::find_or(debug, "ConfigVersion", current_version); } - if (data.contains("Settings")) { - const toml::value& settings = data.at("Settings"); - m_language.setFromToml(settings, "consoleLanguage", is_game_specific); - } - if (data.contains("Keys")) { const toml::value& keys = data.at("Keys"); trophyKey = toml::find_or(keys, "TrophyKey", trophyKey); @@ -335,8 +307,6 @@ void save(const std::filesystem::path& path, bool is_game_specific) { // Entries saved by the game-specific settings GUI userNames.setTomlValue(data, "General", "userNames", is_game_specific); - m_language.setTomlValue(data, "Settings", "consoleLanguage", is_game_specific); - if (!is_game_specific) { // Non game-specific entries data["Debug"]["ConfigVersion"] = config_version; @@ -344,7 +314,6 @@ void save(const std::filesystem::path& path, bool is_game_specific) { // Do not save these entries in the game-specific dialog since they are not in the GUI data["Input"]["useUnifiedInputConfig"] = useUnifiedInputConfig.base_value; - data["Debug"]["showFpsCounter"] = showFpsCounter.base_value; } // Sorting of TOML sections @@ -364,9 +333,6 @@ void setDefaultValues(bool is_game_specific) { // GS - General userNames.setDefault(is_game_specific); - // GS - Settings - m_language.setDefault(is_game_specific); - // All other entries if (!is_game_specific) { // Input @@ -374,9 +340,6 @@ void setDefaultValues(bool is_game_specific) { controllerCustomColorRGB[0] = 0; controllerCustomColorRGB[1] = 0; controllerCustomColorRGB[2] = 255; - - // Debug - showFpsCounter.base_value = false; } } diff --git a/src/common/config.h b/src/common/config.h index e124eca56..262ab4f9d 100644 --- a/src/common/config.h +++ b/src/common/config.h @@ -26,10 +26,6 @@ void save(const std::filesystem::path& path, bool is_game_specific = false); std::string getTrophyKey(); void setTrophyKey(std::string key); -u32 GetLanguage(); -void setLanguage(u32 language, bool is_game_specific = false); -bool getShowFpsCounter(); -void setShowFpsCounter(bool enable, bool is_game_specific = false); void setUserName(const std::string& name, bool is_game_specific = false); // TODO diff --git a/src/core/devtools/layer.cpp b/src/core/devtools/layer.cpp index d599e9cf0..f0ce2355d 100644 --- a/src/core/devtools/layer.cpp +++ b/src/core/devtools/layer.cpp @@ -309,7 +309,7 @@ static void LoadSettings(const char* line) { void L::SetupSettings() { frame_graph.is_open = true; - show_simple_fps = Config::getShowFpsCounter(); + show_simple_fps = EmulatorSettings::GetInstance()->IsShowFpsCounter(); using SettingLoader = void (*)(const char*); diff --git a/src/core/emulator_settings.h b/src/core/emulator_settings.h index 250e171ff..d778dc28d 100644 --- a/src/core/emulator_settings.h +++ b/src/core/emulator_settings.h @@ -94,6 +94,8 @@ struct GeneralSettings { Setting show_splash{false}; Setting connected_to_network{false}; Setting discord_rpc_enabled{false}; + Setting show_fps_counter{false}; + Setting console_language{1}; // return a vector of override descriptors (runtime, but tiny) std::vector GetOverrideableFields() const { @@ -122,7 +124,7 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(GeneralSettings, install_dirs, addon_install_ extra_dmem_in_mbytes, psn_signed_in, trophy_popup_disabled, trophy_notification_duration, log_filter, log_type, show_splash, trophy_notification_side, connected_to_network, - discord_rpc_enabled) + discord_rpc_enabled, show_fps_counter, console_language) // ------------------------------- // Debug settings @@ -131,8 +133,7 @@ struct DebugSettings { Setting separate_logging_enabled{false}; // specific Setting debug_dump{false}; // specific Setting shader_collect{false}; // specific - Setting fps_color{true}; - Setting log_enabled{true}; // specific + Setting log_enabled{true}; // specific std::vector GetOverrideableFields() const { return std::vector{ @@ -144,7 +145,7 @@ struct DebugSettings { } }; NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(DebugSettings, separate_logging_enabled, debug_dump, - shader_collect, fps_color, log_enabled) + shader_collect, log_enabled) // ------------------------------- // Input settings @@ -397,6 +398,8 @@ public: SETTING_FORWARD(m_general, LogType, log_type) SETTING_FORWARD_BOOL(m_general, ConnectedToNetwork, connected_to_network) SETTING_FORWARD_BOOL(m_general, DiscordRPCEnabled, discord_rpc_enabled) + SETTING_FORWARD_BOOL(m_general, ShowFpsCounter, show_fps_counter) + SETTING_FORWARD(m_general, ConsoleLanguage, console_language) // Audio settings SETTING_FORWARD(m_audio, MicDevice, mic_device) diff --git a/src/core/libraries/save_data/save_instance.cpp b/src/core/libraries/save_data/save_instance.cpp index c64b9c4e5..0b80a5b55 100644 --- a/src/core/libraries/save_data/save_instance.cpp +++ b/src/core/libraries/save_data/save_instance.cpp @@ -74,7 +74,7 @@ fs::path SaveInstance::GetParamSFOPath(const fs::path& dir_path) { void SaveInstance::SetupDefaultParamSFO(PSF& param_sfo, std::string dir_name, std::string game_serial) { - int locale = Config::GetLanguage(); + int locale = EmulatorSettings::GetInstance()->GetConsoleLanguage(); if (!default_title.contains(locale)) { locale = 1; // default to en_US if not found } diff --git a/src/core/libraries/system/systemservice.cpp b/src/core/libraries/system/systemservice.cpp index 8e35d045d..0701dfe23 100644 --- a/src/core/libraries/system/systemservice.cpp +++ b/src/core/libraries/system/systemservice.cpp @@ -1919,7 +1919,7 @@ s32 PS4_SYSV_ABI sceSystemServiceParamGetInt(OrbisSystemServiceParamId param_id, } switch (param_id) { case OrbisSystemServiceParamId::Lang: - *value = Config::GetLanguage(); + *value = EmulatorSettings::GetInstance()->GetConsoleLanguage(); break; case OrbisSystemServiceParamId::DateFormat: *value = u32(OrbisSystemParamDateFormat::FmtDDMMYYYY); diff --git a/src/main.cpp b/src/main.cpp index 34ed6333b..ff1306753 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -190,7 +190,7 @@ int main(int argc, char* argv[]) { } waitPid = std::stoi(argv[i]); }}, - {"--show-fps", [&](int& i) { Config::setShowFpsCounter(true); }}}; + {"--show-fps", [&](int& i) { EmulatorSettings::GetInstance()->SetShowFpsCounter(true); }}}; if (argc == 1) { if (!SDL_ShowSimpleMessageBox(