diff options
| -rw-r--r-- | src/core/core.cpp | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp index 7ca3652af..6acdffa6f 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp | |||
| @@ -92,33 +92,43 @@ FileSys::VirtualFile GetGameFileFromPath(const FileSys::VirtualFilesystem& vfs, | |||
| 92 | std::string dir_name; | 92 | std::string dir_name; |
| 93 | std::string filename; | 93 | std::string filename; |
| 94 | Common::SplitPath(path, &dir_name, &filename, nullptr); | 94 | Common::SplitPath(path, &dir_name, &filename, nullptr); |
| 95 | |||
| 95 | if (filename == "00") { | 96 | if (filename == "00") { |
| 96 | const auto dir = vfs->OpenDirectory(dir_name, FileSys::Mode::Read); | 97 | const auto dir = vfs->OpenDirectory(dir_name, FileSys::Mode::Read); |
| 97 | std::vector<FileSys::VirtualFile> concat; | 98 | std::vector<FileSys::VirtualFile> concat; |
| 98 | for (u8 i = 0; i < 0x10; ++i) { | 99 | |
| 99 | auto next = dir->GetFile(fmt::format("{:02X}", i)); | 100 | for (u32 i = 0; i < 0x10; ++i) { |
| 100 | if (next != nullptr) | 101 | const auto file_name = fmt::format("{:02X}", i); |
| 102 | auto next = dir->GetFile(file_name); | ||
| 103 | |||
| 104 | if (next != nullptr) { | ||
| 101 | concat.push_back(std::move(next)); | 105 | concat.push_back(std::move(next)); |
| 102 | else { | 106 | } else { |
| 103 | next = dir->GetFile(fmt::format("{:02x}", i)); | 107 | next = dir->GetFile(file_name); |
| 104 | if (next != nullptr) | 108 | |
| 105 | concat.push_back(std::move(next)); | 109 | if (next == nullptr) { |
| 106 | else | ||
| 107 | break; | 110 | break; |
| 111 | } | ||
| 112 | |||
| 113 | concat.push_back(std::move(next)); | ||
| 108 | } | 114 | } |
| 109 | } | 115 | } |
| 110 | 116 | ||
| 111 | if (concat.empty()) | 117 | if (concat.empty()) { |
| 112 | return nullptr; | 118 | return nullptr; |
| 119 | } | ||
| 113 | 120 | ||
| 114 | return FileSys::ConcatenatedVfsFile::MakeConcatenatedFile(concat, dir->GetName()); | 121 | return FileSys::ConcatenatedVfsFile::MakeConcatenatedFile(std::move(concat), |
| 122 | dir->GetName()); | ||
| 115 | } | 123 | } |
| 116 | 124 | ||
| 117 | if (Common::FS::IsDirectory(path)) | 125 | if (Common::FS::IsDirectory(path)) { |
| 118 | return vfs->OpenFile(path + "/" + "main", FileSys::Mode::Read); | 126 | return vfs->OpenFile(path + "/main", FileSys::Mode::Read); |
| 127 | } | ||
| 119 | 128 | ||
| 120 | return vfs->OpenFile(path, FileSys::Mode::Read); | 129 | return vfs->OpenFile(path, FileSys::Mode::Read); |
| 121 | } | 130 | } |
| 131 | |||
| 122 | struct System::Impl { | 132 | struct System::Impl { |
| 123 | explicit Impl(System& system) | 133 | explicit Impl(System& system) |
| 124 | : kernel{system}, fs_controller{system}, memory{system}, | 134 | : kernel{system}, fs_controller{system}, memory{system}, |