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.
This commit is contained in:
JosJuice
2017-06-07 20:32:09 +02:00
parent 5f8935932d
commit 37c09343d8
14 changed files with 215 additions and 307 deletions

View File

@ -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));
}
}