summaryrefslogtreecommitdiff
path: root/src/core/hle/service/am
diff options
context:
space:
mode:
authorGravatar Liam2024-02-11 19:16:36 -0500
committerGravatar Liam2024-02-11 21:59:33 -0500
commit6fd6c65fd40d2e719cbb62b7e05468d632c04d88 (patch)
tree745b0c1be466ec1e51a29f8b2fdc706a79051b16 /src/core/hle/service/am
parentam: rewrite ILibraryAppletProxy (diff)
downloadyuzu-6fd6c65fd40d2e719cbb62b7e05468d632c04d88.tar.gz
yuzu-6fd6c65fd40d2e719cbb62b7e05468d632c04d88.tar.xz
yuzu-6fd6c65fd40d2e719cbb62b7e05468d632c04d88.zip
am: rewrite ISystemAppletProxy
Diffstat (limited to 'src/core/hle/service/am')
-rw-r--r--src/core/hle/service/am/service/all_system_applet_proxies_service.cpp6
-rw-r--r--src/core/hle/service/am/service/system_applet_proxy.cpp132
-rw-r--r--src/core/hle/service/am/service/system_applet_proxy.h54
-rw-r--r--src/core/hle/service/am/system_applet_proxy.cpp136
-rw-r--r--src/core/hle/service/am/system_applet_proxy.h36
5 files changed, 189 insertions, 175 deletions
diff --git a/src/core/hle/service/am/service/all_system_applet_proxies_service.cpp b/src/core/hle/service/am/service/all_system_applet_proxies_service.cpp
index dfefc9310..eebd90ba2 100644
--- a/src/core/hle/service/am/service/all_system_applet_proxies_service.cpp
+++ b/src/core/hle/service/am/service/all_system_applet_proxies_service.cpp
@@ -5,7 +5,7 @@
5#include "core/hle/service/am/applet_manager.h" 5#include "core/hle/service/am/applet_manager.h"
6#include "core/hle/service/am/service/all_system_applet_proxies_service.h" 6#include "core/hle/service/am/service/all_system_applet_proxies_service.h"
7#include "core/hle/service/am/service/library_applet_proxy.h" 7#include "core/hle/service/am/service/library_applet_proxy.h"
8#include "core/hle/service/am/system_applet_proxy.h" 8#include "core/hle/service/am/service/system_applet_proxy.h"
9#include "core/hle/service/cmif_serialization.h" 9#include "core/hle/service/cmif_serialization.h"
10 10
11namespace Service::AM { 11namespace Service::AM {
@@ -37,8 +37,8 @@ Result IAllSystemAppletProxiesService::OpenSystemAppletProxy(
37 LOG_DEBUG(Service_AM, "called"); 37 LOG_DEBUG(Service_AM, "called");
38 38
39 if (const auto applet = this->GetAppletFromProcessId(pid); applet) { 39 if (const auto applet = this->GetAppletFromProcessId(pid); applet) {
40 *out_system_applet_proxy = 40 *out_system_applet_proxy = std::make_shared<ISystemAppletProxy>(
41 std::make_shared<ISystemAppletProxy>(m_nvnflinger, applet, system); 41 system, applet, process_handle.Get(), m_nvnflinger);
42 R_SUCCEED(); 42 R_SUCCEED();
43 } else { 43 } else {
44 UNIMPLEMENTED(); 44 UNIMPLEMENTED();
diff --git a/src/core/hle/service/am/service/system_applet_proxy.cpp b/src/core/hle/service/am/service/system_applet_proxy.cpp
new file mode 100644
index 000000000..0a69d1502
--- /dev/null
+++ b/src/core/hle/service/am/service/system_applet_proxy.cpp
@@ -0,0 +1,132 @@
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_creator.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/global_state_controller.h"
11#include "core/hle/service/am/home_menu_functions.h"
12#include "core/hle/service/am/library_applet_creator.h"
13#include "core/hle/service/am/library_applet_self_accessor.h"
14#include "core/hle/service/am/process_winding_controller.h"
15#include "core/hle/service/am/self_controller.h"
16#include "core/hle/service/am/service/system_applet_proxy.h"
17#include "core/hle/service/am/window_controller.h"
18#include "core/hle/service/cmif_serialization.h"
19
20namespace Service::AM {
21
22ISystemAppletProxy::ISystemAppletProxy(Core::System& system_, std::shared_ptr<Applet> applet,
23 Kernel::KProcess* process,
24 Nvnflinger::Nvnflinger& nvnflinger)
25 : ServiceFramework{system_, "ISystemAppletProxy"},
26 m_nvnflinger{nvnflinger}, m_process{process}, m_applet{std::move(applet)} {
27 // clang-format off
28 static const FunctionInfo functions[] = {
29 {0, D<&ISystemAppletProxy::GetCommonStateGetter>, "GetCommonStateGetter"},
30 {1, D<&ISystemAppletProxy::GetSelfController>, "GetSelfController"},
31 {2, D<&ISystemAppletProxy::GetWindowController>, "GetWindowController"},
32 {3, D<&ISystemAppletProxy::GetAudioController>, "GetAudioController"},
33 {4, D<&ISystemAppletProxy::GetDisplayController>, "GetDisplayController"},
34 {10, D<&ISystemAppletProxy::GetProcessWindingController>, "GetProcessWindingController"},
35 {11, D<&ISystemAppletProxy::GetLibraryAppletCreator>, "GetLibraryAppletCreator"},
36 {20, D<&ISystemAppletProxy::GetHomeMenuFunctions>, "GetHomeMenuFunctions"},
37 {21, D<&ISystemAppletProxy::GetGlobalStateController>, "GetGlobalStateController"},
38 {22, D<&ISystemAppletProxy::GetApplicationCreator>, "GetApplicationCreator"},
39 {23, D<&ISystemAppletProxy::GetAppletCommonFunctions>, "GetAppletCommonFunctions"},
40 {1000, D<&ISystemAppletProxy::GetDebugFunctions>, "GetDebugFunctions"},
41 };
42 // clang-format on
43
44 RegisterHandlers(functions);
45}
46
47ISystemAppletProxy::~ISystemAppletProxy() = default;
48
49Result ISystemAppletProxy::GetAudioController(
50 Out<SharedPointer<IAudioController>> out_audio_controller) {
51 LOG_DEBUG(Service_AM, "called");
52 *out_audio_controller = std::make_shared<IAudioController>(system);
53 R_SUCCEED();
54}
55
56Result ISystemAppletProxy::GetDisplayController(
57 Out<SharedPointer<IDisplayController>> out_display_controller) {
58 LOG_DEBUG(Service_AM, "called");
59 *out_display_controller = std::make_shared<IDisplayController>(system, m_applet);
60 R_SUCCEED();
61}
62
63Result ISystemAppletProxy::GetProcessWindingController(
64 Out<SharedPointer<IProcessWindingController>> out_process_winding_controller) {
65 LOG_DEBUG(Service_AM, "called");
66 *out_process_winding_controller = std::make_shared<IProcessWindingController>(system, m_applet);
67 R_SUCCEED();
68}
69
70Result ISystemAppletProxy::GetDebugFunctions(
71 Out<SharedPointer<IDebugFunctions>> out_debug_functions) {
72 LOG_DEBUG(Service_AM, "called");
73 *out_debug_functions = std::make_shared<IDebugFunctions>(system);
74 R_SUCCEED();
75}
76
77Result ISystemAppletProxy::GetWindowController(
78 Out<SharedPointer<IWindowController>> out_window_controller) {
79 LOG_DEBUG(Service_AM, "called");
80 *out_window_controller = std::make_shared<IWindowController>(system, m_applet);
81 R_SUCCEED();
82}
83
84Result ISystemAppletProxy::GetSelfController(
85 Out<SharedPointer<ISelfController>> out_self_controller) {
86 LOG_DEBUG(Service_AM, "called");
87 *out_self_controller = std::make_shared<ISelfController>(system, m_applet, m_nvnflinger);
88 R_SUCCEED();
89}
90
91Result ISystemAppletProxy::GetCommonStateGetter(
92 Out<SharedPointer<ICommonStateGetter>> out_common_state_getter) {
93 LOG_DEBUG(Service_AM, "called");
94 *out_common_state_getter = std::make_shared<ICommonStateGetter>(system, m_applet);
95 R_SUCCEED();
96}
97
98Result ISystemAppletProxy::GetLibraryAppletCreator(
99 Out<SharedPointer<ILibraryAppletCreator>> out_library_applet_creator) {
100 LOG_DEBUG(Service_AM, "called");
101 *out_library_applet_creator = std::make_shared<ILibraryAppletCreator>(system, m_applet);
102 R_SUCCEED();
103}
104
105Result ISystemAppletProxy::GetApplicationCreator(
106 Out<SharedPointer<IApplicationCreator>> out_application_creator) {
107 LOG_ERROR(Service_AM, "called");
108 R_THROW(ResultUnknown);
109}
110
111Result ISystemAppletProxy::GetAppletCommonFunctions(
112 Out<SharedPointer<IAppletCommonFunctions>> out_applet_common_functions) {
113 LOG_DEBUG(Service_AM, "called");
114 *out_applet_common_functions = std::make_shared<IAppletCommonFunctions>(system, m_applet);
115 R_SUCCEED();
116}
117
118Result ISystemAppletProxy::GetHomeMenuFunctions(
119 Out<SharedPointer<IHomeMenuFunctions>> out_home_menu_functions) {
120 LOG_DEBUG(Service_AM, "called");
121 *out_home_menu_functions = std::make_shared<IHomeMenuFunctions>(system);
122 R_SUCCEED();
123}
124
125Result ISystemAppletProxy::GetGlobalStateController(
126 Out<SharedPointer<IGlobalStateController>> out_global_state_controller) {
127 LOG_DEBUG(Service_AM, "called");
128 *out_global_state_controller = std::make_shared<IGlobalStateController>(system);
129 R_SUCCEED();
130}
131
132} // namespace Service::AM
diff --git a/src/core/hle/service/am/service/system_applet_proxy.h b/src/core/hle/service/am/service/system_applet_proxy.h
new file mode 100644
index 000000000..3d5040315
--- /dev/null
+++ b/src/core/hle/service/am/service/system_applet_proxy.h
@@ -0,0 +1,54 @@
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
9namespace Service::AM {
10
11struct Applet;
12class IAppletCommonFunctions;
13class IApplicationCreator;
14class IAudioController;
15class ICommonStateGetter;
16class IDebugFunctions;
17class IDisplayController;
18class IHomeMenuFunctions;
19class IGlobalStateController;
20class ILibraryAppletCreator;
21class IProcessWindingController;
22class ISelfController;
23class IWindowController;
24
25class ISystemAppletProxy final : public ServiceFramework<ISystemAppletProxy> {
26public:
27 explicit ISystemAppletProxy(Core::System& system, std::shared_ptr<Applet> applet,
28 Kernel::KProcess* process, Nvnflinger::Nvnflinger& nvnflinger);
29 ~ISystemAppletProxy();
30
31private:
32 Result GetAudioController(Out<SharedPointer<IAudioController>> out_audio_controller);
33 Result GetDisplayController(Out<SharedPointer<IDisplayController>> out_display_controller);
34 Result GetProcessWindingController(
35 Out<SharedPointer<IProcessWindingController>> out_process_winding_controller);
36 Result GetDebugFunctions(Out<SharedPointer<IDebugFunctions>> out_debug_functions);
37 Result GetWindowController(Out<SharedPointer<IWindowController>> out_window_controller);
38 Result GetSelfController(Out<SharedPointer<ISelfController>> out_self_controller);
39 Result GetCommonStateGetter(Out<SharedPointer<ICommonStateGetter>> out_common_state_getter);
40 Result GetLibraryAppletCreator(
41 Out<SharedPointer<ILibraryAppletCreator>> out_library_applet_creator);
42 Result GetApplicationCreator(Out<SharedPointer<IApplicationCreator>> out_application_creator);
43 Result GetAppletCommonFunctions(
44 Out<SharedPointer<IAppletCommonFunctions>> out_applet_common_functions);
45 Result GetHomeMenuFunctions(Out<SharedPointer<IHomeMenuFunctions>> out_home_menu_functions);
46 Result GetGlobalStateController(
47 Out<SharedPointer<IGlobalStateController>> out_global_state_controller);
48
49 Nvnflinger::Nvnflinger& m_nvnflinger;
50 Kernel::KProcess* const m_process;
51 const std::shared_ptr<Applet> m_applet;
52};
53
54} // namespace Service::AM
diff --git a/src/core/hle/service/am/system_applet_proxy.cpp b/src/core/hle/service/am/system_applet_proxy.cpp
deleted file mode 100644
index 38643408e..000000000
--- a/src/core/hle/service/am/system_applet_proxy.cpp
+++ /dev/null
@@ -1,136 +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_creator.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/global_state_controller.h"
11#include "core/hle/service/am/home_menu_functions.h"
12#include "core/hle/service/am/library_applet_creator.h"
13#include "core/hle/service/am/library_applet_self_accessor.h"
14#include "core/hle/service/am/process_winding_controller.h"
15#include "core/hle/service/am/self_controller.h"
16#include "core/hle/service/am/system_applet_proxy.h"
17#include "core/hle/service/am/window_controller.h"
18#include "core/hle/service/ipc_helpers.h"
19
20namespace Service::AM {
21
22ISystemAppletProxy::ISystemAppletProxy(Nvnflinger::Nvnflinger& nvnflinger_,
23 std::shared_ptr<Applet> applet_, Core::System& system_)
24 : ServiceFramework{system_, "ISystemAppletProxy"}, nvnflinger{nvnflinger_}, applet{std::move(
25 applet_)} {
26 // clang-format off
27 static const FunctionInfo functions[] = {
28 {0, &ISystemAppletProxy::GetCommonStateGetter, "GetCommonStateGetter"},
29 {1, &ISystemAppletProxy::GetSelfController, "GetSelfController"},
30 {2, &ISystemAppletProxy::GetWindowController, "GetWindowController"},
31 {3, &ISystemAppletProxy::GetAudioController, "GetAudioController"},
32 {4, &ISystemAppletProxy::GetDisplayController, "GetDisplayController"},
33 {10, nullptr, "GetProcessWindingController"},
34 {11, &ISystemAppletProxy::GetLibraryAppletCreator, "GetLibraryAppletCreator"},
35 {20, &ISystemAppletProxy::GetHomeMenuFunctions, "GetHomeMenuFunctions"},
36 {21, &ISystemAppletProxy::GetGlobalStateController, "GetGlobalStateController"},
37 {22, &ISystemAppletProxy::GetApplicationCreator, "GetApplicationCreator"},
38 {23, &ISystemAppletProxy::GetAppletCommonFunctions, "GetAppletCommonFunctions"},
39 {1000, &ISystemAppletProxy::GetDebugFunctions, "GetDebugFunctions"},
40 };
41 // clang-format on
42
43 RegisterHandlers(functions);
44}
45
46ISystemAppletProxy::~ISystemAppletProxy() = default;
47
48void ISystemAppletProxy::GetCommonStateGetter(HLERequestContext& ctx) {
49 LOG_DEBUG(Service_AM, "called");
50
51 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
52 rb.Push(ResultSuccess);
53 rb.PushIpcInterface<ICommonStateGetter>(system, applet);
54}
55
56void ISystemAppletProxy::GetSelfController(HLERequestContext& ctx) {
57 LOG_DEBUG(Service_AM, "called");
58
59 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
60 rb.Push(ResultSuccess);
61 rb.PushIpcInterface<ISelfController>(system, applet, nvnflinger);
62}
63
64void ISystemAppletProxy::GetWindowController(HLERequestContext& ctx) {
65 LOG_DEBUG(Service_AM, "called");
66
67 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
68 rb.Push(ResultSuccess);
69 rb.PushIpcInterface<IWindowController>(system, applet);
70}
71
72void ISystemAppletProxy::GetAudioController(HLERequestContext& ctx) {
73 LOG_DEBUG(Service_AM, "called");
74
75 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
76 rb.Push(ResultSuccess);
77 rb.PushIpcInterface<IAudioController>(system);
78}
79
80void ISystemAppletProxy::GetDisplayController(HLERequestContext& ctx) {
81 LOG_DEBUG(Service_AM, "called");
82
83 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
84 rb.Push(ResultSuccess);
85 rb.PushIpcInterface<IDisplayController>(system, applet);
86}
87
88void ISystemAppletProxy::GetLibraryAppletCreator(HLERequestContext& ctx) {
89 LOG_DEBUG(Service_AM, "called");
90
91 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
92 rb.Push(ResultSuccess);
93 rb.PushIpcInterface<ILibraryAppletCreator>(system, applet);
94}
95
96void ISystemAppletProxy::GetHomeMenuFunctions(HLERequestContext& ctx) {
97 LOG_DEBUG(Service_AM, "called");
98
99 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
100 rb.Push(ResultSuccess);
101 rb.PushIpcInterface<IHomeMenuFunctions>(system);
102}
103
104void ISystemAppletProxy::GetGlobalStateController(HLERequestContext& ctx) {
105 LOG_DEBUG(Service_AM, "called");
106
107 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
108 rb.Push(ResultSuccess);
109 rb.PushIpcInterface<IGlobalStateController>(system);
110}
111
112void ISystemAppletProxy::GetApplicationCreator(HLERequestContext& ctx) {
113 LOG_DEBUG(Service_AM, "called");
114
115 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
116 rb.Push(ResultSuccess);
117 rb.PushIpcInterface<IApplicationCreator>(system);
118}
119
120void ISystemAppletProxy::GetAppletCommonFunctions(HLERequestContext& ctx) {
121 LOG_DEBUG(Service_AM, "called");
122
123 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
124 rb.Push(ResultSuccess);
125 rb.PushIpcInterface<IAppletCommonFunctions>(system, applet);
126}
127
128void ISystemAppletProxy::GetDebugFunctions(HLERequestContext& ctx) {
129 LOG_DEBUG(Service_AM, "called");
130
131 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
132 rb.Push(ResultSuccess);
133 rb.PushIpcInterface<IDebugFunctions>(system);
134}
135
136} // namespace Service::AM
diff --git a/src/core/hle/service/am/system_applet_proxy.h b/src/core/hle/service/am/system_applet_proxy.h
deleted file mode 100644
index 0390cd1e5..000000000
--- a/src/core/hle/service/am/system_applet_proxy.h
+++ /dev/null
@@ -1,36 +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/am/applet_message_queue.h"
7#include "core/hle/service/service.h"
8
9namespace Service::AM {
10
11struct Applet;
12
13class ISystemAppletProxy final : public ServiceFramework<ISystemAppletProxy> {
14public:
15 explicit ISystemAppletProxy(Nvnflinger::Nvnflinger& nvnflinger_,
16 std::shared_ptr<Applet> applet_, Core::System& system_);
17 ~ISystemAppletProxy();
18
19private:
20 void GetCommonStateGetter(HLERequestContext& ctx);
21 void GetSelfController(HLERequestContext& ctx);
22 void GetWindowController(HLERequestContext& ctx);
23 void GetAudioController(HLERequestContext& ctx);
24 void GetDisplayController(HLERequestContext& ctx);
25 void GetLibraryAppletCreator(HLERequestContext& ctx);
26 void GetHomeMenuFunctions(HLERequestContext& ctx);
27 void GetGlobalStateController(HLERequestContext& ctx);
28 void GetApplicationCreator(HLERequestContext& ctx);
29 void GetAppletCommonFunctions(HLERequestContext& ctx);
30 void GetDebugFunctions(HLERequestContext& ctx);
31
32 Nvnflinger::Nvnflinger& nvnflinger;
33 std::shared_ptr<Applet> applet;
34};
35
36} // namespace Service::AM