summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service
diff options
context:
space:
mode:
authorLiam <byteslice@airmail.cc>2024-02-12 01:38:23 +0100
committerLiam <byteslice@airmail.cc>2024-02-12 15:16:02 +0100
commit96fea99af952490bf8799f0775bfa307e82bbf0f (patch)
tree74fcd45dc02c1463d3f4b0ff39262895a57a741b /src/core/hle/service
parentam: rewrite IApplicationFunctions (diff)
downloadyuzu-96fea99af952490bf8799f0775bfa307e82bbf0f.tar
yuzu-96fea99af952490bf8799f0775bfa307e82bbf0f.tar.gz
yuzu-96fea99af952490bf8799f0775bfa307e82bbf0f.tar.bz2
yuzu-96fea99af952490bf8799f0775bfa307e82bbf0f.tar.lz
yuzu-96fea99af952490bf8799f0775bfa307e82bbf0f.tar.xz
yuzu-96fea99af952490bf8799f0775bfa307e82bbf0f.tar.zst
yuzu-96fea99af952490bf8799f0775bfa307e82bbf0f.zip
Diffstat (limited to 'src/core/hle/service')
-rw-r--r--src/core/hle/service/am/am_types.h34
-rw-r--r--src/core/hle/service/am/applet_manager.cpp4
-rw-r--r--src/core/hle/service/am/applet_message_queue.cpp2
-rw-r--r--src/core/hle/service/am/applet_message_queue.h35
-rw-r--r--src/core/hle/service/am/common_state_getter.cpp314
-rw-r--r--src/core/hle/service/am/common_state_getter.h77
-rw-r--r--src/core/hle/service/am/library_applet_creator.cpp4
-rw-r--r--src/core/hle/service/am/service/application_proxy.cpp2
-rw-r--r--src/core/hle/service/am/service/common_state_getter.cpp277
-rw-r--r--src/core/hle/service/am/service/common_state_getter.h61
-rw-r--r--src/core/hle/service/am/service/library_applet_proxy.cpp2
-rw-r--r--src/core/hle/service/am/service/system_applet_proxy.cpp2
-rw-r--r--src/core/hle/service/am/window_controller.cpp4
13 files changed, 383 insertions, 435 deletions
diff --git a/src/core/hle/service/am/am_types.h b/src/core/hle/service/am/am_types.h
index bf2272c0e..093adcdea 100644
--- a/src/core/hle/service/am/am_types.h
+++ b/src/core/hle/service/am/am_types.h
@@ -128,6 +128,40 @@ enum class AppletProgramId : u64 {
MaxProgramId = 0x0100000000001FFFull,
};
+// This is nn::am::AppletMessage
+enum class AppletMessage : u32 {
+ None = 0,
+ ChangeIntoForeground = 1,
+ ChangeIntoBackground = 2,
+ Exit = 4,
+ ApplicationExited = 6,
+ FocusStateChanged = 15,
+ Resume = 16,
+ DetectShortPressingHomeButton = 20,
+ DetectLongPressingHomeButton = 21,
+ DetectShortPressingPowerButton = 22,
+ DetectMiddlePressingPowerButton = 23,
+ DetectLongPressingPowerButton = 24,
+ RequestToPrepareSleep = 25,
+ FinishedSleepSequence = 26,
+ SleepRequiredByHighTemperature = 27,
+ SleepRequiredByLowBattery = 28,
+ AutoPowerDown = 29,
+ OperationModeChanged = 30,
+ PerformanceModeChanged = 31,
+ DetectReceivingCecSystemStandby = 32,
+ SdCardRemoved = 33,
+ LaunchApplicationRequested = 50,
+ RequestToDisplay = 51,
+ ShowApplicationLogo = 55,
+ HideApplicationLogo = 56,
+ ForceHideApplicationLogo = 57,
+ FloatingApplicationDetected = 60,
+ DetectShortPressingCaptureButton = 90,
+ AlbumScreenShotTaken = 92,
+ AlbumRecordingSaved = 93,
+};
+
enum class LibraryAppletMode : u32 {
AllForeground = 0,
PartialForeground = 1,
diff --git a/src/core/hle/service/am/applet_manager.cpp b/src/core/hle/service/am/applet_manager.cpp
index 52200d5b2..b35d97bc7 100644
--- a/src/core/hle/service/am/applet_manager.cpp
+++ b/src/core/hle/service/am/applet_manager.cpp
@@ -303,8 +303,8 @@ void AppletManager::CreateAndInsertByFrontendAppletParameters(
}
// Applet was started by frontend, so it is foreground.
- applet->message_queue.PushMessage(AppletMessageQueue::AppletMessage::ChangeIntoForeground);
- applet->message_queue.PushMessage(AppletMessageQueue::AppletMessage::FocusStateChanged);
+ applet->message_queue.PushMessage(AppletMessage::ChangeIntoForeground);
+ applet->message_queue.PushMessage(AppletMessage::FocusStateChanged);
applet->focus_state = FocusState::InFocus;
this->InsertApplet(std::move(applet));
diff --git a/src/core/hle/service/am/applet_message_queue.cpp b/src/core/hle/service/am/applet_message_queue.cpp
index 5ed996b70..83c3c5a55 100644
--- a/src/core/hle/service/am/applet_message_queue.cpp
+++ b/src/core/hle/service/am/applet_message_queue.cpp
@@ -33,7 +33,7 @@ void AppletMessageQueue::PushMessage(AppletMessage msg) {
on_new_message->Signal();
}
-AppletMessageQueue::AppletMessage AppletMessageQueue::PopMessage() {
+AppletMessage AppletMessageQueue::PopMessage() {
std::scoped_lock lk{lock};
if (messages.empty()) {
on_new_message->Clear();
diff --git a/src/core/hle/service/am/applet_message_queue.h b/src/core/hle/service/am/applet_message_queue.h
index 5cb236d47..429b77d37 100644
--- a/src/core/hle/service/am/applet_message_queue.h
+++ b/src/core/hle/service/am/applet_message_queue.h
@@ -5,6 +5,7 @@
#include <queue>
+#include "core/hle/service/am/am_types.h"
#include "core/hle/service/kernel_helpers.h"
#include "core/hle/service/service.h"
@@ -16,40 +17,6 @@ namespace Service::AM {
class AppletMessageQueue {
public:
- // This is nn::am::AppletMessage
- enum class AppletMessage : u32 {
- None = 0,
- ChangeIntoForeground = 1,
- ChangeIntoBackground = 2,
- Exit = 4,
- ApplicationExited = 6,
- FocusStateChanged = 15,
- Resume = 16,
- DetectShortPressingHomeButton = 20,
- DetectLongPressingHomeButton = 21,
- DetectShortPressingPowerButton = 22,
- DetectMiddlePressingPowerButton = 23,
- DetectLongPressingPowerButton = 24,
- RequestToPrepareSleep = 25,
- FinishedSleepSequence = 26,
- SleepRequiredByHighTemperature = 27,
- SleepRequiredByLowBattery = 28,
- AutoPowerDown = 29,
- OperationModeChanged = 30,
- PerformanceModeChanged = 31,
- DetectReceivingCecSystemStandby = 32,
- SdCardRemoved = 33,
- LaunchApplicationRequested = 50,
- RequestToDisplay = 51,
- ShowApplicationLogo = 55,
- HideApplicationLogo = 56,
- ForceHideApplicationLogo = 57,
- FloatingApplicationDetected = 60,
- DetectShortPressingCaptureButton = 90,
- AlbumScreenShotTaken = 92,
- AlbumRecordingSaved = 93,
- };
-
explicit AppletMessageQueue(Core::System& system);
~AppletMessageQueue();
diff --git a/src/core/hle/service/am/common_state_getter.cpp b/src/core/hle/service/am/common_state_getter.cpp
deleted file mode 100644
index 937ac0beb..000000000
--- a/src/core/hle/service/am/common_state_getter.cpp
+++ /dev/null
@@ -1,314 +0,0 @@
-// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#include "common/settings.h"
-#include "core/hle/service/am/am_results.h"
-#include "core/hle/service/am/applet.h"
-#include "core/hle/service/am/common_state_getter.h"
-#include "core/hle/service/am/lock_accessor.h"
-#include "core/hle/service/apm/apm_controller.h"
-#include "core/hle/service/apm/apm_interface.h"
-#include "core/hle/service/ipc_helpers.h"
-#include "core/hle/service/pm/pm.h"
-#include "core/hle/service/sm/sm.h"
-#include "core/hle/service/vi/vi.h"
-
-namespace Service::AM {
-
-ICommonStateGetter::ICommonStateGetter(Core::System& system_, std::shared_ptr<Applet> applet_)
- : ServiceFramework{system_, "ICommonStateGetter"}, applet{std::move(applet_)} {
- // clang-format off
- static const FunctionInfo functions[] = {
- {0, &ICommonStateGetter::GetEventHandle, "GetEventHandle"},
- {1, &ICommonStateGetter::ReceiveMessage, "ReceiveMessage"},
- {2, nullptr, "GetThisAppletKind"},
- {3, nullptr, "AllowToEnterSleep"},
- {4, nullptr, "DisallowToEnterSleep"},
- {5, &ICommonStateGetter::GetOperationMode, "GetOperationMode"},
- {6, &ICommonStateGetter::GetPerformanceMode, "GetPerformanceMode"},
- {7, nullptr, "GetCradleStatus"},
- {8, &ICommonStateGetter::GetBootMode, "GetBootMode"},
- {9, &ICommonStateGetter::GetCurrentFocusState, "GetCurrentFocusState"},
- {10, &ICommonStateGetter::RequestToAcquireSleepLock, "RequestToAcquireSleepLock"},
- {11, nullptr, "ReleaseSleepLock"},
- {12, nullptr, "ReleaseSleepLockTransiently"},
- {13, &ICommonStateGetter::GetAcquiredSleepLockEvent, "GetAcquiredSleepLockEvent"},
- {14, nullptr, "GetWakeupCount"},
- {20, nullptr, "PushToGeneralChannel"},
- {30, nullptr, "GetHomeButtonReaderLockAccessor"},
- {31, &ICommonStateGetter::GetReaderLockAccessorEx, "GetReaderLockAccessorEx"},
- {32, nullptr, "GetWriterLockAccessorEx"},
- {40, nullptr, "GetCradleFwVersion"},
- {50, &ICommonStateGetter::IsVrModeEnabled, "IsVrModeEnabled"},
- {51, &ICommonStateGetter::SetVrModeEnabled, "SetVrModeEnabled"},
- {52, &ICommonStateGetter::SetLcdBacklighOffEnabled, "SetLcdBacklighOffEnabled"},
- {53, &ICommonStateGetter::BeginVrModeEx, "BeginVrModeEx"},
- {54, &ICommonStateGetter::EndVrModeEx, "EndVrModeEx"},
- {55, nullptr, "IsInControllerFirmwareUpdateSection"},
- {59, nullptr, "SetVrPositionForDebug"},
- {60, &ICommonStateGetter::GetDefaultDisplayResolution, "GetDefaultDisplayResolution"},
- {61, &ICommonStateGetter::GetDefaultDisplayResolutionChangeEvent, "GetDefaultDisplayResolutionChangeEvent"},
- {62, nullptr, "GetHdcpAuthenticationState"},
- {63, nullptr, "GetHdcpAuthenticationStateChangeEvent"},
- {64, nullptr, "SetTvPowerStateMatchingMode"},
- {65, nullptr, "GetApplicationIdByContentActionName"},
- {66, &ICommonStateGetter::SetCpuBoostMode, "SetCpuBoostMode"},
- {67, nullptr, "CancelCpuBoostMode"},
- {68, &ICommonStateGetter::GetBuiltInDisplayType, "GetBuiltInDisplayType"},
- {80, &ICommonStateGetter::PerformSystemButtonPressingIfInFocus, "PerformSystemButtonPressingIfInFocus"},
- {90, nullptr, "SetPerformanceConfigurationChangedNotification"},
- {91, nullptr, "GetCurrentPerformanceConfiguration"},
- {100, nullptr, "SetHandlingHomeButtonShortPressedEnabled"},
- {110, nullptr, "OpenMyGpuErrorHandler"},
- {120, &ICommonStateGetter::GetAppletLaunchedHistory, "GetAppletLaunchedHistory"},
- {200, nullptr, "GetOperationModeSystemInfo"},
- {300, &ICommonStateGetter::GetSettingsPlatformRegion, "GetSettingsPlatformRegion"},
- {400, nullptr, "ActivateMigrationService"},
- {401, nullptr, "DeactivateMigrationService"},
- {500, nullptr, "DisableSleepTillShutdown"},
- {501, nullptr, "SuppressDisablingSleepTemporarily"},
- {502, nullptr, "IsSleepEnabled"},
- {503, nullptr, "IsDisablingSleepSuppressed"},
- {900, &ICommonStateGetter::SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled, "SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled"},
- };
- // clang-format on
-
- RegisterHandlers(functions);
-}
-
-ICommonStateGetter::~ICommonStateGetter() = default;
-
-void ICommonStateGetter::GetBootMode(HLERequestContext& ctx) {
- LOG_DEBUG(Service_AM, "called");
-
- IPC::ResponseBuilder rb{ctx, 3};
- rb.Push(ResultSuccess);
- rb.Push<u8>(static_cast<u8>(Service::PM::SystemBootMode::Normal)); // Normal boot mode
-}
-
-void ICommonStateGetter::GetEventHandle(HLERequestContext& ctx) {
- LOG_DEBUG(Service_AM, "(STUBBED) called");
-
- IPC::ResponseBuilder rb{ctx, 2, 1};
- rb.Push(ResultSuccess);
- rb.PushCopyObjects(applet->message_queue.GetMessageReceiveEvent());
-}
-
-void ICommonStateGetter::ReceiveMessage(HLERequestContext& ctx) {
- LOG_DEBUG(Service_AM, "called");
-
- const auto message = applet->message_queue.PopMessage();
- IPC::ResponseBuilder rb{ctx, 3};
-
- if (message == AppletMessageQueue::AppletMessage::None) {
- LOG_ERROR(Service_AM, "Message queue is empty");
- rb.Push(AM::ResultNoMessages);
- rb.PushEnum<AppletMessageQueue::AppletMessage>(message);
- return;
- }
-
- rb.Push(ResultSuccess);
- rb.PushEnum<AppletMessageQueue::AppletMessage>(message);
-}
-
-void ICommonStateGetter::GetCurrentFocusState(HLERequestContext& ctx) {
- LOG_DEBUG(Service_AM, "(STUBBED) called");
-
- std::scoped_lock lk{applet->lock};
-
- IPC::ResponseBuilder rb{ctx, 3};
- rb.Push(ResultSuccess);
- rb.Push(static_cast<u8>(applet->focus_state));
-}
-
-void ICommonStateGetter::GetOperationMode(HLERequestContext& ctx) {
- const bool use_docked_mode{Settings::IsDockedMode()};
- LOG_DEBUG(Service_AM, "called, use_docked_mode={}", use_docked_mode);
-
- IPC::ResponseBuilder rb{ctx, 3};
- rb.Push(ResultSuccess);
- rb.Push(static_cast<u8>(use_docked_mode ? OperationMode::Docked : OperationMode::Handheld));
-}
-
-void ICommonStateGetter::GetPerformanceMode(HLERequestContext& ctx) {
- LOG_DEBUG(Service_AM, "called");
-
- IPC::ResponseBuilder rb{ctx, 3};
- rb.Push(ResultSuccess);
- rb.PushEnum(system.GetAPMController().GetCurrentPerformanceMode());
-}
-
-void ICommonStateGetter::RequestToAcquireSleepLock(HLERequestContext& ctx) {
- LOG_WARNING(Service_AM, "(STUBBED) called");
-
- // Sleep lock is acquired immediately.
- applet->sleep_lock_event.Signal();
-
- IPC::ResponseBuilder rb{ctx, 2};
- rb.Push(ResultSuccess);
-}
-
-void ICommonStateGetter::GetReaderLockAccessorEx(HLERequestContext& ctx) {
- IPC::RequestParser rp{ctx};
- const auto unknown = rp.Pop<u32>();
-
- LOG_INFO(Service_AM, "called, unknown={}", unknown);
-
- IPC::ResponseBuilder rb{ctx, 2, 0, 1};
-
- rb.Push(ResultSuccess);
- rb.PushIpcInterface<ILockAccessor>(system);
-}
-
-void ICommonStateGetter::GetAcquiredSleepLockEvent(HLERequestContext& ctx) {
- LOG_WARNING(Service_AM, "called");
-
- IPC::ResponseBuilder rb{ctx, 2, 1};
- rb.Push(ResultSuccess);
- rb.PushCopyObjects(applet->sleep_lock_event.GetHandle());
-}
-
-void ICommonStateGetter::IsVrModeEnabled(HLERequestContext& ctx) {
- LOG_DEBUG(Service_AM, "called");
-
- std::scoped_lock lk{applet->lock};
-
- IPC::ResponseBuilder rb{ctx, 3};
- rb.Push(ResultSuccess);
- rb.Push(applet->vr_mode_enabled);
-}
-
-void ICommonStateGetter::SetVrModeEnabled(HLERequestContext& ctx) {
- IPC::RequestParser rp{ctx};
-
- std::scoped_lock lk{applet->lock};
- applet->vr_mode_enabled = rp.Pop<bool>();
- LOG_WARNING(Service_AM, "VR Mode is {}", applet->vr_mode_enabled ? "on" : "off");
-
- IPC::ResponseBuilder rb{ctx, 2};
- rb.Push(ResultSuccess);
-}
-
-void ICommonStateGetter::SetLcdBacklighOffEnabled(HLERequestContext& ctx) {
- IPC::RequestParser rp{ctx};
- const auto is_lcd_backlight_off_enabled = rp.Pop<bool>();
-
- LOG_WARNING(Service_AM, "(STUBBED) called. is_lcd_backlight_off_enabled={}",
- is_lcd_backlight_off_enabled);
-
- IPC::ResponseBuilder rb{ctx, 2};
- rb.Push(ResultSuccess);
-}
-
-void ICommonStateGetter::BeginVrModeEx(HLERequestContext& ctx) {
- LOG_WARNING(Service_AM, "(STUBBED) called");
-
- std::scoped_lock lk{applet->lock};
- applet->vr_mode_enabled = true;
-
- IPC::ResponseBuilder rb{ctx, 2};
- rb.Push(ResultSuccess);
-}
-
-void ICommonStateGetter::EndVrModeEx(HLERequestContext& ctx) {
- LOG_WARNING(Service_AM, "(STUBBED) called");
-
- std::scoped_lock lk{applet->lock};
- applet->vr_mode_enabled = false;
-
- IPC::ResponseBuilder rb{ctx, 2};
- rb.Push(ResultSuccess);
-}
-
-void ICommonStateGetter::GetDefaultDisplayResolutionChangeEvent(HLERequestContext& ctx) {
- LOG_DEBUG(Service_AM, "called");
-
- IPC::ResponseBuilder rb{ctx, 2, 1};
- rb.Push(ResultSuccess);
- rb.PushCopyObjects(applet->message_queue.GetOperationModeChangedEvent());
-}
-
-void ICommonStateGetter::GetDefaultDisplayResolution(HLERequestContext& ctx) {
- LOG_DEBUG(Service_AM, "called");
-
- IPC::ResponseBuilder rb{ctx, 4};
- rb.Push(ResultSuccess);
-
- if (Settings::IsDockedMode()) {
- rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedWidth));
- rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedHeight));
- } else {
- rb.Push(static_cast<u32>(Service::VI::DisplayResolution::UndockedWidth));
- rb.Push(static_cast<u32>(Service::VI::DisplayResolution::UndockedHeight));
- }
-}
-
-void ICommonStateGetter::SetCpuBoostMode(HLERequestContext& ctx) {
- LOG_DEBUG(Service_AM, "called, forwarding to APM:SYS");
-
- const auto& sm = system.ServiceManager();
- const auto apm_sys = sm.GetService<APM::APM_Sys>("apm:sys");
- ASSERT(apm_sys != nullptr);
-
- apm_sys->SetCpuBoostMode(ctx);
-}
-
-void ICommonStateGetter::GetBuiltInDisplayType(HLERequestContext& ctx) {
- LOG_WARNING(Service_AM, "(STUBBED) called");
-
- IPC::ResponseBuilder rb{ctx, 3};
- rb.Push(ResultSuccess);
- rb.Push(0);
-}
-
-void ICommonStateGetter::PerformSystemButtonPressingIfInFocus(HLERequestContext& ctx) {
- IPC::RequestParser rp{ctx};
- const auto system_button{rp.PopEnum<SystemButtonType>()};
-
- LOG_WARNING(Service_AM, "(STUBBED) called, system_button={}", system_button);
-
- IPC::ResponseBuilder rb{ctx, 2};
- rb.Push(ResultSuccess);
-}
-
-void ICommonStateGetter::GetAppletLaunchedHistory(HLERequestContext& ctx) {
- LOG_WARNING(Service_AM, "(STUBBED) called");
-
- std::shared_ptr<Applet> current_applet = applet;
- std::vector<AppletId> result;
-
- const size_t count = ctx.GetWriteBufferNumElements<AppletId>();
- size_t i;
-
- for (i = 0; i < count && current_applet != nullptr; i++) {
- result.push_back(current_applet->applet_id);
- current_applet = current_applet->caller_applet.lock();
- }
-
- ctx.WriteBuffer(result);
-
- IPC::ResponseBuilder rb{ctx, 3};
- rb.Push(ResultSuccess);
- rb.Push(static_cast<u32>(i));
-}
-
-void ICommonStateGetter::GetSettingsPlatformRegion(HLERequestContext& ctx) {
- LOG_WARNING(Service_AM, "(STUBBED) called");
-
- IPC::ResponseBuilder rb{ctx, 3};
- rb.Push(ResultSuccess);
- rb.PushEnum(SysPlatformRegion::Global);
-}
-
-void ICommonStateGetter::SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled(
- HLERequestContext& ctx) {
- LOG_WARNING(Service_AM, "(STUBBED) called");
-
- std::scoped_lock lk{applet->lock};
- applet->request_exit_to_library_applet_at_execute_next_program_enabled = true;
-
- IPC::ResponseBuilder rb{ctx, 2};
- rb.Push(ResultSuccess);
-}
-
-} // namespace Service::AM
diff --git a/src/core/hle/service/am/common_state_getter.h b/src/core/hle/service/am/common_state_getter.h
deleted file mode 100644
index bf652790c..000000000
--- a/src/core/hle/service/am/common_state_getter.h
+++ /dev/null
@@ -1,77 +0,0 @@
-// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#pragma once
-
-#include "core/hle/service/kernel_helpers.h"
-#include "core/hle/service/service.h"
-
-#include "core/hle/service/am/applet_message_queue.h"
-
-namespace Service::AM {
-
-struct Applet;
-
-class ICommonStateGetter final : public ServiceFramework<ICommonStateGetter> {
-public:
- explicit ICommonStateGetter(Core::System& system_, std::shared_ptr<Applet> applet_);
- ~ICommonStateGetter() override;
-
-private:
- // This is nn::oe::FocusState
- enum class FocusState : u8 {
- InFocus = 1,
- NotInFocus = 2,
- Background = 3,
- };
-
- // This is nn::oe::OperationMode
- enum class OperationMode : u8 {
- Handheld = 0,
- Docked = 1,
- };
-
- // This is nn::am::service::SystemButtonType
- enum class SystemButtonType {
- None,
- HomeButtonShortPressing,
- HomeButtonLongPressing,
- PowerButtonShortPressing,
- PowerButtonLongPressing,
- ShutdownSystem,
- CaptureButtonShortPressing,
- CaptureButtonLongPressing,
- };
-
- enum class SysPlatformRegion : s32 {
- Global = 1,
- Terra = 2,
- };
-
- void GetEventHandle(HLERequestContext& ctx);
- void ReceiveMessage(HLERequestContext& ctx);
- void GetCurrentFocusState(HLERequestContext& ctx);
- void RequestToAcquireSleepLock(HLERequestContext& ctx);
- void GetAcquiredSleepLockEvent(HLERequestContext& ctx);
- void GetReaderLockAccessorEx(HLERequestContext& ctx);
- void GetDefaultDisplayResolutionChangeEvent(HLERequestContext& ctx);
- void GetOperationMode(HLERequestContext& ctx);
- void GetPerformanceMode(HLERequestContext& ctx);
- void GetBootMode(HLERequestContext& ctx);
- void IsVrModeEnabled(HLERequestContext& ctx);
- void SetVrModeEnabled(HLERequestContext& ctx);
- void SetLcdBacklighOffEnabled(HLERequestContext& ctx);
- void BeginVrModeEx(HLERequestContext& ctx);
- void EndVrModeEx(HLERequestContext& ctx);
- void GetDefaultDisplayResolution(HLERequestContext& ctx);
- void SetCpuBoostMode(HLERequestContext& ctx);
- void GetBuiltInDisplayType(HLERequestContext& ctx);
- void PerformSystemButtonPressingIfInFocus(HLERequestContext& ctx);
- void GetAppletLaunchedHistory(HLERequestContext& ctx);
- void GetSettingsPlatformRegion(HLERequestContext& ctx);
- void SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled(HLERequestContext& ctx);
-
- const std::shared_ptr<Applet> applet;
-};
-
-} // namespace Service::AM
diff --git a/src/core/hle/service/am/library_applet_creator.cpp b/src/core/hle/service/am/library_applet_creator.cpp
index 00d5a0705..f7fdcb5db 100644
--- a/src/core/hle/service/am/library_applet_creator.cpp
+++ b/src/core/hle/service/am/library_applet_creator.cpp
@@ -130,13 +130,13 @@ std::shared_ptr<ILibraryAppletAccessor> CreateGuestApplet(Core::System& system,
case LibraryAppletMode::PartialForegroundIndirectDisplay:
applet->hid_registration.EnableAppletToGetInput(true);
applet->focus_state = FocusState::InFocus;
- applet->message_queue.PushMessage(AppletMessageQueue::AppletMessage::ChangeIntoForeground);
+ applet->message_queue.PushMessage(AppletMessage::ChangeIntoForeground);
break;
case LibraryAppletMode::AllForegroundInitiallyHidden:
applet->hid_registration.EnableAppletToGetInput(false);
applet->focus_state = FocusState::NotInFocus;
applet->system_buffer_manager.SetWindowVisibility(false);
- applet->message_queue.PushMessage(AppletMessageQueue::AppletMessage::ChangeIntoBackground);
+ applet->message_queue.PushMessage(AppletMessage::ChangeIntoBackground);
break;
}
diff --git a/src/core/hle/service/am/service/application_proxy.cpp b/src/core/hle/service/am/service/application_proxy.cpp
index 55a4ea72f..2d46299e0 100644
--- a/src/core/hle/service/am/service/application_proxy.cpp
+++ b/src/core/hle/service/am/service/application_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/common_state_getter.h"
#include "core/hle/service/am/debug_functions.h"
#include "core/hle/service/am/display_controller.h"
#include "core/hle/service/am/library_applet_creator.h"
@@ -12,6 +11,7 @@
#include "core/hle/service/am/service/application_functions.h"
#include "core/hle/service/am/service/application_proxy.h"
#include "core/hle/service/am/service/audio_controller.h"
+#include "core/hle/service/am/service/common_state_getter.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/common_state_getter.cpp b/src/core/hle/service/am/service/common_state_getter.cpp
new file mode 100644
index 000000000..ac05b457b
--- /dev/null
+++ b/src/core/hle/service/am/service/common_state_getter.cpp
@@ -0,0 +1,277 @@
+// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "common/settings.h"
+#include "core/hle/service/am/am_results.h"
+#include "core/hle/service/am/applet.h"
+#include "core/hle/service/am/lock_accessor.h"
+#include "core/hle/service/am/service/common_state_getter.h"
+#include "core/hle/service/apm/apm_interface.h"
+#include "core/hle/service/cmif_serialization.h"
+#include "core/hle/service/pm/pm.h"
+#include "core/hle/service/sm/sm.h"
+#include "core/hle/service/vi/vi.h"
+
+namespace Service::AM {
+
+ICommonStateGetter::ICommonStateGetter(Core::System& system_, std::shared_ptr<Applet> applet)
+ : ServiceFramework{system_, "ICommonStateGetter"}, m_applet{std::move(applet)} {
+ // clang-format off
+ static const FunctionInfo functions[] = {
+ {0, D<&ICommonStateGetter::GetEventHandle>, "GetEventHandle"},
+ {1, D<&ICommonStateGetter::ReceiveMessage>, "ReceiveMessage"},
+ {2, nullptr, "GetThisAppletKind"},
+ {3, nullptr, "AllowToEnterSleep"},
+ {4, nullptr, "DisallowToEnterSleep"},
+ {5, D<&ICommonStateGetter::GetOperationMode>, "GetOperationMode"},
+ {6, D<&ICommonStateGetter::GetPerformanceMode>, "GetPerformanceMode"},
+ {7, nullptr, "GetCradleStatus"},
+ {8, D<&ICommonStateGetter::GetBootMode>, "GetBootMode"},
+ {9, D<&ICommonStateGetter::GetCurrentFocusState>, "GetCurrentFocusState"},
+ {10, D<&ICommonStateGetter::RequestToAcquireSleepLock>, "RequestToAcquireSleepLock"},
+ {11, nullptr, "ReleaseSleepLock"},
+ {12, nullptr, "ReleaseSleepLockTransiently"},
+ {13, D<&ICommonStateGetter::GetAcquiredSleepLockEvent>, "GetAcquiredSleepLockEvent"},
+ {14, nullptr, "GetWakeupCount"},
+ {20, nullptr, "PushToGeneralChannel"},
+ {30, nullptr, "GetHomeButtonReaderLockAccessor"},
+ {31, D<&ICommonStateGetter::GetReaderLockAccessorEx>, "GetReaderLockAccessorEx"},
+ {32, D<&ICommonStateGetter::GetWriterLockAccessorEx>, "GetWriterLockAccessorEx"},
+ {40, nullptr, "GetCradleFwVersion"},
+ {50, D<&ICommonStateGetter::IsVrModeEnabled>, "IsVrModeEnabled"},
+ {51, D<&ICommonStateGetter::SetVrModeEnabled>, "SetVrModeEnabled"},
+ {52, D<&ICommonStateGetter::SetLcdBacklighOffEnabled>, "SetLcdBacklighOffEnabled"},
+ {53, D<&ICommonStateGetter::BeginVrModeEx>, "BeginVrModeEx"},
+ {54, D<&ICommonStateGetter::EndVrModeEx>, "EndVrModeEx"},
+ {55, D<&ICommonStateGetter::IsInControllerFirmwareUpdateSection>, "IsInControllerFirmwareUpdateSection"},
+ {59, nullptr, "SetVrPositionForDebug"},
+ {60, D<&ICommonStateGetter::GetDefaultDisplayResolution>, "GetDefaultDisplayResolution"},
+ {61, D<&ICommonStateGetter::GetDefaultDisplayResolutionChangeEvent>, "GetDefaultDisplayResolutionChangeEvent"},
+ {62, nullptr, "GetHdcpAuthenticationState"},
+ {63, nullptr, "GetHdcpAuthenticationStateChangeEvent"},
+ {64, nullptr, "SetTvPowerStateMatchingMode"},
+ {65, nullptr, "GetApplicationIdByContentActionName"},
+ {66, &ICommonStateGetter::SetCpuBoostMode, "SetCpuBoostMode"},
+ {67, nullptr, "CancelCpuBoostMode"},
+ {68, D<&ICommonStateGetter::GetBuiltInDisplayType>, "GetBuiltInDisplayType"},
+ {80, D<&ICommonStateGetter::PerformSystemButtonPressingIfInFocus>, "PerformSystemButtonPressingIfInFocus"},
+ {90, nullptr, "SetPerformanceConfigurationChangedNotification"},
+ {91, nullptr, "GetCurrentPerformanceConfiguration"},
+ {100, nullptr, "SetHandlingHomeButtonShortPressedEnabled"},
+ {110, nullptr, "OpenMyGpuErrorHandler"},
+ {120, D<&ICommonStateGetter::GetAppletLaunchedHistory>, "GetAppletLaunchedHistory"},
+ {200, D<&ICommonStateGetter::GetOperationModeSystemInfo>, "GetOperationModeSystemInfo"},
+ {300, D<&ICommonStateGetter::GetSettingsPlatformRegion>, "GetSettingsPlatformRegion"},
+ {400, nullptr, "ActivateMigrationService"},
+ {401, nullptr, "DeactivateMigrationService"},
+ {500, nullptr, "DisableSleepTillShutdown"},
+ {501, nullptr, "SuppressDisablingSleepTemporarily"},
+ {502, nullptr, "IsSleepEnabled"},
+ {503, nullptr, "IsDisablingSleepSuppressed"},
+ {900, D<&ICommonStateGetter::SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled>, "SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled"},
+ };
+ // clang-format on
+
+ RegisterHandlers(functions);
+}
+
+ICommonStateGetter::~ICommonStateGetter() = default;
+
+Result ICommonStateGetter::GetEventHandle(OutCopyHandle<Kernel::KReadableEvent> out_event) {
+ LOG_DEBUG(Service_AM, "called");
+ *out_event = &m_applet->message_queue.GetMessageReceiveEvent();
+ R_SUCCEED();
+}
+
+Result ICommonStateGetter::ReceiveMessage(Out<AppletMessage> out_applet_message) {
+ LOG_DEBUG(Service_AM, "called");
+
+ *out_applet_message = m_applet->message_queue.PopMessage();
+ if (*out_applet_message == AppletMessage::None) {
+ LOG_ERROR(Service_AM, "Tried to pop message but none was available!");
+ R_THROW(AM::ResultNoMessages);
+ }
+
+ R_SUCCEED();
+}
+
+Result ICommonStateGetter::GetCurrentFocusState(Out<FocusState> out_focus_state) {
+ LOG_DEBUG(Service_AM, "called");
+
+ std::scoped_lock lk{m_applet->lock};
+ *out_focus_state = m_applet->focus_state;
+
+ R_SUCCEED();
+}
+
+Result ICommonStateGetter::RequestToAcquireSleepLock() {
+ LOG_WARNING(Service_AM, "(STUBBED) called");
+
+ // Sleep lock is acquired immediately.
+ m_applet->sleep_lock_event.Signal();
+ R_SUCCEED();
+}
+
+Result ICommonStateGetter::GetAcquiredSleepLockEvent(
+ OutCopyHandle<Kernel::KReadableEvent> out_event) {
+ LOG_WARNING(Service_AM, "called");
+ *out_event = m_applet->sleep_lock_event.GetHandle();
+ R_SUCCEED();
+}
+
+Result ICommonStateGetter::GetReaderLockAccessorEx(
+ Out<SharedPointer<ILockAccessor>> out_lock_accessor, u32 button_type) {
+ LOG_INFO(Service_AM, "called, button_type={}", button_type);
+ *out_lock_accessor = std::make_shared<ILockAccessor>(system);
+ R_SUCCEED();
+}
+
+Result ICommonStateGetter::GetWriterLockAccessorEx(
+ Out<SharedPointer<ILockAccessor>> out_lock_accessor, u32 button_type) {
+ LOG_INFO(Service_AM, "called, button_type={}", button_type);
+ *out_lock_accessor = std::make_shared<ILockAccessor>(system);
+ R_SUCCEED();
+}
+
+Result ICommonStateGetter::GetDefaultDisplayResolutionChangeEvent(
+ OutCopyHandle<Kernel::KReadableEvent> out_event) {
+ LOG_DEBUG(Service_AM, "called");
+ *out_event = &m_applet->message_queue.GetOperationModeChangedEvent();
+ R_SUCCEED();
+}
+
+Result ICommonStateGetter::GetOperationMode(Out<OperationMode> out_operation_mode) {
+ const bool use_docked_mode{Settings::IsDockedMode()};
+ LOG_DEBUG(Service_AM, "called, use_docked_mode={}", use_docked_mode);
+ *out_operation_mode = use_docked_mode ? OperationMode::Docked : OperationMode::Handheld;
+ R_SUCCEED();
+}
+
+Result ICommonStateGetter::GetPerformanceMode(Out<APM::PerformanceMode> out_performance_mode) {
+ LOG_DEBUG(Service_AM, "called");
+ *out_performance_mode = system.GetAPMController().GetCurrentPerformanceMode();
+ R_SUCCEED();
+}
+
+Result ICommonStateGetter::GetBootMode(Out<PM::SystemBootMode> out_boot_mode) {
+ LOG_DEBUG(Service_AM, "called");
+ *out_boot_mode = Service::PM::SystemBootMode::Normal;
+ R_SUCCEED();
+}
+
+Result ICommonStateGetter::IsVrModeEnabled(Out<bool> out_is_vr_mode_enabled) {
+ LOG_DEBUG(Service_AM, "called");
+
+ std::scoped_lock lk{m_applet->lock};
+ *out_is_vr_mode_enabled = m_applet->vr_mode_enabled;
+ R_SUCCEED();
+}
+
+Result ICommonStateGetter::SetVrModeEnabled(bool is_vr_mode_enabled) {
+ std::scoped_lock lk{m_applet->lock};
+ m_applet->vr_mode_enabled = is_vr_mode_enabled;
+ LOG_WARNING(Service_AM, "VR Mode is {}", m_applet->vr_mode_enabled ? "on" : "off");
+ R_SUCCEED();
+}
+
+Result ICommonStateGetter::SetLcdBacklighOffEnabled(bool is_lcd_backlight_off_enabled) {
+ LOG_WARNING(Service_AM, "(STUBBED) called. is_lcd_backlight_off_enabled={}",
+ is_lcd_backlight_off_enabled);
+ R_SUCCEED();
+}
+
+Result ICommonStateGetter::BeginVrModeEx() {
+ LOG_WARNING(Service_AM, "(STUBBED) called");
+ std::scoped_lock lk{m_applet->lock};
+ m_applet->vr_mode_enabled = true;
+ R_SUCCEED();
+}
+
+Result ICommonStateGetter::EndVrModeEx() {
+ LOG_WARNING(Service_AM, "(STUBBED) called");
+ std::scoped_lock lk{m_applet->lock};
+ m_applet->vr_mode_enabled = false;
+ R_SUCCEED();
+}
+
+Result ICommonStateGetter::IsInControllerFirmwareUpdateSection(
+ Out<bool> out_is_in_controller_firmware_update_section) {
+ LOG_INFO(Service_AM, "called");
+ *out_is_in_controller_firmware_update_section = false;
+ R_SUCCEED();
+}
+
+Result ICommonStateGetter::GetDefaultDisplayResolution(Out<s32> out_width, Out<s32> out_height) {
+ LOG_DEBUG(Service_AM, "called");
+
+ if (Settings::IsDockedMode()) {
+ *out_width = static_cast<u32>(Service::VI::DisplayResolution::DockedWidth);
+ *out_height = static_cast<u32>(Service::VI::DisplayResolution::DockedHeight);
+ } else {
+ *out_width = static_cast<u32>(Service::VI::DisplayResolution::UndockedWidth);
+ *out_height = static_cast<u32>(Service::VI::DisplayResolution::UndockedHeight);
+ }
+
+ R_SUCCEED();
+}
+
+void ICommonStateGetter::SetCpuBoostMode(HLERequestContext& ctx) {
+ LOG_DEBUG(Service_AM, "called, forwarding to APM:SYS");
+
+ const auto& sm = system.ServiceManager();
+ const auto apm_sys = sm.GetService<APM::APM_Sys>("apm:sys");
+ ASSERT(apm_sys != nullptr);
+
+ apm_sys->SetCpuBoostMode(ctx);
+}
+
+Result ICommonStateGetter::GetBuiltInDisplayType(Out<s32> out_display_type) {
+ LOG_WARNING(Service_AM, "(STUBBED) called");
+ *out_display_type = 0;
+ R_SUCCEED();
+}
+
+Result ICommonStateGetter::PerformSystemButtonPressingIfInFocus(SystemButtonType type) {
+ LOG_WARNING(Service_AM, "(STUBBED) called, type={}", type);
+ R_SUCCEED();
+}
+
+Result ICommonStateGetter::GetOperationModeSystemInfo(Out<u32> out_operation_mode_system_info) {
+ LOG_WARNING(Service_AM, "(STUBBED) called");
+ *out_operation_mode_system_info = 0;
+ R_SUCCEED();
+}
+
+Result ICommonStateGetter::GetAppletLaunchedHistory(
+ Out<s32> out_count, OutArray<AppletId, BufferAttr_HipcMapAlias> out_applet_ids) {
+ LOG_INFO(Service_AM, "called");
+
+ std::shared_ptr<Applet> current_applet = m_applet;
+
+ for (*out_count = 0;
+ *out_count < static_cast<s32>(out_applet_ids.size()) && current_applet != nullptr;
+ /* ... */) {
+ out_applet_ids[(*out_count)++] = current_applet->applet_id;
+ current_applet = current_applet->caller_applet.lock();
+ }
+
+ R_SUCCEED();
+}
+
+Result ICommonStateGetter::GetSettingsPlatformRegion(
+ Out<SysPlatformRegion> out_settings_platform_region) {
+ LOG_INFO(Service_AM, "called");
+ *out_settings_platform_region = SysPlatformRegion::Global;
+ R_SUCCEED();
+}
+
+Result ICommonStateGetter::SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled() {
+ LOG_WARNING(Service_AM, "(STUBBED) called");
+
+ std::scoped_lock lk{m_applet->lock};
+ m_applet->request_exit_to_library_applet_at_execute_next_program_enabled = true;
+
+ R_SUCCEED();
+}
+
+} // namespace Service::AM
diff --git a/src/core/hle/service/am/service/common_state_getter.h b/src/core/hle/service/am/service/common_state_getter.h
new file mode 100644
index 000000000..5a8dca3d6
--- /dev/null
+++ b/src/core/hle/service/am/service/common_state_getter.h
@@ -0,0 +1,61 @@
+// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "core/hle/service/am/am_types.h"
+#include "core/hle/service/apm/apm_controller.h"
+#include "core/hle/service/cmif_types.h"
+#include "core/hle/service/pm/pm.h"
+#include "core/hle/service/service.h"
+
+namespace Kernel {
+class KReadableEvent;
+}
+
+namespace Service::AM {
+
+struct Applet;
+class ILockAccessor;
+
+class ICommonStateGetter final : public ServiceFramework<ICommonStateGetter> {
+public:
+ explicit ICommonStateGetter(Core::System& system_, std::shared_ptr<Applet> applet_);
+ ~ICommonStateGetter() override;
+
+private:
+ Result GetEventHandle(OutCopyHandle<Kernel::KReadableEvent> out_event);
+ Result ReceiveMessage(Out<AppletMessage> out_applet_message);
+ Result GetCurrentFocusState(Out<FocusState> out_focus_state);
+ Result RequestToAcquireSleepLock();
+ Result GetAcquiredSleepLockEvent(OutCopyHandle<Kernel::KReadableEvent> out_event);
+ Result GetReaderLockAccessorEx(Out<SharedPointer<ILockAccessor>> out_lock_accessor,
+ u32 button_type);
+ Result GetWriterLockAccessorEx(Out<SharedPointer<ILockAccessor>> out_lock_accessor,
+ u32 button_type);
+ Result GetDefaultDisplayResolutionChangeEvent(OutCopyHandle<Kernel::KReadableEvent> out_event);
+ Result GetOperationMode(Out<OperationMode> out_operation_mode);
+ Result GetPerformanceMode(Out<APM::PerformanceMode> out_performance_mode);
+ Result GetBootMode(Out<PM::SystemBootMode> out_boot_mode);
+ Result IsVrModeEnabled(Out<bool> out_is_vr_mode_enabled);
+ Result SetVrModeEnabled(bool is_vr_mode_enabled);
+ Result SetLcdBacklighOffEnabled(bool is_lcd_backlight_off_enabled);
+ Result BeginVrModeEx();
+ Result EndVrModeEx();
+ Result IsInControllerFirmwareUpdateSection(
+ Out<bool> out_is_in_controller_firmware_update_section);
+ Result GetDefaultDisplayResolution(Out<s32> out_width, Out<s32> out_height);
+ Result GetBuiltInDisplayType(Out<s32> out_display_type);
+ Result PerformSystemButtonPressingIfInFocus(SystemButtonType type);
+ Result GetOperationModeSystemInfo(Out<u32> out_operation_mode_system_info);
+ Result GetAppletLaunchedHistory(Out<s32> out_count,
+ OutArray<AppletId, BufferAttr_HipcMapAlias> out_applet_ids);
+ Result GetSettingsPlatformRegion(Out<SysPlatformRegion> out_settings_platform_region);
+ Result SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled();
+
+ void SetCpuBoostMode(HLERequestContext& ctx);
+
+ const std::shared_ptr<Applet> m_applet;
+};
+
+} // 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 c4ea9392a..28886b0c3 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/common_state_getter.h"
#include "core/hle/service/am/debug_functions.h"
#include "core/hle/service/am/display_controller.h"
#include "core/hle/service/am/global_state_controller.h"
@@ -12,6 +11,7 @@
#include "core/hle/service/am/self_controller.h"
#include "core/hle/service/am/service/applet_common_functions.h"
#include "core/hle/service/am/service/audio_controller.h"
+#include "core/hle/service/am/service/common_state_getter.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 c63b53ac8..ea23bef94 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/common_state_getter.h"
#include "core/hle/service/am/debug_functions.h"
#include "core/hle/service/am/display_controller.h"
#include "core/hle/service/am/global_state_controller.h"
@@ -13,6 +12,7 @@
#include "core/hle/service/am/self_controller.h"
#include "core/hle/service/am/service/applet_common_functions.h"
#include "core/hle/service/am/service/audio_controller.h"
+#include "core/hle/service/am/service/common_state_getter.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"
diff --git a/src/core/hle/service/am/window_controller.cpp b/src/core/hle/service/am/window_controller.cpp
index c07ef228b..7347fe9d9 100644
--- a/src/core/hle/service/am/window_controller.cpp
+++ b/src/core/hle/service/am/window_controller.cpp
@@ -63,10 +63,10 @@ void IWindowController::SetAppletWindowVisibility(HLERequestContext& ctx) {
if (visible) {
applet->focus_state = FocusState::InFocus;
- applet->message_queue.PushMessage(AppletMessageQueue::AppletMessage::ChangeIntoForeground);
+ applet->message_queue.PushMessage(AppletMessage::ChangeIntoForeground);
} else {
applet->focus_state = FocusState::NotInFocus;
- applet->message_queue.PushMessage(AppletMessageQueue::AppletMessage::ChangeIntoBackground);
+ applet->message_queue.PushMessage(AppletMessage::ChangeIntoBackground);
}
IPC::ResponseBuilder rb{ctx, 2};