From abbcc8e61e33ba093df9c823a03c70eccf010e4c Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Mon, 24 Dec 2018 16:18:28 -0500 Subject: romfs: Add SingleDiscard extraction type Needed for manual RomFS extraction, as Full generates an extra directory and Truncated generates variable results. --- src/core/file_sys/romfs.cpp | 3 +++ src/core/file_sys/romfs.h | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/core/file_sys/romfs.cpp b/src/core/file_sys/romfs.cpp index 81e1f66ac..ebbdf081e 100644 --- a/src/core/file_sys/romfs.cpp +++ b/src/core/file_sys/romfs.cpp @@ -119,6 +119,9 @@ VirtualDir ExtractRomFS(VirtualFile file, RomFSExtractionType type) { VirtualDir out = std::move(root); + if (type == RomFSExtractionType::SingleDiscard) + return out->GetSubdirectories().front(); + while (out->GetSubdirectories().size() == 1 && out->GetFiles().empty()) { if (out->GetSubdirectories().front()->GetName() == "data" && type == RomFSExtractionType::Truncated) diff --git a/src/core/file_sys/romfs.h b/src/core/file_sys/romfs.h index 0ec404731..0f35639bc 100644 --- a/src/core/file_sys/romfs.h +++ b/src/core/file_sys/romfs.h @@ -33,8 +33,9 @@ struct IVFCHeader { static_assert(sizeof(IVFCHeader) == 0xE0, "IVFCHeader has incorrect size."); enum class RomFSExtractionType { - Full, // Includes data directory - Truncated, // Traverses into data directory + Full, // Includes data directory + Truncated, // Traverses into data directory + SingleDiscard, // Traverses into the first subdirectory of root }; // Converts a RomFS binary blob to VFS Filesystem -- cgit v1.2.3