summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/Blob.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/DiscIO/Blob.cpp')
-rw-r--r--Source/Core/DiscIO/Blob.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/Source/Core/DiscIO/Blob.cpp b/Source/Core/DiscIO/Blob.cpp
index da8640c7bc..a27f6861e1 100644
--- a/Source/Core/DiscIO/Blob.cpp
+++ b/Source/Core/DiscIO/Blob.cpp
@@ -16,6 +16,7 @@
#include "DiscIO/Blob.h"
#include "DiscIO/CISOBlob.h"
#include "DiscIO/CompressedBlob.h"
+#include "DiscIO/DirectoryBlob.h"
#include "DiscIO/DriveBlob.h"
#include "DiscIO/FileBlob.h"
#include "DiscIO/TGCBlob.h"
@@ -183,12 +184,13 @@ std::unique_ptr<BlobReader> CreateBlobReader(const std::string& filename)
if (!file.ReadArray(&magic, 1))
return nullptr;
- // Conveniently, every supported file format (except for plain disc images) starts
- // with a 4-byte magic number that identifies the format, so we just need a simple
- // switch statement to create the right blob type. If the magic number doesn't
- // match any known magic number, we assume it's a plain disc image. If that
- // assumption is wrong, the volume code that runs later will notice the error
- // because the blob won't provide valid data when reading the GC/Wii disc header.
+ // Conveniently, every supported file format (except for plain disc images and
+ // extracted discs) starts with a 4-byte magic number that identifies the format,
+ // so we just need a simple switch statement to create the right blob type. If the
+ // magic number doesn't match any known magic number and the directory structure
+ // doesn't match the directory blob format, we assume it's a plain disc image. If
+ // that assumption is wrong, the volume code that runs later will notice the error
+ // because the blob won't provide the right data when reading the GC/Wii disc header.
switch (magic)
{
@@ -201,6 +203,9 @@ std::unique_ptr<BlobReader> CreateBlobReader(const std::string& filename)
case WBFS_MAGIC:
return WbfsFileReader::Create(std::move(file), filename);
default:
+ if (DirectoryBlobReader::IsValidDirectoryBlob(filename))
+ return DirectoryBlobReader::Create(std::move(file), filename);
+
return PlainFileReader::Create(std::move(file));
}
}