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:
JosJuice
2017-12-25 18:07:29 +01:00
parent c9b78e23a2
commit 9dd88d76dd
13 changed files with 93 additions and 81 deletions

View File

@ -9,6 +9,7 @@
#include <cstdio>
#include <future>
#include <mutex>
#include <optional>
#include <string>
#include <vector>
#include <wx/app.h>
@ -301,7 +302,7 @@ void CFrame::OpenGeneralConfiguration(wxWindowID tab_id)
// 1. Show the game list and boot the selected game.
// 2. Default ISO
// 3. Boot last selected game
void CFrame::BootGame(const std::string& filename)
void CFrame::BootGame(const std::string& filename, const std::optional<std::string>& savestate_path)
{
std::string bootfile = filename;
SConfig& StartUp = SConfig::GetInstance();
@ -331,7 +332,7 @@ void CFrame::BootGame(const std::string& filename)
}
if (!bootfile.empty())
{
StartGame(BootParameters::GenerateFromFile(bootfile));
StartGame(BootParameters::GenerateFromFile(bootfile, savestate_path));
}
}
@ -513,8 +514,9 @@ void CFrame::OnPlayRecording(wxCommandEvent& WXUNUSED(event))
GetMenuBar()->FindItem(IDM_RECORD_READ_ONLY)->Check();
}
if (Movie::PlayInput(WxStrToStr(path)))
BootGame("");
std::optional<std::string> savestate_path;
if (Movie::PlayInput(WxStrToStr(path), &savestate_path))
BootGame("", savestate_path);
}
void CFrame::OnStopRecording(wxCommandEvent& WXUNUSED(event))