diff options
| author | 2024-02-02 12:33:42 -0600 | |
|---|---|---|
| committer | 2024-02-02 13:25:38 -0600 | |
| commit | fb3ef957bbb6d674f7482572443a678e6b4a612e (patch) | |
| tree | dfc5a8c071884b37f6e917269d48e0ad5ab3484d | |
| parent | Merge pull request #12857 from liamwhite/const (diff) | |
| download | yuzu-fb3ef957bbb6d674f7482572443a678e6b4a612e.tar.gz yuzu-fb3ef957bbb6d674f7482572443a678e6b4a612e.tar.xz yuzu-fb3ef957bbb6d674f7482572443a678e6b4a612e.zip | |
service: fs: Skip non user id folders
| -rw-r--r-- | src/common/hex_util.h | 3 | ||||
| -rw-r--r-- | src/core/hle/service/filesystem/fsp/fsp_srv.cpp | 9 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/common/hex_util.h b/src/common/hex_util.h index a00904939..618f53152 100644 --- a/src/common/hex_util.h +++ b/src/common/hex_util.h | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | #include <string> | 9 | #include <string> |
| 10 | #include <vector> | 10 | #include <vector> |
| 11 | #include <fmt/format.h> | 11 | #include <fmt/format.h> |
| 12 | #include "common/assert.h" | ||
| 12 | #include "common/common_types.h" | 13 | #include "common/common_types.h" |
| 13 | 14 | ||
| 14 | namespace Common { | 15 | namespace Common { |
| @@ -29,6 +30,8 @@ namespace Common { | |||
| 29 | 30 | ||
| 30 | template <std::size_t Size, bool le = false> | 31 | template <std::size_t Size, bool le = false> |
| 31 | [[nodiscard]] constexpr std::array<u8, Size> HexStringToArray(std::string_view str) { | 32 | [[nodiscard]] constexpr std::array<u8, Size> HexStringToArray(std::string_view str) { |
| 33 | ASSERT_MSG(Size * 2 <= str.size(), "Invalid string size"); | ||
| 34 | |||
| 32 | std::array<u8, Size> out{}; | 35 | std::array<u8, Size> out{}; |
| 33 | if constexpr (le) { | 36 | if constexpr (le) { |
| 34 | for (std::size_t i = 2 * Size - 2; i <= 2 * Size; i -= 2) { | 37 | for (std::size_t i = 2 * Size - 2; i <= 2 * Size; i -= 2) { |
diff --git a/src/core/hle/service/filesystem/fsp/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp/fsp_srv.cpp index 5fe534c73..63c2d3a58 100644 --- a/src/core/hle/service/filesystem/fsp/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp/fsp_srv.cpp | |||
| @@ -115,6 +115,11 @@ private: | |||
| 115 | if (type->GetName() == "save") { | 115 | if (type->GetName() == "save") { |
| 116 | for (const auto& save_id : type->GetSubdirectories()) { | 116 | for (const auto& save_id : type->GetSubdirectories()) { |
| 117 | for (const auto& user_id : save_id->GetSubdirectories()) { | 117 | for (const auto& user_id : save_id->GetSubdirectories()) { |
| 118 | // Skip non user id subdirectories | ||
| 119 | if (user_id->GetName().size() != 0x20) { | ||
| 120 | continue; | ||
| 121 | } | ||
| 122 | |||
| 118 | const auto save_id_numeric = stoull_be(save_id->GetName()); | 123 | const auto save_id_numeric = stoull_be(save_id->GetName()); |
| 119 | auto user_id_numeric = Common::HexStringToArray<0x10>(user_id->GetName()); | 124 | auto user_id_numeric = Common::HexStringToArray<0x10>(user_id->GetName()); |
| 120 | std::reverse(user_id_numeric.begin(), user_id_numeric.end()); | 125 | std::reverse(user_id_numeric.begin(), user_id_numeric.end()); |
| @@ -160,6 +165,10 @@ private: | |||
| 160 | } else if (space == FileSys::SaveDataSpaceId::TemporaryStorage) { | 165 | } else if (space == FileSys::SaveDataSpaceId::TemporaryStorage) { |
| 161 | // Temporary Storage | 166 | // Temporary Storage |
| 162 | for (const auto& user_id : type->GetSubdirectories()) { | 167 | for (const auto& user_id : type->GetSubdirectories()) { |
| 168 | // Skip non user id subdirectories | ||
| 169 | if (user_id->GetName().size() != 0x20) { | ||
| 170 | continue; | ||
| 171 | } | ||
| 163 | for (const auto& title_id : user_id->GetSubdirectories()) { | 172 | for (const auto& title_id : user_id->GetSubdirectories()) { |
| 164 | if (!title_id->GetFiles().empty() || | 173 | if (!title_id->GetFiles().empty() || |
| 165 | !title_id->GetSubdirectories().empty()) { | 174 | !title_id->GetSubdirectories().empty()) { |