Эх сурвалжийг харах

romfs: Add SingleDiscard extraction type
Needed for manual RomFS extraction, as Full generates an extra directory and Truncated generates variable results.

Zach Hilman 7 жил өмнө
parent
commit
abbcc8e61e

+ 3 - 0
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)

+ 3 - 2
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