summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar lat9nq2021-05-25 21:39:57 -0400
committerGravatar lat9nq2021-05-25 21:39:57 -0400
commitbc38d4c81baba258ecef3a9ce9d76c4b6a4c5429 (patch)
treee2ca9cb0abeaaaceeb5c660d2f34c5059fd68b25
parentyuzu qt: Handle per-game configs for title id 0 (diff)
downloadyuzu-bc38d4c81baba258ecef3a9ce9d76c4b6a4c5429.tar.gz
yuzu-bc38d4c81baba258ecef3a9ce9d76c4b6a4c5429.tar.xz
yuzu-bc38d4c81baba258ecef3a9ce9d76c4b6a4c5429.zip
yuzu qt: Restore const qualifiers
This addresses review comments. Co-authored-by: LC <mathew1800@gmail.com>
-rw-r--r--src/yuzu/configuration/configure_per_game.cpp10
-rw-r--r--src/yuzu/main.cpp25
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 @@
30 30
31ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id, std::string_view file_name) 31ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id, std::string_view file_name)
32 : QDialog(parent), ui(std::make_unique<Ui::ConfigurePerGame>()), title_id(title_id) { 32 : QDialog(parent), ui(std::make_unique<Ui::ConfigurePerGame>()), title_id(title_id) {
33 if (title_id == 0) { 33 const auto config_file_name =
34 game_config = std::make_unique<Config>(Common::FS::GetFilename(file_name), 34 title_id == 0 ? Common::FS::GetFilename(file_name) : fmt::format("{:016X}", title_id);
35 Config::ConfigType::PerGameConfig); 35 game_config = std::make_unique<Config>(config_file_name, Config::ConfigType::PerGameConfig);
36 } else {
37 game_config = std::make_unique<Config>(fmt::format("{:016X}", title_id),
38 Config::ConfigType::PerGameConfig);
39 }
40 36
41 Settings::SetConfiguringGlobal(false); 37 Settings::SetConfiguringGlobal(false);
42 38
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) {
1334 1334
1335 if (!(loader == nullptr || loader->ReadProgramId(title_id) != Loader::ResultStatus::Success)) { 1335 if (!(loader == nullptr || loader->ReadProgramId(title_id) != Loader::ResultStatus::Success)) {
1336 // Load per game settings 1336 // Load per game settings
1337 if (title_id == 0) { 1337 const auto config_file_name = title_id == 0
1338 Config per_game_config(Common::FS::GetFilename(filename.toStdString()), 1338 ? Common::FS::GetFilename(filename.toStdString())
1339 Config::ConfigType::PerGameConfig); 1339 : fmt::format("{:016X}", title_id);
1340 } else { 1340 Config per_game_config(config_file_name, Config::ConfigType::PerGameConfig);
1341 Config per_game_config(fmt::format("{:016X}", title_id),
1342 Config::ConfigType::PerGameConfig);
1343 }
1344 } 1341 }
1345 1342
1346 ConfigureVibration::SetAllVibrationDevices(); 1343 ConfigureVibration::SetAllVibrationDevices();
@@ -1850,15 +1847,11 @@ void GMainWindow::RemoveTransferableShaderCache(u64 program_id) {
1850} 1847}
1851 1848
1852void GMainWindow::RemoveCustomConfiguration(u64 program_id, std::string_view game_path) { 1849void GMainWindow::RemoveCustomConfiguration(u64 program_id, std::string_view game_path) {
1853 std::string custom_config_file_path; 1850 const auto config_file_name = program_id == 0
1854 if (program_id == 0) { 1851 ? fmt::format("{:s}.ini", Common::FS::GetFilename(game_path))
1855 custom_config_file_path = Common::FS::GetYuzuPath(Common::FS::YuzuPath::ConfigDir) / 1852 : fmt::format("{:016X}.ini", program_id);
1856 "custom" / 1853 const auto custom_config_file_path =
1857 fmt::format("{:s}.ini", Common::FS::GetFilename(game_path)); 1854 Common::FS::GetYuzuPath(Common::FS::YuzuPath::ConfigDir) / "custom" / config_file_name;
1858 } else {
1859 custom_config_file_path = Common::FS::GetYuzuPath(Common::FS::YuzuPath::ConfigDir) /
1860 "custom" / fmt::format("{:016X}.ini", program_id);
1861 }
1862 1855
1863 if (!Common::FS::Exists(custom_config_file_path)) { 1856 if (!Common::FS::Exists(custom_config_file_path)) {
1864 QMessageBox::warning(this, tr("Error Removing Custom Configuration"), 1857 QMessageBox::warning(this, tr("Error Removing Custom Configuration"),