diff options
| author | 2019-11-28 01:17:17 -0500 | |
|---|---|---|
| committer | 2019-11-28 01:17:17 -0500 | |
| commit | e0242a46543a798e4ed3d58f70c8abea16309034 (patch) | |
| tree | 61a3aed0c04e2ec60162a15e45f38a4ad2c07b78 /src/core/file_sys | |
| parent | Merge pull request #3170 from lioncash/enum (diff) | |
| download | yuzu-e0242a46543a798e4ed3d58f70c8abea16309034.tar.gz yuzu-e0242a46543a798e4ed3d58f70c8abea16309034.tar.xz yuzu-e0242a46543a798e4ed3d58f70c8abea16309034.zip | |
patch_manager: Adds check for disabled cheats to prevent them from being enabled (#3178)
* Adds check for disabled cheats to prevent them from being added to the CheatList
* Address feedback
Diffstat (limited to 'src/core/file_sys')
| -rw-r--r-- | src/core/file_sys/patch_manager.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/core/file_sys/patch_manager.cpp b/src/core/file_sys/patch_manager.cpp index df0ecb15c..e226e9711 100644 --- a/src/core/file_sys/patch_manager.cpp +++ b/src/core/file_sys/patch_manager.cpp | |||
| @@ -76,7 +76,7 @@ VirtualDir PatchManager::PatchExeFS(VirtualDir exefs) const { | |||
| 76 | 76 | ||
| 77 | const auto& disabled = Settings::values.disabled_addons[title_id]; | 77 | const auto& disabled = Settings::values.disabled_addons[title_id]; |
| 78 | const auto update_disabled = | 78 | const auto update_disabled = |
| 79 | std::find(disabled.begin(), disabled.end(), "Update") != disabled.end(); | 79 | std::find(disabled.cbegin(), disabled.cend(), "Update") != disabled.cend(); |
| 80 | 80 | ||
| 81 | // Game Updates | 81 | // Game Updates |
| 82 | const auto update_tid = GetUpdateTitleID(title_id); | 82 | const auto update_tid = GetUpdateTitleID(title_id); |
| @@ -127,7 +127,7 @@ std::vector<VirtualFile> PatchManager::CollectPatches(const std::vector<VirtualD | |||
| 127 | std::vector<VirtualFile> out; | 127 | std::vector<VirtualFile> out; |
| 128 | out.reserve(patch_dirs.size()); | 128 | out.reserve(patch_dirs.size()); |
| 129 | for (const auto& subdir : patch_dirs) { | 129 | for (const auto& subdir : patch_dirs) { |
| 130 | if (std::find(disabled.begin(), disabled.end(), subdir->GetName()) != disabled.end()) | 130 | if (std::find(disabled.cbegin(), disabled.cend(), subdir->GetName()) != disabled.cend()) |
| 131 | continue; | 131 | continue; |
| 132 | 132 | ||
| 133 | auto exefs_dir = subdir->GetSubdirectory("exefs"); | 133 | auto exefs_dir = subdir->GetSubdirectory("exefs"); |
| @@ -284,12 +284,17 @@ std::vector<Memory::CheatEntry> PatchManager::CreateCheatList( | |||
| 284 | return {}; | 284 | return {}; |
| 285 | } | 285 | } |
| 286 | 286 | ||
| 287 | const auto& disabled = Settings::values.disabled_addons[title_id]; | ||
| 287 | auto patch_dirs = load_dir->GetSubdirectories(); | 288 | auto patch_dirs = load_dir->GetSubdirectories(); |
| 288 | std::sort(patch_dirs.begin(), patch_dirs.end(), | 289 | std::sort(patch_dirs.begin(), patch_dirs.end(), |
| 289 | [](const VirtualDir& l, const VirtualDir& r) { return l->GetName() < r->GetName(); }); | 290 | [](const VirtualDir& l, const VirtualDir& r) { return l->GetName() < r->GetName(); }); |
| 290 | 291 | ||
| 291 | std::vector<Memory::CheatEntry> out; | 292 | std::vector<Memory::CheatEntry> out; |
| 292 | for (const auto& subdir : patch_dirs) { | 293 | for (const auto& subdir : patch_dirs) { |
| 294 | if (std::find(disabled.cbegin(), disabled.cend(), subdir->GetName()) != disabled.cend()) { | ||
| 295 | continue; | ||
| 296 | } | ||
| 297 | |||
| 293 | auto cheats_dir = subdir->GetSubdirectory("cheats"); | 298 | auto cheats_dir = subdir->GetSubdirectory("cheats"); |
| 294 | if (cheats_dir != nullptr) { | 299 | if (cheats_dir != nullptr) { |
| 295 | auto res = ReadCheatFileFromFolder(system, title_id, build_id_, cheats_dir, true); | 300 | auto res = ReadCheatFileFromFolder(system, title_id, build_id_, cheats_dir, true); |
| @@ -331,8 +336,9 @@ static void ApplyLayeredFS(VirtualFile& romfs, u64 title_id, ContentRecordType t | |||
| 331 | layers.reserve(patch_dirs.size() + 1); | 336 | layers.reserve(patch_dirs.size() + 1); |
| 332 | layers_ext.reserve(patch_dirs.size() + 1); | 337 | layers_ext.reserve(patch_dirs.size() + 1); |
| 333 | for (const auto& subdir : patch_dirs) { | 338 | for (const auto& subdir : patch_dirs) { |
| 334 | if (std::find(disabled.begin(), disabled.end(), subdir->GetName()) != disabled.end()) | 339 | if (std::find(disabled.cbegin(), disabled.cend(), subdir->GetName()) != disabled.cend()) { |
| 335 | continue; | 340 | continue; |
| 341 | } | ||
| 336 | 342 | ||
| 337 | auto romfs_dir = subdir->GetSubdirectory("romfs"); | 343 | auto romfs_dir = subdir->GetSubdirectory("romfs"); |
| 338 | if (romfs_dir != nullptr) | 344 | if (romfs_dir != nullptr) |
| @@ -381,7 +387,7 @@ VirtualFile PatchManager::PatchRomFS(VirtualFile romfs, u64 ivfc_offset, Content | |||
| 381 | 387 | ||
| 382 | const auto& disabled = Settings::values.disabled_addons[title_id]; | 388 | const auto& disabled = Settings::values.disabled_addons[title_id]; |
| 383 | const auto update_disabled = | 389 | const auto update_disabled = |
| 384 | std::find(disabled.begin(), disabled.end(), "Update") != disabled.end(); | 390 | std::find(disabled.cbegin(), disabled.cend(), "Update") != disabled.cend(); |
| 385 | 391 | ||
| 386 | if (!update_disabled && update != nullptr) { | 392 | if (!update_disabled && update != nullptr) { |
| 387 | const auto new_nca = std::make_shared<NCA>(update, romfs, ivfc_offset); | 393 | const auto new_nca = std::make_shared<NCA>(update, romfs, ivfc_offset); |
| @@ -431,7 +437,7 @@ std::map<std::string, std::string, std::less<>> PatchManager::GetPatchVersionNam | |||
| 431 | auto [nacp, discard_icon_file] = update.GetControlMetadata(); | 437 | auto [nacp, discard_icon_file] = update.GetControlMetadata(); |
| 432 | 438 | ||
| 433 | const auto update_disabled = | 439 | const auto update_disabled = |
| 434 | std::find(disabled.begin(), disabled.end(), "Update") != disabled.end(); | 440 | std::find(disabled.cbegin(), disabled.cend(), "Update") != disabled.cend(); |
| 435 | const auto update_label = update_disabled ? "[D] Update" : "Update"; | 441 | const auto update_label = update_disabled ? "[D] Update" : "Update"; |
| 436 | 442 | ||
| 437 | if (nacp != nullptr) { | 443 | if (nacp != nullptr) { |