diff options
| author | 2024-02-11 18:31:29 -0500 | |
|---|---|---|
| committer | 2024-02-11 21:59:33 -0500 | |
| commit | c7e97b22fb6fd14800ad374a13ad21d6a4c829f1 (patch) | |
| tree | 23263e4ecf7c77a40a0366ce1ed099ab4b653d62 /src/core/hle/service/am | |
| parent | am: rewrite appletAE, appletOE (diff) | |
| download | yuzu-c7e97b22fb6fd14800ad374a13ad21d6a4c829f1.tar.gz yuzu-c7e97b22fb6fd14800ad374a13ad21d6a4c829f1.tar.xz yuzu-c7e97b22fb6fd14800ad374a13ad21d6a4c829f1.zip | |
am: rewrite IApplicationProxy
Diffstat (limited to 'src/core/hle/service/am')
| -rw-r--r-- | src/core/hle/service/am/application_proxy.cpp | 115 | ||||
| -rw-r--r-- | src/core/hle/service/am/application_proxy.h | 33 | ||||
| -rw-r--r-- | src/core/hle/service/am/service/application_proxy.cpp | 106 | ||||
| -rw-r--r-- | src/core/hle/service/am/service/application_proxy.h | 48 | ||||
| -rw-r--r-- | src/core/hle/service/am/service/application_proxy_service.cpp | 5 |
5 files changed, 157 insertions, 150 deletions
diff --git a/src/core/hle/service/am/application_proxy.cpp b/src/core/hle/service/am/application_proxy.cpp deleted file mode 100644 index a6fd6d37f..000000000 --- a/src/core/hle/service/am/application_proxy.cpp +++ /dev/null | |||
| @@ -1,115 +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_common_functions.h" | ||
| 5 | #include "core/hle/service/am/application_functions.h" | ||
| 6 | #include "core/hle/service/am/application_proxy.h" | ||
| 7 | #include "core/hle/service/am/audio_controller.h" | ||
| 8 | #include "core/hle/service/am/common_state_getter.h" | ||
| 9 | #include "core/hle/service/am/debug_functions.h" | ||
| 10 | #include "core/hle/service/am/display_controller.h" | ||
| 11 | #include "core/hle/service/am/library_applet_creator.h" | ||
| 12 | #include "core/hle/service/am/library_applet_self_accessor.h" | ||
| 13 | #include "core/hle/service/am/process_winding_controller.h" | ||
| 14 | #include "core/hle/service/am/self_controller.h" | ||
| 15 | #include "core/hle/service/am/window_controller.h" | ||
| 16 | #include "core/hle/service/ipc_helpers.h" | ||
| 17 | |||
| 18 | namespace Service::AM { | ||
| 19 | |||
| 20 | IApplicationProxy::IApplicationProxy(Nvnflinger::Nvnflinger& nvnflinger_, | ||
| 21 | std::shared_ptr<Applet> applet_, Core::System& system_) | ||
| 22 | : ServiceFramework{system_, "IApplicationProxy"}, nvnflinger{nvnflinger_}, applet{std::move( | ||
| 23 | applet_)} { | ||
| 24 | // clang-format off | ||
| 25 | static const FunctionInfo functions[] = { | ||
| 26 | {0, &IApplicationProxy::GetCommonStateGetter, "GetCommonStateGetter"}, | ||
| 27 | {1, &IApplicationProxy::GetSelfController, "GetSelfController"}, | ||
| 28 | {2, &IApplicationProxy::GetWindowController, "GetWindowController"}, | ||
| 29 | {3, &IApplicationProxy::GetAudioController, "GetAudioController"}, | ||
| 30 | {4, &IApplicationProxy::GetDisplayController, "GetDisplayController"}, | ||
| 31 | {10, &IApplicationProxy::GetProcessWindingController, "GetProcessWindingController"}, | ||
| 32 | {11, &IApplicationProxy::GetLibraryAppletCreator, "GetLibraryAppletCreator"}, | ||
| 33 | {20, &IApplicationProxy::GetApplicationFunctions, "GetApplicationFunctions"}, | ||
| 34 | {1000, &IApplicationProxy::GetDebugFunctions, "GetDebugFunctions"}, | ||
| 35 | }; | ||
| 36 | // clang-format on | ||
| 37 | |||
| 38 | RegisterHandlers(functions); | ||
| 39 | } | ||
| 40 | |||
| 41 | IApplicationProxy::~IApplicationProxy() = default; | ||
| 42 | |||
| 43 | void IApplicationProxy::GetAudioController(HLERequestContext& ctx) { | ||
| 44 | LOG_DEBUG(Service_AM, "called"); | ||
| 45 | |||
| 46 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 47 | rb.Push(ResultSuccess); | ||
| 48 | rb.PushIpcInterface<IAudioController>(system); | ||
| 49 | } | ||
| 50 | |||
| 51 | void IApplicationProxy::GetDisplayController(HLERequestContext& ctx) { | ||
| 52 | LOG_DEBUG(Service_AM, "called"); | ||
| 53 | |||
| 54 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 55 | rb.Push(ResultSuccess); | ||
| 56 | rb.PushIpcInterface<IDisplayController>(system, applet); | ||
| 57 | } | ||
| 58 | |||
| 59 | void IApplicationProxy::GetProcessWindingController(HLERequestContext& ctx) { | ||
| 60 | LOG_DEBUG(Service_AM, "called"); | ||
| 61 | |||
| 62 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 63 | rb.Push(ResultSuccess); | ||
| 64 | rb.PushIpcInterface<IProcessWindingController>(system, applet); | ||
| 65 | } | ||
| 66 | |||
| 67 | void IApplicationProxy::GetDebugFunctions(HLERequestContext& ctx) { | ||
| 68 | LOG_DEBUG(Service_AM, "called"); | ||
| 69 | |||
| 70 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 71 | rb.Push(ResultSuccess); | ||
| 72 | rb.PushIpcInterface<IDebugFunctions>(system); | ||
| 73 | } | ||
| 74 | |||
| 75 | void IApplicationProxy::GetWindowController(HLERequestContext& ctx) { | ||
| 76 | LOG_DEBUG(Service_AM, "called"); | ||
| 77 | |||
| 78 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 79 | rb.Push(ResultSuccess); | ||
| 80 | rb.PushIpcInterface<IWindowController>(system, applet); | ||
| 81 | } | ||
| 82 | |||
| 83 | void IApplicationProxy::GetSelfController(HLERequestContext& ctx) { | ||
| 84 | LOG_DEBUG(Service_AM, "called"); | ||
| 85 | |||
| 86 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 87 | rb.Push(ResultSuccess); | ||
| 88 | rb.PushIpcInterface<ISelfController>(system, applet, nvnflinger); | ||
| 89 | } | ||
| 90 | |||
| 91 | void IApplicationProxy::GetCommonStateGetter(HLERequestContext& ctx) { | ||
| 92 | LOG_DEBUG(Service_AM, "called"); | ||
| 93 | |||
| 94 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 95 | rb.Push(ResultSuccess); | ||
| 96 | rb.PushIpcInterface<ICommonStateGetter>(system, applet); | ||
| 97 | } | ||
| 98 | |||
| 99 | void IApplicationProxy::GetLibraryAppletCreator(HLERequestContext& ctx) { | ||
| 100 | LOG_DEBUG(Service_AM, "called"); | ||
| 101 | |||
| 102 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 103 | rb.Push(ResultSuccess); | ||
| 104 | rb.PushIpcInterface<ILibraryAppletCreator>(system, applet); | ||
| 105 | } | ||
| 106 | |||
| 107 | void IApplicationProxy::GetApplicationFunctions(HLERequestContext& ctx) { | ||
| 108 | LOG_DEBUG(Service_AM, "called"); | ||
| 109 | |||
| 110 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 111 | rb.Push(ResultSuccess); | ||
| 112 | rb.PushIpcInterface<IApplicationFunctions>(system, applet); | ||
| 113 | } | ||
| 114 | |||
| 115 | } // namespace Service::AM | ||
diff --git a/src/core/hle/service/am/application_proxy.h b/src/core/hle/service/am/application_proxy.h deleted file mode 100644 index eb98b095c..000000000 --- a/src/core/hle/service/am/application_proxy.h +++ /dev/null | |||
| @@ -1,33 +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 IApplicationProxy final : public ServiceFramework<IApplicationProxy> { | ||
| 13 | public: | ||
| 14 | explicit IApplicationProxy(Nvnflinger::Nvnflinger& nvnflinger_, | ||
| 15 | std::shared_ptr<Applet> msg_queue_, Core::System& system_); | ||
| 16 | ~IApplicationProxy(); | ||
| 17 | |||
| 18 | private: | ||
| 19 | void GetAudioController(HLERequestContext& ctx); | ||
| 20 | void GetDisplayController(HLERequestContext& ctx); | ||
| 21 | void GetProcessWindingController(HLERequestContext& ctx); | ||
| 22 | void GetDebugFunctions(HLERequestContext& ctx); | ||
| 23 | void GetWindowController(HLERequestContext& ctx); | ||
| 24 | void GetSelfController(HLERequestContext& ctx); | ||
| 25 | void GetCommonStateGetter(HLERequestContext& ctx); | ||
| 26 | void GetLibraryAppletCreator(HLERequestContext& ctx); | ||
| 27 | void GetApplicationFunctions(HLERequestContext& ctx); | ||
| 28 | |||
| 29 | Nvnflinger::Nvnflinger& nvnflinger; | ||
| 30 | std::shared_ptr<Applet> applet; | ||
| 31 | }; | ||
| 32 | |||
| 33 | } // 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 new file mode 100644 index 000000000..d1f87709e --- /dev/null +++ b/src/core/hle/service/am/service/application_proxy.cpp | |||
| @@ -0,0 +1,106 @@ | |||
| 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_common_functions.h" | ||
| 5 | #include "core/hle/service/am/application_functions.h" | ||
| 6 | #include "core/hle/service/am/audio_controller.h" | ||
| 7 | #include "core/hle/service/am/common_state_getter.h" | ||
| 8 | #include "core/hle/service/am/debug_functions.h" | ||
| 9 | #include "core/hle/service/am/display_controller.h" | ||
| 10 | #include "core/hle/service/am/library_applet_creator.h" | ||
| 11 | #include "core/hle/service/am/library_applet_self_accessor.h" | ||
| 12 | #include "core/hle/service/am/process_winding_controller.h" | ||
| 13 | #include "core/hle/service/am/self_controller.h" | ||
| 14 | #include "core/hle/service/am/service/application_proxy.h" | ||
| 15 | #include "core/hle/service/am/window_controller.h" | ||
| 16 | #include "core/hle/service/cmif_serialization.h" | ||
| 17 | |||
| 18 | namespace Service::AM { | ||
| 19 | |||
| 20 | IApplicationProxy::IApplicationProxy(Core::System& system_, std::shared_ptr<Applet> applet, | ||
| 21 | Kernel::KProcess* process, Nvnflinger::Nvnflinger& nvnflinger) | ||
| 22 | : ServiceFramework{system_, "IApplicationProxy"}, | ||
| 23 | m_nvnflinger{nvnflinger}, m_process{process}, m_applet{std::move(applet)} { | ||
| 24 | // clang-format off | ||
| 25 | static const FunctionInfo functions[] = { | ||
| 26 | {0, D<&IApplicationProxy::GetCommonStateGetter>, "GetCommonStateGetter"}, | ||
| 27 | {1, D<&IApplicationProxy::GetSelfController>, "GetSelfController"}, | ||
| 28 | {2, D<&IApplicationProxy::GetWindowController>, "GetWindowController"}, | ||
| 29 | {3, D<&IApplicationProxy::GetAudioController>, "GetAudioController"}, | ||
| 30 | {4, D<&IApplicationProxy::GetDisplayController>, "GetDisplayController"}, | ||
| 31 | {10, D<&IApplicationProxy::GetProcessWindingController>, "GetProcessWindingController"}, | ||
| 32 | {11, D<&IApplicationProxy::GetLibraryAppletCreator>, "GetLibraryAppletCreator"}, | ||
| 33 | {20, D<&IApplicationProxy::GetApplicationFunctions>, "GetApplicationFunctions"}, | ||
| 34 | {1000, D<&IApplicationProxy::GetDebugFunctions>, "GetDebugFunctions"}, | ||
| 35 | }; | ||
| 36 | // clang-format on | ||
| 37 | |||
| 38 | RegisterHandlers(functions); | ||
| 39 | } | ||
| 40 | |||
| 41 | IApplicationProxy::~IApplicationProxy() = default; | ||
| 42 | |||
| 43 | Result IApplicationProxy::GetAudioController( | ||
| 44 | Out<SharedPointer<IAudioController>> out_audio_controller) { | ||
| 45 | LOG_DEBUG(Service_AM, "called"); | ||
| 46 | *out_audio_controller = std::make_shared<IAudioController>(system); | ||
| 47 | R_SUCCEED(); | ||
| 48 | } | ||
| 49 | |||
| 50 | Result IApplicationProxy::GetDisplayController( | ||
| 51 | Out<SharedPointer<IDisplayController>> out_display_controller) { | ||
| 52 | LOG_DEBUG(Service_AM, "called"); | ||
| 53 | *out_display_controller = std::make_shared<IDisplayController>(system, m_applet); | ||
| 54 | R_SUCCEED(); | ||
| 55 | } | ||
| 56 | |||
| 57 | Result IApplicationProxy::GetProcessWindingController( | ||
| 58 | Out<SharedPointer<IProcessWindingController>> out_process_winding_controller) { | ||
| 59 | LOG_DEBUG(Service_AM, "called"); | ||
| 60 | *out_process_winding_controller = std::make_shared<IProcessWindingController>(system, m_applet); | ||
| 61 | R_SUCCEED(); | ||
| 62 | } | ||
| 63 | |||
| 64 | Result IApplicationProxy::GetDebugFunctions( | ||
| 65 | Out<SharedPointer<IDebugFunctions>> out_debug_functions) { | ||
| 66 | LOG_DEBUG(Service_AM, "called"); | ||
| 67 | *out_debug_functions = std::make_shared<IDebugFunctions>(system); | ||
| 68 | R_SUCCEED(); | ||
| 69 | } | ||
| 70 | |||
| 71 | Result IApplicationProxy::GetWindowController( | ||
| 72 | Out<SharedPointer<IWindowController>> out_window_controller) { | ||
| 73 | LOG_DEBUG(Service_AM, "called"); | ||
| 74 | *out_window_controller = std::make_shared<IWindowController>(system, m_applet); | ||
| 75 | R_SUCCEED(); | ||
| 76 | } | ||
| 77 | |||
| 78 | Result IApplicationProxy::GetSelfController( | ||
| 79 | Out<SharedPointer<ISelfController>> out_self_controller) { | ||
| 80 | LOG_DEBUG(Service_AM, "called"); | ||
| 81 | *out_self_controller = std::make_shared<ISelfController>(system, m_applet, m_nvnflinger); | ||
| 82 | R_SUCCEED(); | ||
| 83 | } | ||
| 84 | |||
| 85 | Result IApplicationProxy::GetCommonStateGetter( | ||
| 86 | Out<SharedPointer<ICommonStateGetter>> out_common_state_getter) { | ||
| 87 | LOG_DEBUG(Service_AM, "called"); | ||
| 88 | *out_common_state_getter = std::make_shared<ICommonStateGetter>(system, m_applet); | ||
| 89 | R_SUCCEED(); | ||
| 90 | } | ||
| 91 | |||
| 92 | Result IApplicationProxy::GetLibraryAppletCreator( | ||
| 93 | Out<SharedPointer<ILibraryAppletCreator>> out_library_applet_creator) { | ||
| 94 | LOG_DEBUG(Service_AM, "called"); | ||
| 95 | *out_library_applet_creator = std::make_shared<ILibraryAppletCreator>(system, m_applet); | ||
| 96 | R_SUCCEED(); | ||
| 97 | } | ||
| 98 | |||
| 99 | Result IApplicationProxy::GetApplicationFunctions( | ||
| 100 | Out<SharedPointer<IApplicationFunctions>> out_application_functions) { | ||
| 101 | LOG_DEBUG(Service_AM, "called"); | ||
| 102 | *out_application_functions = std::make_shared<IApplicationFunctions>(system, m_applet); | ||
| 103 | R_SUCCEED(); | ||
| 104 | } | ||
| 105 | |||
| 106 | } // namespace Service::AM | ||
diff --git a/src/core/hle/service/am/service/application_proxy.h b/src/core/hle/service/am/service/application_proxy.h new file mode 100644 index 000000000..1ebc593ba --- /dev/null +++ b/src/core/hle/service/am/service/application_proxy.h | |||
| @@ -0,0 +1,48 @@ | |||
| 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 | class IAudioController; | ||
| 13 | class IApplicationFunctions; | ||
| 14 | class ICommonStateGetter; | ||
| 15 | class IDebugFunctions; | ||
| 16 | class IDisplayController; | ||
| 17 | class ILibraryAppletCreator; | ||
| 18 | class IProcessWindingController; | ||
| 19 | class ISelfController; | ||
| 20 | class IWindowController; | ||
| 21 | |||
| 22 | class IApplicationProxy final : public ServiceFramework<IApplicationProxy> { | ||
| 23 | public: | ||
| 24 | explicit IApplicationProxy(Core::System& system_, std::shared_ptr<Applet> applet, | ||
| 25 | Kernel::KProcess* process, Nvnflinger::Nvnflinger& nvnflinger); | ||
| 26 | ~IApplicationProxy(); | ||
| 27 | |||
| 28 | private: | ||
| 29 | Result GetAudioController(Out<SharedPointer<IAudioController>> out_audio_controller); | ||
| 30 | Result GetDisplayController(Out<SharedPointer<IDisplayController>> out_display_controller); | ||
| 31 | Result GetProcessWindingController( | ||
| 32 | Out<SharedPointer<IProcessWindingController>> out_process_winding_controller); | ||
| 33 | Result GetDebugFunctions(Out<SharedPointer<IDebugFunctions>> out_debug_functions); | ||
| 34 | Result GetWindowController(Out<SharedPointer<IWindowController>> out_window_controller); | ||
| 35 | Result GetSelfController(Out<SharedPointer<ISelfController>> out_self_controller); | ||
| 36 | Result GetCommonStateGetter(Out<SharedPointer<ICommonStateGetter>> out_common_state_getter); | ||
| 37 | Result GetLibraryAppletCreator( | ||
| 38 | Out<SharedPointer<ILibraryAppletCreator>> out_library_applet_creator); | ||
| 39 | Result GetApplicationFunctions( | ||
| 40 | Out<SharedPointer<IApplicationFunctions>> out_application_functions); | ||
| 41 | |||
| 42 | private: | ||
| 43 | Nvnflinger::Nvnflinger& m_nvnflinger; | ||
| 44 | Kernel::KProcess* const m_process; | ||
| 45 | const std::shared_ptr<Applet> m_applet; | ||
| 46 | }; | ||
| 47 | |||
| 48 | } // namespace Service::AM | ||
diff --git a/src/core/hle/service/am/service/application_proxy_service.cpp b/src/core/hle/service/am/service/application_proxy_service.cpp index b8532d047..36d4478df 100644 --- a/src/core/hle/service/am/service/application_proxy_service.cpp +++ b/src/core/hle/service/am/service/application_proxy_service.cpp | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | #include "core/core.h" | 4 | #include "core/core.h" |
| 5 | #include "core/hle/service/am/am.h" | 5 | #include "core/hle/service/am/am.h" |
| 6 | #include "core/hle/service/am/applet_manager.h" | 6 | #include "core/hle/service/am/applet_manager.h" |
| 7 | #include "core/hle/service/am/application_proxy.h" | 7 | #include "core/hle/service/am/service/application_proxy.h" |
| 8 | #include "core/hle/service/am/service/application_proxy_service.h" | 8 | #include "core/hle/service/am/service/application_proxy_service.h" |
| 9 | #include "core/hle/service/cmif_serialization.h" | 9 | #include "core/hle/service/cmif_serialization.h" |
| 10 | 10 | ||
| @@ -27,7 +27,8 @@ Result IApplicationProxyService::OpenApplicationProxy( | |||
| 27 | LOG_DEBUG(Service_AM, "called"); | 27 | LOG_DEBUG(Service_AM, "called"); |
| 28 | 28 | ||
| 29 | if (const auto applet = this->GetAppletFromProcessId(pid)) { | 29 | if (const auto applet = this->GetAppletFromProcessId(pid)) { |
| 30 | *out_application_proxy = std::make_shared<IApplicationProxy>(m_nvnflinger, applet, system); | 30 | *out_application_proxy = |
| 31 | std::make_shared<IApplicationProxy>(system, applet, process_handle.Get(), m_nvnflinger); | ||
| 31 | R_SUCCEED(); | 32 | R_SUCCEED(); |
| 32 | } else { | 33 | } else { |
| 33 | UNIMPLEMENTED(); | 34 | UNIMPLEMENTED(); |