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.
This commit is contained in:
Zephyron 2025-02-17 17:33:10 +10:00
parent 1c9e17496b
commit c5e480e55d
16 changed files with 206 additions and 115 deletions

View file

@ -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);
}

View file

@ -407,6 +407,7 @@ private slots:
void OnShutdownBeginDialog();
void OnEmulationStopped();
void OnEmulationStopTimeExpired();
void OnHomeMenu();
private:
QString GetGameListErrorRemoving(InstalledEntryType type) const;

View file

@ -17,91 +17,6 @@
<iconset resource="citron.qrc">
<normaloff>:/img/citron.ico</normaloff>:/img/citron.ico</iconset>
</property>
<property name="styleSheet">
<string notr="true">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;
}</string>
</property>
<property name="tabShape">
<enum>QTabWidget::Rounded</enum>
</property>
@ -130,7 +45,7 @@ QToolButton:pressed {
<x>0</x>
<y>0</y>
<width>1280</width>
<height>29</height>
<height>21</height>
</rect>
</property>
<widget class="QMenu" name="menu_File">
@ -254,6 +169,7 @@ QToolButton:pressed {
<addaction name="action_Install_Firmware"/>
<addaction name="action_Verify_installed_contents"/>
<addaction name="separator"/>
<addaction name="action_Load_Home_Menu"/>
<addaction name="menu_cabinet_applet"/>
<addaction name="action_Load_Album"/>
<addaction name="action_Load_Mii_Edit"/>
@ -266,7 +182,6 @@ QToolButton:pressed {
<property name="title">
<string>&amp;Help</string>
</property>
<addaction name="action_Report_Compatibility"/>
<addaction name="action_About"/>
</widget>
<addaction name="menu_File"/>
@ -322,7 +237,7 @@ QToolButton:pressed {
</action>
<action name="action_About">
<property name="text">
<string>&amp;About citron</string>
<string>&amp;About Citron</string>
</property>
</action>
<action name="action_Single_Window_Mode">
@ -457,7 +372,15 @@ QToolButton:pressed {
</action>
<action name="action_Open_citron_Folder">
<property name="text">
<string>Open &amp;citron Folder</string>
<string>Open &amp;Citron Folder</string>
</property>
</action>
<action name="action_Load_Home_Menu">
<property name="text">
<string>Launch System Menu</string>
</property>
<property name="toolTip">
<string>Launch the system Home Menu</string>
</property>
</action>
<action name="action_Capture_Screenshot">
@ -556,16 +479,6 @@ QToolButton:pressed {
<string>Install Decryption Keys</string>
</property>
</action>
<action name="actionSave">
<property name="text">
<string>&amp;Save</string>
</property>
</action>
<action name="actionLoad">
<property name="text">
<string>&amp;Load</string>
</property>
</action>
</widget>
<resources>
<include location="citron.qrc"/>