summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Liam2024-02-11 19:09:49 -0500
committerGravatar Liam2024-02-11 21:59:33 -0500
commitc809f7193aa91a746503f92248652865172b36fb (patch)
tree58f9ae38be8a065a903509f555c08e010797dd9a
parentam: rewrite IApplicationProxy (diff)
downloadyuzu-c809f7193aa91a746503f92248652865172b36fb.tar.gz
yuzu-c809f7193aa91a746503f92248652865172b36fb.tar.xz
yuzu-c809f7193aa91a746503f92248652865172b36fb.zip
am: rewrite ILibraryAppletProxy
-rw-r--r--src/core/CMakeLists.txt4
-rw-r--r--src/core/hle/service/am/library_applet_proxy.cpp143
-rw-r--r--src/core/hle/service/am/library_applet_proxy.h36
-rw-r--r--src/core/hle/service/am/service/all_system_applet_proxies_service.cpp6
-rw-r--r--src/core/hle/service/am/service/library_applet_proxy.cpp133
-rw-r--r--src/core/hle/service/am/service/library_applet_proxy.h55
6 files changed, 193 insertions, 184 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index e2486f2cd..8fd62e45e 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -449,8 +449,6 @@ add_library(core STATIC
449 hle/service/am/library_applet_accessor.h 449 hle/service/am/library_applet_accessor.h
450 hle/service/am/library_applet_creator.cpp 450 hle/service/am/library_applet_creator.cpp
451 hle/service/am/library_applet_creator.h 451 hle/service/am/library_applet_creator.h
452 hle/service/am/library_applet_proxy.cpp
453 hle/service/am/library_applet_proxy.h
454 hle/service/am/library_applet_self_accessor.cpp 452 hle/service/am/library_applet_self_accessor.cpp
455 hle/service/am/library_applet_self_accessor.h 453 hle/service/am/library_applet_self_accessor.h
456 hle/service/am/library_applet_storage.cpp 454 hle/service/am/library_applet_storage.cpp
@@ -473,6 +471,8 @@ add_library(core STATIC
473 hle/service/am/service/application_proxy_service.h 471 hle/service/am/service/application_proxy_service.h
474 hle/service/am/service/application_proxy.cpp 472 hle/service/am/service/application_proxy.cpp
475 hle/service/am/service/application_proxy.h 473 hle/service/am/service/application_proxy.h
474 hle/service/am/service/library_applet_proxy.cpp
475 hle/service/am/service/library_applet_proxy.h
476 hle/service/am/system_applet_proxy.cpp 476 hle/service/am/system_applet_proxy.cpp
477 hle/service/am/system_applet_proxy.h 477 hle/service/am/system_applet_proxy.h
478 hle/service/am/system_buffer_manager.cpp 478 hle/service/am/system_buffer_manager.cpp
diff --git a/src/core/hle/service/am/library_applet_proxy.cpp b/src/core/hle/service/am/library_applet_proxy.cpp
deleted file mode 100644
index d6108fba3..000000000
--- a/src/core/hle/service/am/library_applet_proxy.cpp
+++ /dev/null
@@ -1,143 +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/audio_controller.h"
6#include "core/hle/service/am/common_state_getter.h"
7#include "core/hle/service/am/debug_functions.h"
8#include "core/hle/service/am/display_controller.h"
9#include "core/hle/service/am/global_state_controller.h"
10#include "core/hle/service/am/home_menu_functions.h"
11#include "core/hle/service/am/library_applet_creator.h"
12#include "core/hle/service/am/library_applet_proxy.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/window_controller.h"
17#include "core/hle/service/ipc_helpers.h"
18
19namespace Service::AM {
20
21ILibraryAppletProxy::ILibraryAppletProxy(Nvnflinger::Nvnflinger& nvnflinger_,
22 std::shared_ptr<Applet> applet_, Core::System& system_)
23 : ServiceFramework{system_, "ILibraryAppletProxy"}, nvnflinger{nvnflinger_}, applet{std::move(
24 applet_)} {
25 // clang-format off
26 static const FunctionInfo functions[] = {
27 {0, &ILibraryAppletProxy::GetCommonStateGetter, "GetCommonStateGetter"},
28 {1, &ILibraryAppletProxy::GetSelfController, "GetSelfController"},
29 {2, &ILibraryAppletProxy::GetWindowController, "GetWindowController"},
30 {3, &ILibraryAppletProxy::GetAudioController, "GetAudioController"},
31 {4, &ILibraryAppletProxy::GetDisplayController, "GetDisplayController"},
32 {10, &ILibraryAppletProxy::GetProcessWindingController, "GetProcessWindingController"},
33 {11, &ILibraryAppletProxy::GetLibraryAppletCreator, "GetLibraryAppletCreator"},
34 {20, &ILibraryAppletProxy::OpenLibraryAppletSelfAccessor, "OpenLibraryAppletSelfAccessor"},
35 {21, &ILibraryAppletProxy::GetAppletCommonFunctions, "GetAppletCommonFunctions"},
36 {22, &ILibraryAppletProxy::GetHomeMenuFunctions, "GetHomeMenuFunctions"},
37 {23, &ILibraryAppletProxy::GetGlobalStateController, "GetGlobalStateController"},
38 {1000, &ILibraryAppletProxy::GetDebugFunctions, "GetDebugFunctions"},
39 };
40 // clang-format on
41
42 RegisterHandlers(functions);
43}
44
45ILibraryAppletProxy::~ILibraryAppletProxy() = default;
46
47void ILibraryAppletProxy::GetCommonStateGetter(HLERequestContext& ctx) {
48 LOG_DEBUG(Service_AM, "called");
49
50 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
51 rb.Push(ResultSuccess);
52 rb.PushIpcInterface<ICommonStateGetter>(system, applet);
53}
54
55void ILibraryAppletProxy::GetSelfController(HLERequestContext& ctx) {
56 LOG_DEBUG(Service_AM, "called");
57
58 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
59 rb.Push(ResultSuccess);
60 rb.PushIpcInterface<ISelfController>(system, applet, nvnflinger);
61}
62
63void ILibraryAppletProxy::GetWindowController(HLERequestContext& ctx) {
64 LOG_DEBUG(Service_AM, "called");
65
66 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
67 rb.Push(ResultSuccess);
68 rb.PushIpcInterface<IWindowController>(system, applet);
69}
70
71void ILibraryAppletProxy::GetAudioController(HLERequestContext& ctx) {
72 LOG_DEBUG(Service_AM, "called");
73
74 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
75 rb.Push(ResultSuccess);
76 rb.PushIpcInterface<IAudioController>(system);
77}
78
79void ILibraryAppletProxy::GetDisplayController(HLERequestContext& ctx) {
80 LOG_DEBUG(Service_AM, "called");
81
82 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
83 rb.Push(ResultSuccess);
84 rb.PushIpcInterface<IDisplayController>(system, applet);
85}
86
87void ILibraryAppletProxy::GetProcessWindingController(HLERequestContext& ctx) {
88 LOG_DEBUG(Service_AM, "called");
89
90 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
91 rb.Push(ResultSuccess);
92 rb.PushIpcInterface<IProcessWindingController>(system, applet);
93}
94
95void ILibraryAppletProxy::GetLibraryAppletCreator(HLERequestContext& ctx) {
96 LOG_DEBUG(Service_AM, "called");
97
98 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
99 rb.Push(ResultSuccess);
100 rb.PushIpcInterface<ILibraryAppletCreator>(system, applet);
101}
102
103void ILibraryAppletProxy::OpenLibraryAppletSelfAccessor(HLERequestContext& ctx) {
104 LOG_DEBUG(Service_AM, "called");
105
106 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
107 rb.Push(ResultSuccess);
108 rb.PushIpcInterface<ILibraryAppletSelfAccessor>(system, applet);
109}
110
111void ILibraryAppletProxy::GetAppletCommonFunctions(HLERequestContext& ctx) {
112 LOG_DEBUG(Service_AM, "called");
113
114 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
115 rb.Push(ResultSuccess);
116 rb.PushIpcInterface<IAppletCommonFunctions>(system, applet);
117}
118
119void ILibraryAppletProxy::GetHomeMenuFunctions(HLERequestContext& ctx) {
120 LOG_DEBUG(Service_AM, "called");
121
122 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
123 rb.Push(ResultSuccess);
124 rb.PushIpcInterface<IHomeMenuFunctions>(system);
125}
126
127void ILibraryAppletProxy::GetGlobalStateController(HLERequestContext& ctx) {
128 LOG_DEBUG(Service_AM, "called");
129
130 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
131 rb.Push(ResultSuccess);
132 rb.PushIpcInterface<IGlobalStateController>(system);
133}
134
135void ILibraryAppletProxy::GetDebugFunctions(HLERequestContext& ctx) {
136 LOG_DEBUG(Service_AM, "called");
137
138 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
139 rb.Push(ResultSuccess);
140 rb.PushIpcInterface<IDebugFunctions>(system);
141}
142
143} // namespace Service::AM
diff --git a/src/core/hle/service/am/library_applet_proxy.h b/src/core/hle/service/am/library_applet_proxy.h
deleted file mode 100644
index 8f7a25897..000000000
--- a/src/core/hle/service/am/library_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/service.h"
7
8namespace Service::AM {
9
10struct Applet;
11
12class ILibraryAppletProxy final : public ServiceFramework<ILibraryAppletProxy> {
13public:
14 explicit ILibraryAppletProxy(Nvnflinger::Nvnflinger& nvnflinger_,
15 std::shared_ptr<Applet> applet_, Core::System& system_);
16 ~ILibraryAppletProxy();
17
18private:
19 void GetCommonStateGetter(HLERequestContext& ctx);
20 void GetSelfController(HLERequestContext& ctx);
21 void GetWindowController(HLERequestContext& ctx);
22 void GetAudioController(HLERequestContext& ctx);
23 void GetDisplayController(HLERequestContext& ctx);
24 void GetProcessWindingController(HLERequestContext& ctx);
25 void GetLibraryAppletCreator(HLERequestContext& ctx);
26 void OpenLibraryAppletSelfAccessor(HLERequestContext& ctx);
27 void GetAppletCommonFunctions(HLERequestContext& ctx);
28 void GetHomeMenuFunctions(HLERequestContext& ctx);
29 void GetGlobalStateController(HLERequestContext& ctx);
30 void GetDebugFunctions(HLERequestContext& ctx);
31
32 Nvnflinger::Nvnflinger& nvnflinger;
33 std::shared_ptr<Applet> applet;
34};
35
36} // namespace Service::AM
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 66c23a749..dfefc9310 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
@@ -3,8 +3,8 @@
3 3
4#include "core/core.h" 4#include "core/core.h"
5#include "core/hle/service/am/applet_manager.h" 5#include "core/hle/service/am/applet_manager.h"
6#include "core/hle/service/am/library_applet_proxy.h"
7#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"
8#include "core/hle/service/am/system_applet_proxy.h" 8#include "core/hle/service/am/system_applet_proxy.h"
9#include "core/hle/service/cmif_serialization.h" 9#include "core/hle/service/cmif_serialization.h"
10 10
@@ -53,8 +53,8 @@ Result IAllSystemAppletProxiesService::OpenLibraryAppletProxy(
53 LOG_DEBUG(Service_AM, "called"); 53 LOG_DEBUG(Service_AM, "called");
54 54
55 if (const auto applet = this->GetAppletFromProcessId(pid); applet) { 55 if (const auto applet = this->GetAppletFromProcessId(pid); applet) {
56 *out_library_applet_proxy = 56 *out_library_applet_proxy = std::make_shared<ILibraryAppletProxy>(
57 std::make_shared<ILibraryAppletProxy>(m_nvnflinger, applet, system); 57 system, applet, process_handle.Get(), m_nvnflinger);
58 R_SUCCEED(); 58 R_SUCCEED();
59 } else { 59 } else {
60 UNIMPLEMENTED(); 60 UNIMPLEMENTED();
diff --git a/src/core/hle/service/am/service/library_applet_proxy.cpp b/src/core/hle/service/am/service/library_applet_proxy.cpp
new file mode 100644
index 000000000..9a0d363ac
--- /dev/null
+++ b/src/core/hle/service/am/service/library_applet_proxy.cpp
@@ -0,0 +1,133 @@
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/audio_controller.h"
6#include "core/hle/service/am/common_state_getter.h"
7#include "core/hle/service/am/debug_functions.h"
8#include "core/hle/service/am/display_controller.h"
9#include "core/hle/service/am/global_state_controller.h"
10#include "core/hle/service/am/home_menu_functions.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/service/library_applet_proxy.h"
16#include "core/hle/service/am/window_controller.h"
17#include "core/hle/service/cmif_serialization.h"
18
19namespace Service::AM {
20
21ILibraryAppletProxy::ILibraryAppletProxy(Core::System& system_, std::shared_ptr<Applet> applet,
22 Kernel::KProcess* process,
23 Nvnflinger::Nvnflinger& nvnflinger)
24 : ServiceFramework{system_, "ILibraryAppletProxy"},
25 m_nvnflinger{nvnflinger}, m_process{process}, m_applet{std::move(applet)} {
26 // clang-format off
27 static const FunctionInfo functions[] = {
28 {0, D<&ILibraryAppletProxy::GetCommonStateGetter>, "GetCommonStateGetter"},
29 {1, D<&ILibraryAppletProxy::GetSelfController>, "GetSelfController"},
30 {2, D<&ILibraryAppletProxy::GetWindowController>, "GetWindowController"},
31 {3, D<&ILibraryAppletProxy::GetAudioController>, "GetAudioController"},
32 {4, D<&ILibraryAppletProxy::GetDisplayController>, "GetDisplayController"},
33 {10, D<&ILibraryAppletProxy::GetProcessWindingController>, "GetProcessWindingController"},
34 {11, D<&ILibraryAppletProxy::GetLibraryAppletCreator>, "GetLibraryAppletCreator"},
35 {20, D<&ILibraryAppletProxy::OpenLibraryAppletSelfAccessor>, "OpenLibraryAppletSelfAccessor"},
36 {21, D<&ILibraryAppletProxy::GetAppletCommonFunctions>, "GetAppletCommonFunctions"},
37 {22, D<&ILibraryAppletProxy::GetHomeMenuFunctions>, "GetHomeMenuFunctions"},
38 {23, D<&ILibraryAppletProxy::GetGlobalStateController>, "GetGlobalStateController"},
39 {1000, D<&ILibraryAppletProxy::GetDebugFunctions>, "GetDebugFunctions"},
40 };
41 // clang-format on
42
43 RegisterHandlers(functions);
44}
45
46ILibraryAppletProxy::~ILibraryAppletProxy() = default;
47
48Result ILibraryAppletProxy::GetAudioController(
49 Out<SharedPointer<IAudioController>> out_audio_controller) {
50 LOG_DEBUG(Service_AM, "called");
51 *out_audio_controller = std::make_shared<IAudioController>(system);
52 R_SUCCEED();
53}
54
55Result ILibraryAppletProxy::GetDisplayController(
56 Out<SharedPointer<IDisplayController>> out_display_controller) {
57 LOG_DEBUG(Service_AM, "called");
58 *out_display_controller = std::make_shared<IDisplayController>(system, m_applet);
59 R_SUCCEED();
60}
61
62Result ILibraryAppletProxy::GetProcessWindingController(
63 Out<SharedPointer<IProcessWindingController>> out_process_winding_controller) {
64 LOG_DEBUG(Service_AM, "called");
65 *out_process_winding_controller = std::make_shared<IProcessWindingController>(system, m_applet);
66 R_SUCCEED();
67}
68
69Result ILibraryAppletProxy::GetDebugFunctions(
70 Out<SharedPointer<IDebugFunctions>> out_debug_functions) {
71 LOG_DEBUG(Service_AM, "called");
72 *out_debug_functions = std::make_shared<IDebugFunctions>(system);
73 R_SUCCEED();
74}
75
76Result ILibraryAppletProxy::GetWindowController(
77 Out<SharedPointer<IWindowController>> out_window_controller) {
78 LOG_DEBUG(Service_AM, "called");
79 *out_window_controller = std::make_shared<IWindowController>(system, m_applet);
80 R_SUCCEED();
81}
82
83Result ILibraryAppletProxy::GetSelfController(
84 Out<SharedPointer<ISelfController>> out_self_controller) {
85 LOG_DEBUG(Service_AM, "called");
86 *out_self_controller = std::make_shared<ISelfController>(system, m_applet, m_nvnflinger);
87 R_SUCCEED();
88}
89
90Result ILibraryAppletProxy::GetCommonStateGetter(
91 Out<SharedPointer<ICommonStateGetter>> out_common_state_getter) {
92 LOG_DEBUG(Service_AM, "called");
93 *out_common_state_getter = std::make_shared<ICommonStateGetter>(system, m_applet);
94 R_SUCCEED();
95}
96
97Result ILibraryAppletProxy::GetLibraryAppletCreator(
98 Out<SharedPointer<ILibraryAppletCreator>> out_library_applet_creator) {
99 LOG_DEBUG(Service_AM, "called");
100 *out_library_applet_creator = std::make_shared<ILibraryAppletCreator>(system, m_applet);
101 R_SUCCEED();
102}
103
104Result ILibraryAppletProxy::OpenLibraryAppletSelfAccessor(
105 Out<SharedPointer<ILibraryAppletSelfAccessor>> out_library_applet_self_accessor) {
106 LOG_DEBUG(Service_AM, "called");
107 *out_library_applet_self_accessor =
108 std::make_shared<ILibraryAppletSelfAccessor>(system, m_applet);
109 R_SUCCEED();
110}
111
112Result ILibraryAppletProxy::GetAppletCommonFunctions(
113 Out<SharedPointer<IAppletCommonFunctions>> out_applet_common_functions) {
114 LOG_DEBUG(Service_AM, "called");
115 *out_applet_common_functions = std::make_shared<IAppletCommonFunctions>(system, m_applet);
116 R_SUCCEED();
117}
118
119Result ILibraryAppletProxy::GetHomeMenuFunctions(
120 Out<SharedPointer<IHomeMenuFunctions>> out_home_menu_functions) {
121 LOG_DEBUG(Service_AM, "called");
122 *out_home_menu_functions = std::make_shared<IHomeMenuFunctions>(system);
123 R_SUCCEED();
124}
125
126Result ILibraryAppletProxy::GetGlobalStateController(
127 Out<SharedPointer<IGlobalStateController>> out_global_state_controller) {
128 LOG_DEBUG(Service_AM, "called");
129 *out_global_state_controller = std::make_shared<IGlobalStateController>(system);
130 R_SUCCEED();
131}
132
133} // namespace Service::AM
diff --git a/src/core/hle/service/am/service/library_applet_proxy.h b/src/core/hle/service/am/service/library_applet_proxy.h
new file mode 100644
index 000000000..23e64e295
--- /dev/null
+++ b/src/core/hle/service/am/service/library_applet_proxy.h
@@ -0,0 +1,55 @@
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 IAudioController;
14class ICommonStateGetter;
15class IDebugFunctions;
16class IDisplayController;
17class IHomeMenuFunctions;
18class IGlobalStateController;
19class ILibraryAppletCreator;
20class ILibraryAppletSelfAccessor;
21class IProcessWindingController;
22class ISelfController;
23class IWindowController;
24
25class ILibraryAppletProxy final : public ServiceFramework<ILibraryAppletProxy> {
26public:
27 explicit ILibraryAppletProxy(Core::System& system_, std::shared_ptr<Applet> applet,
28 Kernel::KProcess* process, Nvnflinger::Nvnflinger& nvnflinger);
29 ~ILibraryAppletProxy();
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 OpenLibraryAppletSelfAccessor(
43 Out<SharedPointer<ILibraryAppletSelfAccessor>> out_library_applet_self_accessor);
44 Result GetAppletCommonFunctions(
45 Out<SharedPointer<IAppletCommonFunctions>> out_applet_common_functions);
46 Result GetHomeMenuFunctions(Out<SharedPointer<IHomeMenuFunctions>> out_home_menu_functions);
47 Result GetGlobalStateController(
48 Out<SharedPointer<IGlobalStateController>> out_global_state_controller);
49
50 Nvnflinger::Nvnflinger& m_nvnflinger;
51 Kernel::KProcess* const m_process;
52 const std::shared_ptr<Applet> m_applet;
53};
54
55} // namespace Service::AM