diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/configuration/config.cpp | 7 | ||||
| -rw-r--r-- | src/yuzu/configuration/config.h | 4 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_per_game.cpp | 11 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_per_game.h | 3 | ||||
| -rw-r--r-- | src/yuzu/game_list.h | 2 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 14 | ||||
| -rw-r--r-- | src/yuzu/main.h | 4 |
7 files changed, 27 insertions, 18 deletions
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 552454acf..e9d4bef60 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(std::string_view config_name, ConfigType config_type) : type(config_type) { | 19 | Config::Config(const std::string& 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(std::string_view config_name) { | 245 | void Config::Initialize(const std::string& 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 | ||
| @@ -255,7 +255,8 @@ void Config::Initialize(std::string_view config_name) { | |||
| 255 | Reload(); | 255 | Reload(); |
| 256 | break; | 256 | break; |
| 257 | case ConfigType::PerGameConfig: | 257 | case ConfigType::PerGameConfig: |
| 258 | qt_config_loc = FS::PathToUTF8String(fs_config_loc / "custom" / config_file); | 258 | qt_config_loc = |
| 259 | FS::PathToUTF8String(fs_config_loc / "custom" / FS::ToU8String(config_file)); | ||
| 259 | void(FS::CreateParentDir(qt_config_loc)); | 260 | void(FS::CreateParentDir(qt_config_loc)); |
| 260 | qt_config = std::make_unique<QSettings>(QString::fromStdString(qt_config_loc), | 261 | qt_config = std::make_unique<QSettings>(QString::fromStdString(qt_config_loc), |
| 261 | QSettings::IniFormat); | 262 | QSettings::IniFormat); |
diff --git a/src/yuzu/configuration/config.h b/src/yuzu/configuration/config.h index 114a2eaa7..ce3355588 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(std::string_view config_name = "qt-config", | 25 | explicit Config(const std::string& 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(std::string_view config_name); | 48 | void Initialize(const std::string& 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 7dfcf150c..a1d434aca 100644 --- a/src/yuzu/configuration/configure_per_game.cpp +++ b/src/yuzu/configuration/configure_per_game.cpp | |||
| @@ -3,10 +3,13 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <algorithm> | 5 | #include <algorithm> |
| 6 | #include <filesystem> | ||
| 6 | #include <memory> | 7 | #include <memory> |
| 7 | #include <string> | 8 | #include <string> |
| 8 | #include <utility> | 9 | #include <utility> |
| 9 | 10 | ||
| 11 | #include <fmt/format.h> | ||
| 12 | |||
| 10 | #include <QAbstractButton> | 13 | #include <QAbstractButton> |
| 11 | #include <QCheckBox> | 14 | #include <QCheckBox> |
| 12 | #include <QDialogButtonBox> | 15 | #include <QDialogButtonBox> |
| @@ -18,6 +21,7 @@ | |||
| 18 | #include <QTimer> | 21 | #include <QTimer> |
| 19 | #include <QTreeView> | 22 | #include <QTreeView> |
| 20 | 23 | ||
| 24 | #include "common/fs/fs_util.h" | ||
| 21 | #include "common/fs/path_util.h" | 25 | #include "common/fs/path_util.h" |
| 22 | #include "core/core.h" | 26 | #include "core/core.h" |
| 23 | #include "core/file_sys/control_metadata.h" | 27 | #include "core/file_sys/control_metadata.h" |
| @@ -31,10 +35,11 @@ | |||
| 31 | #include "yuzu/uisettings.h" | 35 | #include "yuzu/uisettings.h" |
| 32 | #include "yuzu/util/util.h" | 36 | #include "yuzu/util/util.h" |
| 33 | 37 | ||
| 34 | ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id, std::string_view file_name) | 38 | ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id, const std::string& file_name) |
| 35 | : QDialog(parent), ui(std::make_unique<Ui::ConfigurePerGame>()), title_id(title_id) { | 39 | : QDialog(parent), ui(std::make_unique<Ui::ConfigurePerGame>()), title_id(title_id) { |
| 36 | const auto config_file_name = | 40 | const auto file_path = std::filesystem::path(Common::FS::ToU8String(file_name)); |
| 37 | title_id == 0 ? Common::FS::GetFilename(file_name) : fmt::format("{:016X}", title_id); | 41 | const auto config_file_name = title_id == 0 ? Common::FS::PathToUTF8String(file_path.filename()) |
| 42 | : fmt::format("{:016X}", title_id); | ||
| 38 | game_config = std::make_unique<Config>(config_file_name, Config::ConfigType::PerGameConfig); | 43 | game_config = std::make_unique<Config>(config_file_name, Config::ConfigType::PerGameConfig); |
| 39 | 44 | ||
| 40 | Settings::SetConfiguringGlobal(false); | 45 | Settings::SetConfiguringGlobal(false); |
diff --git a/src/yuzu/configuration/configure_per_game.h b/src/yuzu/configuration/configure_per_game.h index dc6b68763..a2d0211a3 100644 --- a/src/yuzu/configuration/configure_per_game.h +++ b/src/yuzu/configuration/configure_per_game.h | |||
| @@ -28,7 +28,8 @@ class ConfigurePerGame : public QDialog { | |||
| 28 | Q_OBJECT | 28 | Q_OBJECT |
| 29 | 29 | ||
| 30 | public: | 30 | public: |
| 31 | explicit ConfigurePerGame(QWidget* parent, u64 title_id, std::string_view file_name); | 31 | // Cannot use std::filesystem::path due to https://bugreports.qt.io/browse/QTBUG-73263 |
| 32 | explicit ConfigurePerGame(QWidget* parent, u64 title_id, const std::string& file_name); | ||
| 32 | ~ConfigurePerGame() override; | 33 | ~ConfigurePerGame() override; |
| 33 | 34 | ||
| 34 | /// Save all button configurations to settings file | 35 | /// Save all button configurations to settings file |
diff --git a/src/yuzu/game_list.h b/src/yuzu/game_list.h index 2867f6653..ab6866735 100644 --- a/src/yuzu/game_list.h +++ b/src/yuzu/game_list.h | |||
| @@ -89,7 +89,7 @@ signals: | |||
| 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 | const std::string& game_path); |
| 93 | void DumpRomFSRequested(u64 program_id, const std::string& game_path); | 93 | void DumpRomFSRequested(u64 program_id, const std::string& game_path); |
| 94 | void CopyTIDRequested(u64 program_id); | 94 | void CopyTIDRequested(u64 program_id); |
| 95 | void NavigateToGamedbEntryRequested(u64 program_id, | 95 | void NavigateToGamedbEntryRequested(u64 program_id, |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index dd8dd3233..237e26829 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -1334,8 +1334,9 @@ 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 | const auto file_path = std::filesystem::path{filename.toStdU16String()}; | ||
| 1337 | const auto config_file_name = title_id == 0 | 1338 | const auto config_file_name = title_id == 0 |
| 1338 | ? Common::FS::GetFilename(filename.toStdString()) | 1339 | ? Common::FS::PathToUTF8String(file_path.filename()) |
| 1339 | : fmt::format("{:016X}", title_id); | 1340 | : fmt::format("{:016X}", title_id); |
| 1340 | Config per_game_config(config_file_name, Config::ConfigType::PerGameConfig); | 1341 | Config per_game_config(config_file_name, Config::ConfigType::PerGameConfig); |
| 1341 | } | 1342 | } |
| @@ -1799,7 +1800,7 @@ void GMainWindow::RemoveAddOnContent(u64 program_id, const QString& entry_type) | |||
| 1799 | } | 1800 | } |
| 1800 | 1801 | ||
| 1801 | void GMainWindow::OnGameListRemoveFile(u64 program_id, GameListRemoveTarget target, | 1802 | void GMainWindow::OnGameListRemoveFile(u64 program_id, GameListRemoveTarget target, |
| 1802 | std::string_view game_path) { | 1803 | const std::string& game_path) { |
| 1803 | const QString question = [this, target] { | 1804 | const QString question = [this, target] { |
| 1804 | switch (target) { | 1805 | switch (target) { |
| 1805 | case GameListRemoveTarget::ShaderCache: | 1806 | case GameListRemoveTarget::ShaderCache: |
| @@ -1846,10 +1847,11 @@ void GMainWindow::RemoveTransferableShaderCache(u64 program_id) { | |||
| 1846 | } | 1847 | } |
| 1847 | } | 1848 | } |
| 1848 | 1849 | ||
| 1849 | void GMainWindow::RemoveCustomConfiguration(u64 program_id, std::string_view game_path) { | 1850 | void GMainWindow::RemoveCustomConfiguration(u64 program_id, const std::string& game_path) { |
| 1850 | const auto config_file_name = program_id == 0 | 1851 | const auto file_path = std::filesystem::path(Common::FS::ToU8String(game_path)); |
| 1851 | ? fmt::format("{:s}.ini", Common::FS::GetFilename(game_path)) | 1852 | const auto config_file_name = |
| 1852 | : fmt::format("{:016X}.ini", program_id); | 1853 | program_id == 0 ? Common::FS::PathToUTF8String(file_path.filename()).append(".ini") |
| 1854 | : fmt::format("{:016X}.ini", program_id); | ||
| 1853 | const auto custom_config_file_path = | 1855 | const auto custom_config_file_path = |
| 1854 | Common::FS::GetYuzuPath(Common::FS::YuzuPath::ConfigDir) / "custom" / config_file_name; | 1856 | Common::FS::GetYuzuPath(Common::FS::YuzuPath::ConfigDir) / "custom" / config_file_name; |
| 1855 | 1857 | ||
diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 135681d41..490b6889f 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h | |||
| @@ -237,7 +237,7 @@ private slots: | |||
| 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 | const std::string& game_path); |
| 241 | void OnGameListDumpRomFS(u64 program_id, const std::string& game_path); | 241 | void OnGameListDumpRomFS(u64 program_id, const std::string& game_path); |
| 242 | void OnGameListCopyTID(u64 program_id); | 242 | void OnGameListCopyTID(u64 program_id); |
| 243 | void OnGameListNavigateToGamedbEntry(u64 program_id, | 243 | void OnGameListNavigateToGamedbEntry(u64 program_id, |
| @@ -276,7 +276,7 @@ private: | |||
| 276 | void RemoveUpdateContent(u64 program_id, const QString& entry_type); | 276 | void RemoveUpdateContent(u64 program_id, const QString& entry_type); |
| 277 | void RemoveAddOnContent(u64 program_id, const QString& entry_type); | 277 | void RemoveAddOnContent(u64 program_id, const QString& entry_type); |
| 278 | void RemoveTransferableShaderCache(u64 program_id); | 278 | void RemoveTransferableShaderCache(u64 program_id); |
| 279 | void RemoveCustomConfiguration(u64 program_id, std::string_view game_path); | 279 | void RemoveCustomConfiguration(u64 program_id, const std::string& game_path); |
| 280 | std::optional<u64> SelectRomFSDumpTarget(const FileSys::ContentProvider&, u64 program_id); | 280 | std::optional<u64> SelectRomFSDumpTarget(const FileSys::ContentProvider&, u64 program_id); |
| 281 | InstallResult InstallNSPXCI(const QString& filename); | 281 | InstallResult InstallNSPXCI(const QString& filename); |
| 282 | InstallResult InstallNCA(const QString& filename); | 282 | InstallResult InstallNCA(const QString& filename); |