diff options
| -rw-r--r-- | src/core/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | src/core/hle/service/am/service/application_proxy.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/am/service/library_applet_proxy.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/am/service/system_applet_proxy.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/am/service/window_controller.cpp | 86 | ||||
| -rw-r--r-- | src/core/hle/service/am/service/window_controller.h | 30 | ||||
| -rw-r--r-- | src/core/hle/service/am/window_controller.cpp | 86 | ||||
| -rw-r--r-- | src/core/hle/service/am/window_controller.h | 27 |
8 files changed, 121 insertions, 118 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index bd483816b..f8e093be7 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -481,12 +481,12 @@ add_library(core STATIC | |||
| 481 | hle/service/am/service/storage.h | 481 | hle/service/am/service/storage.h |
| 482 | hle/service/am/service/system_applet_proxy.cpp | 482 | hle/service/am/service/system_applet_proxy.cpp |
| 483 | hle/service/am/service/system_applet_proxy.h | 483 | hle/service/am/service/system_applet_proxy.h |
| 484 | hle/service/am/service/window_controller.cpp | ||
| 485 | hle/service/am/service/window_controller.h | ||
| 484 | hle/service/am/system_buffer_manager.cpp | 486 | hle/service/am/system_buffer_manager.cpp |
| 485 | hle/service/am/system_buffer_manager.h | 487 | hle/service/am/system_buffer_manager.h |
| 486 | hle/service/am/spsm.cpp | 488 | hle/service/am/spsm.cpp |
| 487 | hle/service/am/spsm.h | 489 | hle/service/am/spsm.h |
| 488 | hle/service/am/window_controller.cpp | ||
| 489 | hle/service/am/window_controller.h | ||
| 490 | hle/service/aoc/aoc_u.cpp | 490 | hle/service/aoc/aoc_u.cpp |
| 491 | hle/service/aoc/aoc_u.h | 491 | hle/service/aoc/aoc_u.h |
| 492 | hle/service/apm/apm.cpp | 492 | hle/service/apm/apm.cpp |
diff --git a/src/core/hle/service/am/service/application_proxy.cpp b/src/core/hle/service/am/service/application_proxy.cpp index 9bba985be..776f4552b 100644 --- a/src/core/hle/service/am/service/application_proxy.cpp +++ b/src/core/hle/service/am/service/application_proxy.cpp | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | #include "core/hle/service/am/service/library_applet_creator.h" | 11 | #include "core/hle/service/am/service/library_applet_creator.h" |
| 12 | #include "core/hle/service/am/service/process_winding_controller.h" | 12 | #include "core/hle/service/am/service/process_winding_controller.h" |
| 13 | #include "core/hle/service/am/service/self_controller.h" | 13 | #include "core/hle/service/am/service/self_controller.h" |
| 14 | #include "core/hle/service/am/window_controller.h" | 14 | #include "core/hle/service/am/service/window_controller.h" |
| 15 | #include "core/hle/service/cmif_serialization.h" | 15 | #include "core/hle/service/cmif_serialization.h" |
| 16 | 16 | ||
| 17 | namespace Service::AM { | 17 | 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 bac3e0168..bcb44a71c 100644 --- a/src/core/hle/service/am/service/library_applet_proxy.cpp +++ b/src/core/hle/service/am/service/library_applet_proxy.cpp | |||
| @@ -13,7 +13,7 @@ | |||
| 13 | #include "core/hle/service/am/service/library_applet_self_accessor.h" | 13 | #include "core/hle/service/am/service/library_applet_self_accessor.h" |
| 14 | #include "core/hle/service/am/service/process_winding_controller.h" | 14 | #include "core/hle/service/am/service/process_winding_controller.h" |
| 15 | #include "core/hle/service/am/service/self_controller.h" | 15 | #include "core/hle/service/am/service/self_controller.h" |
| 16 | #include "core/hle/service/am/window_controller.h" | 16 | #include "core/hle/service/am/service/window_controller.h" |
| 17 | #include "core/hle/service/cmif_serialization.h" | 17 | #include "core/hle/service/cmif_serialization.h" |
| 18 | 18 | ||
| 19 | namespace Service::AM { | 19 | namespace Service::AM { |
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 da6e8dadd..a3e801799 100644 --- a/src/core/hle/service/am/service/system_applet_proxy.cpp +++ b/src/core/hle/service/am/service/system_applet_proxy.cpp | |||
| @@ -13,7 +13,7 @@ | |||
| 13 | #include "core/hle/service/am/service/process_winding_controller.h" | 13 | #include "core/hle/service/am/service/process_winding_controller.h" |
| 14 | #include "core/hle/service/am/service/self_controller.h" | 14 | #include "core/hle/service/am/service/self_controller.h" |
| 15 | #include "core/hle/service/am/service/system_applet_proxy.h" | 15 | #include "core/hle/service/am/service/system_applet_proxy.h" |
| 16 | #include "core/hle/service/am/window_controller.h" | 16 | #include "core/hle/service/am/service/window_controller.h" |
| 17 | #include "core/hle/service/cmif_serialization.h" | 17 | #include "core/hle/service/cmif_serialization.h" |
| 18 | 18 | ||
| 19 | namespace Service::AM { | 19 | namespace Service::AM { |
diff --git a/src/core/hle/service/am/service/window_controller.cpp b/src/core/hle/service/am/service/window_controller.cpp new file mode 100644 index 000000000..b874ecb91 --- /dev/null +++ b/src/core/hle/service/am/service/window_controller.cpp | |||
| @@ -0,0 +1,86 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #include "core/hle/service/am/applet.h" | ||
| 5 | #include "core/hle/service/am/applet_manager.h" | ||
| 6 | #include "core/hle/service/am/service/window_controller.h" | ||
| 7 | #include "core/hle/service/cmif_serialization.h" | ||
| 8 | |||
| 9 | namespace Service::AM { | ||
| 10 | |||
| 11 | IWindowController::IWindowController(Core::System& system_, std::shared_ptr<Applet> applet) | ||
| 12 | : ServiceFramework{system_, "IWindowController"}, m_applet{std::move(applet)} { | ||
| 13 | // clang-format off | ||
| 14 | static const FunctionInfo functions[] = { | ||
| 15 | {0, nullptr, "CreateWindow"}, | ||
| 16 | {1, D<&IWindowController::GetAppletResourceUserId>, "GetAppletResourceUserId"}, | ||
| 17 | {2, D<&IWindowController::GetAppletResourceUserIdOfCallerApplet>, "GetAppletResourceUserIdOfCallerApplet"}, | ||
| 18 | {10, D<&IWindowController::AcquireForegroundRights>, "AcquireForegroundRights"}, | ||
| 19 | {11, D<&IWindowController::ReleaseForegroundRights>, "ReleaseForegroundRights"}, | ||
| 20 | {12, D<&IWindowController::RejectToChangeIntoBackground>, "RejectToChangeIntoBackground"}, | ||
| 21 | {20, D<&IWindowController::SetAppletWindowVisibility>, "SetAppletWindowVisibility"}, | ||
| 22 | {21, D<&IWindowController::SetAppletGpuTimeSlice>, "SetAppletGpuTimeSlice"}, | ||
| 23 | }; | ||
| 24 | // clang-format on | ||
| 25 | |||
| 26 | RegisterHandlers(functions); | ||
| 27 | } | ||
| 28 | |||
| 29 | IWindowController::~IWindowController() = default; | ||
| 30 | |||
| 31 | Result IWindowController::GetAppletResourceUserId(Out<AppletResourceUserId> out_aruid) { | ||
| 32 | LOG_INFO(Service_AM, "called"); | ||
| 33 | *out_aruid = m_applet->aruid; | ||
| 34 | R_SUCCEED(); | ||
| 35 | } | ||
| 36 | |||
| 37 | Result IWindowController::GetAppletResourceUserIdOfCallerApplet( | ||
| 38 | Out<AppletResourceUserId> out_aruid) { | ||
| 39 | LOG_INFO(Service_AM, "called"); | ||
| 40 | |||
| 41 | if (auto caller_applet = m_applet->caller_applet.lock(); caller_applet != nullptr) { | ||
| 42 | *out_aruid = caller_applet->aruid; | ||
| 43 | } else { | ||
| 44 | *out_aruid = AppletResourceUserId{}; | ||
| 45 | } | ||
| 46 | |||
| 47 | R_SUCCEED(); | ||
| 48 | } | ||
| 49 | |||
| 50 | Result IWindowController::AcquireForegroundRights() { | ||
| 51 | LOG_INFO(Service_AM, "called"); | ||
| 52 | R_SUCCEED(); | ||
| 53 | } | ||
| 54 | |||
| 55 | Result IWindowController::ReleaseForegroundRights() { | ||
| 56 | LOG_INFO(Service_AM, "called"); | ||
| 57 | R_SUCCEED(); | ||
| 58 | } | ||
| 59 | |||
| 60 | Result IWindowController::RejectToChangeIntoBackground() { | ||
| 61 | LOG_INFO(Service_AM, "called"); | ||
| 62 | R_SUCCEED(); | ||
| 63 | } | ||
| 64 | |||
| 65 | Result IWindowController::SetAppletWindowVisibility(bool visible) { | ||
| 66 | m_applet->system_buffer_manager.SetWindowVisibility(visible); | ||
| 67 | m_applet->hid_registration.EnableAppletToGetInput(visible); | ||
| 68 | |||
| 69 | if (visible) { | ||
| 70 | m_applet->message_queue.PushMessage(AppletMessage::ChangeIntoForeground); | ||
| 71 | m_applet->focus_state = FocusState::InFocus; | ||
| 72 | } else { | ||
| 73 | m_applet->focus_state = FocusState::NotInFocus; | ||
| 74 | } | ||
| 75 | |||
| 76 | m_applet->message_queue.PushMessage(AppletMessage::FocusStateChanged); | ||
| 77 | |||
| 78 | R_SUCCEED(); | ||
| 79 | } | ||
| 80 | |||
| 81 | Result IWindowController::SetAppletGpuTimeSlice(s64 time_slice) { | ||
| 82 | LOG_WARNING(Service_AM, "(STUBBED) called, time_slice={}", time_slice); | ||
| 83 | R_SUCCEED(); | ||
| 84 | } | ||
| 85 | |||
| 86 | } // namespace Service::AM | ||
diff --git a/src/core/hle/service/am/service/window_controller.h b/src/core/hle/service/am/service/window_controller.h new file mode 100644 index 000000000..bfbad9bcc --- /dev/null +++ b/src/core/hle/service/am/service/window_controller.h | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #include "core/hle/service/cmif_types.h" | ||
| 7 | #include "core/hle/service/service.h" | ||
| 8 | |||
| 9 | namespace Service::AM { | ||
| 10 | |||
| 11 | struct Applet; | ||
| 12 | |||
| 13 | class IWindowController final : public ServiceFramework<IWindowController> { | ||
| 14 | public: | ||
| 15 | explicit IWindowController(Core::System& system_, std::shared_ptr<Applet> applet); | ||
| 16 | ~IWindowController() override; | ||
| 17 | |||
| 18 | private: | ||
| 19 | Result GetAppletResourceUserId(Out<AppletResourceUserId> out_aruid); | ||
| 20 | Result GetAppletResourceUserIdOfCallerApplet(Out<AppletResourceUserId> out_aruid); | ||
| 21 | Result AcquireForegroundRights(); | ||
| 22 | Result ReleaseForegroundRights(); | ||
| 23 | Result RejectToChangeIntoBackground(); | ||
| 24 | Result SetAppletWindowVisibility(bool visible); | ||
| 25 | Result SetAppletGpuTimeSlice(s64 time_slice); | ||
| 26 | |||
| 27 | const std::shared_ptr<Applet> m_applet; | ||
| 28 | }; | ||
| 29 | |||
| 30 | } // namespace Service::AM | ||
diff --git a/src/core/hle/service/am/window_controller.cpp b/src/core/hle/service/am/window_controller.cpp deleted file mode 100644 index 7347fe9d9..000000000 --- a/src/core/hle/service/am/window_controller.cpp +++ /dev/null | |||
| @@ -1,86 +0,0 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #include "core/hle/service/am/applet.h" | ||
| 5 | #include "core/hle/service/am/window_controller.h" | ||
| 6 | #include "core/hle/service/ipc_helpers.h" | ||
| 7 | |||
| 8 | namespace Service::AM { | ||
| 9 | |||
| 10 | IWindowController::IWindowController(Core::System& system_, std::shared_ptr<Applet> applet_) | ||
| 11 | : ServiceFramework{system_, "IWindowController"}, applet{std::move(applet_)} { | ||
| 12 | // clang-format off | ||
| 13 | static const FunctionInfo functions[] = { | ||
| 14 | {0, nullptr, "CreateWindow"}, | ||
| 15 | {1, &IWindowController::GetAppletResourceUserId, "GetAppletResourceUserId"}, | ||
| 16 | {2, &IWindowController::GetAppletResourceUserIdOfCallerApplet, "GetAppletResourceUserIdOfCallerApplet"}, | ||
| 17 | {10, &IWindowController::AcquireForegroundRights, "AcquireForegroundRights"}, | ||
| 18 | {11, nullptr, "ReleaseForegroundRights"}, | ||
| 19 | {12, nullptr, "RejectToChangeIntoBackground"}, | ||
| 20 | {20, &IWindowController::SetAppletWindowVisibility, "SetAppletWindowVisibility"}, | ||
| 21 | {21, &IWindowController::SetAppletGpuTimeSlice, "SetAppletGpuTimeSlice"}, | ||
| 22 | }; | ||
| 23 | // clang-format on | ||
| 24 | |||
| 25 | RegisterHandlers(functions); | ||
| 26 | } | ||
| 27 | |||
| 28 | IWindowController::~IWindowController() = default; | ||
| 29 | |||
| 30 | void IWindowController::GetAppletResourceUserId(HLERequestContext& ctx) { | ||
| 31 | IPC::ResponseBuilder rb{ctx, 4}; | ||
| 32 | rb.Push(ResultSuccess); | ||
| 33 | rb.Push<u64>(applet->aruid); | ||
| 34 | } | ||
| 35 | |||
| 36 | void IWindowController::GetAppletResourceUserIdOfCallerApplet(HLERequestContext& ctx) { | ||
| 37 | u64 aruid = 0; | ||
| 38 | if (auto caller = applet->caller_applet.lock(); caller) { | ||
| 39 | aruid = caller->aruid; | ||
| 40 | } | ||
| 41 | |||
| 42 | LOG_WARNING(Service_AM, "(STUBBED) called"); | ||
| 43 | |||
| 44 | IPC::ResponseBuilder rb{ctx, 4}; | ||
| 45 | rb.Push(ResultSuccess); | ||
| 46 | rb.Push<u64>(aruid); | ||
| 47 | } | ||
| 48 | |||
| 49 | void IWindowController::AcquireForegroundRights(HLERequestContext& ctx) { | ||
| 50 | LOG_WARNING(Service_AM, "(STUBBED) called"); | ||
| 51 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 52 | rb.Push(ResultSuccess); | ||
| 53 | } | ||
| 54 | |||
| 55 | void IWindowController::SetAppletWindowVisibility(HLERequestContext& ctx) { | ||
| 56 | LOG_INFO(Service_AM, "called"); | ||
| 57 | |||
| 58 | IPC::RequestParser rp{ctx}; | ||
| 59 | const bool visible = rp.Pop<bool>(); | ||
| 60 | |||
| 61 | applet->system_buffer_manager.SetWindowVisibility(visible); | ||
| 62 | applet->hid_registration.EnableAppletToGetInput(visible); | ||
| 63 | |||
| 64 | if (visible) { | ||
| 65 | applet->focus_state = FocusState::InFocus; | ||
| 66 | applet->message_queue.PushMessage(AppletMessage::ChangeIntoForeground); | ||
| 67 | } else { | ||
| 68 | applet->focus_state = FocusState::NotInFocus; | ||
| 69 | applet->message_queue.PushMessage(AppletMessage::ChangeIntoBackground); | ||
| 70 | } | ||
| 71 | |||
| 72 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 73 | rb.Push(ResultSuccess); | ||
| 74 | } | ||
| 75 | |||
| 76 | void IWindowController::SetAppletGpuTimeSlice(HLERequestContext& ctx) { | ||
| 77 | IPC::RequestParser rp{ctx}; | ||
| 78 | const auto time_slice = rp.Pop<s64>(); | ||
| 79 | |||
| 80 | LOG_WARNING(Service_AM, "(STUBBED) called, time_slice={}", time_slice); | ||
| 81 | |||
| 82 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 83 | rb.Push(ResultSuccess); | ||
| 84 | } | ||
| 85 | |||
| 86 | } // namespace Service::AM | ||
diff --git a/src/core/hle/service/am/window_controller.h b/src/core/hle/service/am/window_controller.h deleted file mode 100644 index a28219abe..000000000 --- a/src/core/hle/service/am/window_controller.h +++ /dev/null | |||
| @@ -1,27 +0,0 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #include "core/hle/service/service.h" | ||
| 7 | |||
| 8 | namespace Service::AM { | ||
| 9 | |||
| 10 | struct Applet; | ||
| 11 | |||
| 12 | class IWindowController final : public ServiceFramework<IWindowController> { | ||
| 13 | public: | ||
| 14 | explicit IWindowController(Core::System& system_, std::shared_ptr<Applet> applet_); | ||
| 15 | ~IWindowController() override; | ||
| 16 | |||
| 17 | private: | ||
| 18 | void GetAppletResourceUserId(HLERequestContext& ctx); | ||
| 19 | void GetAppletResourceUserIdOfCallerApplet(HLERequestContext& ctx); | ||
| 20 | void AcquireForegroundRights(HLERequestContext& ctx); | ||
| 21 | void SetAppletWindowVisibility(HLERequestContext& ctx); | ||
| 22 | void SetAppletGpuTimeSlice(HLERequestContext& ctx); | ||
| 23 | |||
| 24 | const std::shared_ptr<Applet> applet; | ||
| 25 | }; | ||
| 26 | |||
| 27 | } // namespace Service::AM | ||