Merge pull request #5756 from spycrab/qt_sysmenu

Qt: Implement "Load System Menu"
This commit is contained in:
Leo Lam 2017-07-07 16:51:53 +02:00 committed by GitHub
commit ff9f271edc
6 changed files with 37 additions and 4 deletions

View File

@ -327,7 +327,12 @@ bool GameFile::Install()
{
_assert_(m_platform == DiscIO::Platform::WII_WAD);
return WiiUtils::InstallWAD(m_path.toStdString());
bool installed = WiiUtils::InstallWAD(m_path.toStdString());
if (installed)
Settings::Instance().NANDRefresh();
return installed;
}
bool GameFile::Uninstall()

View File

@ -17,6 +17,7 @@
#include "Core/Boot/Boot.h"
#include "Core/BootManager.h"
#include "Core/CommonTitles.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/HW/GCKeyboard.h"
@ -187,6 +188,7 @@ void MainWindow::ConnectMenuBar()
// Tools
connect(m_menu_bar, &MenuBar::PerformOnlineUpdate, this, &MainWindow::PerformOnlineUpdate);
connect(m_menu_bar, &MenuBar::BootWiiSystemMenu, this, &MainWindow::BootWiiSystemMenu);
// View
connect(m_menu_bar, &MenuBar::ShowTable, m_game_list, &GameList::SetTableView);
@ -566,6 +568,12 @@ void MainWindow::PerformOnlineUpdate(const std::string& region)
m_menu_bar->UpdateToolsMenu(false);
}
void MainWindow::BootWiiSystemMenu()
{
StartGame(QString::fromStdString(
Common::GetTitleContentPath(Titles::SYSTEM_MENU, Common::FROM_CONFIGURED_ROOT)));
}
bool MainWindow::eventFilter(QObject* object, QEvent* event)
{
if (event->type() == QEvent::Close && !Stop())

View File

@ -56,6 +56,7 @@ private slots:
void StateSaveUndo();
void StateSaveOldest();
void SetStateSlot(int slot);
void BootWiiSystemMenu();
void PerformOnlineUpdate(const std::string& region);

View File

@ -86,6 +86,12 @@ void MenuBar::AddToolsMenu()
QMenu* tools_menu = addMenu(tr("Tools"));
m_wad_install_action = tools_menu->addAction(tr("Install WAD..."), this, SLOT(InstallWAD()));
// Label will be set by a NANDRefresh later
m_boot_sysmenu = tools_menu->addAction(QStringLiteral(""), [this] { emit BootWiiSystemMenu(); });
m_boot_sysmenu->setEnabled(false);
connect(&Settings::Instance(), &Settings::NANDRefresh, [this] { UpdateToolsMenu(false); });
m_perform_online_update_menu = tools_menu->addMenu(tr("Perform Online System Update"));
m_perform_online_update_for_current_region = m_perform_online_update_menu->addAction(
tr("Current Region"), [this] { emit PerformOnlineUpdate(""); });
@ -266,12 +272,22 @@ void MenuBar::AddTableColumnsMenu(QMenu* view_menu)
void MenuBar::UpdateToolsMenu(bool emulation_started)
{
const bool enable_wii_tools = !emulation_started || !SConfig::GetInstance().bWii;
m_perform_online_update_menu->setEnabled(enable_wii_tools);
if (enable_wii_tools)
m_boot_sysmenu->setEnabled(!emulation_started);
m_perform_online_update_menu->setEnabled(!emulation_started);
if (!emulation_started)
{
IOS::HLE::Kernel ios;
const auto tmd = ios.GetES()->FindInstalledTMD(Titles::SYSTEM_MENU);
const QString sysmenu_version =
tmd.IsValid() ?
QString::fromStdString(DiscIO::GetSysMenuVersionString(tmd.GetTitleVersion())) :
QStringLiteral("");
m_boot_sysmenu->setText(tr("Load Wii System Menu %1").arg(sysmenu_version));
m_boot_sysmenu->setEnabled(tmd.IsValid());
for (QAction* action : m_perform_online_update_menu->actions())
action->setEnabled(!tmd.IsValid());
m_perform_online_update_for_current_region->setEnabled(tmd.IsValid());

View File

@ -39,6 +39,7 @@ signals:
void StateSaveUndo();
void StateSaveOldest();
void SetStateSlot(int slot);
void BootWiiSystemMenu();
void PerformOnlineUpdate(const std::string& region);
@ -95,6 +96,7 @@ private:
QAction* m_fullscreen_action;
QAction* m_frame_advance_action;
QAction* m_screenshot_action;
QAction* m_boot_sysmenu;
QMenu* m_state_load_menu;
QMenu* m_state_save_menu;
QMenu* m_state_slot_menu;

View File

@ -60,6 +60,7 @@ signals:
void PathRemoved(const QString&);
void HideCursorChanged();
void VolumeChanged(int volume);
void NANDRefresh();
private:
Settings();