diff options
| author | 2024-02-11 20:16:38 -0500 | |
|---|---|---|
| committer | 2024-02-12 09:16:03 -0500 | |
| commit | 79f225bd5979f058b682845bcafa9a34af8fdc4e (patch) | |
| tree | af98ed7a3ab6d0ac308fb476bfa7f35ced058e58 | |
| parent | am: rewrite ILibraryAppletSelfAccessor (diff) | |
| download | yuzu-79f225bd5979f058b682845bcafa9a34af8fdc4e.tar.gz yuzu-79f225bd5979f058b682845bcafa9a34af8fdc4e.tar.xz yuzu-79f225bd5979f058b682845bcafa9a34af8fdc4e.zip | |
am: rewrite IProcessWindingController
| -rw-r--r-- | src/core/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | src/core/hle/service/am/process_winding_controller.cpp | 56 | ||||
| -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/process_winding_controller.cpp | 54 | ||||
| -rw-r--r-- | src/core/hle/service/am/service/process_winding_controller.h (renamed from src/core/hle/service/am/process_winding_controller.h) | 10 | ||||
| -rw-r--r-- | src/core/hle/service/am/service/system_applet_proxy.cpp | 2 |
7 files changed, 66 insertions, 64 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index f7f6b216e..935e3c57c 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -437,8 +437,6 @@ add_library(core STATIC | |||
| 437 | hle/service/am/managed_layer_holder.h | 437 | hle/service/am/managed_layer_holder.h |
| 438 | hle/service/am/omm.cpp | 438 | hle/service/am/omm.cpp |
| 439 | hle/service/am/omm.h | 439 | hle/service/am/omm.h |
| 440 | hle/service/am/process_winding_controller.cpp | ||
| 441 | hle/service/am/process_winding_controller.h | ||
| 442 | hle/service/am/process.cpp | 440 | hle/service/am/process.cpp |
| 443 | hle/service/am/process.h | 441 | hle/service/am/process.h |
| 444 | hle/service/am/self_controller.cpp | 442 | hle/service/am/self_controller.cpp |
| @@ -475,6 +473,8 @@ add_library(core STATIC | |||
| 475 | hle/service/am/service/library_applet_proxy.h | 473 | hle/service/am/service/library_applet_proxy.h |
| 476 | hle/service/am/service/library_applet_self_accessor.cpp | 474 | hle/service/am/service/library_applet_self_accessor.cpp |
| 477 | hle/service/am/service/library_applet_self_accessor.h | 475 | hle/service/am/service/library_applet_self_accessor.h |
| 476 | hle/service/am/service/process_winding_controller.cpp | ||
| 477 | hle/service/am/service/process_winding_controller.h | ||
| 478 | hle/service/am/service/system_applet_proxy.cpp | 478 | hle/service/am/service/system_applet_proxy.cpp |
| 479 | hle/service/am/service/system_applet_proxy.h | 479 | hle/service/am/service/system_applet_proxy.h |
| 480 | hle/service/am/system_buffer_manager.cpp | 480 | hle/service/am/system_buffer_manager.cpp |
diff --git a/src/core/hle/service/am/process_winding_controller.cpp b/src/core/hle/service/am/process_winding_controller.cpp deleted file mode 100644 index bc5a50a3d..000000000 --- a/src/core/hle/service/am/process_winding_controller.cpp +++ /dev/null | |||
| @@ -1,56 +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/frontend/applets.h" | ||
| 5 | #include "core/hle/service/am/process_winding_controller.h" | ||
| 6 | #include "core/hle/service/am/service/library_applet_accessor.h" | ||
| 7 | #include "core/hle/service/ipc_helpers.h" | ||
| 8 | |||
| 9 | namespace Service::AM { | ||
| 10 | |||
| 11 | IProcessWindingController::IProcessWindingController(Core::System& system_, | ||
| 12 | std::shared_ptr<Applet> applet_) | ||
| 13 | : ServiceFramework{system_, "IProcessWindingController"}, applet{std::move(applet_)} { | ||
| 14 | // clang-format off | ||
| 15 | static const FunctionInfo functions[] = { | ||
| 16 | {0, &IProcessWindingController::GetLaunchReason, "GetLaunchReason"}, | ||
| 17 | {11, &IProcessWindingController::OpenCallingLibraryApplet, "OpenCallingLibraryApplet"}, | ||
| 18 | {21, nullptr, "PushContext"}, | ||
| 19 | {22, nullptr, "PopContext"}, | ||
| 20 | {23, nullptr, "CancelWindingReservation"}, | ||
| 21 | {30, nullptr, "WindAndDoReserved"}, | ||
| 22 | {40, nullptr, "ReserveToStartAndWaitAndUnwindThis"}, | ||
| 23 | {41, nullptr, "ReserveToStartAndWait"}, | ||
| 24 | }; | ||
| 25 | // clang-format on | ||
| 26 | |||
| 27 | RegisterHandlers(functions); | ||
| 28 | } | ||
| 29 | |||
| 30 | IProcessWindingController::~IProcessWindingController() = default; | ||
| 31 | |||
| 32 | void IProcessWindingController::GetLaunchReason(HLERequestContext& ctx) { | ||
| 33 | LOG_WARNING(Service_AM, "(STUBBED) called"); | ||
| 34 | |||
| 35 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 36 | rb.Push(ResultSuccess); | ||
| 37 | rb.PushRaw(applet->launch_reason); | ||
| 38 | } | ||
| 39 | |||
| 40 | void IProcessWindingController::OpenCallingLibraryApplet(HLERequestContext& ctx) { | ||
| 41 | const auto caller_applet = applet->caller_applet.lock(); | ||
| 42 | if (caller_applet == nullptr) { | ||
| 43 | LOG_ERROR(Service_AM, "No calling applet available"); | ||
| 44 | |||
| 45 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 46 | rb.Push(ResultUnknown); | ||
| 47 | return; | ||
| 48 | } | ||
| 49 | |||
| 50 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 51 | rb.Push(ResultSuccess); | ||
| 52 | rb.PushIpcInterface<ILibraryAppletAccessor>(system, applet->caller_applet_broker, | ||
| 53 | caller_applet); | ||
| 54 | } | ||
| 55 | |||
| 56 | } // namespace Service::AM | ||
diff --git a/src/core/hle/service/am/service/application_proxy.cpp b/src/core/hle/service/am/service/application_proxy.cpp index c9b872887..5f5a8f06c 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 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include "core/hle/service/am/process_winding_controller.h" | ||
| 5 | #include "core/hle/service/am/self_controller.h" | 4 | #include "core/hle/service/am/self_controller.h" |
| 6 | #include "core/hle/service/am/service/applet_common_functions.h" | 5 | #include "core/hle/service/am/service/applet_common_functions.h" |
| 7 | #include "core/hle/service/am/service/application_functions.h" | 6 | #include "core/hle/service/am/service/application_functions.h" |
| @@ -11,6 +10,7 @@ | |||
| 11 | #include "core/hle/service/am/service/debug_functions.h" | 10 | #include "core/hle/service/am/service/debug_functions.h" |
| 12 | #include "core/hle/service/am/service/display_controller.h" | 11 | #include "core/hle/service/am/service/display_controller.h" |
| 13 | #include "core/hle/service/am/service/library_applet_creator.h" | 12 | #include "core/hle/service/am/service/library_applet_creator.h" |
| 13 | #include "core/hle/service/am/service/process_winding_controller.h" | ||
| 14 | #include "core/hle/service/am/window_controller.h" | 14 | #include "core/hle/service/am/window_controller.h" |
| 15 | #include "core/hle/service/cmif_serialization.h" | 15 | #include "core/hle/service/cmif_serialization.h" |
| 16 | 16 | ||
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 9506739e9..91aa9f4db 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 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include "core/hle/service/am/process_winding_controller.h" | ||
| 5 | #include "core/hle/service/am/self_controller.h" | 4 | #include "core/hle/service/am/self_controller.h" |
| 6 | #include "core/hle/service/am/service/applet_common_functions.h" | 5 | #include "core/hle/service/am/service/applet_common_functions.h" |
| 7 | #include "core/hle/service/am/service/audio_controller.h" | 6 | #include "core/hle/service/am/service/audio_controller.h" |
| @@ -13,6 +12,7 @@ | |||
| 13 | #include "core/hle/service/am/service/library_applet_creator.h" | 12 | #include "core/hle/service/am/service/library_applet_creator.h" |
| 14 | #include "core/hle/service/am/service/library_applet_proxy.h" | 13 | #include "core/hle/service/am/service/library_applet_proxy.h" |
| 15 | #include "core/hle/service/am/service/library_applet_self_accessor.h" | 14 | #include "core/hle/service/am/service/library_applet_self_accessor.h" |
| 15 | #include "core/hle/service/am/service/process_winding_controller.h" | ||
| 16 | #include "core/hle/service/am/window_controller.h" | 16 | #include "core/hle/service/am/window_controller.h" |
| 17 | #include "core/hle/service/cmif_serialization.h" | 17 | #include "core/hle/service/cmif_serialization.h" |
| 18 | 18 | ||
diff --git a/src/core/hle/service/am/service/process_winding_controller.cpp b/src/core/hle/service/am/service/process_winding_controller.cpp new file mode 100644 index 000000000..10df830d7 --- /dev/null +++ b/src/core/hle/service/am/service/process_winding_controller.cpp | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #include "core/hle/service/am/frontend/applets.h" | ||
| 5 | #include "core/hle/service/am/service/library_applet_accessor.h" | ||
| 6 | #include "core/hle/service/am/service/process_winding_controller.h" | ||
| 7 | #include "core/hle/service/cmif_serialization.h" | ||
| 8 | |||
| 9 | namespace Service::AM { | ||
| 10 | |||
| 11 | IProcessWindingController::IProcessWindingController(Core::System& system_, | ||
| 12 | std::shared_ptr<Applet> applet) | ||
| 13 | : ServiceFramework{system_, "IProcessWindingController"}, m_applet{std::move(applet)} { | ||
| 14 | // clang-format off | ||
| 15 | static const FunctionInfo functions[] = { | ||
| 16 | {0, D<&IProcessWindingController::GetLaunchReason>, "GetLaunchReason"}, | ||
| 17 | {11, D<&IProcessWindingController::OpenCallingLibraryApplet>, "OpenCallingLibraryApplet"}, | ||
| 18 | {21, nullptr, "PushContext"}, | ||
| 19 | {22, nullptr, "PopContext"}, | ||
| 20 | {23, nullptr, "CancelWindingReservation"}, | ||
| 21 | {30, nullptr, "WindAndDoReserved"}, | ||
| 22 | {40, nullptr, "ReserveToStartAndWaitAndUnwindThis"}, | ||
| 23 | {41, nullptr, "ReserveToStartAndWait"}, | ||
| 24 | }; | ||
| 25 | // clang-format on | ||
| 26 | |||
| 27 | RegisterHandlers(functions); | ||
| 28 | } | ||
| 29 | |||
| 30 | IProcessWindingController::~IProcessWindingController() = default; | ||
| 31 | |||
| 32 | Result IProcessWindingController::GetLaunchReason( | ||
| 33 | Out<AppletProcessLaunchReason> out_launch_reason) { | ||
| 34 | LOG_INFO(Service_AM, "called"); | ||
| 35 | *out_launch_reason = m_applet->launch_reason; | ||
| 36 | R_SUCCEED(); | ||
| 37 | } | ||
| 38 | |||
| 39 | Result IProcessWindingController::OpenCallingLibraryApplet( | ||
| 40 | Out<SharedPointer<ILibraryAppletAccessor>> out_calling_library_applet) { | ||
| 41 | LOG_INFO(Service_AM, "called"); | ||
| 42 | |||
| 43 | const auto caller_applet = m_applet->caller_applet.lock(); | ||
| 44 | if (caller_applet == nullptr) { | ||
| 45 | LOG_ERROR(Service_AM, "No caller applet available"); | ||
| 46 | R_THROW(ResultUnknown); | ||
| 47 | } | ||
| 48 | |||
| 49 | *out_calling_library_applet = std::make_shared<ILibraryAppletAccessor>( | ||
| 50 | system, m_applet->caller_applet_broker, caller_applet); | ||
| 51 | R_SUCCEED(); | ||
| 52 | } | ||
| 53 | |||
| 54 | } // namespace Service::AM | ||
diff --git a/src/core/hle/service/am/process_winding_controller.h b/src/core/hle/service/am/service/process_winding_controller.h index 71ae4c4f5..4408af1f1 100644 --- a/src/core/hle/service/am/process_winding_controller.h +++ b/src/core/hle/service/am/service/process_winding_controller.h | |||
| @@ -3,11 +3,14 @@ | |||
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include "core/hle/service/am/am_types.h" | ||
| 7 | #include "core/hle/service/cmif_types.h" | ||
| 6 | #include "core/hle/service/service.h" | 8 | #include "core/hle/service/service.h" |
| 7 | 9 | ||
| 8 | namespace Service::AM { | 10 | namespace Service::AM { |
| 9 | 11 | ||
| 10 | struct Applet; | 12 | struct Applet; |
| 13 | class ILibraryAppletAccessor; | ||
| 11 | 14 | ||
| 12 | class IProcessWindingController final : public ServiceFramework<IProcessWindingController> { | 15 | class IProcessWindingController final : public ServiceFramework<IProcessWindingController> { |
| 13 | public: | 16 | public: |
| @@ -15,10 +18,11 @@ public: | |||
| 15 | ~IProcessWindingController() override; | 18 | ~IProcessWindingController() override; |
| 16 | 19 | ||
| 17 | private: | 20 | private: |
| 18 | void GetLaunchReason(HLERequestContext& ctx); | 21 | Result GetLaunchReason(Out<AppletProcessLaunchReason> out_launch_reason); |
| 19 | void OpenCallingLibraryApplet(HLERequestContext& ctx); | 22 | Result OpenCallingLibraryApplet( |
| 23 | Out<SharedPointer<ILibraryAppletAccessor>> out_calling_library_applet); | ||
| 20 | 24 | ||
| 21 | const std::shared_ptr<Applet> applet; | 25 | const std::shared_ptr<Applet> m_applet; |
| 22 | }; | 26 | }; |
| 23 | 27 | ||
| 24 | } // namespace Service::AM | 28 | } // 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 1e931dec7..0f6175d32 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 @@ | |||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include "core/hle/service/am/application_creator.h" | 4 | #include "core/hle/service/am/application_creator.h" |
| 5 | #include "core/hle/service/am/process_winding_controller.h" | ||
| 6 | #include "core/hle/service/am/self_controller.h" | 5 | #include "core/hle/service/am/self_controller.h" |
| 7 | #include "core/hle/service/am/service/applet_common_functions.h" | 6 | #include "core/hle/service/am/service/applet_common_functions.h" |
| 8 | #include "core/hle/service/am/service/audio_controller.h" | 7 | #include "core/hle/service/am/service/audio_controller.h" |
| @@ -12,6 +11,7 @@ | |||
| 12 | #include "core/hle/service/am/service/global_state_controller.h" | 11 | #include "core/hle/service/am/service/global_state_controller.h" |
| 13 | #include "core/hle/service/am/service/home_menu_functions.h" | 12 | #include "core/hle/service/am/service/home_menu_functions.h" |
| 14 | #include "core/hle/service/am/service/library_applet_creator.h" | 13 | #include "core/hle/service/am/service/library_applet_creator.h" |
| 14 | #include "core/hle/service/am/service/process_winding_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/window_controller.h" |
| 17 | #include "core/hle/service/cmif_serialization.h" | 17 | #include "core/hle/service/cmif_serialization.h" |