diff --git a/src/core/hle/kernel/k_page_table_base.h b/src/core/hle/kernel/k_page_table_base.h index fd6b7216b8..537ab29e02 100644 --- a/src/core/hle/kernel/k_page_table_base.h +++ b/src/core/hle/kernel/k_page_table_base.h @@ -683,9 +683,6 @@ public: size_t GetAliasRegionSize() const { return m_alias_region_end - m_alias_region_start; } - size_t GetReservedRegionExtraSize() const { - return m_alias_region_extra_size; - } size_t GetStackRegionSize() const { return m_stack_region_end - m_stack_region_start; } @@ -719,6 +716,10 @@ public: return m_address_space_width; } + size_t GetReservedRegionExtraSize() const { + return m_alias_region_extra_size; + } + public: // Linear mapped static u8* GetLinearMappedVirtualPointer(KernelCore& kernel, KPhysicalAddress addr) { diff --git a/src/core/hle/kernel/k_process_page_table.h b/src/core/hle/kernel/k_process_page_table.h index 38c5fb8162..4b9942d50c 100644 --- a/src/core/hle/kernel/k_process_page_table.h +++ b/src/core/hle/kernel/k_process_page_table.h @@ -410,9 +410,6 @@ public: size_t GetAliasRegionSize() const { return m_page_table.GetAliasRegionSize(); } - size_t GetReservedRegionExtraSize() const { - return m_page_table.GetReservedRegionExtraSize(); - } size_t GetStackRegionSize() const { return m_page_table.GetStackRegionSize(); } @@ -475,6 +472,10 @@ public: const KPageTable& GetBasePageTable() const { return m_page_table; } + + size_t GetReservedRegionExtraSize() const { + return m_page_table.GetReservedRegionExtraSize(); + } }; } // namespace Kernel diff --git a/src/core/hle/kernel/svc_types.h b/src/core/hle/kernel/svc_types.h index 58d7ca9b9a..dbd8ab9dbb 100644 --- a/src/core/hle/kernel/svc_types.h +++ b/src/core/hle/kernel/svc_types.h @@ -644,6 +644,7 @@ enum class CreateProcessFlag : u32 { // 11.x+ DisableDeviceAddressSpaceMerge. DisableDeviceAddressSpaceMerge = (1 << 12), + // 13.x+ EnableReservedRegionExtraSize. EnableReservedRegionExtraSize = (1 << 13), // Mask of all flags. diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 37ab3f6d5e..ef16c90f4d 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp @@ -323,6 +323,10 @@ public: {1, &IProfileCommon::GetBase, "GetBase"}, {10, &IProfileCommon::GetImageSize, "GetImageSize"}, {11, &IProfileCommon::LoadImage, "LoadImage"}, + {20, &IProfileCommon::GetImageSize, "GetLargeImageSize"}, + {21, &IProfileCommon::LoadImage, "LoadLargeImage"}, + {30, &IProfileCommon::Unknown, "GetImageId"}, + {40, &IProfileCommon::GetStableUserId, "GetStableUserId"}, }; RegisterHandlers(functions); @@ -492,6 +496,20 @@ protected: rb.Push(ResultSuccess); } + void Unknown(HLERequestContext& ctx) { + LOG_WARNING(Service_ACC, "(STUBBED) called"); + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push(0); + } + + void GetStableUserId(HLERequestContext& ctx) { + LOG_DEBUG(Service_ACC, "called"); + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push(user_id.Hash()); + } + ProfileManager& profile_manager; Common::UUID user_id{}; ///< The user id this profile refers to. }; @@ -506,8 +524,13 @@ public: class IProfileEditor final : public IProfileCommon { public: explicit IProfileEditor(Core::System& system_, Common::UUID user_id_, - ProfileManager& profile_manager_) - : IProfileCommon{system_, "IProfileEditor", true, user_id_, profile_manager_} {} + ProfileManager& profile_manager_) + : IProfileCommon{system_, "IProfileEditor", true, user_id_, profile_manager_} { + static const FunctionInfo functions[] = { + {30, &IProfileEditor::Unknown, "Unknown"}, + }; + RegisterHandlers(functions); + } }; class ISessionObject final : public ServiceFramework { diff --git a/src/core/hle/service/am/service/all_system_applet_proxies_service.cpp b/src/core/hle/service/am/service/all_system_applet_proxies_service.cpp index bc9c86c557..e44037d307 100644 --- a/src/core/hle/service/am/service/all_system_applet_proxies_service.cpp +++ b/src/core/hle/service/am/service/all_system_applet_proxies_service.cpp @@ -4,6 +4,7 @@ #include "core/core.h" #include "core/hle/service/am/applet_manager.h" #include "core/hle/service/am/service/all_system_applet_proxies_service.h" +#include "core/hle/service/am/service/global_state_controller.h" #include "core/hle/service/am/service/library_applet_proxy.h" #include "core/hle/service/am/service/system_applet_proxy.h" #include "core/hle/service/am/window_system.h" @@ -23,6 +24,7 @@ IAllSystemAppletProxiesService::IAllSystemAppletProxiesService(Core::System& sys {350, nullptr, "OpenSystemApplicationProxy"}, {400, nullptr, "CreateSelfLibraryAppletCreatorForDevelop"}, {410, nullptr, "GetSystemAppletControllerForDebug"}, + {450, D<&IAllSystemAppletProxiesService::GetGlobalStateController>, "GetGlobalStateController"}, {1000, nullptr, "GetDebugFunctions"}, }; // clang-format on @@ -73,6 +75,13 @@ Result IAllSystemAppletProxiesService::OpenLibraryAppletProxyOld( this->OpenLibraryAppletProxy(out_library_applet_proxy, pid, process_handle, attribute)); } +Result IAllSystemAppletProxiesService::GetGlobalStateController( + Out> out_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_controller = std::make_shared(this->system); + R_SUCCEED(); +} + std::shared_ptr IAllSystemAppletProxiesService::GetAppletFromProcessId( ProcessId process_id) { return m_window_system.GetByAppletResourceUserId(process_id.pid); diff --git a/src/core/hle/service/am/service/all_system_applet_proxies_service.h b/src/core/hle/service/am/service/all_system_applet_proxies_service.h index e3e79dc4fa..344d93b130 100644 --- a/src/core/hle/service/am/service/all_system_applet_proxies_service.h +++ b/src/core/hle/service/am/service/all_system_applet_proxies_service.h @@ -5,6 +5,7 @@ #include "core/hle/service/cmif_types.h" #include "core/hle/service/service.h" +#include "core/hle/service/am/service/global_state_controller.h" namespace Service { @@ -14,6 +15,7 @@ struct Applet; struct AppletAttribute; class ILibraryAppletProxy; class ISystemAppletProxy; +class IGlobalStateController; class WindowSystem; class IAllSystemAppletProxiesService final @@ -34,7 +36,8 @@ private: Out> out_library_applet_proxy, ClientProcessId pid, InCopyHandle process_handle); -private: + Result GetGlobalStateController(Out> out_controller); + std::shared_ptr GetAppletFromProcessId(ProcessId pid); WindowSystem& m_window_system; diff --git a/src/core/hle/service/am/service/global_state_controller.cpp b/src/core/hle/service/am/service/global_state_controller.cpp index aa8f852fea..f49afb9c13 100644 --- a/src/core/hle/service/am/service/global_state_controller.cpp +++ b/src/core/hle/service/am/service/global_state_controller.cpp @@ -38,18 +38,6 @@ Result IGlobalStateController::StartSleepSequence(u8 a) { R_SUCCEED(); } -Result IGlobalStateController::StartShutdownSequence() { - LOG_INFO(Service_AM, "called"); - system.Exit(); - R_SUCCEED(); -} - -Result IGlobalStateController::StartRebootSequence() { - LOG_INFO(Service_AM, "called"); - system.Exit(); - R_SUCCEED(); -} - Result IGlobalStateController::LoadAndApplyIdlePolicySettings() { LOG_WARNING(Service_AM, "(STUBBED) called"); R_SUCCEED(); @@ -75,4 +63,16 @@ Result IGlobalStateController::OpenCradleFirmwareUpdater( R_SUCCEED(); } +Result IGlobalStateController::StartShutdownSequence() { + LOG_INFO(Service_AM, "called"); + system.Exit(); + R_SUCCEED(); +} + +Result IGlobalStateController::StartRebootSequence() { + LOG_INFO(Service_AM, "called"); + system.Exit(); + R_SUCCEED(); +} + } // namespace Service::AM diff --git a/src/core/hle/service/audio/audio_controller.cpp b/src/core/hle/service/audio/audio_controller.cpp index 300764ad6b..c725e05fc6 100644 --- a/src/core/hle/service/audio/audio_controller.cpp +++ b/src/core/hle/service/audio/audio_controller.cpp @@ -11,8 +11,19 @@ namespace Service::Audio { IAudioController::IAudioController(Core::System& system_) - : ServiceFramework{system_, "audctl"}, service_context{system, "audctl"} { - // clang-format off + : ServiceFramework{system_, "audctl"} + , service_context{system, "audctl"} + , m_current_output_target{1} // Initialize with default values + , m_current_parameter{0x1388} + , m_current_volume{100} { + + // Create notification event first + notification_event = service_context.CreateEvent("IAudioController:NotificationEvent"); + + // Get system settings service + m_set_sys = system.ServiceManager().GetService("set:sys", true); + + // Register handlers static const FunctionInfo functions[] = { {0, nullptr, "GetTargetVolume"}, {1, nullptr, "SetTargetVolume"}, @@ -67,15 +78,15 @@ IAudioController::IAudioController(Core::System& system_) {10104, nullptr, "GetAudioOutputChannelCountForPlayReport"}, {10105, nullptr, "BindAudioOutputChannelCountUpdateEventForPlayReport"}, {10106, nullptr, "GetDefaultAudioOutputTargetForPlayReport"}, - {50000, nullptr, "SetAnalogInputBoostGainForPrototyping"}, + {5000, D<&IAudioController::GetSelfController>, "GetSelfController"}, + {50001, D<&IAudioController::SetAudioControllerOutput>, "SetAudioControllerOutput"}, }; - // clang-format on - RegisterHandlers(functions); - m_set_sys = - system.ServiceManager().GetService("set:sys", true); - notification_event = service_context.CreateEvent("IAudioController:NotificationEvent"); + // Signal initial state + if (notification_event) { + notification_event->Signal(); + } } IAudioController::~IAudioController() { @@ -176,4 +187,34 @@ Result IAudioController::AcquireTargetNotification( R_SUCCEED(); } +Result IAudioController::SetAudioControllerOutput(u32 output_target, u32 parameter, u32 volume) { + LOG_DEBUG(Audio, "called. output_target={}, parameter={}, volume={}", output_target, parameter, volume); + + if (!notification_event) { + LOG_ERROR(Audio, "Notification event not initialized"); + R_THROW(ResultCode::ResultInvalidState); + } + + m_current_output_target = output_target; + m_current_parameter = parameter; + m_current_volume = volume; + + notification_event->Signal(); + R_SUCCEED(); +} + +Result IAudioController::GetSelfController(Out> out_controller) { + LOG_DEBUG(Audio, "called"); + + // Use ServiceFramework's built-in method to get a shared pointer + *out_controller = SharedPointer(this); + + // Signal notification event since we're returning a new interface + if (notification_event) { + notification_event->Signal(); + } + + R_SUCCEED(); +} + } // namespace Service::Audio diff --git a/src/core/hle/service/audio/audio_controller.h b/src/core/hle/service/audio/audio_controller.h index d37c4843e3..98d7ecf894 100644 --- a/src/core/hle/service/audio/audio_controller.h +++ b/src/core/hle/service/audio/audio_controller.h @@ -6,6 +6,7 @@ #include "core/hle/service/cmif_types.h" #include "core/hle/service/service.h" #include "core/hle/service/set/settings_types.h" +#include "core/hle/result.h" namespace Core { class System; @@ -17,6 +18,10 @@ class ISystemSettingsServer; namespace Service::Audio { +namespace ResultCode { + constexpr Result ResultInvalidState{ErrorModule::Audio, 1}; +} // namespace ResultCode + class IAudioController final : public ServiceFramework { public: explicit IAudioController(Core::System& system_); @@ -49,11 +54,18 @@ private: Result SetSpeakerAutoMuteEnabled(bool is_speaker_auto_mute_enabled); Result IsSpeakerAutoMuteEnabled(Out out_is_speaker_auto_mute_enabled); Result AcquireTargetNotification(OutCopyHandle out_notification_event); + Result SetAudioControllerOutput(u32 output_target, u32 parameter, u32 volume); + Result GetSelfController(Out> out_controller); KernelHelpers::ServiceContext service_context; Kernel::KEvent* notification_event; std::shared_ptr m_set_sys; + + // Add state tracking + u32 m_current_output_target{0}; + u32 m_current_parameter{0}; + u32 m_current_volume{0}; }; } // namespace Service::Audio diff --git a/src/core/hle/service/pctl/parental_control_service.cpp b/src/core/hle/service/pctl/parental_control_service.cpp index 6bc677252f..cb6a1f1c21 100644 --- a/src/core/hle/service/pctl/parental_control_service.cpp +++ b/src/core/hle/service/pctl/parental_control_service.cpp @@ -77,7 +77,7 @@ IParentalControlService::IParentalControlService(Core::System& system_, Capabili {1451, D<&IParentalControlService::StartPlayTimer>, "StartPlayTimer"}, {1452, D<&IParentalControlService::StopPlayTimer>, "StopPlayTimer"}, {1453, D<&IParentalControlService::IsPlayTimerEnabled>, "IsPlayTimerEnabled"}, - {1454, nullptr, "GetPlayTimerRemainingTime"}, + {1454, D<&IParentalControlService::GetPlayTimerRemainingTime>, "GetPlayTimerRemainingTime"}, {1455, D<&IParentalControlService::IsRestrictedByPlayTimer>, "IsRestrictedByPlayTimer"}, {1456, D<&IParentalControlService::GetPlayTimerSettings>, "GetPlayTimerSettings"}, {1457, D<&IParentalControlService::GetPlayTimerEventToRequestSuspension>, "GetPlayTimerEventToRequestSuspension"}, @@ -123,7 +123,7 @@ IParentalControlService::IParentalControlService(Core::System& system_, Capabili {2014, nullptr, "FinishSynchronizeParentalControlSettings"}, {2015, nullptr, "FinishSynchronizeParentalControlSettingsWithLastUpdated"}, {2016, nullptr, "RequestUpdateExemptionListAsync"}, - {145601, nullptr, "GetPlayTimerSettingsVer2"}, // 18.0.0+ + {145601, D<&IParentalControlService::GetSelfController>, "GetSelfController"}, {195101, nullptr, "SetPlayTimerSettingsForDebugVer2"}, // 18.0.0+ }; // clang-format on @@ -439,4 +439,22 @@ Result IParentalControlService::ResetConfirmedStereoVisionPermission() { R_SUCCEED(); } +Result IParentalControlService::GetSelfController(Out> out_controller) { + LOG_DEBUG(Service_PCTL, "called"); + + // Return a shared pointer to this service instance + *out_controller = SharedPointer(this); + + R_SUCCEED(); +} + +Result IParentalControlService::GetPlayTimerRemainingTime(Out out_remaining_time) { + LOG_DEBUG(Service_PCTL, "called"); + + // For now, return maximum time remaining since play timer is stubbed + *out_remaining_time = std::numeric_limits::max(); + + R_SUCCEED(); +} + } // namespace Service::PCTL diff --git a/src/core/hle/service/pctl/parental_control_service.h b/src/core/hle/service/pctl/parental_control_service.h index 03dbaa2e5f..121e67664d 100644 --- a/src/core/hle/service/pctl/parental_control_service.h +++ b/src/core/hle/service/pctl/parental_control_service.h @@ -53,6 +53,8 @@ private: Result GetStereoVisionRestriction(Out out_stereo_vision_restriction); Result SetStereoVisionRestriction(bool stereo_vision_restriction); Result ResetConfirmedStereoVisionPermission(); + Result GetSelfController(Out> out_controller); + Result GetPlayTimerRemainingTime(Out out_remaining_time); struct States { u64 current_tid{}; diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 415863021d..476826e782 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -1610,8 +1610,8 @@ void GMainWindow::UpdateMenuState() { ui->action_Load_Cabinet_Restorer, ui->action_Load_Cabinet_Formatter, ui->action_Load_Mii_Edit, - ui->action_Load_Home_Menu, - ui->action_Open_Controller_Menu}; + ui->action_Open_Controller_Menu, + ui->action_Load_Home_Menu}; for (QAction* action : running_actions) { action->setEnabled(emulation_running); @@ -4466,29 +4466,6 @@ void GMainWindow::OnOpenControllerMenu() { LibraryAppletParameters(ControllerAppletId, Service::AM::AppletId::Controller)); } -void GMainWindow::OnHomeMenu() { - constexpr u64 QLaunchId = static_cast(Service::AM::AppletProgramId::QLaunch); - auto bis_system = system->GetFileSystemController().GetSystemNANDContents(); - if (!bis_system) { - QMessageBox::warning(this, tr("No firmware available"), - tr("Please install the firmware to use the Home Menu.")); - return; - } - - auto qlaunch_applet_nca = bis_system->GetEntry(QLaunchId, FileSys::ContentRecordType::Program); - if (!qlaunch_applet_nca) { - QMessageBox::warning(this, tr("Home Menu Applet"), - tr("Home Menu is not available. Please reinstall firmware.")); - return; - } - - system->GetFrontendAppletHolder().SetCurrentAppletId(Service::AM::AppletId::QLaunch); - - const auto filename = QString::fromStdString((qlaunch_applet_nca->GetFullPath())); - UISettings::values.roms_path = QFileInfo(filename).path().toStdString(); - BootGame(filename, LibraryAppletParameters(QLaunchId, Service::AM::AppletId::QLaunch)); -} - void GMainWindow::OnCaptureScreenshot() { if (emu_thread == nullptr || !emu_thread->IsRunning()) { return; @@ -5368,3 +5345,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/yuzu/main.h b/src/yuzu/main.h index d460981ac0..9df32bdbc1 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h @@ -404,7 +404,6 @@ private slots: void OnCabinet(Service::NFP::CabinetMode mode); void OnMiiEdit(); void OnOpenControllerMenu(); - void OnHomeMenu(); void OnCaptureScreenshot(); void OnCheckFirmwareDecryption(); void OnLanguageChanged(const QString& locale); @@ -413,6 +412,7 @@ private slots: void OnShutdownBeginDialog(); void OnEmulationStopped(); void OnEmulationStopTimeExpired(); + void OnHomeMenu(); private: QString GetGameListErrorRemoving(InstalledEntryType type) const; diff --git a/src/yuzu/main.ui b/src/yuzu/main.ui index 7b9da0c6fa..5749294efa 100644 --- a/src/yuzu/main.ui +++ b/src/yuzu/main.ui @@ -17,91 +17,6 @@ :/img/yuzu.ico:/img/yuzu.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 @@ -255,6 +170,7 @@ QToolButton:pressed { + @@ -268,7 +184,6 @@ QToolButton:pressed { &Help - @@ -473,6 +388,14 @@ QToolButton:pressed { Open &yuzu Folder + + + Launch System Menu + + + Launch the system Home Menu + + false @@ -569,16 +492,6 @@ QToolButton:pressed { Install Decryption Keys - - - &Save - - - - - &Load - - Open Home Menu