diff options
| author | 2023-09-21 20:55:30 -0600 | |
|---|---|---|
| committer | 2023-09-23 20:13:36 -0600 | |
| commit | bb4ae5ee538a1fc69cfdcb292a9223c587627d58 (patch) | |
| tree | 2b057c8f05fd679bc6e34d25ad992efe04911961 /src | |
| parent | Merge pull request #11573 from t895/import-fix (diff) | |
| download | yuzu-bb4ae5ee538a1fc69cfdcb292a9223c587627d58.tar.gz yuzu-bb4ae5ee538a1fc69cfdcb292a9223c587627d58.tar.xz yuzu-bb4ae5ee538a1fc69cfdcb292a9223c587627d58.zip | |
yuzu: Add button to boot mii edit from firmware
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/main.cpp | 42 | ||||
| -rw-r--r-- | src/yuzu/main.h | 2 | ||||
| -rw-r--r-- | src/yuzu/main.ui | 9 |
3 files changed, 52 insertions, 1 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index d32aa9615..b1b6b9354 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -1551,6 +1551,7 @@ 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_Mii_Edit, &GMainWindow::OnMiiEdit); | ||
| 1554 | connect_menu(ui->action_Capture_Screenshot, &GMainWindow::OnCaptureScreenshot); | 1555 | connect_menu(ui->action_Capture_Screenshot, &GMainWindow::OnCaptureScreenshot); |
| 1555 | 1556 | ||
| 1556 | // TAS | 1557 | // TAS |
| @@ -1590,6 +1591,8 @@ void GMainWindow::UpdateMenuState() { | |||
| 1590 | } | 1591 | } |
| 1591 | 1592 | ||
| 1592 | multiplayer_state->UpdateNotificationStatus(); | 1593 | multiplayer_state->UpdateNotificationStatus(); |
| 1594 | |||
| 1595 | ui->action_Load_Mii_Edit->setEnabled(CheckFirmwarePresence()); | ||
| 1593 | } | 1596 | } |
| 1594 | 1597 | ||
| 1595 | void GMainWindow::OnDisplayTitleBars(bool show) { | 1598 | void GMainWindow::OnDisplayTitleBars(bool show) { |
| @@ -4134,6 +4137,27 @@ void GMainWindow::OnToggleStatusBar() { | |||
| 4134 | statusBar()->setVisible(ui->action_Show_Status_Bar->isChecked()); | 4137 | statusBar()->setVisible(ui->action_Show_Status_Bar->isChecked()); |
| 4135 | } | 4138 | } |
| 4136 | 4139 | ||
| 4140 | void GMainWindow::OnMiiEdit() { | ||
| 4141 | constexpr u64 MiiEditId = 0x0100000000001009ull; | ||
| 4142 | auto bis_system = system->GetFileSystemController().GetSystemNANDContents(); | ||
| 4143 | if (!bis_system) { | ||
| 4144 | QMessageBox::warning(this, tr("No firmware available"), | ||
| 4145 | tr("Please install the firmware to use the Mii editor.")); | ||
| 4146 | return; | ||
| 4147 | } | ||
| 4148 | |||
| 4149 | auto mii_applet_nca = bis_system->GetEntry(MiiEditId, FileSys::ContentRecordType::Program); | ||
| 4150 | if (!mii_applet_nca) { | ||
| 4151 | QMessageBox::warning(this, tr("Mii Edit Applet"), | ||
| 4152 | tr("Mii editor is not available. Please reinstall firmware.")); | ||
| 4153 | return; | ||
| 4154 | } | ||
| 4155 | |||
| 4156 | const auto filename = QString::fromStdString((mii_applet_nca->GetFullPath())); | ||
| 4157 | UISettings::values.roms_path = QFileInfo(filename).path(); | ||
| 4158 | BootGame(filename); | ||
| 4159 | } | ||
| 4160 | |||
| 4137 | void GMainWindow::OnCaptureScreenshot() { | 4161 | void GMainWindow::OnCaptureScreenshot() { |
| 4138 | if (emu_thread == nullptr || !emu_thread->IsRunning()) { | 4162 | if (emu_thread == nullptr || !emu_thread->IsRunning()) { |
| 4139 | return; | 4163 | return; |
| @@ -4540,6 +4564,8 @@ void GMainWindow::OnReinitializeKeys(ReinitializeKeyBehavior behavior) { | |||
| 4540 | if (behavior == ReinitializeKeyBehavior::Warning) { | 4564 | if (behavior == ReinitializeKeyBehavior::Warning) { |
| 4541 | game_list->PopulateAsync(UISettings::values.game_dirs); | 4565 | game_list->PopulateAsync(UISettings::values.game_dirs); |
| 4542 | } | 4566 | } |
| 4567 | |||
| 4568 | UpdateMenuState(); | ||
| 4543 | } | 4569 | } |
| 4544 | 4570 | ||
| 4545 | bool GMainWindow::CheckSystemArchiveDecryption() { | 4571 | bool GMainWindow::CheckSystemArchiveDecryption() { |
| @@ -4561,6 +4587,22 @@ bool GMainWindow::CheckSystemArchiveDecryption() { | |||
| 4561 | return mii_nca->GetRomFS().get() != nullptr; | 4587 | return mii_nca->GetRomFS().get() != nullptr; |
| 4562 | } | 4588 | } |
| 4563 | 4589 | ||
| 4590 | bool GMainWindow::CheckFirmwarePresence() { | ||
| 4591 | constexpr u64 MiiEditId = 0x0100000000001009ull; | ||
| 4592 | |||
| 4593 | auto bis_system = system->GetFileSystemController().GetSystemNANDContents(); | ||
| 4594 | if (!bis_system) { | ||
| 4595 | return false; | ||
| 4596 | } | ||
| 4597 | |||
| 4598 | auto mii_applet_nca = bis_system->GetEntry(MiiEditId, FileSys::ContentRecordType::Program); | ||
| 4599 | if (!mii_applet_nca) { | ||
| 4600 | return false; | ||
| 4601 | } | ||
| 4602 | |||
| 4603 | return true; | ||
| 4604 | } | ||
| 4605 | |||
| 4564 | bool GMainWindow::SelectRomFSDumpTarget(const FileSys::ContentProvider& installed, u64 program_id, | 4606 | bool GMainWindow::SelectRomFSDumpTarget(const FileSys::ContentProvider& installed, u64 program_id, |
| 4565 | u64* selected_title_id, u8* selected_content_record_type) { | 4607 | u64* selected_title_id, u8* selected_content_record_type) { |
| 4566 | using ContentInfo = std::pair<FileSys::TitleType, FileSys::ContentRecordType>; | 4608 | using ContentInfo = std::pair<FileSys::TitleType, FileSys::ContentRecordType>; |
diff --git a/src/yuzu/main.h b/src/yuzu/main.h index cf191f698..53bedfab3 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h | |||
| @@ -365,6 +365,7 @@ private slots: | |||
| 365 | void ResetWindowSize720(); | 365 | void ResetWindowSize720(); |
| 366 | void ResetWindowSize900(); | 366 | void ResetWindowSize900(); |
| 367 | void ResetWindowSize1080(); | 367 | void ResetWindowSize1080(); |
| 368 | void OnMiiEdit(); | ||
| 368 | void OnCaptureScreenshot(); | 369 | void OnCaptureScreenshot(); |
| 369 | void OnReinitializeKeys(ReinitializeKeyBehavior behavior); | 370 | void OnReinitializeKeys(ReinitializeKeyBehavior behavior); |
| 370 | void OnLanguageChanged(const QString& locale); | 371 | void OnLanguageChanged(const QString& locale); |
| @@ -409,6 +410,7 @@ private: | |||
| 409 | void OpenPerGameConfiguration(u64 title_id, const std::string& file_name); | 410 | void OpenPerGameConfiguration(u64 title_id, const std::string& file_name); |
| 410 | bool CheckDarkMode(); | 411 | bool CheckDarkMode(); |
| 411 | bool CheckSystemArchiveDecryption(); | 412 | bool CheckSystemArchiveDecryption(); |
| 413 | bool CheckFirmwarePresence(); | ||
| 412 | void ConfigureFilesystemProvider(const std::string& filepath); | 414 | void ConfigureFilesystemProvider(const std::string& filepath); |
| 413 | 415 | ||
| 414 | QString GetTasStateDescription() const; | 416 | QString GetTasStateDescription() const; |
diff --git a/src/yuzu/main.ui b/src/yuzu/main.ui index e54d7d75d..91d6c5ef3 100644 --- a/src/yuzu/main.ui +++ b/src/yuzu/main.ui | |||
| @@ -150,6 +150,8 @@ | |||
| 150 | <addaction name="action_Rederive"/> | 150 | <addaction name="action_Rederive"/> |
| 151 | <addaction name="action_Verify_installed_contents"/> | 151 | <addaction name="action_Verify_installed_contents"/> |
| 152 | <addaction name="separator"/> | 152 | <addaction name="separator"/> |
| 153 | <addaction name="action_Load_Mii_Edit"/> | ||
| 154 | <addaction name="separator"/> | ||
| 153 | <addaction name="action_Capture_Screenshot"/> | 155 | <addaction name="action_Capture_Screenshot"/> |
| 154 | <addaction name="menuTAS"/> | 156 | <addaction name="menuTAS"/> |
| 155 | </widget> | 157 | </widget> |
| @@ -217,7 +219,7 @@ | |||
| 217 | </action> | 219 | </action> |
| 218 | <action name="action_Verify_installed_contents"> | 220 | <action name="action_Verify_installed_contents"> |
| 219 | <property name="text"> | 221 | <property name="text"> |
| 220 | <string>Verify installed contents</string> | 222 | <string>&Verify Installed Contents</string> |
| 221 | </property> | 223 | </property> |
| 222 | </action> | 224 | </action> |
| 223 | <action name="action_About"> | 225 | <action name="action_About"> |
| @@ -368,6 +370,11 @@ | |||
| 368 | <string>&Capture Screenshot</string> | 370 | <string>&Capture Screenshot</string> |
| 369 | </property> | 371 | </property> |
| 370 | </action> | 372 | </action> |
| 373 | <action name="action_Load_Mii_Edit"> | ||
| 374 | <property name="text"> | ||
| 375 | <string>Open &Mii Editor</string> | ||
| 376 | </property> | ||
| 377 | </action> | ||
| 371 | <action name="action_Configure_Tas"> | 378 | <action name="action_Configure_Tas"> |
| 372 | <property name="text"> | 379 | <property name="text"> |
| 373 | <string>&Configure TAS...</string> | 380 | <string>&Configure TAS...</string> |