diff options
| author | 2023-10-01 11:59:50 -0600 | |
|---|---|---|
| committer | 2023-10-02 11:29:12 -0600 | |
| commit | 2fa53ec1d90ab6b2c126fbe42ac73b4ea74cc726 (patch) | |
| tree | 9aa78ae7069ccef4edd56d16130bb5dd8c18c65c | |
| parent | externals: Add stb_image and stb_image_resize (diff) | |
| download | yuzu-2fa53ec1d90ab6b2c126fbe42ac73b4ea74cc726.tar.gz yuzu-2fa53ec1d90ab6b2c126fbe42ac73b4ea74cc726.tar.xz yuzu-2fa53ec1d90ab6b2c126fbe42ac73b4ea74cc726.zip | |
yuzu: Allow to launch album applet from firmware
| -rw-r--r-- | src/core/hle/service/am/am.cpp | 20 | ||||
| -rw-r--r-- | src/core/hle/service/am/am.h | 1 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 25 | ||||
| -rw-r--r-- | src/yuzu/main.h | 1 | ||||
| -rw-r--r-- | src/yuzu/main.ui | 6 |
5 files changed, 53 insertions, 0 deletions
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 819dea6a7..a92243fc7 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -1493,6 +1493,9 @@ ILibraryAppletSelfAccessor::ILibraryAppletSelfAccessor(Core::System& system_) | |||
| 1493 | case Applets::AppletId::MiiEdit: | 1493 | case Applets::AppletId::MiiEdit: |
| 1494 | PushInShowMiiEditData(); | 1494 | PushInShowMiiEditData(); |
| 1495 | break; | 1495 | break; |
| 1496 | case Applets::AppletId::PhotoViewer: | ||
| 1497 | PushInShowAlbum(); | ||
| 1498 | break; | ||
| 1496 | default: | 1499 | default: |
| 1497 | break; | 1500 | break; |
| 1498 | } | 1501 | } |
| @@ -1569,6 +1572,23 @@ void ILibraryAppletSelfAccessor::GetCallerAppletIdentityInfo(HLERequestContext& | |||
| 1569 | rb.PushRaw(applet_info); | 1572 | rb.PushRaw(applet_info); |
| 1570 | } | 1573 | } |
| 1571 | 1574 | ||
| 1575 | void ILibraryAppletSelfAccessor::PushInShowAlbum() { | ||
| 1576 | const Applets::CommonArguments arguments{ | ||
| 1577 | .arguments_version = Applets::CommonArgumentVersion::Version3, | ||
| 1578 | .size = Applets::CommonArgumentSize::Version3, | ||
| 1579 | .library_version = 1, | ||
| 1580 | .theme_color = Applets::ThemeColor::BasicBlack, | ||
| 1581 | .play_startup_sound = true, | ||
| 1582 | .system_tick = system.CoreTiming().GetClockTicks(), | ||
| 1583 | }; | ||
| 1584 | |||
| 1585 | std::vector<u8> argument_data(sizeof(arguments)); | ||
| 1586 | std::vector<u8> settings_data{2}; | ||
| 1587 | std::memcpy(argument_data.data(), &arguments, sizeof(arguments)); | ||
| 1588 | queue_data.emplace_back(std::move(argument_data)); | ||
| 1589 | queue_data.emplace_back(std::move(settings_data)); | ||
| 1590 | } | ||
| 1591 | |||
| 1572 | void ILibraryAppletSelfAccessor::PushInShowCabinetData() { | 1592 | void ILibraryAppletSelfAccessor::PushInShowCabinetData() { |
| 1573 | const Applets::CommonArguments arguments{ | 1593 | const Applets::CommonArguments arguments{ |
| 1574 | .arguments_version = Applets::CommonArgumentVersion::Version3, | 1594 | .arguments_version = Applets::CommonArgumentVersion::Version3, |
diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h index 349482dcc..62994a13f 100644 --- a/src/core/hle/service/am/am.h +++ b/src/core/hle/service/am/am.h | |||
| @@ -327,6 +327,7 @@ private: | |||
| 327 | void ExitProcessAndReturn(HLERequestContext& ctx); | 327 | void ExitProcessAndReturn(HLERequestContext& ctx); |
| 328 | void GetCallerAppletIdentityInfo(HLERequestContext& ctx); | 328 | void GetCallerAppletIdentityInfo(HLERequestContext& ctx); |
| 329 | 329 | ||
| 330 | void PushInShowAlbum(); | ||
| 330 | void PushInShowCabinetData(); | 331 | void PushInShowCabinetData(); |
| 331 | void PushInShowMiiEditData(); | 332 | void PushInShowMiiEditData(); |
| 332 | 333 | ||
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 16fa92e2c..55f61f98e 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -1553,6 +1553,7 @@ void GMainWindow::ConnectMenuEvents() { | |||
| 1553 | // Tools | 1553 | // Tools |
| 1554 | connect_menu(ui->action_Rederive, std::bind(&GMainWindow::OnReinitializeKeys, this, | 1554 | connect_menu(ui->action_Rederive, std::bind(&GMainWindow::OnReinitializeKeys, this, |
| 1555 | ReinitializeKeyBehavior::Warning)); | 1555 | ReinitializeKeyBehavior::Warning)); |
| 1556 | connect_menu(ui->action_Load_Album, &GMainWindow::OnAlbum); | ||
| 1556 | connect_menu(ui->action_Load_Cabinet_Nickname_Owner, | 1557 | connect_menu(ui->action_Load_Cabinet_Nickname_Owner, |
| 1557 | [this]() { OnCabinet(Service::NFP::CabinetMode::StartNicknameAndOwnerSettings); }); | 1558 | [this]() { OnCabinet(Service::NFP::CabinetMode::StartNicknameAndOwnerSettings); }); |
| 1558 | connect_menu(ui->action_Load_Cabinet_Eraser, | 1559 | connect_menu(ui->action_Load_Cabinet_Eraser, |
| @@ -1590,6 +1591,7 @@ void GMainWindow::UpdateMenuState() { | |||
| 1590 | }; | 1591 | }; |
| 1591 | 1592 | ||
| 1592 | const std::array applet_actions{ | 1593 | const std::array applet_actions{ |
| 1594 | ui->action_Load_Album, | ||
| 1593 | ui->action_Load_Cabinet_Nickname_Owner, | 1595 | ui->action_Load_Cabinet_Nickname_Owner, |
| 1594 | ui->action_Load_Cabinet_Eraser, | 1596 | ui->action_Load_Cabinet_Eraser, |
| 1595 | ui->action_Load_Cabinet_Restorer, | 1597 | ui->action_Load_Cabinet_Restorer, |
| @@ -4157,6 +4159,29 @@ void GMainWindow::OnToggleStatusBar() { | |||
| 4157 | statusBar()->setVisible(ui->action_Show_Status_Bar->isChecked()); | 4159 | statusBar()->setVisible(ui->action_Show_Status_Bar->isChecked()); |
| 4158 | } | 4160 | } |
| 4159 | 4161 | ||
| 4162 | void GMainWindow::OnAlbum() { | ||
| 4163 | constexpr u64 AlbumId = 0x010000000000100Dull; | ||
| 4164 | auto bis_system = system->GetFileSystemController().GetSystemNANDContents(); | ||
| 4165 | if (!bis_system) { | ||
| 4166 | QMessageBox::warning(this, tr("No firmware available"), | ||
| 4167 | tr("Please install the firmware to use the Album applet.")); | ||
| 4168 | return; | ||
| 4169 | } | ||
| 4170 | |||
| 4171 | auto album_nca = bis_system->GetEntry(AlbumId, FileSys::ContentRecordType::Program); | ||
| 4172 | if (!album_nca) { | ||
| 4173 | QMessageBox::warning(this, tr("Album Applet"), | ||
| 4174 | tr("Album applet is not available. Please reinstall firmware.")); | ||
| 4175 | return; | ||
| 4176 | } | ||
| 4177 | |||
| 4178 | system->GetAppletManager().SetCurrentAppletId(Service::AM::Applets::AppletId::PhotoViewer); | ||
| 4179 | |||
| 4180 | const auto filename = QString::fromStdString(album_nca->GetFullPath()); | ||
| 4181 | UISettings::values.roms_path = QFileInfo(filename).path(); | ||
| 4182 | BootGame(filename); | ||
| 4183 | } | ||
| 4184 | |||
| 4160 | void GMainWindow::OnCabinet(Service::NFP::CabinetMode mode) { | 4185 | void GMainWindow::OnCabinet(Service::NFP::CabinetMode mode) { |
| 4161 | constexpr u64 CabinetId = 0x0100000000001002ull; | 4186 | constexpr u64 CabinetId = 0x0100000000001002ull; |
| 4162 | auto bis_system = system->GetFileSystemController().GetSystemNANDContents(); | 4187 | auto bis_system = system->GetFileSystemController().GetSystemNANDContents(); |
diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 52028234c..6450beb65 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h | |||
| @@ -369,6 +369,7 @@ private slots: | |||
| 369 | void ResetWindowSize720(); | 369 | void ResetWindowSize720(); |
| 370 | void ResetWindowSize900(); | 370 | void ResetWindowSize900(); |
| 371 | void ResetWindowSize1080(); | 371 | void ResetWindowSize1080(); |
| 372 | void OnAlbum(); | ||
| 372 | void OnCabinet(Service::NFP::CabinetMode mode); | 373 | void OnCabinet(Service::NFP::CabinetMode mode); |
| 373 | void OnMiiEdit(); | 374 | void OnMiiEdit(); |
| 374 | void OnCaptureScreenshot(); | 375 | void OnCaptureScreenshot(); |
diff --git a/src/yuzu/main.ui b/src/yuzu/main.ui index 31c3de9ef..88684ffb5 100644 --- a/src/yuzu/main.ui +++ b/src/yuzu/main.ui | |||
| @@ -160,6 +160,7 @@ | |||
| 160 | <addaction name="action_Verify_installed_contents"/> | 160 | <addaction name="action_Verify_installed_contents"/> |
| 161 | <addaction name="separator"/> | 161 | <addaction name="separator"/> |
| 162 | <addaction name="menu_cabinet_applet"/> | 162 | <addaction name="menu_cabinet_applet"/> |
| 163 | <addaction name="action_Load_Album"/> | ||
| 163 | <addaction name="action_Load_Mii_Edit"/> | 164 | <addaction name="action_Load_Mii_Edit"/> |
| 164 | <addaction name="separator"/> | 165 | <addaction name="separator"/> |
| 165 | <addaction name="action_Capture_Screenshot"/> | 166 | <addaction name="action_Capture_Screenshot"/> |
| @@ -380,6 +381,11 @@ | |||
| 380 | <string>&Capture Screenshot</string> | 381 | <string>&Capture Screenshot</string> |
| 381 | </property> | 382 | </property> |
| 382 | </action> | 383 | </action> |
| 384 | <action name="action_Load_Album"> | ||
| 385 | <property name="text"> | ||
| 386 | <string>Open &Album</string> | ||
| 387 | </property> | ||
| 388 | </action> | ||
| 383 | <action name="action_Load_Cabinet_Nickname_Owner"> | 389 | <action name="action_Load_Cabinet_Nickname_Owner"> |
| 384 | <property name="text"> | 390 | <property name="text"> |
| 385 | <string>&Set Nickname and Owner</string> | 391 | <string>&Set Nickname and Owner</string> |