diff options
| author | JosJuice <josjuice@gmail.com> | 2017-06-07 14:18:55 +0200 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2017-08-01 11:36:40 +0200 |
| commit | 878869488d292e8295daa5a885087f2ec1d875a8 (patch) | |
| tree | 6029d4a1df401b3e43a17828d15a46c5368c05d3 /Source/Core | |
| parent | 2098ee1b15d119cc1f4e890f72c55aab6d985969 (diff) | |
Boot: Consider DOL/ELF files as possible volumes
The old approach to detecting DOL/ELF files doesn't fit
with the new way of implementing extracted discs.
The game list is already doing it in a way that's similar
to the approach that this commit uses.
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/Core/Boot/Boot.cpp | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/Source/Core/Core/Boot/Boot.cpp b/Source/Core/Core/Boot/Boot.cpp index 7d83cc7660..bf1f87b3ec 100644 --- a/Source/Core/Core/Boot/Boot.cpp +++ b/Source/Core/Core/Boot/Boot.cpp @@ -63,35 +63,34 @@ std::unique_ptr<BootParameters> BootParameters::GenerateFromFile(const std::stri std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower); static const std::unordered_set<std::string> disc_image_extensions = { - {".gcm", ".iso", ".tgc", ".wbfs", ".ciso", ".gcz"}}; + {".gcm", ".iso", ".tgc", ".wbfs", ".ciso", ".gcz", ".dol", ".elf"}}; if (disc_image_extensions.find(extension) != disc_image_extensions.end() || is_drive) { - auto volume = DiscIO::CreateVolumeFromFilename(path); - if (!volume) + std::unique_ptr<DiscIO::Volume> volume = DiscIO::CreateVolumeFromFilename(path); + if (volume) + return std::make_unique<BootParameters>(Disc{path, std::move(volume)}); + + if (extension == ".elf") + return std::make_unique<BootParameters>(Executable{path, std::make_unique<ElfReader>(path)}); + + if (extension == ".dol") + return std::make_unique<BootParameters>(Executable{path, std::make_unique<DolReader>(path)}); + + if (is_drive) { - if (is_drive) - { - PanicAlertT("Could not read \"%s\". " - "There is no disc in the drive or it is not a GameCube/Wii backup. " - "Please note that Dolphin cannot play games directly from the original " - "GameCube and Wii discs.", - path.c_str()); - } - else - { - PanicAlertT("\"%s\" is an invalid GCM/ISO file, or is not a GC/Wii ISO.", path.c_str()); - } - return {}; + PanicAlertT("Could not read \"%s\". " + "There is no disc in the drive or it is not a GameCube/Wii backup. " + "Please note that Dolphin cannot play games directly from the original " + "GameCube and Wii discs.", + path.c_str()); + } + else + { + PanicAlertT("\"%s\" is an invalid GCM/ISO file, or is not a GC/Wii ISO.", path.c_str()); } - return std::make_unique<BootParameters>(Disc{path, std::move(volume)}); + return {}; } - if (extension == ".elf") - return std::make_unique<BootParameters>(Executable{path, std::make_unique<ElfReader>(path)}); - - if (extension == ".dol") - return std::make_unique<BootParameters>(Executable{path, std::make_unique<DolReader>(path)}); - if (extension == ".dff") return std::make_unique<BootParameters>(DFF{path}); |
