diff options
author | lat9nq <22451773+lat9nq@users.noreply.github.com> | 2021-05-26 03:39:57 +0200 |
---|---|---|
committer | lat9nq <22451773+lat9nq@users.noreply.github.com> | 2021-05-26 03:39:57 +0200 |
commit | bc38d4c81baba258ecef3a9ce9d76c4b6a4c5429 (patch) | |
tree | e2ca9cb0abeaaaceeb5c660d2f34c5059fd68b25 /src | |
parent | yuzu qt: Handle per-game configs for title id 0 (diff) | |
download | yuzu-bc38d4c81baba258ecef3a9ce9d76c4b6a4c5429.tar yuzu-bc38d4c81baba258ecef3a9ce9d76c4b6a4c5429.tar.gz yuzu-bc38d4c81baba258ecef3a9ce9d76c4b6a4c5429.tar.bz2 yuzu-bc38d4c81baba258ecef3a9ce9d76c4b6a4c5429.tar.lz yuzu-bc38d4c81baba258ecef3a9ce9d76c4b6a4c5429.tar.xz yuzu-bc38d4c81baba258ecef3a9ce9d76c4b6a4c5429.tar.zst yuzu-bc38d4c81baba258ecef3a9ce9d76c4b6a4c5429.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/yuzu/configuration/configure_per_game.cpp | 10 | ||||
-rw-r--r-- | src/yuzu/main.cpp | 25 |
2 files changed, 12 insertions, 23 deletions
diff --git a/src/yuzu/configuration/configure_per_game.cpp b/src/yuzu/configuration/configure_per_game.cpp index a7b7698f2..007d93c77 100644 --- a/src/yuzu/configuration/configure_per_game.cpp +++ b/src/yuzu/configuration/configure_per_game.cpp @@ -30,13 +30,9 @@ ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id, std::string_view file_name) : QDialog(parent), ui(std::make_unique<Ui::ConfigurePerGame>()), title_id(title_id) { - if (title_id == 0) { - game_config = std::make_unique<Config>(Common::FS::GetFilename(file_name), - Config::ConfigType::PerGameConfig); - } else { - game_config = std::make_unique<Config>(fmt::format("{:016X}", title_id), - Config::ConfigType::PerGameConfig); - } + const auto config_file_name = + title_id == 0 ? Common::FS::GetFilename(file_name) : fmt::format("{:016X}", title_id); + game_config = std::make_unique<Config>(config_file_name, Config::ConfigType::PerGameConfig); Settings::SetConfiguringGlobal(false); diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 8f04575f1..1d63ababb 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -1334,13 +1334,10 @@ void GMainWindow::BootGame(const QString& filename, std::size_t program_index) { if (!(loader == nullptr || loader->ReadProgramId(title_id) != Loader::ResultStatus::Success)) { // Load per game settings - if (title_id == 0) { - Config per_game_config(Common::FS::GetFilename(filename.toStdString()), - Config::ConfigType::PerGameConfig); - } else { - Config per_game_config(fmt::format("{:016X}", title_id), - Config::ConfigType::PerGameConfig); - } + const auto config_file_name = title_id == 0 + ? Common::FS::GetFilename(filename.toStdString()) + : fmt::format("{:016X}", title_id); + Config per_game_config(config_file_name, Config::ConfigType::PerGameConfig); } ConfigureVibration::SetAllVibrationDevices(); @@ -1850,15 +1847,11 @@ void GMainWindow::RemoveTransferableShaderCache(u64 program_id) { } void GMainWindow::RemoveCustomConfiguration(u64 program_id, std::string_view game_path) { - std::string custom_config_file_path; - if (program_id == 0) { - custom_config_file_path = Common::FS::GetYuzuPath(Common::FS::YuzuPath::ConfigDir) / - "custom" / - fmt::format("{:s}.ini", Common::FS::GetFilename(game_path)); - } else { - custom_config_file_path = Common::FS::GetYuzuPath(Common::FS::YuzuPath::ConfigDir) / - "custom" / fmt::format("{:016X}.ini", program_id); - } + const auto config_file_name = program_id == 0 + ? fmt::format("{:s}.ini", Common::FS::GetFilename(game_path)) + : fmt::format("{:016X}.ini", program_id); + const auto custom_config_file_path = + Common::FS::GetYuzuPath(Common::FS::YuzuPath::ConfigDir) / "custom" / config_file_name; if (!Common::FS::Exists(custom_config_file_path)) { QMessageBox::warning(this, tr("Error Removing Custom Configuration"), |