From c5e480e55ddc3183c48148daaa14c00ada855fee Mon Sep 17 00:00:00 2001 From: Zephyron Date: Mon, 17 Feb 2025 17:33:10 +1000 Subject: feat: Add Home Menu launch support and system improvements This commit adds support for launching the system Home Menu and implements several system-level improvements: - Add Home Menu launch functionality through new UI action - Implement shutdown/reboot sequence handlers in GlobalStateController - Add support for reserved region extra size in page tables - Enhance audio controller with output management - Expand parental control service capabilities - Add profile service improvements for user management Technical changes: - Add OnHomeMenu() handler to launch QLaunch system applet - Implement m_alias_region_extra_size tracking in page tables - Add new CreateProcessFlag for reserved region extra size - Expand audio controller interface with output management - Add self-controller methods to various services - Implement play timer and profile service improvements The changes primarily focus on system menu integration and core service improvements to better support system functionality. --- src/citron/main.cpp | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'src/citron/main.cpp') 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(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); +} -- cgit v1.2.3