mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-26 20:25:58 +00:00
Redesign the ability to load state at boot
BootParameters can now contain the path of a savestate to load at boot. Movie has been made to use this instead of poking at Core.cpp's state.
This commit is contained in:
parent
c9b78e23a2
commit
9dd88d76dd
13 changed files with 93 additions and 81 deletions
|
@ -48,11 +48,15 @@
|
|||
#include "DiscIO/Enums.h"
|
||||
#include "DiscIO/Volume.h"
|
||||
|
||||
BootParameters::BootParameters(Parameters&& parameters_) : parameters(std::move(parameters_))
|
||||
BootParameters::BootParameters(Parameters&& parameters_,
|
||||
const std::optional<std::string>& savestate_path_)
|
||||
: parameters(std::move(parameters_)), savestate_path(savestate_path_)
|
||||
{
|
||||
}
|
||||
|
||||
std::unique_ptr<BootParameters> BootParameters::GenerateFromFile(const std::string& path)
|
||||
std::unique_ptr<BootParameters>
|
||||
BootParameters::GenerateFromFile(const std::string& path,
|
||||
const std::optional<std::string>& savestate_path)
|
||||
{
|
||||
const bool is_drive = cdio_is_cdrom(path);
|
||||
// Check if the file exist, we may have gotten it from a --elf command line
|
||||
|
@ -73,13 +77,19 @@ std::unique_ptr<BootParameters> BootParameters::GenerateFromFile(const std::stri
|
|||
{
|
||||
std::unique_ptr<DiscIO::Volume> volume = DiscIO::CreateVolumeFromFilename(path);
|
||||
if (volume)
|
||||
return std::make_unique<BootParameters>(Disc{path, std::move(volume)});
|
||||
return std::make_unique<BootParameters>(Disc{path, std::move(volume)}, savestate_path);
|
||||
|
||||
if (extension == ".elf")
|
||||
return std::make_unique<BootParameters>(Executable{path, std::make_unique<ElfReader>(path)});
|
||||
{
|
||||
return std::make_unique<BootParameters>(Executable{path, std::make_unique<ElfReader>(path)},
|
||||
savestate_path);
|
||||
}
|
||||
|
||||
if (extension == ".dol")
|
||||
return std::make_unique<BootParameters>(Executable{path, std::make_unique<DolReader>(path)});
|
||||
{
|
||||
return std::make_unique<BootParameters>(Executable{path, std::make_unique<DolReader>(path)},
|
||||
savestate_path);
|
||||
}
|
||||
|
||||
if (is_drive)
|
||||
{
|
||||
|
@ -97,10 +107,10 @@ std::unique_ptr<BootParameters> BootParameters::GenerateFromFile(const std::stri
|
|||
}
|
||||
|
||||
if (extension == ".dff")
|
||||
return std::make_unique<BootParameters>(DFF{path});
|
||||
return std::make_unique<BootParameters>(DFF{path}, savestate_path);
|
||||
|
||||
if (extension == ".wad")
|
||||
return std::make_unique<BootParameters>(DiscIO::WiiWAD{path});
|
||||
return std::make_unique<BootParameters>(DiscIO::WiiWAD{path}, savestate_path);
|
||||
|
||||
PanicAlertT("Could not recognize file %s", path.c_str());
|
||||
return {};
|
||||
|
|
|
@ -67,12 +67,15 @@ struct BootParameters
|
|||
std::string dff_path;
|
||||
};
|
||||
|
||||
static std::unique_ptr<BootParameters> GenerateFromFile(const std::string& path);
|
||||
static std::unique_ptr<BootParameters>
|
||||
GenerateFromFile(const std::string& boot_path,
|
||||
const std::optional<std::string>& savestate_path = {});
|
||||
|
||||
using Parameters = std::variant<Disc, Executable, DiscIO::WiiWAD, NANDTitle, IPL, DFF>;
|
||||
BootParameters(Parameters&& parameters_);
|
||||
BootParameters(Parameters&& parameters_, const std::optional<std::string>& savestate_path_ = {});
|
||||
|
||||
Parameters parameters;
|
||||
std::optional<std::string> savestate_path;
|
||||
};
|
||||
|
||||
class CBoot
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue