diff options
author | Liam <byteslice@airmail.cc> | 2024-02-12 02:38:42 +0100 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2024-02-12 15:17:25 +0100 |
commit | 87b740df46935a672a6bf5d43c944a2516cc72f9 (patch) | |
tree | 3de50c74fc8795ca486653cf4603b30dbad6bff0 | |
parent | am: rewrite IStorage (diff) | |
download | yuzu-87b740df46935a672a6bf5d43c944a2516cc72f9.tar yuzu-87b740df46935a672a6bf5d43c944a2516cc72f9.tar.gz yuzu-87b740df46935a672a6bf5d43c944a2516cc72f9.tar.bz2 yuzu-87b740df46935a672a6bf5d43c944a2516cc72f9.tar.lz yuzu-87b740df46935a672a6bf5d43c944a2516cc72f9.tar.xz yuzu-87b740df46935a672a6bf5d43c944a2516cc72f9.tar.zst yuzu-87b740df46935a672a6bf5d43c944a2516cc72f9.zip |
-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 hle/service/am/service/storage.h hle/service/am/service/system_applet_proxy.cpp hle/service/am/service/system_applet_proxy.h + hle/service/am/service/window_controller.cpp + hle/service/am/service/window_controller.h hle/service/am/system_buffer_manager.cpp hle/service/am/system_buffer_manager.h hle/service/am/spsm.cpp hle/service/am/spsm.h - hle/service/am/window_controller.cpp - hle/service/am/window_controller.h hle/service/aoc/aoc_u.cpp hle/service/aoc/aoc_u.h 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 @@ #include "core/hle/service/am/service/library_applet_creator.h" #include "core/hle/service/am/service/process_winding_controller.h" #include "core/hle/service/am/service/self_controller.h" -#include "core/hle/service/am/window_controller.h" +#include "core/hle/service/am/service/window_controller.h" #include "core/hle/service/cmif_serialization.h" 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 @@ #include "core/hle/service/am/service/library_applet_self_accessor.h" #include "core/hle/service/am/service/process_winding_controller.h" #include "core/hle/service/am/service/self_controller.h" -#include "core/hle/service/am/window_controller.h" +#include "core/hle/service/am/service/window_controller.h" #include "core/hle/service/cmif_serialization.h" 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 @@ #include "core/hle/service/am/service/process_winding_controller.h" #include "core/hle/service/am/service/self_controller.h" #include "core/hle/service/am/service/system_applet_proxy.h" -#include "core/hle/service/am/window_controller.h" +#include "core/hle/service/am/service/window_controller.h" #include "core/hle/service/cmif_serialization.h" 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 @@ +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "core/hle/service/am/applet.h" +#include "core/hle/service/am/applet_manager.h" +#include "core/hle/service/am/service/window_controller.h" +#include "core/hle/service/cmif_serialization.h" + +namespace Service::AM { + +IWindowController::IWindowController(Core::System& system_, std::shared_ptr<Applet> applet) + : ServiceFramework{system_, "IWindowController"}, m_applet{std::move(applet)} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "CreateWindow"}, + {1, D<&IWindowController::GetAppletResourceUserId>, "GetAppletResourceUserId"}, + {2, D<&IWindowController::GetAppletResourceUserIdOfCallerApplet>, "GetAppletResourceUserIdOfCallerApplet"}, + {10, D<&IWindowController::AcquireForegroundRights>, "AcquireForegroundRights"}, + {11, D<&IWindowController::ReleaseForegroundRights>, "ReleaseForegroundRights"}, + {12, D<&IWindowController::RejectToChangeIntoBackground>, "RejectToChangeIntoBackground"}, + {20, D<&IWindowController::SetAppletWindowVisibility>, "SetAppletWindowVisibility"}, + {21, D<&IWindowController::SetAppletGpuTimeSlice>, "SetAppletGpuTimeSlice"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +IWindowController::~IWindowController() = default; + +Result IWindowController::GetAppletResourceUserId(Out<AppletResourceUserId> out_aruid) { + LOG_INFO(Service_AM, "called"); + *out_aruid = m_applet->aruid; + R_SUCCEED(); +} + +Result IWindowController::GetAppletResourceUserIdOfCallerApplet( + Out<AppletResourceUserId> out_aruid) { + LOG_INFO(Service_AM, "called"); + + if (auto caller_applet = m_applet->caller_applet.lock(); caller_applet != nullptr) { + *out_aruid = caller_applet->aruid; + } else { + *out_aruid = AppletResourceUserId{}; + } + + R_SUCCEED(); +} + +Result IWindowController::AcquireForegroundRights() { + LOG_INFO(Service_AM, "called"); + R_SUCCEED(); +} + +Result IWindowController::ReleaseForegroundRights() { + LOG_INFO(Service_AM, "called"); + R_SUCCEED(); +} + +Result IWindowController::RejectToChangeIntoBackground() { + LOG_INFO(Service_AM, "called"); + R_SUCCEED(); +} + +Result IWindowController::SetAppletWindowVisibility(bool visible) { + m_applet->system_buffer_manager.SetWindowVisibility(visible); + m_applet->hid_registration.EnableAppletToGetInput(visible); + + if (visible) { + m_applet->message_queue.PushMessage(AppletMessage::ChangeIntoForeground); + m_applet->focus_state = FocusState::InFocus; + } else { + m_applet->focus_state = FocusState::NotInFocus; + } + + m_applet->message_queue.PushMessage(AppletMessage::FocusStateChanged); + + R_SUCCEED(); +} + +Result IWindowController::SetAppletGpuTimeSlice(s64 time_slice) { + LOG_WARNING(Service_AM, "(STUBBED) called, time_slice={}", time_slice); + R_SUCCEED(); +} + +} // 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 @@ +// 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/service.h" + +namespace Service::AM { + +struct Applet; + +class IWindowController final : public ServiceFramework<IWindowController> { +public: + explicit IWindowController(Core::System& system_, std::shared_ptr<Applet> applet); + ~IWindowController() override; + +private: + Result GetAppletResourceUserId(Out<AppletResourceUserId> out_aruid); + Result GetAppletResourceUserIdOfCallerApplet(Out<AppletResourceUserId> out_aruid); + Result AcquireForegroundRights(); + Result ReleaseForegroundRights(); + Result RejectToChangeIntoBackground(); + Result SetAppletWindowVisibility(bool visible); + Result SetAppletGpuTimeSlice(s64 time_slice); + + const std::shared_ptr<Applet> m_applet; +}; + +} // 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 @@ -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "core/hle/service/am/applet.h" -#include "core/hle/service/am/window_controller.h" -#include "core/hle/service/ipc_helpers.h" - -namespace Service::AM { - -IWindowController::IWindowController(Core::System& system_, std::shared_ptr<Applet> applet_) - : ServiceFramework{system_, "IWindowController"}, applet{std::move(applet_)} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "CreateWindow"}, - {1, &IWindowController::GetAppletResourceUserId, "GetAppletResourceUserId"}, - {2, &IWindowController::GetAppletResourceUserIdOfCallerApplet, "GetAppletResourceUserIdOfCallerApplet"}, - {10, &IWindowController::AcquireForegroundRights, "AcquireForegroundRights"}, - {11, nullptr, "ReleaseForegroundRights"}, - {12, nullptr, "RejectToChangeIntoBackground"}, - {20, &IWindowController::SetAppletWindowVisibility, "SetAppletWindowVisibility"}, - {21, &IWindowController::SetAppletGpuTimeSlice, "SetAppletGpuTimeSlice"}, - }; - // clang-format on - - RegisterHandlers(functions); -} - -IWindowController::~IWindowController() = default; - -void IWindowController::GetAppletResourceUserId(HLERequestContext& ctx) { - IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(ResultSuccess); - rb.Push<u64>(applet->aruid); -} - -void IWindowController::GetAppletResourceUserIdOfCallerApplet(HLERequestContext& ctx) { - u64 aruid = 0; - if (auto caller = applet->caller_applet.lock(); caller) { - aruid = caller->aruid; - } - - LOG_WARNING(Service_AM, "(STUBBED) called"); - - IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(ResultSuccess); - rb.Push<u64>(aruid); -} - -void IWindowController::AcquireForegroundRights(HLERequestContext& ctx) { - LOG_WARNING(Service_AM, "(STUBBED) called"); - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ResultSuccess); -} - -void IWindowController::SetAppletWindowVisibility(HLERequestContext& ctx) { - LOG_INFO(Service_AM, "called"); - - IPC::RequestParser rp{ctx}; - const bool visible = rp.Pop<bool>(); - - applet->system_buffer_manager.SetWindowVisibility(visible); - applet->hid_registration.EnableAppletToGetInput(visible); - - if (visible) { - applet->focus_state = FocusState::InFocus; - applet->message_queue.PushMessage(AppletMessage::ChangeIntoForeground); - } else { - applet->focus_state = FocusState::NotInFocus; - applet->message_queue.PushMessage(AppletMessage::ChangeIntoBackground); - } - - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ResultSuccess); -} - -void IWindowController::SetAppletGpuTimeSlice(HLERequestContext& ctx) { - IPC::RequestParser rp{ctx}; - const auto time_slice = rp.Pop<s64>(); - - LOG_WARNING(Service_AM, "(STUBBED) called, time_slice={}", time_slice); - - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ResultSuccess); -} - -} // 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 @@ -// 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 { - -struct Applet; - -class IWindowController final : public ServiceFramework<IWindowController> { -public: - explicit IWindowController(Core::System& system_, std::shared_ptr<Applet> applet_); - ~IWindowController() override; - -private: - void GetAppletResourceUserId(HLERequestContext& ctx); - void GetAppletResourceUserIdOfCallerApplet(HLERequestContext& ctx); - void AcquireForegroundRights(HLERequestContext& ctx); - void SetAppletWindowVisibility(HLERequestContext& ctx); - void SetAppletGpuTimeSlice(HLERequestContext& ctx); - - const std::shared_ptr<Applet> applet; -}; - -} // namespace Service::AM |