From 878869488d292e8295daa5a885087f2ec1d875a8 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Wed, 7 Jun 2017 14:18:55 +0200 Subject: [PATCH] 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. --- Source/Core/Core/Boot/Boot.cpp | 45 +++++++++++++++++----------------- 1 file 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::GenerateFromFile(const std::stri std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower); static const std::unordered_set 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 volume = DiscIO::CreateVolumeFromFilename(path); + if (volume) + return std::make_unique(Disc{path, std::move(volume)}); + + if (extension == ".elf") + return std::make_unique(Executable{path, std::make_unique(path)}); + + if (extension == ".dol") + return std::make_unique(Executable{path, std::make_unique(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()); } - return std::make_unique(Disc{path, std::move(volume)}); + else + { + PanicAlertT("\"%s\" is an invalid GCM/ISO file, or is not a GC/Wii ISO.", path.c_str()); + } + return {}; } - if (extension == ".elf") - return std::make_unique(Executable{path, std::make_unique(path)}); - - if (extension == ".dol") - return std::make_unique(Executable{path, std::make_unique(path)}); - if (extension == ".dff") return std::make_unique(DFF{path});