diff options
| author | Leo Lam <leolino.lam@gmail.com> | 2017-08-01 19:19:14 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-08-01 19:19:14 +0800 |
| commit | bf2241ccd2586f7c3d7c84737b0112461b56a08b (patch) | |
| tree | 01f4e79ab28c850b2b015f93c0e7ca962c80e845 /Source/Core/DiscIO/Blob.cpp | |
| parent | 2098ee1b15d119cc1f4e890f72c55aab6d985969 (diff) | |
| parent | b6c6a04f9552c804fdb6a5a9eae2b51fd902d3ef (diff) | |
Merge pull request #5573 from JosJuice/directory-blob
Turn VolumeDirectory into DirectoryBlob
Diffstat (limited to 'Source/Core/DiscIO/Blob.cpp')
| -rw-r--r-- | Source/Core/DiscIO/Blob.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/Source/Core/DiscIO/Blob.cpp b/Source/Core/DiscIO/Blob.cpp index da8640c7bc..5e603610b2 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 (auto directory_blob = DirectoryBlobReader::Create(filename)) + return std::move(directory_blob); + return PlainFileReader::Create(std::move(file)); } } |
