diff options
| author | 2018-10-01 09:12:14 -0400 | |
|---|---|---|
| committer | 2018-10-04 12:29:14 -0400 | |
| commit | bc4bec8a60720b1f911fa960ab633eec4afc975e (patch) | |
| tree | aa7fe54a0322c12fa18205b4c5fdac062a9077c0 | |
| parent | Merge pull request #1415 from DarkLordZach/ips (diff) | |
| download | yuzu-bc4bec8a60720b1f911fa960ab633eec4afc975e.tar.gz yuzu-bc4bec8a60720b1f911fa960ab633eec4afc975e.tar.xz yuzu-bc4bec8a60720b1f911fa960ab633eec4afc975e.zip | |
fsmitm_romfsbuild: Add support for stubbing and IPS patches in LFS
Diffstat (limited to '')
| -rw-r--r-- | src/core/file_sys/fsmitm_romfsbuild.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/core/file_sys/fsmitm_romfsbuild.cpp b/src/core/file_sys/fsmitm_romfsbuild.cpp index 2a913ce82..4aa8ae369 100644 --- a/src/core/file_sys/fsmitm_romfsbuild.cpp +++ b/src/core/file_sys/fsmitm_romfsbuild.cpp | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | #include "common/alignment.h" | 26 | #include "common/alignment.h" |
| 27 | #include "common/assert.h" | 27 | #include "common/assert.h" |
| 28 | #include "core/file_sys/fsmitm_romfsbuild.h" | 28 | #include "core/file_sys/fsmitm_romfsbuild.h" |
| 29 | #include "core/file_sys/ips_layer.h" | ||
| 29 | #include "core/file_sys/vfs.h" | 30 | #include "core/file_sys/vfs.h" |
| 30 | #include "core/file_sys/vfs_vector.h" | 31 | #include "core/file_sys/vfs_vector.h" |
| 31 | 32 | ||
| @@ -138,6 +139,9 @@ void RomFSBuildContext::VisitDirectory(VirtualDir root_romfs, | |||
| 138 | 139 | ||
| 139 | for (const auto& kv : entries) { | 140 | for (const auto& kv : entries) { |
| 140 | if (kv.second == VfsEntryType::Directory) { | 141 | if (kv.second == VfsEntryType::Directory) { |
| 142 | if (dir->GetSubdirectory(kv.first + ".stub") != nullptr) | ||
| 143 | continue; | ||
| 144 | |||
| 141 | const auto child = std::make_shared<RomFSBuildDirectoryContext>(); | 145 | const auto child = std::make_shared<RomFSBuildDirectoryContext>(); |
| 142 | // Set child's path. | 146 | // Set child's path. |
| 143 | child->cur_path_ofs = parent->path_len + 1; | 147 | child->cur_path_ofs = parent->path_len + 1; |
| @@ -151,6 +155,9 @@ void RomFSBuildContext::VisitDirectory(VirtualDir root_romfs, | |||
| 151 | child_dirs.push_back(child); | 155 | child_dirs.push_back(child); |
| 152 | } | 156 | } |
| 153 | } else { | 157 | } else { |
| 158 | if (dir->GetFile(kv.first + ".stub") != nullptr) | ||
| 159 | continue; | ||
| 160 | |||
| 154 | const auto child = std::make_shared<RomFSBuildFileContext>(); | 161 | const auto child = std::make_shared<RomFSBuildFileContext>(); |
| 155 | // Set child's path. | 162 | // Set child's path. |
| 156 | child->cur_path_ofs = parent->path_len + 1; | 163 | child->cur_path_ofs = parent->path_len + 1; |
| @@ -162,6 +169,13 @@ void RomFSBuildContext::VisitDirectory(VirtualDir root_romfs, | |||
| 162 | 169 | ||
| 163 | child->source = root_romfs->GetFileRelative(child->path); | 170 | child->source = root_romfs->GetFileRelative(child->path); |
| 164 | 171 | ||
| 172 | if (dir->GetFile(kv.first + ".ips") != nullptr) { | ||
| 173 | const auto ips = dir->GetFile(kv.first + ".ips"); | ||
| 174 | auto patched = PatchIPS(child->source, ips); | ||
| 175 | if (patched != nullptr) | ||
| 176 | child->source = std::move(patched); | ||
| 177 | } | ||
| 178 | |||
| 165 | child->size = child->source->GetSize(); | 179 | child->size = child->source->GetSize(); |
| 166 | 180 | ||
| 167 | AddFile(parent, child); | 181 | AddFile(parent, child); |