From 37c09343d82efec3f758f4ad08ccb59686fd8a10 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Wed, 7 Jun 2017 20:32:09 +0200 Subject: Turn VolumeDirectory into DirectoryBlob This lets VolumeDirectory/DirectoryBlob skip implementing various volume functions like GetGameID, GetBanner, etc. It also lets us view extracted discs in the game list. This ends up breaking the boot process for Wii DirectoryBlobs due to workarounds being removed from the boot process, but that will be fixed later by adding proper DirectoryBlob support for things like TMDs. We now expect the directories to be laid out in a certain format (based on the format that WIT uses) instead of requiring the user to set the DVD root and apploader path settings. --- Source/Core/DiscIO/Blob.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'Source/Core/DiscIO/Blob.cpp') 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 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 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)); } } -- cgit v1.2.3 From a6bbf7e21b7ae1c0d11feb3acb88875b7b6e30ca Mon Sep 17 00:00:00 2001 From: JosJuice Date: Fri, 9 Jun 2017 12:45:34 +0200 Subject: DirectoryBlob: Don't keep DOL in memory --- Source/Core/DiscIO/Blob.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/DiscIO/Blob.cpp') diff --git a/Source/Core/DiscIO/Blob.cpp b/Source/Core/DiscIO/Blob.cpp index a27f6861e1..7f4eeccb1c 100644 --- a/Source/Core/DiscIO/Blob.cpp +++ b/Source/Core/DiscIO/Blob.cpp @@ -204,7 +204,7 @@ std::unique_ptr CreateBlobReader(const std::string& filename) return WbfsFileReader::Create(std::move(file), filename); default: if (DirectoryBlobReader::IsValidDirectoryBlob(filename)) - return DirectoryBlobReader::Create(std::move(file), filename); + return DirectoryBlobReader::Create(filename); return PlainFileReader::Create(std::move(file)); } -- cgit v1.2.3 From 251828ccc0d449ff9da1c823c7fb5aee6c4ace73 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Fri, 9 Jun 2017 12:56:36 +0200 Subject: Don't check validity twice when creating DirectoryBlob --- Source/Core/DiscIO/Blob.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Source/Core/DiscIO/Blob.cpp') diff --git a/Source/Core/DiscIO/Blob.cpp b/Source/Core/DiscIO/Blob.cpp index 7f4eeccb1c..5e603610b2 100644 --- a/Source/Core/DiscIO/Blob.cpp +++ b/Source/Core/DiscIO/Blob.cpp @@ -203,8 +203,8 @@ std::unique_ptr CreateBlobReader(const std::string& filename) case WBFS_MAGIC: return WbfsFileReader::Create(std::move(file), filename); default: - if (DirectoryBlobReader::IsValidDirectoryBlob(filename)) - return DirectoryBlobReader::Create(filename); + if (auto directory_blob = DirectoryBlobReader::Create(filename)) + return std::move(directory_blob); return PlainFileReader::Create(std::move(file)); } -- cgit v1.2.3