diff options
| -rw-r--r-- | src/yuzu/configuration/config.cpp | 4 | ||||
| -rw-r--r-- | src/yuzu/configuration/config.h | 4 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_per_game.cpp | 9 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_per_game.h | 3 | ||||
| -rw-r--r-- | src/yuzu/game_list.cpp | 8 | ||||
| -rw-r--r-- | src/yuzu/game_list.h | 3 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 21 | ||||
| -rw-r--r-- | src/yuzu/main.h | 5 |
8 files changed, 35 insertions, 22 deletions
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index eb58bfa5b..552454acf 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp | |||
| @@ -16,7 +16,7 @@ | |||
| 16 | 16 | ||
| 17 | namespace FS = Common::FS; | 17 | namespace FS = Common::FS; |
| 18 | 18 | ||
| 19 | Config::Config(const std::string& config_name, ConfigType config_type) : type(config_type) { | 19 | Config::Config(std::string_view config_name, ConfigType config_type) : type(config_type) { |
| 20 | global = config_type == ConfigType::GlobalConfig; | 20 | global = config_type == ConfigType::GlobalConfig; |
| 21 | 21 | ||
| 22 | Initialize(config_name); | 22 | Initialize(config_name); |
| @@ -242,7 +242,7 @@ const std::array<UISettings::Shortcut, 17> Config::default_hotkeys{{ | |||
| 242 | }}; | 242 | }}; |
| 243 | // clang-format on | 243 | // clang-format on |
| 244 | 244 | ||
| 245 | void Config::Initialize(const std::string& config_name) { | 245 | void Config::Initialize(std::string_view config_name) { |
| 246 | const auto fs_config_loc = FS::GetYuzuPath(FS::YuzuPath::ConfigDir); | 246 | const auto fs_config_loc = FS::GetYuzuPath(FS::YuzuPath::ConfigDir); |
| 247 | const auto config_file = fmt::format("{}.ini", config_name); | 247 | const auto config_file = fmt::format("{}.ini", config_name); |
| 248 | 248 | ||
diff --git a/src/yuzu/configuration/config.h b/src/yuzu/configuration/config.h index ce3355588..114a2eaa7 100644 --- a/src/yuzu/configuration/config.h +++ b/src/yuzu/configuration/config.h | |||
| @@ -22,7 +22,7 @@ public: | |||
| 22 | InputProfile, | 22 | InputProfile, |
| 23 | }; | 23 | }; |
| 24 | 24 | ||
| 25 | explicit Config(const std::string& config_name = "qt-config", | 25 | explicit Config(std::string_view config_name = "qt-config", |
| 26 | ConfigType config_type = ConfigType::GlobalConfig); | 26 | ConfigType config_type = ConfigType::GlobalConfig); |
| 27 | ~Config(); | 27 | ~Config(); |
| 28 | 28 | ||
| @@ -45,7 +45,7 @@ public: | |||
| 45 | static const std::array<UISettings::Shortcut, 17> default_hotkeys; | 45 | static const std::array<UISettings::Shortcut, 17> default_hotkeys; |
| 46 | 46 | ||
| 47 | private: | 47 | private: |
| 48 | void Initialize(const std::string& config_name); | 48 | void Initialize(std::string_view config_name); |
| 49 | 49 | ||
| 50 | void ReadValues(); | 50 | void ReadValues(); |
| 51 | void ReadPlayerValue(std::size_t player_index); | 51 | void ReadPlayerValue(std::size_t player_index); |
diff --git a/src/yuzu/configuration/configure_per_game.cpp b/src/yuzu/configuration/configure_per_game.cpp index d89f1ad4b..7dfcf150c 100644 --- a/src/yuzu/configuration/configure_per_game.cpp +++ b/src/yuzu/configuration/configure_per_game.cpp | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | #include <algorithm> | 5 | #include <algorithm> |
| 6 | #include <memory> | 6 | #include <memory> |
| 7 | #include <string> | ||
| 7 | #include <utility> | 8 | #include <utility> |
| 8 | 9 | ||
| 9 | #include <QAbstractButton> | 10 | #include <QAbstractButton> |
| @@ -17,6 +18,7 @@ | |||
| 17 | #include <QTimer> | 18 | #include <QTimer> |
| 18 | #include <QTreeView> | 19 | #include <QTreeView> |
| 19 | 20 | ||
| 21 | #include "common/fs/path_util.h" | ||
| 20 | #include "core/core.h" | 22 | #include "core/core.h" |
| 21 | #include "core/file_sys/control_metadata.h" | 23 | #include "core/file_sys/control_metadata.h" |
| 22 | #include "core/file_sys/patch_manager.h" | 24 | #include "core/file_sys/patch_manager.h" |
| @@ -29,10 +31,11 @@ | |||
| 29 | #include "yuzu/uisettings.h" | 31 | #include "yuzu/uisettings.h" |
| 30 | #include "yuzu/util/util.h" | 32 | #include "yuzu/util/util.h" |
| 31 | 33 | ||
| 32 | ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id) | 34 | ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id, std::string_view file_name) |
| 33 | : QDialog(parent), ui(std::make_unique<Ui::ConfigurePerGame>()), title_id(title_id) { | 35 | : QDialog(parent), ui(std::make_unique<Ui::ConfigurePerGame>()), title_id(title_id) { |
| 34 | game_config = std::make_unique<Config>(fmt::format("{:016X}", title_id), | 36 | const auto config_file_name = |
| 35 | Config::ConfigType::PerGameConfig); | 37 | title_id == 0 ? Common::FS::GetFilename(file_name) : fmt::format("{:016X}", title_id); |
| 38 | game_config = std::make_unique<Config>(config_file_name, Config::ConfigType::PerGameConfig); | ||
| 36 | 39 | ||
| 37 | Settings::SetConfiguringGlobal(false); | 40 | Settings::SetConfiguringGlobal(false); |
| 38 | 41 | ||
diff --git a/src/yuzu/configuration/configure_per_game.h b/src/yuzu/configuration/configure_per_game.h index f6e6ab7c4..dc6b68763 100644 --- a/src/yuzu/configuration/configure_per_game.h +++ b/src/yuzu/configuration/configure_per_game.h | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <memory> | 7 | #include <memory> |
| 8 | #include <string> | ||
| 8 | #include <vector> | 9 | #include <vector> |
| 9 | 10 | ||
| 10 | #include <QDialog> | 11 | #include <QDialog> |
| @@ -27,7 +28,7 @@ class ConfigurePerGame : public QDialog { | |||
| 27 | Q_OBJECT | 28 | Q_OBJECT |
| 28 | 29 | ||
| 29 | public: | 30 | public: |
| 30 | explicit ConfigurePerGame(QWidget* parent, u64 title_id); | 31 | explicit ConfigurePerGame(QWidget* parent, u64 title_id, std::string_view file_name); |
| 31 | ~ConfigurePerGame() override; | 32 | ~ConfigurePerGame() override; |
| 32 | 33 | ||
| 33 | /// Save all button configurations to settings file | 34 | /// Save all button configurations to settings file |
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp index 63cf82f7d..aa3bd5e34 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp | |||
| @@ -561,11 +561,11 @@ void GameList::AddGamePopup(QMenu& context_menu, u64 program_id, const std::stri | |||
| 561 | connect(remove_dlc, &QAction::triggered, [this, program_id]() { | 561 | connect(remove_dlc, &QAction::triggered, [this, program_id]() { |
| 562 | emit RemoveInstalledEntryRequested(program_id, InstalledEntryType::AddOnContent); | 562 | emit RemoveInstalledEntryRequested(program_id, InstalledEntryType::AddOnContent); |
| 563 | }); | 563 | }); |
| 564 | connect(remove_shader_cache, &QAction::triggered, [this, program_id]() { | 564 | connect(remove_shader_cache, &QAction::triggered, [this, program_id, path]() { |
| 565 | emit RemoveFileRequested(program_id, GameListRemoveTarget::ShaderCache); | 565 | emit RemoveFileRequested(program_id, GameListRemoveTarget::ShaderCache, path); |
| 566 | }); | 566 | }); |
| 567 | connect(remove_custom_config, &QAction::triggered, [this, program_id]() { | 567 | connect(remove_custom_config, &QAction::triggered, [this, program_id, path]() { |
| 568 | emit RemoveFileRequested(program_id, GameListRemoveTarget::CustomConfiguration); | 568 | emit RemoveFileRequested(program_id, GameListRemoveTarget::CustomConfiguration, path); |
| 569 | }); | 569 | }); |
| 570 | connect(dump_romfs, &QAction::triggered, | 570 | connect(dump_romfs, &QAction::triggered, |
| 571 | [this, program_id, path]() { emit DumpRomFSRequested(program_id, path); }); | 571 | [this, program_id, path]() { emit DumpRomFSRequested(program_id, path); }); |
diff --git a/src/yuzu/game_list.h b/src/yuzu/game_list.h index 9c0a1a482..2867f6653 100644 --- a/src/yuzu/game_list.h +++ b/src/yuzu/game_list.h | |||
| @@ -88,7 +88,8 @@ signals: | |||
| 88 | const std::string& game_path); | 88 | const std::string& game_path); |
| 89 | void OpenTransferableShaderCacheRequested(u64 program_id); | 89 | void OpenTransferableShaderCacheRequested(u64 program_id); |
| 90 | void RemoveInstalledEntryRequested(u64 program_id, InstalledEntryType type); | 90 | void RemoveInstalledEntryRequested(u64 program_id, InstalledEntryType type); |
| 91 | void RemoveFileRequested(u64 program_id, GameListRemoveTarget target); | 91 | void RemoveFileRequested(u64 program_id, GameListRemoveTarget target, |
| 92 | std::string_view game_path); | ||
| 92 | void DumpRomFSRequested(u64 program_id, const std::string& game_path); | 93 | void DumpRomFSRequested(u64 program_id, const std::string& game_path); |
| 93 | void CopyTIDRequested(u64 program_id); | 94 | void CopyTIDRequested(u64 program_id); |
| 94 | void NavigateToGamedbEntryRequested(u64 program_id, | 95 | void NavigateToGamedbEntryRequested(u64 program_id, |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 0f0e228b0..dd8dd3233 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -1334,7 +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 | Config per_game_config(fmt::format("{:016X}", title_id), Config::ConfigType::PerGameConfig); | 1337 | const auto config_file_name = title_id == 0 |
| 1338 | ? Common::FS::GetFilename(filename.toStdString()) | ||
| 1339 | : fmt::format("{:016X}", title_id); | ||
| 1340 | Config per_game_config(config_file_name, Config::ConfigType::PerGameConfig); | ||
| 1338 | } | 1341 | } |
| 1339 | 1342 | ||
| 1340 | ConfigureVibration::SetAllVibrationDevices(); | 1343 | ConfigureVibration::SetAllVibrationDevices(); |
| @@ -1795,7 +1798,8 @@ void GMainWindow::RemoveAddOnContent(u64 program_id, const QString& entry_type) | |||
| 1795 | tr("Successfully removed %1 installed DLC.").arg(count)); | 1798 | tr("Successfully removed %1 installed DLC.").arg(count)); |
| 1796 | } | 1799 | } |
| 1797 | 1800 | ||
| 1798 | void GMainWindow::OnGameListRemoveFile(u64 program_id, GameListRemoveTarget target) { | 1801 | void GMainWindow::OnGameListRemoveFile(u64 program_id, GameListRemoveTarget target, |
| 1802 | std::string_view game_path) { | ||
| 1799 | const QString question = [this, target] { | 1803 | const QString question = [this, target] { |
| 1800 | switch (target) { | 1804 | switch (target) { |
| 1801 | case GameListRemoveTarget::ShaderCache: | 1805 | case GameListRemoveTarget::ShaderCache: |
| @@ -1817,7 +1821,7 @@ void GMainWindow::OnGameListRemoveFile(u64 program_id, GameListRemoveTarget targ | |||
| 1817 | RemoveTransferableShaderCache(program_id); | 1821 | RemoveTransferableShaderCache(program_id); |
| 1818 | break; | 1822 | break; |
| 1819 | case GameListRemoveTarget::CustomConfiguration: | 1823 | case GameListRemoveTarget::CustomConfiguration: |
| 1820 | RemoveCustomConfiguration(program_id); | 1824 | RemoveCustomConfiguration(program_id, game_path); |
| 1821 | break; | 1825 | break; |
| 1822 | } | 1826 | } |
| 1823 | } | 1827 | } |
| @@ -1842,9 +1846,12 @@ void GMainWindow::RemoveTransferableShaderCache(u64 program_id) { | |||
| 1842 | } | 1846 | } |
| 1843 | } | 1847 | } |
| 1844 | 1848 | ||
| 1845 | void GMainWindow::RemoveCustomConfiguration(u64 program_id) { | 1849 | void GMainWindow::RemoveCustomConfiguration(u64 program_id, std::string_view game_path) { |
| 1846 | const auto custom_config_file_path = Common::FS::GetYuzuPath(Common::FS::YuzuPath::ConfigDir) / | 1850 | const auto config_file_name = program_id == 0 |
| 1847 | "custom" / fmt::format("{:016X}.ini", program_id); | 1851 | ? fmt::format("{:s}.ini", Common::FS::GetFilename(game_path)) |
| 1852 | : fmt::format("{:016X}.ini", program_id); | ||
| 1853 | const auto custom_config_file_path = | ||
| 1854 | Common::FS::GetYuzuPath(Common::FS::YuzuPath::ConfigDir) / "custom" / config_file_name; | ||
| 1848 | 1855 | ||
| 1849 | if (!Common::FS::Exists(custom_config_file_path)) { | 1856 | if (!Common::FS::Exists(custom_config_file_path)) { |
| 1850 | QMessageBox::warning(this, tr("Error Removing Custom Configuration"), | 1857 | QMessageBox::warning(this, tr("Error Removing Custom Configuration"), |
| @@ -2635,7 +2642,7 @@ void GMainWindow::OpenPerGameConfiguration(u64 title_id, const std::string& file | |||
| 2635 | const auto v_file = Core::GetGameFileFromPath(vfs, file_name); | 2642 | const auto v_file = Core::GetGameFileFromPath(vfs, file_name); |
| 2636 | const auto& system = Core::System::GetInstance(); | 2643 | const auto& system = Core::System::GetInstance(); |
| 2637 | 2644 | ||
| 2638 | ConfigurePerGame dialog(this, title_id); | 2645 | ConfigurePerGame dialog(this, title_id, file_name); |
| 2639 | dialog.LoadFromFile(v_file); | 2646 | dialog.LoadFromFile(v_file); |
| 2640 | const auto result = dialog.exec(); | 2647 | const auto result = dialog.exec(); |
| 2641 | 2648 | ||
diff --git a/src/yuzu/main.h b/src/yuzu/main.h index b3a5033ce..135681d41 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h | |||
| @@ -236,7 +236,8 @@ private slots: | |||
| 236 | const std::string& game_path); | 236 | const std::string& game_path); |
| 237 | void OnTransferableShaderCacheOpenFile(u64 program_id); | 237 | void OnTransferableShaderCacheOpenFile(u64 program_id); |
| 238 | void OnGameListRemoveInstalledEntry(u64 program_id, InstalledEntryType type); | 238 | void OnGameListRemoveInstalledEntry(u64 program_id, InstalledEntryType type); |
| 239 | void OnGameListRemoveFile(u64 program_id, GameListRemoveTarget target); | 239 | void OnGameListRemoveFile(u64 program_id, GameListRemoveTarget target, |
| 240 | std::string_view game_path); | ||
| 240 | void OnGameListDumpRomFS(u64 program_id, const std::string& game_path); | 241 | void OnGameListDumpRomFS(u64 program_id, const std::string& game_path); |
| 241 | void OnGameListCopyTID(u64 program_id); | 242 | void OnGameListCopyTID(u64 program_id); |
| 242 | void OnGameListNavigateToGamedbEntry(u64 program_id, | 243 | void OnGameListNavigateToGamedbEntry(u64 program_id, |
| @@ -275,7 +276,7 @@ private: | |||
| 275 | void RemoveUpdateContent(u64 program_id, const QString& entry_type); | 276 | void RemoveUpdateContent(u64 program_id, const QString& entry_type); |
| 276 | void RemoveAddOnContent(u64 program_id, const QString& entry_type); | 277 | void RemoveAddOnContent(u64 program_id, const QString& entry_type); |
| 277 | void RemoveTransferableShaderCache(u64 program_id); | 278 | void RemoveTransferableShaderCache(u64 program_id); |
| 278 | void RemoveCustomConfiguration(u64 program_id); | 279 | void RemoveCustomConfiguration(u64 program_id, std::string_view game_path); |
| 279 | std::optional<u64> SelectRomFSDumpTarget(const FileSys::ContentProvider&, u64 program_id); | 280 | std::optional<u64> SelectRomFSDumpTarget(const FileSys::ContentProvider&, u64 program_id); |
| 280 | InstallResult InstallNSPXCI(const QString& filename); | 281 | InstallResult InstallNSPXCI(const QString& filename); |
| 281 | InstallResult InstallNCA(const QString& filename); | 282 | InstallResult InstallNCA(const QString& filename); |