Skip to content
Snippets Groups Projects
Commit abbcc8e6 authored by Zach Hilman's avatar Zach Hilman
Browse files

romfs: Add SingleDiscard extraction type

Needed for manual RomFS extraction, as Full generates an extra directory and Truncated generates variable results.
parent 94db6e5f
No related branches found
No related tags found
No related merge requests found
...@@ -119,6 +119,9 @@ VirtualDir ExtractRomFS(VirtualFile file, RomFSExtractionType type) { ...@@ -119,6 +119,9 @@ VirtualDir ExtractRomFS(VirtualFile file, RomFSExtractionType type) {
VirtualDir out = std::move(root); VirtualDir out = std::move(root);
if (type == RomFSExtractionType::SingleDiscard)
return out->GetSubdirectories().front();
while (out->GetSubdirectories().size() == 1 && out->GetFiles().empty()) { while (out->GetSubdirectories().size() == 1 && out->GetFiles().empty()) {
if (out->GetSubdirectories().front()->GetName() == "data" && if (out->GetSubdirectories().front()->GetName() == "data" &&
type == RomFSExtractionType::Truncated) type == RomFSExtractionType::Truncated)
......
...@@ -33,8 +33,9 @@ struct IVFCHeader { ...@@ -33,8 +33,9 @@ struct IVFCHeader {
static_assert(sizeof(IVFCHeader) == 0xE0, "IVFCHeader has incorrect size."); static_assert(sizeof(IVFCHeader) == 0xE0, "IVFCHeader has incorrect size.");
enum class RomFSExtractionType { enum class RomFSExtractionType {
Full, // Includes data directory Full, // Includes data directory
Truncated, // Traverses into data directory Truncated, // Traverses into data directory
SingleDiscard, // Traverses into the first subdirectory of root
}; };
// Converts a RomFS binary blob to VFS Filesystem // Converts a RomFS binary blob to VFS Filesystem
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment