mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 17:19:44 -06: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:
@ -8,6 +8,7 @@
|
||||
#include <atomic>
|
||||
#include <cstddef>
|
||||
#include <fstream>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
@ -130,8 +131,9 @@ void CRenderFrame::OnDropFiles(wxDropFilesEvent& event)
|
||||
main_frame->GetMenuBar()->FindItem(IDM_RECORD_READ_ONLY)->Check(true);
|
||||
}
|
||||
|
||||
if (Movie::PlayInput(filepath))
|
||||
main_frame->BootGame("");
|
||||
std::optional<std::string> savestate_path;
|
||||
if (Movie::PlayInput(filepath, &savestate_path))
|
||||
main_frame->BootGame("", savestate_path);
|
||||
}
|
||||
else if (!Core::IsRunning())
|
||||
{
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <wx/bitmap.h>
|
||||
@ -105,7 +106,7 @@ public:
|
||||
void ToggleLogConfigWindow(bool bShow);
|
||||
void StatusBarMessage(const char* format, ...);
|
||||
void ClearStatusBar();
|
||||
void BootGame(const std::string& filename);
|
||||
void BootGame(const std::string& filename, const std::optional<std::string>& savestate_path = {});
|
||||
void StartGame(std::unique_ptr<BootParameters> boot);
|
||||
bool RendererHasFocus();
|
||||
bool RendererIsFullscreen();
|
||||
|
@ -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))
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <OptionParser.h>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <wx/app.h>
|
||||
@ -256,12 +257,18 @@ void DolphinApp::AfterInit()
|
||||
|
||||
if (m_play_movie && !m_movie_file.empty())
|
||||
{
|
||||
if (Movie::PlayInput(WxStrToStr(m_movie_file)))
|
||||
std::optional<std::string> savestate_path;
|
||||
if (Movie::PlayInput(WxStrToStr(m_movie_file), &savestate_path))
|
||||
{
|
||||
if (m_boot)
|
||||
{
|
||||
m_boot->savestate_path = savestate_path;
|
||||
main_frame->StartGame(std::move(m_boot));
|
||||
}
|
||||
else
|
||||
main_frame->BootGame("");
|
||||
{
|
||||
main_frame->BootGame("", savestate_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
// First check if we have an exec command line.
|
||||
|
Reference in New Issue
Block a user