more settings

This commit is contained in:
georgemoralis 2026-01-09 20:59:46 +02:00
parent 251a6e29e8
commit 2e8c24aea9
7 changed files with 11 additions and 49 deletions

View File

@ -145,12 +145,6 @@ static ConfigEntry<std::array<std::string, 4>> userNames({
static ConfigEntry<bool> useUnifiedInputConfig(true);
// Debug
static ConfigEntry<bool> showFpsCounter(false);
// Settings
ConfigEntry<u32> 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<std::string>(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<string>(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;
}
}

View File

@ -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

View File

@ -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*);

View File

@ -94,6 +94,8 @@ struct GeneralSettings {
Setting<bool> show_splash{false};
Setting<bool> connected_to_network{false};
Setting<bool> discord_rpc_enabled{false};
Setting<bool> show_fps_counter{false};
Setting<int> console_language{1};
// return a vector of override descriptors (runtime, but tiny)
std::vector<OverrideItem> 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<bool> separate_logging_enabled{false}; // specific
Setting<bool> debug_dump{false}; // specific
Setting<bool> shader_collect{false}; // specific
Setting<bool> fps_color{true};
Setting<bool> log_enabled{true}; // specific
Setting<bool> log_enabled{true}; // specific
std::vector<OverrideItem> GetOverrideableFields() const {
return std::vector<OverrideItem>{
@ -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)

View File

@ -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
}

View File

@ -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);

View File

@ -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(