diff options
| author | spycrab <spycrab@users.noreply.github.com> | 2017-08-24 16:35:47 +0200 |
|---|---|---|
| committer | spycrab <spycrab@users.noreply.github.com> | 2017-08-29 02:57:46 +0200 |
| commit | a2b7632850015efde794f4cac0b1a80d0cd752a7 (patch) | |
| tree | 7b9527e39074528656c1fa10ec07e4a70519a652 /Source/Core/DolphinQt2/MainWindow.cpp | |
| parent | 0dfde1d34e7f4f068aad1461619691b8eea8d84d (diff) | |
Qt: Implement "Load GameCube Main Menu"
Diffstat (limited to 'Source/Core/DolphinQt2/MainWindow.cpp')
| -rw-r--r-- | Source/Core/DolphinQt2/MainWindow.cpp | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/Source/Core/DolphinQt2/MainWindow.cpp b/Source/Core/DolphinQt2/MainWindow.cpp index 6dc3ff4ec9..2723ca6431 100644 --- a/Source/Core/DolphinQt2/MainWindow.cpp +++ b/Source/Core/DolphinQt2/MainWindow.cpp @@ -14,6 +14,7 @@ #include <QMimeData> #include "Common/Common.h" +#include "Common/Compat/optional" #include "Core/Boot/Boot.h" #include "Core/BootManager.h" @@ -199,6 +200,7 @@ void MainWindow::ConnectMenuBar() connect(m_menu_bar, &MenuBar::ConfigureHotkeys, this, &MainWindow::ShowHotkeyDialog); // Tools + connect(m_menu_bar, &MenuBar::BootGameCubeIPL, this, &MainWindow::OnBootGameCubeIPL); connect(m_menu_bar, &MenuBar::PerformOnlineUpdate, this, &MainWindow::PerformOnlineUpdate); connect(m_menu_bar, &MenuBar::BootWiiSystemMenu, this, &MainWindow::BootWiiSystemMenu); connect(m_menu_bar, &MenuBar::StartNetPlay, this, &MainWindow::ShowNetPlaySetupDialog); @@ -345,10 +347,10 @@ void MainWindow::OnStopComplete() QGuiApplication::instance()->quit(); // If the current emulation prevented the booting of another, do that now - if (!m_pending_boot.isEmpty()) + if (m_pending_boot != nullptr) { - StartGame(m_pending_boot); - m_pending_boot.clear(); + StartGame(std::move(m_pending_boot)); + m_pending_boot.reset(); } } @@ -447,6 +449,11 @@ void MainWindow::ScreenShot() void MainWindow::StartGame(const QString& path) { + StartGame(BootParameters::GenerateFromFile(path.toStdString())); +} + +void MainWindow::StartGame(std::unique_ptr<BootParameters>&& parameters) +{ // If we're running, only start a new game once we've stopped the last. if (Core::GetState() != Core::State::Uninitialized) { @@ -454,11 +461,11 @@ void MainWindow::StartGame(const QString& path) return; // As long as the shutdown isn't complete, we can't boot, so let's boot later - m_pending_boot = path; + m_pending_boot = std::move(parameters); return; } // Boot up, show an error if it fails to load the game. - if (!BootManager::BootCore(BootParameters::GenerateFromFile(path.toStdString()))) + if (!BootManager::BootCore(std::move(parameters))) { QMessageBox::critical(this, tr("Error"), tr("Failed to init core"), QMessageBox::Ok); return; @@ -637,7 +644,8 @@ void MainWindow::NetPlayInit() m_netplay_setup_dialog = new NetPlaySetupDialog(this); m_netplay_dialog = new NetPlayDialog(this); - connect(m_netplay_dialog, &NetPlayDialog::Boot, this, &MainWindow::StartGame); + connect(m_netplay_dialog, &NetPlayDialog::Boot, this, + static_cast<void (MainWindow::*)(const QString&)>(&MainWindow::StartGame)); connect(m_netplay_dialog, &NetPlayDialog::Stop, this, &MainWindow::RequestStop); connect(m_netplay_dialog, &NetPlayDialog::rejected, this, &MainWindow::NetPlayQuit); connect(this, &MainWindow::EmulationStopped, m_netplay_dialog, &NetPlayDialog::EmulationStopped); @@ -819,3 +827,8 @@ QSize MainWindow::sizeHint() const { return QSize(800, 600); } + +void MainWindow::OnBootGameCubeIPL(DiscIO::Region region) +{ + StartGame(std::make_unique<BootParameters>(BootParameters::IPL{region})); +} |
