diff options
author | Liam <byteslice@airmail.cc> | 2024-02-12 01:48:13 +0100 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2024-02-12 15:16:02 +0100 |
commit | 17460def8eff8e5e70d2e298a31c591ba03593b6 (patch) | |
tree | 26e40572b656643a7acda6a7d58ee0cbc190b76c | |
parent | am: rewrite IDisplayController (diff) | |
download | yuzu-17460def8eff8e5e70d2e298a31c591ba03593b6.tar yuzu-17460def8eff8e5e70d2e298a31c591ba03593b6.tar.gz yuzu-17460def8eff8e5e70d2e298a31c591ba03593b6.tar.bz2 yuzu-17460def8eff8e5e70d2e298a31c591ba03593b6.tar.lz yuzu-17460def8eff8e5e70d2e298a31c591ba03593b6.tar.xz yuzu-17460def8eff8e5e70d2e298a31c591ba03593b6.tar.zst yuzu-17460def8eff8e5e70d2e298a31c591ba03593b6.zip |
9 files changed, 187 insertions, 54 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index b5b1192b3..724ed989d 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -425,8 +425,6 @@ add_library(core STATIC hle/service/am/applet_message_queue.h hle/service/am/application_creator.cpp hle/service/am/application_creator.h - hle/service/am/global_state_controller.cpp - hle/service/am/global_state_controller.h hle/service/am/hid_registration.cpp hle/service/am/hid_registration.h hle/service/am/home_menu_functions.cpp @@ -467,10 +465,14 @@ add_library(core STATIC hle/service/am/service/audio_controller.h hle/service/am/service/common_state_getter.cpp hle/service/am/service/common_state_getter.h + hle/service/am/service/cradle_firmware_updater.cpp + hle/service/am/service/cradle_firmware_updater.h hle/service/am/service/debug_functions.cpp hle/service/am/service/debug_functions.h hle/service/am/service/display_controller.cpp hle/service/am/service/display_controller.h + hle/service/am/service/global_state_controller.cpp + hle/service/am/service/global_state_controller.h hle/service/am/service/library_applet_proxy.cpp hle/service/am/service/library_applet_proxy.h hle/service/am/service/system_applet_proxy.cpp diff --git a/src/core/hle/service/am/global_state_controller.cpp b/src/core/hle/service/am/global_state_controller.cpp deleted file mode 100644 index ed0eb7108..000000000 --- a/src/core/hle/service/am/global_state_controller.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "core/hle/service/am/global_state_controller.h" -#include "core/hle/service/ipc_helpers.h" - -namespace Service::AM { - -IGlobalStateController::IGlobalStateController(Core::System& system_) - : ServiceFramework{system_, "IGlobalStateController"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "RequestToEnterSleep"}, - {1, nullptr, "EnterSleep"}, - {2, nullptr, "StartSleepSequence"}, - {3, nullptr, "StartShutdownSequence"}, - {4, nullptr, "StartRebootSequence"}, - {9, nullptr, "IsAutoPowerDownRequested"}, - {10, nullptr, "LoadAndApplyIdlePolicySettings"}, - {11, nullptr, "NotifyCecSettingsChanged"}, - {12, nullptr, "SetDefaultHomeButtonLongPressTime"}, - {13, nullptr, "UpdateDefaultDisplayResolution"}, - {14, nullptr, "ShouldSleepOnBoot"}, - {15, nullptr, "GetHdcpAuthenticationFailedEvent"}, - {30, nullptr, "OpenCradleFirmwareUpdater"}, - }; - // clang-format on - - RegisterHandlers(functions); -} - -IGlobalStateController::~IGlobalStateController() = default; - -} // namespace Service::AM diff --git a/src/core/hle/service/am/global_state_controller.h b/src/core/hle/service/am/global_state_controller.h deleted file mode 100644 index 7125464a1..000000000 --- a/src/core/hle/service/am/global_state_controller.h +++ /dev/null @@ -1,16 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "core/hle/service/service.h" - -namespace Service::AM { - -class IGlobalStateController final : public ServiceFramework<IGlobalStateController> { -public: - explicit IGlobalStateController(Core::System& system_); - ~IGlobalStateController() override; -}; - -} // namespace Service::AM diff --git a/src/core/hle/service/am/service/cradle_firmware_updater.cpp b/src/core/hle/service/am/service/cradle_firmware_updater.cpp new file mode 100644 index 000000000..0a8af0858 --- /dev/null +++ b/src/core/hle/service/am/service/cradle_firmware_updater.cpp @@ -0,0 +1,52 @@ +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "core/hle/service/am/service/cradle_firmware_updater.h" +#include "core/hle/service/cmif_serialization.h" + +namespace Service::AM { + +ICradleFirmwareUpdater::ICradleFirmwareUpdater(Core::System& system_) + : ServiceFramework{system_, "ICradleFirmwareUpdater"}, + m_context{system, "ICradleFirmwareUpdater"}, m_cradle_device_info_event{m_context} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&ICradleFirmwareUpdater::StartUpdate>, "StartUpdate"}, + {1, D<&ICradleFirmwareUpdater::FinishUpdate>, "FinishUpdate"}, + {2, D<&ICradleFirmwareUpdater::GetCradleDeviceInfo>, "GetCradleDeviceInfo"}, + {3, D<&ICradleFirmwareUpdater::GetCradleDeviceInfoChangeEvent>, "GetCradleDeviceInfoChangeEvent"}, + {4, nullptr, "GetUpdateProgressInfo"}, + {5, nullptr, "GetLastInternalResult"}, + + }; + // clang-format on + + RegisterHandlers(functions); +} + +ICradleFirmwareUpdater::~ICradleFirmwareUpdater() = default; + +Result ICradleFirmwareUpdater::StartUpdate() { + LOG_WARNING(Service_AM, "(STUBBED) called"); + R_SUCCEED(); +} + +Result ICradleFirmwareUpdater::FinishUpdate() { + LOG_WARNING(Service_AM, "(STUBBED) called"); + R_SUCCEED(); +} + +Result ICradleFirmwareUpdater::GetCradleDeviceInfo(Out<CradleDeviceInfo> out_cradle_device_info) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + *out_cradle_device_info = {}; + R_SUCCEED(); +} + +Result ICradleFirmwareUpdater::GetCradleDeviceInfoChangeEvent( + OutCopyHandle<Kernel::KReadableEvent> out_event) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + *out_event = m_cradle_device_info_event.GetHandle(); + R_SUCCEED(); +} + +} // namespace Service::AM diff --git a/src/core/hle/service/am/service/cradle_firmware_updater.h b/src/core/hle/service/am/service/cradle_firmware_updater.h new file mode 100644 index 000000000..3e803f0ae --- /dev/null +++ b/src/core/hle/service/am/service/cradle_firmware_updater.h @@ -0,0 +1,37 @@ +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/hle/service/cmif_types.h" +#include "core/hle/service/kernel_helpers.h" +#include "core/hle/service/os/event.h" +#include "core/hle/service/service.h" + +namespace Service::AM { + +struct CradleDeviceInfo { + bool unknown0; + bool unknown1; + bool unknown2; + u64 unknown3; +}; +static_assert(sizeof(CradleDeviceInfo) == 0x10, "CradleDeviceInfo has incorrect size"); + +class ICradleFirmwareUpdater final : public ServiceFramework<ICradleFirmwareUpdater> { +public: + explicit ICradleFirmwareUpdater(Core::System& system_); + ~ICradleFirmwareUpdater() override; + +private: + Result StartUpdate(); + Result FinishUpdate(); + Result GetCradleDeviceInfo(Out<CradleDeviceInfo> out_cradle_device_info); + Result GetCradleDeviceInfoChangeEvent(OutCopyHandle<Kernel::KReadableEvent> out_event); + +private: + KernelHelpers::ServiceContext m_context; + Event m_cradle_device_info_event; +}; + +} // namespace Service::AM diff --git a/src/core/hle/service/am/service/global_state_controller.cpp b/src/core/hle/service/am/service/global_state_controller.cpp new file mode 100644 index 000000000..dba5d3613 --- /dev/null +++ b/src/core/hle/service/am/service/global_state_controller.cpp @@ -0,0 +1,61 @@ +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "core/hle/service/am/service/cradle_firmware_updater.h" +#include "core/hle/service/am/service/global_state_controller.h" +#include "core/hle/service/cmif_serialization.h" + +namespace Service::AM { + +IGlobalStateController::IGlobalStateController(Core::System& system_) + : ServiceFramework{system_, "IGlobalStateController"}, + m_context{system_, "IGlobalStateController"}, m_hdcp_authentication_failed_event{m_context} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "RequestToEnterSleep"}, + {1, nullptr, "EnterSleep"}, + {2, nullptr, "StartSleepSequence"}, + {3, nullptr, "StartShutdownSequence"}, + {4, nullptr, "StartRebootSequence"}, + {9, nullptr, "IsAutoPowerDownRequested"}, + {10, D<&IGlobalStateController::LoadAndApplyIdlePolicySettings>, "LoadAndApplyIdlePolicySettings"}, + {11, nullptr, "NotifyCecSettingsChanged"}, + {12, nullptr, "SetDefaultHomeButtonLongPressTime"}, + {13, nullptr, "UpdateDefaultDisplayResolution"}, + {14, D<&IGlobalStateController::ShouldSleepOnBoot>, "ShouldSleepOnBoot"}, + {15, D<&IGlobalStateController::GetHdcpAuthenticationFailedEvent>, "GetHdcpAuthenticationFailedEvent"}, + {30, D<&IGlobalStateController::OpenCradleFirmwareUpdater>, "OpenCradleFirmwareUpdater"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +IGlobalStateController::~IGlobalStateController() = default; + +Result IGlobalStateController::LoadAndApplyIdlePolicySettings() { + LOG_WARNING(Service_AM, "(STUBBED) called"); + R_SUCCEED(); +} + +Result IGlobalStateController::ShouldSleepOnBoot(Out<bool> out_should_sleep_on_boot) { + LOG_INFO(Service_AM, "called"); + *out_should_sleep_on_boot = false; + R_SUCCEED(); +} + +Result IGlobalStateController::GetHdcpAuthenticationFailedEvent( + OutCopyHandle<Kernel::KReadableEvent> out_event) { + LOG_INFO(Service_AM, "called"); + *out_event = m_hdcp_authentication_failed_event.GetHandle(); + R_SUCCEED(); +} + +Result IGlobalStateController::OpenCradleFirmwareUpdater( + Out<SharedPointer<ICradleFirmwareUpdater>> out_cradle_firmware_updater) { + LOG_INFO(Service_AM, "called"); + *out_cradle_firmware_updater = std::make_shared<ICradleFirmwareUpdater>(system); + R_SUCCEED(); +} + +} // namespace Service::AM diff --git a/src/core/hle/service/am/service/global_state_controller.h b/src/core/hle/service/am/service/global_state_controller.h new file mode 100644 index 000000000..67c753513 --- /dev/null +++ b/src/core/hle/service/am/service/global_state_controller.h @@ -0,0 +1,31 @@ +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/hle/service/cmif_types.h" +#include "core/hle/service/kernel_helpers.h" +#include "core/hle/service/os/event.h" +#include "core/hle/service/service.h" + +namespace Service::AM { + +class ICradleFirmwareUpdater; + +class IGlobalStateController final : public ServiceFramework<IGlobalStateController> { +public: + explicit IGlobalStateController(Core::System& system_); + ~IGlobalStateController() override; + +private: + Result LoadAndApplyIdlePolicySettings(); + Result ShouldSleepOnBoot(Out<bool> out_should_sleep_on_boot); + Result GetHdcpAuthenticationFailedEvent(OutCopyHandle<Kernel::KReadableEvent> out_event); + Result OpenCradleFirmwareUpdater( + Out<SharedPointer<ICradleFirmwareUpdater>> out_cradle_firmware_updater); + + KernelHelpers::ServiceContext m_context; + Event m_hdcp_authentication_failed_event; +}; + +} // namespace Service::AM diff --git a/src/core/hle/service/am/service/library_applet_proxy.cpp b/src/core/hle/service/am/service/library_applet_proxy.cpp index 589d53c20..7b5e9717d 100644 --- a/src/core/hle/service/am/service/library_applet_proxy.cpp +++ b/src/core/hle/service/am/service/library_applet_proxy.cpp @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include "core/hle/service/am/global_state_controller.h" #include "core/hle/service/am/home_menu_functions.h" #include "core/hle/service/am/library_applet_creator.h" #include "core/hle/service/am/library_applet_self_accessor.h" @@ -12,6 +11,7 @@ #include "core/hle/service/am/service/common_state_getter.h" #include "core/hle/service/am/service/debug_functions.h" #include "core/hle/service/am/service/display_controller.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/window_controller.h" #include "core/hle/service/cmif_serialization.h" diff --git a/src/core/hle/service/am/service/system_applet_proxy.cpp b/src/core/hle/service/am/service/system_applet_proxy.cpp index 4bfbd1067..077f6eea7 100644 --- a/src/core/hle/service/am/service/system_applet_proxy.cpp +++ b/src/core/hle/service/am/service/system_applet_proxy.cpp @@ -2,7 +2,6 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include "core/hle/service/am/application_creator.h" -#include "core/hle/service/am/global_state_controller.h" #include "core/hle/service/am/home_menu_functions.h" #include "core/hle/service/am/library_applet_creator.h" #include "core/hle/service/am/library_applet_self_accessor.h" @@ -13,6 +12,7 @@ #include "core/hle/service/am/service/common_state_getter.h" #include "core/hle/service/am/service/debug_functions.h" #include "core/hle/service/am/service/display_controller.h" +#include "core/hle/service/am/service/global_state_controller.h" #include "core/hle/service/am/service/system_applet_proxy.h" #include "core/hle/service/am/window_controller.h" #include "core/hle/service/cmif_serialization.h" |