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