diff options
Diffstat (limited to 'src/yuzu')
-rw-r--r-- | src/yuzu/main.cpp | 41 | ||||
-rw-r--r-- | src/yuzu/main.h | 1 | ||||
-rw-r--r-- | src/yuzu/main.ui | 22 |
3 files changed, 48 insertions, 16 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index f6b548fd3..f22db233b 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -1575,6 +1575,7 @@ void GMainWindow::ConnectMenuEvents() { connect_menu(ui->action_Load_Cabinet_Formatter, [this]() { OnCabinet(Service::NFP::CabinetMode::StartFormatter); }); connect_menu(ui->action_Load_Mii_Edit, &GMainWindow::OnMiiEdit); + connect_menu(ui->action_Open_Controller_Menu, &GMainWindow::OnOpenControllerMenu); connect_menu(ui->action_Capture_Screenshot, &GMainWindow::OnCaptureScreenshot); // TAS @@ -1602,14 +1603,13 @@ void GMainWindow::UpdateMenuState() { ui->action_Pause, }; - const std::array applet_actions{ - ui->action_Load_Album, - ui->action_Load_Cabinet_Nickname_Owner, - ui->action_Load_Cabinet_Eraser, - ui->action_Load_Cabinet_Restorer, - ui->action_Load_Cabinet_Formatter, - ui->action_Load_Mii_Edit, - }; + const std::array applet_actions{ui->action_Load_Album, + ui->action_Load_Cabinet_Nickname_Owner, + ui->action_Load_Cabinet_Eraser, + ui->action_Load_Cabinet_Restorer, + ui->action_Load_Cabinet_Formatter, + ui->action_Load_Mii_Edit, + ui->action_Open_Controller_Menu}; for (QAction* action : running_actions) { action->setEnabled(emulation_running); @@ -4375,6 +4375,31 @@ void GMainWindow::OnMiiEdit() { BootGame(filename, MiiEditId); } +void GMainWindow::OnOpenControllerMenu() { + constexpr u64 ControllerAppletId = + static_cast<u64>(Service::AM::Applets::AppletProgramId::Controller); + auto bis_system = system->GetFileSystemController().GetSystemNANDContents(); + if (!bis_system) { + QMessageBox::warning(this, tr("No firmware available"), + tr("Please install the firmware to use the Controller Menu.")); + return; + } + + auto controller_applet_nca = + bis_system->GetEntry(ControllerAppletId, FileSys::ContentRecordType::Program); + if (!controller_applet_nca) { + QMessageBox::warning(this, tr("Controller Applet"), + tr("Controller Menu is not available. Please reinstall firmware.")); + return; + } + + system->GetAppletManager().SetCurrentAppletId(Service::AM::Applets::AppletId::Controller); + + const auto filename = QString::fromStdString((controller_applet_nca->GetFullPath())); + UISettings::values.roms_path = QFileInfo(filename).path(); + BootGame(filename, ControllerAppletId); +} + void GMainWindow::OnCaptureScreenshot() { if (emu_thread == nullptr || !emu_thread->IsRunning()) { return; diff --git a/src/yuzu/main.h b/src/yuzu/main.h index f67c4cfda..49ee1e1d2 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h @@ -410,6 +410,7 @@ private slots: void OnAlbum(); void OnCabinet(Service::NFP::CabinetMode mode); void OnMiiEdit(); + void OnOpenControllerMenu(); void OnCaptureScreenshot(); void OnReinitializeKeys(ReinitializeKeyBehavior behavior); void OnLanguageChanged(const QString& locale); diff --git a/src/yuzu/main.ui b/src/yuzu/main.ui index 88684ffb5..e53f9951e 100644 --- a/src/yuzu/main.ui +++ b/src/yuzu/main.ui @@ -25,7 +25,7 @@ </property> <widget class="QWidget" name="centralwidget"> <layout class="QHBoxLayout" name="horizontalLayout"> - <property name="margin"> + <property name="margin" stdset="0"> <number>0</number> </property> </layout> @@ -36,7 +36,7 @@ <x>0</x> <y>0</y> <width>1280</width> - <height>26</height> + <height>21</height> </rect> </property> <widget class="QMenu" name="menu_File"> @@ -162,6 +162,7 @@ <addaction name="menu_cabinet_applet"/> <addaction name="action_Load_Album"/> <addaction name="action_Load_Mii_Edit"/> + <addaction name="action_Open_Controller_Menu"/> <addaction name="separator"/> <addaction name="action_Capture_Screenshot"/> <addaction name="menuTAS"/> @@ -382,9 +383,9 @@ </property> </action> <action name="action_Load_Album"> - <property name="text"> - <string>Open &Album</string> - </property> + <property name="text"> + <string>Open &Album</string> + </property> </action> <action name="action_Load_Cabinet_Nickname_Owner"> <property name="text"> @@ -407,9 +408,9 @@ </property> </action> <action name="action_Load_Mii_Edit"> - <property name="text"> - <string>Open &Mii Editor</string> - </property> + <property name="text"> + <string>Open &Mii Editor</string> + </property> </action> <action name="action_Configure_Tas"> <property name="text"> @@ -454,6 +455,11 @@ <string>R&ecord</string> </property> </action> + <action name="action_Open_Controller_Menu"> + <property name="text"> + <string>Open &Controller Menu</string> + </property> + </action> </widget> <resources> <include location="yuzu.qrc"/> |