mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
Qt: Implement "Load GameCube Main Menu"
This commit is contained in:
parent
0dfde1d34e
commit
a2b7632850
@ -14,6 +14,7 @@
|
|||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
|
|
||||||
#include "Common/Common.h"
|
#include "Common/Common.h"
|
||||||
|
#include "Common/Compat/optional"
|
||||||
|
|
||||||
#include "Core/Boot/Boot.h"
|
#include "Core/Boot/Boot.h"
|
||||||
#include "Core/BootManager.h"
|
#include "Core/BootManager.h"
|
||||||
@ -199,6 +200,7 @@ void MainWindow::ConnectMenuBar()
|
|||||||
connect(m_menu_bar, &MenuBar::ConfigureHotkeys, this, &MainWindow::ShowHotkeyDialog);
|
connect(m_menu_bar, &MenuBar::ConfigureHotkeys, this, &MainWindow::ShowHotkeyDialog);
|
||||||
|
|
||||||
// Tools
|
// Tools
|
||||||
|
connect(m_menu_bar, &MenuBar::BootGameCubeIPL, this, &MainWindow::OnBootGameCubeIPL);
|
||||||
connect(m_menu_bar, &MenuBar::PerformOnlineUpdate, this, &MainWindow::PerformOnlineUpdate);
|
connect(m_menu_bar, &MenuBar::PerformOnlineUpdate, this, &MainWindow::PerformOnlineUpdate);
|
||||||
connect(m_menu_bar, &MenuBar::BootWiiSystemMenu, this, &MainWindow::BootWiiSystemMenu);
|
connect(m_menu_bar, &MenuBar::BootWiiSystemMenu, this, &MainWindow::BootWiiSystemMenu);
|
||||||
connect(m_menu_bar, &MenuBar::StartNetPlay, this, &MainWindow::ShowNetPlaySetupDialog);
|
connect(m_menu_bar, &MenuBar::StartNetPlay, this, &MainWindow::ShowNetPlaySetupDialog);
|
||||||
@ -345,10 +347,10 @@ void MainWindow::OnStopComplete()
|
|||||||
QGuiApplication::instance()->quit();
|
QGuiApplication::instance()->quit();
|
||||||
|
|
||||||
// If the current emulation prevented the booting of another, do that now
|
// 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);
|
StartGame(std::move(m_pending_boot));
|
||||||
m_pending_boot.clear();
|
m_pending_boot.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -446,6 +448,11 @@ void MainWindow::ScreenShot()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::StartGame(const QString& path)
|
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 we're running, only start a new game once we've stopped the last.
|
||||||
if (Core::GetState() != Core::State::Uninitialized)
|
if (Core::GetState() != Core::State::Uninitialized)
|
||||||
@ -454,11 +461,11 @@ void MainWindow::StartGame(const QString& path)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// As long as the shutdown isn't complete, we can't boot, so let's boot later
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
// Boot up, show an error if it fails to load the game.
|
// 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);
|
QMessageBox::critical(this, tr("Error"), tr("Failed to init core"), QMessageBox::Ok);
|
||||||
return;
|
return;
|
||||||
@ -637,7 +644,8 @@ void MainWindow::NetPlayInit()
|
|||||||
m_netplay_setup_dialog = new NetPlaySetupDialog(this);
|
m_netplay_setup_dialog = new NetPlaySetupDialog(this);
|
||||||
m_netplay_dialog = new NetPlayDialog(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::Stop, this, &MainWindow::RequestStop);
|
||||||
connect(m_netplay_dialog, &NetPlayDialog::rejected, this, &MainWindow::NetPlayQuit);
|
connect(m_netplay_dialog, &NetPlayDialog::rejected, this, &MainWindow::NetPlayQuit);
|
||||||
connect(this, &MainWindow::EmulationStopped, m_netplay_dialog, &NetPlayDialog::EmulationStopped);
|
connect(this, &MainWindow::EmulationStopped, m_netplay_dialog, &NetPlayDialog::EmulationStopped);
|
||||||
@ -819,3 +827,8 @@ QSize MainWindow::sizeHint() const
|
|||||||
{
|
{
|
||||||
return QSize(800, 600);
|
return QSize(800, 600);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::OnBootGameCubeIPL(DiscIO::Region region)
|
||||||
|
{
|
||||||
|
StartGame(std::make_unique<BootParameters>(BootParameters::IPL{region}));
|
||||||
|
}
|
||||||
|
@ -9,11 +9,14 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QToolBar>
|
#include <QToolBar>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "DolphinQt2/GameList/GameList.h"
|
#include "DolphinQt2/GameList/GameList.h"
|
||||||
#include "DolphinQt2/MenuBar.h"
|
#include "DolphinQt2/MenuBar.h"
|
||||||
#include "DolphinQt2/RenderWidget.h"
|
#include "DolphinQt2/RenderWidget.h"
|
||||||
#include "DolphinQt2/ToolBar.h"
|
#include "DolphinQt2/ToolBar.h"
|
||||||
|
|
||||||
|
struct BootParameters;
|
||||||
class HotkeyScheduler;
|
class HotkeyScheduler;
|
||||||
class LoggerWidget;
|
class LoggerWidget;
|
||||||
class MappingWindow;
|
class MappingWindow;
|
||||||
@ -83,6 +86,7 @@ private:
|
|||||||
void InitCoreCallbacks();
|
void InitCoreCallbacks();
|
||||||
|
|
||||||
void StartGame(const QString& path);
|
void StartGame(const QString& path);
|
||||||
|
void StartGame(std::unique_ptr<BootParameters>&& parameters);
|
||||||
void ShowRenderWidget();
|
void ShowRenderWidget();
|
||||||
void HideRenderWidget();
|
void HideRenderWidget();
|
||||||
|
|
||||||
@ -99,6 +103,7 @@ private:
|
|||||||
bool NetPlayHost(const QString& game_id);
|
bool NetPlayHost(const QString& game_id);
|
||||||
void NetPlayQuit();
|
void NetPlayQuit();
|
||||||
|
|
||||||
|
void OnBootGameCubeIPL(DiscIO::Region region);
|
||||||
void OnStopComplete();
|
void OnStopComplete();
|
||||||
void dragEnterEvent(QDragEnterEvent* event) override;
|
void dragEnterEvent(QDragEnterEvent* event) override;
|
||||||
void dropEvent(QDropEvent* event) override;
|
void dropEvent(QDropEvent* event) override;
|
||||||
@ -113,7 +118,7 @@ private:
|
|||||||
bool m_stop_requested = false;
|
bool m_stop_requested = false;
|
||||||
bool m_exit_requested = false;
|
bool m_exit_requested = false;
|
||||||
int m_state_slot = 1;
|
int m_state_slot = 1;
|
||||||
QString m_pending_boot;
|
std::unique_ptr<BootParameters> m_pending_boot;
|
||||||
|
|
||||||
HotkeyScheduler* m_hotkey_scheduler;
|
HotkeyScheduler* m_hotkey_scheduler;
|
||||||
ControllersWindow* m_controllers_window;
|
ControllersWindow* m_controllers_window;
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
|
#include "Common/CommonPaths.h"
|
||||||
|
#include "Common/FileUtil.h"
|
||||||
#include "Core/CommonTitles.h"
|
#include "Core/CommonTitles.h"
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
#include "Core/HW/WiiSaveCrypted.h"
|
#include "Core/HW/WiiSaveCrypted.h"
|
||||||
@ -95,6 +97,16 @@ void MenuBar::AddToolsMenu()
|
|||||||
|
|
||||||
m_wad_install_action = tools_menu->addAction(tr("Install WAD..."), this, &MenuBar::InstallWAD);
|
m_wad_install_action = tools_menu->addAction(tr("Install WAD..."), this, &MenuBar::InstallWAD);
|
||||||
|
|
||||||
|
tools_menu->addSeparator();
|
||||||
|
QMenu* gc_ipl = tools_menu->addMenu(tr("Load GameCube Main Menu"));
|
||||||
|
|
||||||
|
m_ntscj_ipl = gc_ipl->addAction(tr("NTSC-J"), this,
|
||||||
|
[this] { emit BootGameCubeIPL(DiscIO::Region::NTSC_J); });
|
||||||
|
m_ntscu_ipl = gc_ipl->addAction(tr("NTSC-U"), this,
|
||||||
|
[this] { emit BootGameCubeIPL(DiscIO::Region::NTSC_U); });
|
||||||
|
m_pal_ipl =
|
||||||
|
gc_ipl->addAction(tr("PAL"), this, [this] { emit BootGameCubeIPL(DiscIO::Region::PAL); });
|
||||||
|
|
||||||
tools_menu->addAction(tr("Start &NetPlay..."), this, &MenuBar::StartNetPlay);
|
tools_menu->addAction(tr("Start &NetPlay..."), this, &MenuBar::StartNetPlay);
|
||||||
tools_menu->addSeparator();
|
tools_menu->addSeparator();
|
||||||
|
|
||||||
@ -375,6 +387,12 @@ void MenuBar::UpdateToolsMenu(bool emulation_started)
|
|||||||
{
|
{
|
||||||
m_boot_sysmenu->setEnabled(!emulation_started);
|
m_boot_sysmenu->setEnabled(!emulation_started);
|
||||||
m_perform_online_update_menu->setEnabled(!emulation_started);
|
m_perform_online_update_menu->setEnabled(!emulation_started);
|
||||||
|
m_ntscj_ipl->setEnabled(!emulation_started &&
|
||||||
|
File::Exists(SConfig::GetInstance().GetBootROMPath(JAP_DIR)));
|
||||||
|
m_ntscu_ipl->setEnabled(!emulation_started &&
|
||||||
|
File::Exists(SConfig::GetInstance().GetBootROMPath(USA_DIR)));
|
||||||
|
m_pal_ipl->setEnabled(!emulation_started &&
|
||||||
|
File::Exists(SConfig::GetInstance().GetBootROMPath(EUR_DIR)));
|
||||||
|
|
||||||
if (!emulation_started)
|
if (!emulation_started)
|
||||||
{
|
{
|
||||||
|
@ -55,6 +55,9 @@ signals:
|
|||||||
|
|
||||||
void PerformOnlineUpdate(const std::string& region);
|
void PerformOnlineUpdate(const std::string& region);
|
||||||
|
|
||||||
|
// Tools
|
||||||
|
void BootGameCubeIPL(DiscIO::Region region);
|
||||||
|
|
||||||
// Options
|
// Options
|
||||||
void Configure();
|
void Configure();
|
||||||
void ConfigureGraphics();
|
void ConfigureGraphics();
|
||||||
@ -97,6 +100,9 @@ private:
|
|||||||
QAction* m_wad_install_action;
|
QAction* m_wad_install_action;
|
||||||
QMenu* m_perform_online_update_menu;
|
QMenu* m_perform_online_update_menu;
|
||||||
QAction* m_perform_online_update_for_current_region;
|
QAction* m_perform_online_update_for_current_region;
|
||||||
|
QAction* m_ntscj_ipl;
|
||||||
|
QAction* m_ntscu_ipl;
|
||||||
|
QAction* m_pal_ipl;
|
||||||
|
|
||||||
// Emulation
|
// Emulation
|
||||||
QAction* m_play_action;
|
QAction* m_play_action;
|
||||||
|
Loading…
Reference in New Issue
Block a user