diff options
| -rw-r--r-- | src/common/common_funcs.h | 25 | ||||
| -rw-r--r-- | src/common/fs/fs_util.cpp | 14 | ||||
| -rw-r--r-- | src/common/fs/fs_util.h | 33 | ||||
| -rw-r--r-- | src/common/fs/path_util.cpp | 6 | ||||
| -rw-r--r-- | src/common/fs/path_util.h | 9 | ||||
| -rw-r--r-- | src/core/hle/result.h | 25 | ||||
| -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 |
14 files changed, 107 insertions, 62 deletions
diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h index 17d1ee86b..53bd7da60 100644 --- a/src/common/common_funcs.h +++ b/src/common/common_funcs.h | |||
| @@ -97,17 +97,6 @@ __declspec(dllimport) void __stdcall DebugBreak(void); | |||
| 97 | return static_cast<T>(key) == 0; \ | 97 | return static_cast<T>(key) == 0; \ |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | /// Evaluates a boolean expression, and returns a result unless that expression is true. | ||
| 101 | #define R_UNLESS(expr, res) \ | ||
| 102 | { \ | ||
| 103 | if (!(expr)) { \ | ||
| 104 | if (res.IsError()) { \ | ||
| 105 | LOG_ERROR(Kernel, "Failed with result: {}", res.raw); \ | ||
| 106 | } \ | ||
| 107 | return res; \ | ||
| 108 | } \ | ||
| 109 | } | ||
| 110 | |||
| 111 | #define YUZU_NON_COPYABLE(cls) \ | 100 | #define YUZU_NON_COPYABLE(cls) \ |
| 112 | cls(const cls&) = delete; \ | 101 | cls(const cls&) = delete; \ |
| 113 | cls& operator=(const cls&) = delete | 102 | cls& operator=(const cls&) = delete |
| @@ -116,20 +105,6 @@ __declspec(dllimport) void __stdcall DebugBreak(void); | |||
| 116 | cls(cls&&) = delete; \ | 105 | cls(cls&&) = delete; \ |
| 117 | cls& operator=(cls&&) = delete | 106 | cls& operator=(cls&&) = delete |
| 118 | 107 | ||
| 119 | #define R_SUCCEEDED(res) (res.IsSuccess()) | ||
| 120 | |||
| 121 | /// Evaluates an expression that returns a result, and returns the result if it would fail. | ||
| 122 | #define R_TRY(res_expr) \ | ||
| 123 | { \ | ||
| 124 | const auto _tmp_r_try_rc = (res_expr); \ | ||
| 125 | if (_tmp_r_try_rc.IsError()) { \ | ||
| 126 | return _tmp_r_try_rc; \ | ||
| 127 | } \ | ||
| 128 | } | ||
| 129 | |||
| 130 | /// Evaluates a boolean expression, and succeeds if that expression is true. | ||
| 131 | #define R_SUCCEED_IF(expr) R_UNLESS(!(expr), RESULT_SUCCESS) | ||
| 132 | |||
| 133 | namespace Common { | 108 | namespace Common { |
| 134 | 109 | ||
| 135 | [[nodiscard]] constexpr u32 MakeMagic(char a, char b, char c, char d) { | 110 | [[nodiscard]] constexpr u32 MakeMagic(char a, char b, char c, char d) { |
diff --git a/src/common/fs/fs_util.cpp b/src/common/fs/fs_util.cpp index 0ddfc3131..357cf5855 100644 --- a/src/common/fs/fs_util.cpp +++ b/src/common/fs/fs_util.cpp | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <algorithm> | ||
| 6 | |||
| 5 | #include "common/fs/fs_util.h" | 7 | #include "common/fs/fs_util.h" |
| 6 | 8 | ||
| 7 | namespace Common::FS { | 9 | namespace Common::FS { |
| @@ -10,4 +12,16 @@ std::u8string ToU8String(std::string_view utf8_string) { | |||
| 10 | return std::u8string{utf8_string.begin(), utf8_string.end()}; | 12 | return std::u8string{utf8_string.begin(), utf8_string.end()}; |
| 11 | } | 13 | } |
| 12 | 14 | ||
| 15 | std::u8string BufferToU8String(std::span<const u8> buffer) { | ||
| 16 | return std::u8string{buffer.begin(), std::ranges::find(buffer, u8{0})}; | ||
| 17 | } | ||
| 18 | |||
| 19 | std::string ToUTF8String(std::u8string_view u8_string) { | ||
| 20 | return std::string{u8_string.begin(), u8_string.end()}; | ||
| 21 | } | ||
| 22 | |||
| 23 | std::string PathToUTF8String(const std::filesystem::path& path) { | ||
| 24 | return ToUTF8String(path.u8string()); | ||
| 25 | } | ||
| 26 | |||
| 13 | } // namespace Common::FS | 27 | } // namespace Common::FS |
diff --git a/src/common/fs/fs_util.h b/src/common/fs/fs_util.h index 951df53b6..ec9950ee7 100644 --- a/src/common/fs/fs_util.h +++ b/src/common/fs/fs_util.h | |||
| @@ -5,9 +5,13 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <concepts> | 7 | #include <concepts> |
| 8 | #include <filesystem> | ||
| 9 | #include <span> | ||
| 8 | #include <string> | 10 | #include <string> |
| 9 | #include <string_view> | 11 | #include <string_view> |
| 10 | 12 | ||
| 13 | #include "common/common_types.h" | ||
| 14 | |||
| 11 | namespace Common::FS { | 15 | namespace Common::FS { |
| 12 | 16 | ||
| 13 | template <typename T> | 17 | template <typename T> |
| @@ -22,4 +26,33 @@ concept IsChar = std::same_as<T, char>; | |||
| 22 | */ | 26 | */ |
| 23 | [[nodiscard]] std::u8string ToU8String(std::string_view utf8_string); | 27 | [[nodiscard]] std::u8string ToU8String(std::string_view utf8_string); |
| 24 | 28 | ||
| 29 | /** | ||
| 30 | * Converts a buffer of bytes to a UTF8-encoded std::u8string. | ||
| 31 | * This converts from the start of the buffer until the first encountered null-terminator. | ||
| 32 | * If no null-terminator is found, this converts the entire buffer instead. | ||
| 33 | * | ||
| 34 | * @param buffer Buffer of bytes | ||
| 35 | * | ||
| 36 | * @returns UTF-8 encoded std::u8string. | ||
| 37 | */ | ||
| 38 | [[nodiscard]] std::u8string BufferToU8String(std::span<const u8> buffer); | ||
| 39 | |||
| 40 | /** | ||
| 41 | * Converts a std::u8string or std::u8string_view to a UTF-8 encoded std::string. | ||
| 42 | * | ||
| 43 | * @param u8_string UTF-8 encoded u8string | ||
| 44 | * | ||
| 45 | * @returns UTF-8 encoded std::string. | ||
| 46 | */ | ||
| 47 | [[nodiscard]] std::string ToUTF8String(std::u8string_view u8_string); | ||
| 48 | |||
| 49 | /** | ||
| 50 | * Converts a filesystem path to a UTF-8 encoded std::string. | ||
| 51 | * | ||
| 52 | * @param path Filesystem path | ||
| 53 | * | ||
| 54 | * @returns UTF-8 encoded std::string. | ||
| 55 | */ | ||
| 56 | [[nodiscard]] std::string PathToUTF8String(const std::filesystem::path& path); | ||
| 57 | |||
| 25 | } // namespace Common::FS | 58 | } // namespace Common::FS |
diff --git a/src/common/fs/path_util.cpp b/src/common/fs/path_util.cpp index 8b732a21c..6cdd14f13 100644 --- a/src/common/fs/path_util.cpp +++ b/src/common/fs/path_util.cpp | |||
| @@ -129,12 +129,6 @@ private: | |||
| 129 | std::unordered_map<YuzuPath, fs::path> yuzu_paths; | 129 | std::unordered_map<YuzuPath, fs::path> yuzu_paths; |
| 130 | }; | 130 | }; |
| 131 | 131 | ||
| 132 | std::string PathToUTF8String(const fs::path& path) { | ||
| 133 | const auto utf8_string = path.u8string(); | ||
| 134 | |||
| 135 | return std::string{utf8_string.begin(), utf8_string.end()}; | ||
| 136 | } | ||
| 137 | |||
| 138 | bool ValidatePath(const fs::path& path) { | 132 | bool ValidatePath(const fs::path& path) { |
| 139 | if (path.empty()) { | 133 | if (path.empty()) { |
| 140 | LOG_ERROR(Common_Filesystem, "Input path is empty, path={}", PathToUTF8String(path)); | 134 | LOG_ERROR(Common_Filesystem, "Input path is empty, path={}", PathToUTF8String(path)); |
diff --git a/src/common/fs/path_util.h b/src/common/fs/path_util.h index a9fadbceb..14e8c35d7 100644 --- a/src/common/fs/path_util.h +++ b/src/common/fs/path_util.h | |||
| @@ -26,15 +26,6 @@ enum class YuzuPath { | |||
| 26 | }; | 26 | }; |
| 27 | 27 | ||
| 28 | /** | 28 | /** |
| 29 | * Converts a filesystem path to a UTF-8 encoded std::string. | ||
| 30 | * | ||
| 31 | * @param path Filesystem path | ||
| 32 | * | ||
| 33 | * @returns UTF-8 encoded std::string. | ||
| 34 | */ | ||
| 35 | [[nodiscard]] std::string PathToUTF8String(const std::filesystem::path& path); | ||
| 36 | |||
| 37 | /** | ||
| 38 | * Validates a given path. | 29 | * Validates a given path. |
| 39 | * | 30 | * |
| 40 | * A given path is valid if it meets these conditions: | 31 | * A given path is valid if it meets these conditions: |
diff --git a/src/core/hle/result.h b/src/core/hle/result.h index 43968386f..df3283fe3 100644 --- a/src/core/hle/result.h +++ b/src/core/hle/result.h | |||
| @@ -358,3 +358,28 @@ ResultVal<std::remove_reference_t<Arg>> MakeResult(Arg&& arg) { | |||
| 358 | return CONCAT2(check_result_L, __LINE__); \ | 358 | return CONCAT2(check_result_L, __LINE__); \ |
| 359 | } \ | 359 | } \ |
| 360 | } while (false) | 360 | } while (false) |
| 361 | |||
| 362 | #define R_SUCCEEDED(res) (res.IsSuccess()) | ||
| 363 | |||
| 364 | /// Evaluates a boolean expression, and succeeds if that expression is true. | ||
| 365 | #define R_SUCCEED_IF(expr) R_UNLESS(!(expr), RESULT_SUCCESS) | ||
| 366 | |||
| 367 | /// Evaluates a boolean expression, and returns a result unless that expression is true. | ||
| 368 | #define R_UNLESS(expr, res) \ | ||
| 369 | { \ | ||
| 370 | if (!(expr)) { \ | ||
| 371 | if (res.IsError()) { \ | ||
| 372 | LOG_ERROR(Kernel, "Failed with result: {}", res.raw); \ | ||
| 373 | } \ | ||
| 374 | return res; \ | ||
| 375 | } \ | ||
| 376 | } | ||
| 377 | |||
| 378 | /// Evaluates an expression that returns a result, and returns the result if it would fail. | ||
| 379 | #define R_TRY(res_expr) \ | ||
| 380 | { \ | ||
| 381 | const auto _tmp_r_try_rc = (res_expr); \ | ||
| 382 | if (_tmp_r_try_rc.IsError()) { \ | ||
| 383 | return _tmp_r_try_rc; \ | ||
| 384 | } \ | ||
| 385 | } | ||
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 5fe4604e0..25bb066c9 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp | |||
| @@ -558,11 +558,11 @@ void GameList::AddGamePopup(QMenu& context_menu, u64 program_id, const std::stri | |||
| 558 | connect(remove_dlc, &QAction::triggered, [this, program_id]() { | 558 | connect(remove_dlc, &QAction::triggered, [this, program_id]() { |
| 559 | emit RemoveInstalledEntryRequested(program_id, InstalledEntryType::AddOnContent); | 559 | emit RemoveInstalledEntryRequested(program_id, InstalledEntryType::AddOnContent); |
| 560 | }); | 560 | }); |
| 561 | connect(remove_shader_cache, &QAction::triggered, [this, program_id]() { | 561 | connect(remove_shader_cache, &QAction::triggered, [this, program_id, path]() { |
| 562 | emit RemoveFileRequested(program_id, GameListRemoveTarget::ShaderCache); | 562 | emit RemoveFileRequested(program_id, GameListRemoveTarget::ShaderCache, path); |
| 563 | }); | 563 | }); |
| 564 | connect(remove_custom_config, &QAction::triggered, [this, program_id]() { | 564 | connect(remove_custom_config, &QAction::triggered, [this, program_id, path]() { |
| 565 | emit RemoveFileRequested(program_id, GameListRemoveTarget::CustomConfiguration); | 565 | emit RemoveFileRequested(program_id, GameListRemoveTarget::CustomConfiguration, path); |
| 566 | }); | 566 | }); |
| 567 | connect(dump_romfs, &QAction::triggered, | 567 | connect(dump_romfs, &QAction::triggered, |
| 568 | [this, program_id, path]() { emit DumpRomFSRequested(program_id, path); }); | 568 | [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); |