diff options
author | Narr the Reg <juangerman-13@hotmail.com> | 2024-01-16 21:27:25 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-16 21:27:25 -0600 |
commit | 46c24352351be663bbbf7fff3ce328f86f09c9f6 (patch) | |
tree | f0d5328966edfc791d6febef348c3a84ed1cb77d /src/yuzu | |
parent | 2c29c2b8dd280d0aeff432569f324cd85d83b415 (diff) | |
parent | 63b835f822e5167aa529f2c27c5df136defef6eb (diff) |
Merge pull request #12380 from flodavid/save-profile
Save configuration profile name used by players
Diffstat (limited to 'src/yuzu')
-rw-r--r-- | src/yuzu/configuration/configure_input_player.cpp | 16 | ||||
-rw-r--r-- | src/yuzu/configuration/input_profiles.cpp | 3 | ||||
-rw-r--r-- | src/yuzu/configuration/qt_config.cpp | 7 |
3 files changed, 23 insertions, 3 deletions
diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp index 5dac9f1e7..400917f9d 100644 --- a/src/yuzu/configuration/configure_input_player.cpp +++ b/src/yuzu/configuration/configure_input_player.cpp @@ -1650,9 +1650,21 @@ void ConfigureInputPlayer::SaveProfile() { void ConfigureInputPlayer::UpdateInputProfiles() { ui->comboProfiles->clear(); - for (const auto& profile_name : profiles->GetInputProfileNames()) { + // Set current profile as empty by default + int profile_index = -1; + + // Add every available profile and search the player profile to set it as current one + auto& current_profile = Settings::values.players.GetValue()[player_index].profile_name; + std::vector<std::string> profile_names = profiles->GetInputProfileNames(); + std::string profile_name; + for (size_t i = 0; i < profile_names.size(); i++) { + profile_name = profile_names[i]; ui->comboProfiles->addItem(QString::fromStdString(profile_name)); + if (current_profile == profile_name) { + profile_index = (int)i; + } } - ui->comboProfiles->setCurrentIndex(-1); + LOG_DEBUG(Frontend, "Setting the current input profile to index {}", profile_index); + ui->comboProfiles->setCurrentIndex(profile_index); } diff --git a/src/yuzu/configuration/input_profiles.cpp b/src/yuzu/configuration/input_profiles.cpp index 716efbccd..ebebadc94 100644 --- a/src/yuzu/configuration/input_profiles.cpp +++ b/src/yuzu/configuration/input_profiles.cpp @@ -5,6 +5,7 @@ #include "common/fs/fs.h" #include "common/fs/path_util.h" +#include "common/logging/log.h" #include "frontend_common/config.h" #include "yuzu/configuration/input_profiles.h" @@ -113,6 +114,8 @@ bool InputProfiles::LoadProfile(const std::string& profile_name, std::size_t pla return false; } + LOG_INFO(Config, "Loading input profile `{}`", profile_name); + map_profiles[profile_name]->ReadQtControlPlayerValues(player_index); return true; } diff --git a/src/yuzu/configuration/qt_config.cpp b/src/yuzu/configuration/qt_config.cpp index 6aca71d7c..1051031f2 100644 --- a/src/yuzu/configuration/qt_config.cpp +++ b/src/yuzu/configuration/qt_config.cpp @@ -1,6 +1,7 @@ // SPDX-FileCopyrightText: 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later +#include "common/logging/log.h" #include "input_common/main.h" #include "qt_config.h" #include "uisettings.h" @@ -65,7 +66,7 @@ void QtConfig::ReloadAllValues() { } void QtConfig::SaveAllValues() { - Save(); + SaveValues(); SaveQtValues(); } @@ -327,7 +328,10 @@ void QtConfig::ReadMultiplayerValues() { void QtConfig::SaveQtValues() { if (global) { + LOG_DEBUG(Config, "Saving global Qt configuration values"); SaveUIValues(); + } else { + LOG_DEBUG(Config, "Saving Qt configuration values"); } SaveQtControlValues(); @@ -545,6 +549,7 @@ void QtConfig::ReadQtControlPlayerValues(std::size_t player_index) { void QtConfig::SaveQtControlPlayerValues(std::size_t player_index) { BeginGroup(Settings::TranslateCategory(Settings::Category::Controls)); + LOG_DEBUG(Config, "Saving players control configuration values"); SavePlayerValues(player_index); SaveQtPlayerValues(player_index); |