diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/main.cpp | 44 | ||||
| -rw-r--r-- | src/yuzu/main.h | 5 | ||||
| -rw-r--r-- | src/yuzu/main.ui | 30 |
3 files changed, 77 insertions, 2 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index adb7b332f..0879d6168 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -1551,6 +1551,14 @@ void GMainWindow::ConnectMenuEvents() { | |||
| 1551 | // Tools | 1551 | // Tools |
| 1552 | connect_menu(ui->action_Rederive, std::bind(&GMainWindow::OnReinitializeKeys, this, | 1552 | connect_menu(ui->action_Rederive, std::bind(&GMainWindow::OnReinitializeKeys, this, |
| 1553 | ReinitializeKeyBehavior::Warning)); | 1553 | ReinitializeKeyBehavior::Warning)); |
| 1554 | connect_menu(ui->action_Load_Cabinet_Nickname_Owner, | ||
| 1555 | [this]() { OnCabinet(Service::NFP::CabinetMode::StartNicknameAndOwnerSettings); }); | ||
| 1556 | connect_menu(ui->action_Load_Cabinet_Eraser, | ||
| 1557 | [this]() { OnCabinet(Service::NFP::CabinetMode::StartGameDataEraser); }); | ||
| 1558 | connect_menu(ui->action_Load_Cabinet_Restorer, | ||
| 1559 | [this]() { OnCabinet(Service::NFP::CabinetMode::StartRestorer); }); | ||
| 1560 | connect_menu(ui->action_Load_Cabinet_Formatter, | ||
| 1561 | [this]() { OnCabinet(Service::NFP::CabinetMode::StartFormatter); }); | ||
| 1554 | connect_menu(ui->action_Load_Mii_Edit, &GMainWindow::OnMiiEdit); | 1562 | connect_menu(ui->action_Load_Mii_Edit, &GMainWindow::OnMiiEdit); |
| 1555 | connect_menu(ui->action_Capture_Screenshot, &GMainWindow::OnCaptureScreenshot); | 1563 | connect_menu(ui->action_Capture_Screenshot, &GMainWindow::OnCaptureScreenshot); |
| 1556 | 1564 | ||
| @@ -1568,6 +1576,7 @@ void GMainWindow::ConnectMenuEvents() { | |||
| 1568 | 1576 | ||
| 1569 | void GMainWindow::UpdateMenuState() { | 1577 | void GMainWindow::UpdateMenuState() { |
| 1570 | const bool is_paused = emu_thread == nullptr || !emu_thread->IsRunning(); | 1578 | const bool is_paused = emu_thread == nullptr || !emu_thread->IsRunning(); |
| 1579 | const bool is_firmware_available = CheckFirmwarePresence(); | ||
| 1571 | 1580 | ||
| 1572 | const std::array running_actions{ | 1581 | const std::array running_actions{ |
| 1573 | ui->action_Stop, | 1582 | ui->action_Stop, |
| @@ -1578,10 +1587,22 @@ void GMainWindow::UpdateMenuState() { | |||
| 1578 | ui->action_Pause, | 1587 | ui->action_Pause, |
| 1579 | }; | 1588 | }; |
| 1580 | 1589 | ||
| 1590 | const std::array applet_actions{ | ||
| 1591 | ui->action_Load_Cabinet_Nickname_Owner, | ||
| 1592 | ui->action_Load_Cabinet_Eraser, | ||
| 1593 | ui->action_Load_Cabinet_Restorer, | ||
| 1594 | ui->action_Load_Cabinet_Formatter, | ||
| 1595 | ui->action_Load_Mii_Edit, | ||
| 1596 | }; | ||
| 1597 | |||
| 1581 | for (QAction* action : running_actions) { | 1598 | for (QAction* action : running_actions) { |
| 1582 | action->setEnabled(emulation_running); | 1599 | action->setEnabled(emulation_running); |
| 1583 | } | 1600 | } |
| 1584 | 1601 | ||
| 1602 | for (QAction* action : applet_actions) { | ||
| 1603 | action->setEnabled(is_firmware_available && !emulation_running); | ||
| 1604 | } | ||
| 1605 | |||
| 1585 | ui->action_Capture_Screenshot->setEnabled(emulation_running && !is_paused); | 1606 | ui->action_Capture_Screenshot->setEnabled(emulation_running && !is_paused); |
| 1586 | 1607 | ||
| 1587 | if (emulation_running && is_paused) { | 1608 | if (emulation_running && is_paused) { |
| @@ -1591,8 +1612,6 @@ void GMainWindow::UpdateMenuState() { | |||
| 1591 | } | 1612 | } |
| 1592 | 1613 | ||
| 1593 | multiplayer_state->UpdateNotificationStatus(); | 1614 | multiplayer_state->UpdateNotificationStatus(); |
| 1594 | |||
| 1595 | ui->action_Load_Mii_Edit->setEnabled(CheckFirmwarePresence()); | ||
| 1596 | } | 1615 | } |
| 1597 | 1616 | ||
| 1598 | void GMainWindow::OnDisplayTitleBars(bool show) { | 1617 | void GMainWindow::OnDisplayTitleBars(bool show) { |
| @@ -4134,6 +4153,27 @@ void GMainWindow::OnToggleStatusBar() { | |||
| 4134 | statusBar()->setVisible(ui->action_Show_Status_Bar->isChecked()); | 4153 | statusBar()->setVisible(ui->action_Show_Status_Bar->isChecked()); |
| 4135 | } | 4154 | } |
| 4136 | 4155 | ||
| 4156 | void GMainWindow::OnCabinet(Service::NFP::CabinetMode mode) { | ||
| 4157 | constexpr u64 CabinetId = 0x0100000000001002ull; | ||
| 4158 | auto bis_system = system->GetFileSystemController().GetSystemNANDContents(); | ||
| 4159 | if (!bis_system) { | ||
| 4160 | QMessageBox::warning(this, tr("No firmware available"), | ||
| 4161 | tr("Please install the firmware to use the Cabinet applet.")); | ||
| 4162 | return; | ||
| 4163 | } | ||
| 4164 | |||
| 4165 | auto cabinet_nca = bis_system->GetEntry(CabinetId, FileSys::ContentRecordType::Program); | ||
| 4166 | if (!cabinet_nca) { | ||
| 4167 | QMessageBox::warning(this, tr("Cabinet Applet"), | ||
| 4168 | tr("Cabinet applet is not available. Please reinstall firmware.")); | ||
| 4169 | return; | ||
| 4170 | } | ||
| 4171 | |||
| 4172 | const auto filename = QString::fromStdString(cabinet_nca->GetFullPath()); | ||
| 4173 | UISettings::values.roms_path = QFileInfo(filename).path(); | ||
| 4174 | BootGame(filename); | ||
| 4175 | } | ||
| 4176 | |||
| 4137 | void GMainWindow::OnMiiEdit() { | 4177 | void GMainWindow::OnMiiEdit() { |
| 4138 | constexpr u64 MiiEditId = 0x0100000000001009ull; | 4178 | constexpr u64 MiiEditId = 0x0100000000001009ull; |
| 4139 | auto bis_system = system->GetFileSystemController().GetSystemNANDContents(); | 4179 | auto bis_system = system->GetFileSystemController().GetSystemNANDContents(); |
diff --git a/src/yuzu/main.h b/src/yuzu/main.h index ba318eb11..52028234c 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h | |||
| @@ -102,6 +102,10 @@ namespace Service::NFC { | |||
| 102 | class NfcDevice; | 102 | class NfcDevice; |
| 103 | } // namespace Service::NFC | 103 | } // namespace Service::NFC |
| 104 | 104 | ||
| 105 | namespace Service::NFP { | ||
| 106 | enum class CabinetMode : u8; | ||
| 107 | } // namespace Service::NFP | ||
| 108 | |||
| 105 | namespace Ui { | 109 | namespace Ui { |
| 106 | class MainWindow; | 110 | class MainWindow; |
| 107 | } | 111 | } |
| @@ -365,6 +369,7 @@ private slots: | |||
| 365 | void ResetWindowSize720(); | 369 | void ResetWindowSize720(); |
| 366 | void ResetWindowSize900(); | 370 | void ResetWindowSize900(); |
| 367 | void ResetWindowSize1080(); | 371 | void ResetWindowSize1080(); |
| 372 | void OnCabinet(Service::NFP::CabinetMode mode); | ||
| 368 | void OnMiiEdit(); | 373 | void OnMiiEdit(); |
| 369 | void OnCaptureScreenshot(); | 374 | void OnCaptureScreenshot(); |
| 370 | void OnReinitializeKeys(ReinitializeKeyBehavior behavior); | 375 | void OnReinitializeKeys(ReinitializeKeyBehavior behavior); |
diff --git a/src/yuzu/main.ui b/src/yuzu/main.ui index 91d6c5ef3..31c3de9ef 100644 --- a/src/yuzu/main.ui +++ b/src/yuzu/main.ui | |||
| @@ -137,6 +137,15 @@ | |||
| 137 | <property name="title"> | 137 | <property name="title"> |
| 138 | <string>&Tools</string> | 138 | <string>&Tools</string> |
| 139 | </property> | 139 | </property> |
| 140 | <widget class="QMenu" name="menu_cabinet_applet"> | ||
| 141 | <property name="title"> | ||
| 142 | <string>&Amiibo</string> | ||
| 143 | </property> | ||
| 144 | <addaction name="action_Load_Cabinet_Nickname_Owner"/> | ||
| 145 | <addaction name="action_Load_Cabinet_Eraser"/> | ||
| 146 | <addaction name="action_Load_Cabinet_Restorer"/> | ||
| 147 | <addaction name="action_Load_Cabinet_Formatter"/> | ||
| 148 | </widget> | ||
| 140 | <widget class="QMenu" name="menuTAS"> | 149 | <widget class="QMenu" name="menuTAS"> |
| 141 | <property name="title"> | 150 | <property name="title"> |
| 142 | <string>&TAS</string> | 151 | <string>&TAS</string> |
| @@ -150,6 +159,7 @@ | |||
| 150 | <addaction name="action_Rederive"/> | 159 | <addaction name="action_Rederive"/> |
| 151 | <addaction name="action_Verify_installed_contents"/> | 160 | <addaction name="action_Verify_installed_contents"/> |
| 152 | <addaction name="separator"/> | 161 | <addaction name="separator"/> |
| 162 | <addaction name="menu_cabinet_applet"/> | ||
| 153 | <addaction name="action_Load_Mii_Edit"/> | 163 | <addaction name="action_Load_Mii_Edit"/> |
| 154 | <addaction name="separator"/> | 164 | <addaction name="separator"/> |
| 155 | <addaction name="action_Capture_Screenshot"/> | 165 | <addaction name="action_Capture_Screenshot"/> |
| @@ -370,6 +380,26 @@ | |||
| 370 | <string>&Capture Screenshot</string> | 380 | <string>&Capture Screenshot</string> |
| 371 | </property> | 381 | </property> |
| 372 | </action> | 382 | </action> |
| 383 | <action name="action_Load_Cabinet_Nickname_Owner"> | ||
| 384 | <property name="text"> | ||
| 385 | <string>&Set Nickname and Owner</string> | ||
| 386 | </property> | ||
| 387 | </action> | ||
| 388 | <action name="action_Load_Cabinet_Eraser"> | ||
| 389 | <property name="text"> | ||
| 390 | <string>&Delete Game Data</string> | ||
| 391 | </property> | ||
| 392 | </action> | ||
| 393 | <action name="action_Load_Cabinet_Restorer"> | ||
| 394 | <property name="text"> | ||
| 395 | <string>&Restore Amiibo</string> | ||
| 396 | </property> | ||
| 397 | </action> | ||
| 398 | <action name="action_Load_Cabinet_Formatter"> | ||
| 399 | <property name="text"> | ||
| 400 | <string>&Format Amiibo</string> | ||
| 401 | </property> | ||
| 402 | </action> | ||
| 373 | <action name="action_Load_Mii_Edit"> | 403 | <action name="action_Load_Mii_Edit"> |
| 374 | <property name="text"> | 404 | <property name="text"> |
| 375 | <string>Open &Mii Editor</string> | 405 | <string>Open &Mii Editor</string> |