diff options
Diffstat (limited to 'src/citron/main.cpp')
-rw-r--r-- | src/citron/main.cpp | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/src/citron/main.cpp b/src/citron/main.cpp index c30395310..cb6cedd19 100644 --- a/src/citron/main.cpp +++ b/src/citron/main.cpp @@ -1584,6 +1584,7 @@ void GMainWindow::ConnectMenuEvents() { [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_Load_Home_Menu, &GMainWindow::OnHomeMenu); connect_menu(ui->action_Capture_Screenshot, &GMainWindow::OnCaptureScreenshot); // TAS @@ -1619,7 +1620,8 @@ void GMainWindow::UpdateMenuState() { ui->action_Load_Cabinet_Restorer, ui->action_Load_Cabinet_Formatter, ui->action_Load_Mii_Edit, - ui->action_Open_Controller_Menu}; + ui->action_Open_Controller_Menu, + ui->action_Load_Home_Menu}; for (QAction* action : running_actions) { action->setEnabled(emulation_running); @@ -5324,3 +5326,40 @@ int main(int argc, char* argv[]) { detached_tasks.WaitForAllTasks(); return result; } + +void GMainWindow::OnHomeMenu() { + constexpr u64 QLaunchId = static_cast<u64>(Service::AM::AppletProgramId::QLaunch); + + // Check if system NAND contents are available + auto bis_system = system->GetFileSystemController().GetSystemNANDContents(); + if (!bis_system) { + QMessageBox::warning(this, tr("System Error"), + tr("System NAND contents not found. Please verify your firmware installation.")); + return; + } + + // Try to get the QLaunch NCA + auto qlaunch_nca = bis_system->GetEntry(QLaunchId, FileSys::ContentRecordType::Program); + if (!qlaunch_nca) { + QMessageBox::warning(this, tr("System Error"), + tr("Home Menu applet not found. Please verify your firmware installation.")); + return; + } + + // Set up applet parameters + Service::AM::FrontendAppletParameters params{ + .program_id = QLaunchId, + .applet_id = Service::AM::AppletId::QLaunch, + .applet_type = Service::AM::AppletType::SystemApplet + }; + + // Configure system for QLaunch + system->GetFrontendAppletHolder().SetCurrentAppletId(Service::AM::AppletId::QLaunch); + + // Get path and launch + const auto nca_path = QString::fromStdString(qlaunch_nca->GetFullPath()); + UISettings::values.roms_path = QFileInfo(nca_path).path().toStdString(); + + // Launch QLaunch with proper parameters + BootGame(nca_path, params); +} |