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 ++++++++++++++++++- src/citron/main.h | 1 + src/citron/main.ui | 111 ++++++---------------------------------------------- 3 files changed, 53 insertions(+), 100 deletions(-) (limited to 'src/citron') 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); +} diff --git a/src/citron/main.h b/src/citron/main.h index 4822a8981..8a2771760 100644 --- a/src/citron/main.h +++ b/src/citron/main.h @@ -407,6 +407,7 @@ private slots: void OnShutdownBeginDialog(); void OnEmulationStopped(); void OnEmulationStopTimeExpired(); + void OnHomeMenu(); private: QString GetGameListErrorRemoving(InstalledEntryType type) const; diff --git a/src/citron/main.ui b/src/citron/main.ui index 56f1a358b..c68e0180a 100644 --- a/src/citron/main.ui +++ b/src/citron/main.ui @@ -17,91 +17,6 @@ :/img/citron.ico:/img/citron.ico - - QMainWindow { - background-color: #2D2D2D; -} - -QMenuBar { - background-color: #333333; - color: #E0E0E0; - border-bottom: 1px solid #404040; - padding: 2px; -} - -QMenuBar::item { - padding: 4px 8px; - background: transparent; - border-radius: 4px; -} - -QMenuBar::item:selected { - background: #404040; -} - -QMenuBar::item:pressed { - background: #505050; -} - -QMenu { - background-color: #333333; - border: 1px solid #404040; - padding: 4px; -} - -QMenu::item { - padding: 6px 24px 6px 12px; - color: #E0E0E0; - border-radius: 4px; -} - -QMenu::item:selected { - background-color: #404040; -} - -QMenu::separator { - height: 1px; - background: #404040; - margin: 4px 0px; -} - -QStatusBar { - background-color: #333333; - color: #E0E0E0; - border-top: 1px solid #404040; -} - -QDockWidget { - border: 1px solid #404040; - titlebar-close-icon: url(close.png); -} - -QDockWidget::title { - background: #333333; - padding: 6px; - color: #E0E0E0; -} - -QToolBar { - background: #333333; - border: none; - spacing: 3px; - padding: 3px; -} - -QToolButton { - border-radius: 4px; - padding: 4px; -} - -QToolButton:hover { - background-color: #404040; -} - -QToolButton:pressed { - background-color: #505050; -} - QTabWidget::Rounded @@ -130,7 +45,7 @@ QToolButton:pressed { 0 0 1280 - 29 + 21 @@ -254,6 +169,7 @@ QToolButton:pressed { + @@ -266,7 +182,6 @@ QToolButton:pressed { &Help - @@ -322,7 +237,7 @@ QToolButton:pressed { - &About citron + &About Citron @@ -457,7 +372,15 @@ QToolButton:pressed { - Open &citron Folder + Open &Citron Folder + + + + + Launch System Menu + + + Launch the system Home Menu @@ -556,16 +479,6 @@ QToolButton:pressed { Install Decryption Keys - - - &Save - - - - - &Load - - -- cgit v1.2.3