summaryrefslogtreecommitdiff
path: root/src/core/file_sys
diff options
context:
space:
mode:
authorGravatar Rodrigo Locatti2020-09-16 00:24:14 +0000
committerGravatar GitHub2020-09-16 00:24:14 +0000
commit9cd1ea338b4936f58ea74a839a3beb9d998e55af (patch)
tree5730a53f2b5e113ac254bc408d7ff968f9da5242 /src/core/file_sys
parentMerge pull request #4655 from lioncash/internal2 (diff)
parentcheat_engine: Convert ExtractName into a non-template function (diff)
downloadyuzu-9cd1ea338b4936f58ea74a839a3beb9d998e55af.tar.gz
yuzu-9cd1ea338b4936f58ea74a839a3beb9d998e55af.tar.xz
yuzu-9cd1ea338b4936f58ea74a839a3beb9d998e55af.zip
Merge pull request #4657 from lioncash/cheatparser
cheat_engine: Remove unnecessary system argument to CheatParser's Parse function
Diffstat (limited to 'src/core/file_sys')
-rw-r--r--src/core/file_sys/patch_manager.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/core/file_sys/patch_manager.cpp b/src/core/file_sys/patch_manager.cpp
index 87c354a43..b9c09b456 100644
--- a/src/core/file_sys/patch_manager.cpp
+++ b/src/core/file_sys/patch_manager.cpp
@@ -76,8 +76,7 @@ VirtualDir FindSubdirectoryCaseless(const VirtualDir dir, std::string_view name)
76} 76}
77 77
78std::optional<std::vector<Core::Memory::CheatEntry>> ReadCheatFileFromFolder( 78std::optional<std::vector<Core::Memory::CheatEntry>> ReadCheatFileFromFolder(
79 const Core::System& system, u64 title_id, const PatchManager::BuildID& build_id_, 79 u64 title_id, const PatchManager::BuildID& build_id_, const VirtualDir& base_path, bool upper) {
80 const VirtualDir& base_path, bool upper) {
81 const auto build_id_raw = Common::HexToString(build_id_, upper); 80 const auto build_id_raw = Common::HexToString(build_id_, upper);
82 const auto build_id = build_id_raw.substr(0, sizeof(u64) * 2); 81 const auto build_id = build_id_raw.substr(0, sizeof(u64) * 2);
83 const auto file = base_path->GetFile(fmt::format("{}.txt", build_id)); 82 const auto file = base_path->GetFile(fmt::format("{}.txt", build_id));
@@ -95,9 +94,8 @@ std::optional<std::vector<Core::Memory::CheatEntry>> ReadCheatFileFromFolder(
95 return std::nullopt; 94 return std::nullopt;
96 } 95 }
97 96
98 Core::Memory::TextCheatParser parser; 97 const Core::Memory::TextCheatParser parser;
99 return parser.Parse(system, 98 return parser.Parse(std::string_view(reinterpret_cast<const char*>(data.data()), data.size()));
100 std::string_view(reinterpret_cast<const char*>(data.data()), data.size()));
101} 99}
102 100
103void AppendCommaIfNotEmpty(std::string& to, std::string_view with) { 101void AppendCommaIfNotEmpty(std::string& to, std::string_view with) {
@@ -335,14 +333,12 @@ std::vector<Core::Memory::CheatEntry> PatchManager::CreateCheatList(
335 333
336 auto cheats_dir = FindSubdirectoryCaseless(subdir, "cheats"); 334 auto cheats_dir = FindSubdirectoryCaseless(subdir, "cheats");
337 if (cheats_dir != nullptr) { 335 if (cheats_dir != nullptr) {
338 auto res = ReadCheatFileFromFolder(system, title_id, build_id_, cheats_dir, true); 336 if (const auto res = ReadCheatFileFromFolder(title_id, build_id_, cheats_dir, true)) {
339 if (res.has_value()) {
340 std::copy(res->begin(), res->end(), std::back_inserter(out)); 337 std::copy(res->begin(), res->end(), std::back_inserter(out));
341 continue; 338 continue;
342 } 339 }
343 340
344 res = ReadCheatFileFromFolder(system, title_id, build_id_, cheats_dir, false); 341 if (const auto res = ReadCheatFileFromFolder(title_id, build_id_, cheats_dir, false)) {
345 if (res.has_value()) {
346 std::copy(res->begin(), res->end(), std::back_inserter(out)); 342 std::copy(res->begin(), res->end(), std::back_inserter(out));
347 } 343 }
348 } 344 }