feat(hle/am): add event handling for state controllers

- Implement GetGpuErrorDetectedSystemEvent (cmd 1020)

- Implement GetFriendInvitationStorageChannelEvent (cmd 1030)

- Implement GetNotificationStorageChannelEvent (cmd 1040)

- Implement GetHealthWarningDisappearedSystemEvent (cmd 1050)

- Implement GetAccumulatedSuspendedTickChangedEvent (cmd 63)
This commit is contained in:
Zephyron
2026-01-28 16:41:21 +10:00
parent ab93279542
commit 53fc6bf107
4 changed files with 51 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 citron Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "common/settings.h"
@@ -82,13 +82,13 @@ ICommonStateGetter::ICommonStateGetter(Core::System& system_, std::shared_ptr<Ap
{1001, nullptr, "GetScreenShotPermission"},
{1010, nullptr, "GetNextProgramArgumentInfo"},
{1011, nullptr, "GetPreviousProgramArgumentInfo"},
{1020, nullptr, "GetGpuErrorDetectedSystemEvent"},
{1020, D<&ICommonStateGetter::GetGpuErrorDetectedSystemEvent>, "GetGpuErrorDetectedSystemEvent"},
{1021, nullptr, "SetDelayTimeToAbortOnGpuError"},
{1030, nullptr, "GetFriendInvitationStorageChannelEvent"},
{1030, D<&ICommonStateGetter::GetFriendInvitationStorageChannelEvent>, "GetFriendInvitationStorageChannelEvent"},
{1031, nullptr, "TryPopFromFriendInvitationStorageChannel"},
{1040, nullptr, "GetNotificationStorageChannelEvent"},
{1040, D<&ICommonStateGetter::GetNotificationStorageChannelEvent>, "GetNotificationStorageChannelEvent"},
{1041, nullptr, "TryPopFromNotificationStorageChannel"},
{1050, nullptr, "GetHealthWarningDisappearedSystemEvent"},
{1050, D<&ICommonStateGetter::GetHealthWarningDisappearedSystemEvent>, "GetHealthWarningDisappearedSystemEvent"},
{1060, nullptr, "SetHdcpAuthenticationActivated"},
{1061, nullptr, "GetLastForegroundCaptureImageEx"},
{1062, nullptr, "GetLastApplicationCaptureImageEx"},
@@ -297,4 +297,32 @@ Result ICommonStateGetter::SetRequestExitToLibraryAppletAtExecuteNextProgramEnab
R_SUCCEED();
}
Result ICommonStateGetter::GetGpuErrorDetectedSystemEvent(
OutCopyHandle<Kernel::KReadableEvent> out_event) {
LOG_DEBUG(Service_AM, "called");
*out_event = m_applet->gpu_error_detected_event.GetHandle();
R_SUCCEED();
}
Result ICommonStateGetter::GetFriendInvitationStorageChannelEvent(
OutCopyHandle<Kernel::KReadableEvent> out_event) {
LOG_DEBUG(Service_AM, "called");
*out_event = m_applet->friend_invitation_storage_channel_event.GetHandle();
R_SUCCEED();
}
Result ICommonStateGetter::GetNotificationStorageChannelEvent(
OutCopyHandle<Kernel::KReadableEvent> out_event) {
LOG_DEBUG(Service_AM, "called");
*out_event = m_applet->notification_storage_channel_event.GetHandle();
R_SUCCEED();
}
Result ICommonStateGetter::GetHealthWarningDisappearedSystemEvent(
OutCopyHandle<Kernel::KReadableEvent> out_event) {
LOG_DEBUG(Service_AM, "called");
*out_event = m_applet->health_warning_disappeared_system_event.GetHandle();
R_SUCCEED();
}
} // namespace Service::AM

View File

@@ -53,6 +53,10 @@ private:
OutArray<AppletId, BufferAttr_HipcMapAlias> out_applet_ids);
Result GetSettingsPlatformRegion(Out<Set::PlatformRegion> out_settings_platform_region);
Result SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled();
Result GetGpuErrorDetectedSystemEvent(OutCopyHandle<Kernel::KReadableEvent> out_event);
Result GetFriendInvitationStorageChannelEvent(OutCopyHandle<Kernel::KReadableEvent> out_event);
Result GetNotificationStorageChannelEvent(OutCopyHandle<Kernel::KReadableEvent> out_event);
Result GetHealthWarningDisappearedSystemEvent(OutCopyHandle<Kernel::KReadableEvent> out_event);
void SetCpuBoostMode(HLERequestContext& ctx);

View File

@@ -1,5 +1,5 @@
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 citron Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "core/hle/service/am/service/cradle_firmware_updater.h"
@@ -10,7 +10,8 @@ namespace Service::AM {
IGlobalStateController::IGlobalStateController(Core::System& system_)
: ServiceFramework{system_, "IGlobalStateController"},
m_context{system_, "IGlobalStateController"}, m_hdcp_authentication_failed_event{m_context} {
m_context{system_, "IGlobalStateController"}, m_hdcp_authentication_failed_event{m_context},
m_accumulated_suspended_tick_changed_event{m_context} {
// clang-format off
static const FunctionInfo functions[] = {
{0, D<&IGlobalStateController::RequestToEnterSleep>, "RequestToEnterSleep"},
@@ -35,7 +36,7 @@ IGlobalStateController::IGlobalStateController(Core::System& system_)
{60, nullptr, "SetWirelessPriorityMode"},
{61, nullptr, "GetWirelessPriorityMode"},
{62, nullptr, "GetAccumulatedSuspendedTickValue"},
{63, nullptr, "GetAccumulatedSuspendedTickChangedEvent"},
{63, D<&IGlobalStateController::GetAccumulatedSuspendedTickChangedEvent>, "GetAccumulatedSuspendedTickChangedEvent"},
{64, nullptr, "SetAlarmTimeChangeEvent"},
{65, nullptr, "GetWakeupCount"},
{66, nullptr, "GetHomeButtonInputProtectionStartTime"},
@@ -130,4 +131,11 @@ Result IGlobalStateController::UpdateDefaultDisplayResolution() {
R_SUCCEED();
}
Result IGlobalStateController::GetAccumulatedSuspendedTickChangedEvent(
OutCopyHandle<Kernel::KReadableEvent> out_event) {
LOG_DEBUG(Service_AM, "called");
*out_event = m_accumulated_suspended_tick_changed_event.GetHandle();
R_SUCCEED();
}
} // namespace Service::AM

View File

@@ -1,5 +1,5 @@
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 citron Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
@@ -33,9 +33,11 @@ private:
Result GetHdcpAuthenticationFailedEvent(OutCopyHandle<Kernel::KReadableEvent> out_event);
Result OpenCradleFirmwareUpdater(
Out<SharedPointer<ICradleFirmwareUpdater>> out_cradle_firmware_updater);
Result GetAccumulatedSuspendedTickChangedEvent(OutCopyHandle<Kernel::KReadableEvent> out_event);
KernelHelpers::ServiceContext m_context;
Event m_hdcp_authentication_failed_event;
Event m_accumulated_suspended_tick_changed_event;
};
} // namespace Service::AM