romfs: Add SingleDiscard extraction type
Needed for manual RomFS extraction, as Full generates an extra directory and Truncated generates variable results.
This commit is contained in:
parent
94db6e5f3f
commit
abbcc8e61e
@ -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 {
|
|||||||
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
|
||||||
|
Loading…
Reference in New Issue
Block a user