diff options
author | bunnei <bunneidev@gmail.com> | 2018-09-25 22:59:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-25 22:59:44 +0200 |
commit | 7b81e1e52565ee867c285e2b0c2526f8d4b82581 (patch) | |
tree | 718decad5aae4153d8acaa444058914a1c12f147 /src/core/file_sys/romfs.cpp | |
parent | Merge pull request #1393 from tech4me/svc (diff) | |
parent | fsmitm: Cleanup and modernize fsmitm port (diff) | |
download | yuzu-7b81e1e52565ee867c285e2b0c2526f8d4b82581.tar yuzu-7b81e1e52565ee867c285e2b0c2526f8d4b82581.tar.gz yuzu-7b81e1e52565ee867c285e2b0c2526f8d4b82581.tar.bz2 yuzu-7b81e1e52565ee867c285e2b0c2526f8d4b82581.tar.lz yuzu-7b81e1e52565ee867c285e2b0c2526f8d4b82581.tar.xz yuzu-7b81e1e52565ee867c285e2b0c2526f8d4b82581.tar.zst yuzu-7b81e1e52565ee867c285e2b0c2526f8d4b82581.zip |
Diffstat (limited to 'src/core/file_sys/romfs.cpp')
-rw-r--r-- | src/core/file_sys/romfs.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/core/file_sys/romfs.cpp b/src/core/file_sys/romfs.cpp index 9f6e41cdf..205284a4d 100644 --- a/src/core/file_sys/romfs.cpp +++ b/src/core/file_sys/romfs.cpp @@ -4,8 +4,10 @@ #include "common/common_types.h" #include "common/swap.h" +#include "core/file_sys/fsmitm_romfsbuild.h" #include "core/file_sys/romfs.h" #include "core/file_sys/vfs.h" +#include "core/file_sys/vfs_concat.h" #include "core/file_sys/vfs_offset.h" #include "core/file_sys/vfs_vector.h" @@ -98,7 +100,7 @@ void ProcessDirectory(VirtualFile file, std::size_t dir_offset, std::size_t file } } -VirtualDir ExtractRomFS(VirtualFile file) { +VirtualDir ExtractRomFS(VirtualFile file, RomFSExtractionType type) { RomFSHeader header{}; if (file->ReadObject(&header) != sizeof(RomFSHeader)) return nullptr; @@ -117,9 +119,22 @@ VirtualDir ExtractRomFS(VirtualFile file) { VirtualDir out = std::move(root); - while (out->GetSubdirectory("") != nullptr) - out = out->GetSubdirectory(""); + while (out->GetSubdirectories().size() == 1 && out->GetFiles().empty()) { + if (out->GetSubdirectories().front()->GetName() == "data" && + type == RomFSExtractionType::Truncated) + break; + out = out->GetSubdirectories().front(); + } return out; } + +VirtualFile CreateRomFS(VirtualDir dir) { + if (dir == nullptr) + return nullptr; + + RomFSBuildContext ctx{dir}; + return ConcatenateFiles<0>(ctx.Build(), dir->GetName()); +} + } // namespace FileSys |