summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/CMakeLists.txt4
-rw-r--r--src/core/hle/service/am/display_controller.cpp135
-rw-r--r--src/core/hle/service/am/display_controller.h30
-rw-r--r--src/core/hle/service/am/service/application_proxy.cpp2
-rw-r--r--src/core/hle/service/am/service/display_controller.cpp105
-rw-r--r--src/core/hle/service/am/service/display_controller.h36
-rw-r--r--src/core/hle/service/am/service/library_applet_proxy.cpp2
-rw-r--r--src/core/hle/service/am/service/system_applet_proxy.cpp2
8 files changed, 146 insertions, 170 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index ad9831979..b5b1192b3 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -425,8 +425,6 @@ add_library(core STATIC
425 hle/service/am/applet_message_queue.h 425 hle/service/am/applet_message_queue.h
426 hle/service/am/application_creator.cpp 426 hle/service/am/application_creator.cpp
427 hle/service/am/application_creator.h 427 hle/service/am/application_creator.h
428 hle/service/am/display_controller.cpp
429 hle/service/am/display_controller.h
430 hle/service/am/global_state_controller.cpp 428 hle/service/am/global_state_controller.cpp
431 hle/service/am/global_state_controller.h 429 hle/service/am/global_state_controller.h
432 hle/service/am/hid_registration.cpp 430 hle/service/am/hid_registration.cpp
@@ -471,6 +469,8 @@ add_library(core STATIC
471 hle/service/am/service/common_state_getter.h 469 hle/service/am/service/common_state_getter.h
472 hle/service/am/service/debug_functions.cpp 470 hle/service/am/service/debug_functions.cpp
473 hle/service/am/service/debug_functions.h 471 hle/service/am/service/debug_functions.h
472 hle/service/am/service/display_controller.cpp
473 hle/service/am/service/display_controller.h
474 hle/service/am/service/library_applet_proxy.cpp 474 hle/service/am/service/library_applet_proxy.cpp
475 hle/service/am/service/library_applet_proxy.h 475 hle/service/am/service/library_applet_proxy.h
476 hle/service/am/service/system_applet_proxy.cpp 476 hle/service/am/service/system_applet_proxy.cpp
diff --git a/src/core/hle/service/am/display_controller.cpp b/src/core/hle/service/am/display_controller.cpp
deleted file mode 100644
index 4d6858348..000000000
--- a/src/core/hle/service/am/display_controller.cpp
+++ /dev/null
@@ -1,135 +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.h"
5#include "core/hle/service/am/display_controller.h"
6#include "core/hle/service/ipc_helpers.h"
7
8namespace Service::AM {
9
10namespace {
11struct OutputParameters {
12 bool was_written;
13 s32 fbshare_layer_index;
14};
15
16static_assert(sizeof(OutputParameters) == 8, "OutputParameters has wrong size");
17} // namespace
18
19IDisplayController::IDisplayController(Core::System& system_, std::shared_ptr<Applet> applet_)
20 : ServiceFramework{system_, "IDisplayController"}, applet(std::move(applet_)) {
21 // clang-format off
22 static const FunctionInfo functions[] = {
23 {0, nullptr, "GetLastForegroundCaptureImage"},
24 {1, nullptr, "UpdateLastForegroundCaptureImage"},
25 {2, nullptr, "GetLastApplicationCaptureImage"},
26 {3, nullptr, "GetCallerAppletCaptureImage"},
27 {4, nullptr, "UpdateCallerAppletCaptureImage"},
28 {5, nullptr, "GetLastForegroundCaptureImageEx"},
29 {6, nullptr, "GetLastApplicationCaptureImageEx"},
30 {7, &IDisplayController::GetCallerAppletCaptureImageEx, "GetCallerAppletCaptureImageEx"},
31 {8, &IDisplayController::TakeScreenShotOfOwnLayer, "TakeScreenShotOfOwnLayer"},
32 {9, nullptr, "CopyBetweenCaptureBuffers"},
33 {10, nullptr, "AcquireLastApplicationCaptureBuffer"},
34 {11, nullptr, "ReleaseLastApplicationCaptureBuffer"},
35 {12, nullptr, "AcquireLastForegroundCaptureBuffer"},
36 {13, nullptr, "ReleaseLastForegroundCaptureBuffer"},
37 {14, nullptr, "AcquireCallerAppletCaptureBuffer"},
38 {15, nullptr, "ReleaseCallerAppletCaptureBuffer"},
39 {16, nullptr, "AcquireLastApplicationCaptureBufferEx"},
40 {17, nullptr, "AcquireLastForegroundCaptureBufferEx"},
41 {18, nullptr, "AcquireCallerAppletCaptureBufferEx"},
42 {20, nullptr, "ClearCaptureBuffer"},
43 {21, nullptr, "ClearAppletTransitionBuffer"},
44 {22, &IDisplayController::AcquireLastApplicationCaptureSharedBuffer, "AcquireLastApplicationCaptureSharedBuffer"},
45 {23, &IDisplayController::ReleaseLastApplicationCaptureSharedBuffer, "ReleaseLastApplicationCaptureSharedBuffer"},
46 {24, &IDisplayController::AcquireLastForegroundCaptureSharedBuffer, "AcquireLastForegroundCaptureSharedBuffer"},
47 {25, &IDisplayController::ReleaseLastForegroundCaptureSharedBuffer, "ReleaseLastForegroundCaptureSharedBuffer"},
48 {26, &IDisplayController::AcquireCallerAppletCaptureSharedBuffer, "AcquireCallerAppletCaptureSharedBuffer"},
49 {27, &IDisplayController::ReleaseCallerAppletCaptureSharedBuffer, "ReleaseCallerAppletCaptureSharedBuffer"},
50 {28, nullptr, "TakeScreenShotOfOwnLayerEx"},
51 };
52 // clang-format on
53
54 RegisterHandlers(functions);
55}
56
57IDisplayController::~IDisplayController() = default;
58
59void IDisplayController::GetCallerAppletCaptureImageEx(HLERequestContext& ctx) {
60 LOG_WARNING(Service_AM, "(STUBBED) called");
61
62 OutputParameters params{};
63 const auto res = applet->system_buffer_manager.WriteAppletCaptureBuffer(
64 &params.was_written, &params.fbshare_layer_index);
65
66 IPC::ResponseBuilder rb{ctx, 4};
67 rb.Push(res);
68 rb.PushRaw(params);
69}
70
71void IDisplayController::TakeScreenShotOfOwnLayer(HLERequestContext& ctx) {
72 LOG_WARNING(Service_AM, "(STUBBED) called");
73
74 IPC::ResponseBuilder rb{ctx, 2};
75 rb.Push(ResultSuccess);
76}
77
78void IDisplayController::AcquireLastApplicationCaptureSharedBuffer(HLERequestContext& ctx) {
79 LOG_WARNING(Service_AM, "(STUBBED) called");
80
81 OutputParameters params{};
82 const auto res = applet->system_buffer_manager.WriteAppletCaptureBuffer(
83 &params.was_written, &params.fbshare_layer_index);
84
85 IPC::ResponseBuilder rb{ctx, 4};
86 rb.Push(res);
87 rb.PushRaw(params);
88}
89
90void IDisplayController::ReleaseLastApplicationCaptureSharedBuffer(HLERequestContext& ctx) {
91 LOG_WARNING(Service_AM, "(STUBBED) called");
92
93 IPC::ResponseBuilder rb{ctx, 2};
94 rb.Push(ResultSuccess);
95}
96
97void IDisplayController::AcquireLastForegroundCaptureSharedBuffer(HLERequestContext& ctx) {
98 LOG_WARNING(Service_AM, "(STUBBED) called");
99
100 OutputParameters params{};
101 const auto res = applet->system_buffer_manager.WriteAppletCaptureBuffer(
102 &params.was_written, &params.fbshare_layer_index);
103
104 IPC::ResponseBuilder rb{ctx, 4};
105 rb.Push(res);
106 rb.PushRaw(params);
107}
108
109void IDisplayController::ReleaseLastForegroundCaptureSharedBuffer(HLERequestContext& ctx) {
110 LOG_WARNING(Service_AM, "(STUBBED) called");
111
112 IPC::ResponseBuilder rb{ctx, 2};
113 rb.Push(ResultSuccess);
114}
115
116void IDisplayController::AcquireCallerAppletCaptureSharedBuffer(HLERequestContext& ctx) {
117 LOG_WARNING(Service_AM, "(STUBBED) called");
118
119 OutputParameters params{};
120 const auto res = applet->system_buffer_manager.WriteAppletCaptureBuffer(
121 &params.was_written, &params.fbshare_layer_index);
122
123 IPC::ResponseBuilder rb{ctx, 4};
124 rb.Push(res);
125 rb.PushRaw(params);
126}
127
128void IDisplayController::ReleaseCallerAppletCaptureSharedBuffer(HLERequestContext& ctx) {
129 LOG_WARNING(Service_AM, "(STUBBED) called");
130
131 IPC::ResponseBuilder rb{ctx, 2};
132 rb.Push(ResultSuccess);
133}
134
135} // namespace Service::AM
diff --git a/src/core/hle/service/am/display_controller.h b/src/core/hle/service/am/display_controller.h
deleted file mode 100644
index 75172580c..000000000
--- a/src/core/hle/service/am/display_controller.h
+++ /dev/null
@@ -1,30 +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 IDisplayController final : public ServiceFramework<IDisplayController> {
13public:
14 explicit IDisplayController(Core::System& system_, std::shared_ptr<Applet> applet_);
15 ~IDisplayController() override;
16
17private:
18 void GetCallerAppletCaptureImageEx(HLERequestContext& ctx);
19 void TakeScreenShotOfOwnLayer(HLERequestContext& ctx);
20 void AcquireLastForegroundCaptureSharedBuffer(HLERequestContext& ctx);
21 void ReleaseLastForegroundCaptureSharedBuffer(HLERequestContext& ctx);
22 void AcquireCallerAppletCaptureSharedBuffer(HLERequestContext& ctx);
23 void ReleaseCallerAppletCaptureSharedBuffer(HLERequestContext& ctx);
24 void AcquireLastApplicationCaptureSharedBuffer(HLERequestContext& ctx);
25 void ReleaseLastApplicationCaptureSharedBuffer(HLERequestContext& ctx);
26
27 const std::shared_ptr<Applet> applet;
28};
29
30} // 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 6cd6df2d0..445f9b158 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/display_controller.h"
5#include "core/hle/service/am/library_applet_creator.h" 4#include "core/hle/service/am/library_applet_creator.h"
6#include "core/hle/service/am/library_applet_self_accessor.h" 5#include "core/hle/service/am/library_applet_self_accessor.h"
7#include "core/hle/service/am/process_winding_controller.h" 6#include "core/hle/service/am/process_winding_controller.h"
@@ -12,6 +11,7 @@
12#include "core/hle/service/am/service/audio_controller.h" 11#include "core/hle/service/am/service/audio_controller.h"
13#include "core/hle/service/am/service/common_state_getter.h" 12#include "core/hle/service/am/service/common_state_getter.h"
14#include "core/hle/service/am/service/debug_functions.h" 13#include "core/hle/service/am/service/debug_functions.h"
14#include "core/hle/service/am/service/display_controller.h"
15#include "core/hle/service/am/window_controller.h" 15#include "core/hle/service/am/window_controller.h"
16#include "core/hle/service/cmif_serialization.h" 16#include "core/hle/service/cmif_serialization.h"
17 17
diff --git a/src/core/hle/service/am/service/display_controller.cpp b/src/core/hle/service/am/service/display_controller.cpp
new file mode 100644
index 000000000..249c73dfb
--- /dev/null
+++ b/src/core/hle/service/am/service/display_controller.cpp
@@ -0,0 +1,105 @@
1// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#include "core/hle/result.h"
5#include "core/hle/service/am/applet.h"
6#include "core/hle/service/am/service/display_controller.h"
7#include "core/hle/service/cmif_serialization.h"
8
9namespace Service::AM {
10
11IDisplayController::IDisplayController(Core::System& system_, std::shared_ptr<Applet> applet_)
12 : ServiceFramework{system_, "IDisplayController"}, applet(std::move(applet_)) {
13 // clang-format off
14 static const FunctionInfo functions[] = {
15 {0, nullptr, "GetLastForegroundCaptureImage"},
16 {1, nullptr, "UpdateLastForegroundCaptureImage"},
17 {2, nullptr, "GetLastApplicationCaptureImage"},
18 {3, nullptr, "GetCallerAppletCaptureImage"},
19 {4, nullptr, "UpdateCallerAppletCaptureImage"},
20 {5, nullptr, "GetLastForegroundCaptureImageEx"},
21 {6, nullptr, "GetLastApplicationCaptureImageEx"},
22 {7, D<&IDisplayController::GetCallerAppletCaptureImageEx>, "GetCallerAppletCaptureImageEx"},
23 {8, D<&IDisplayController::TakeScreenShotOfOwnLayer>, "TakeScreenShotOfOwnLayer"},
24 {9, nullptr, "CopyBetweenCaptureBuffers"},
25 {10, nullptr, "AcquireLastApplicationCaptureBuffer"},
26 {11, nullptr, "ReleaseLastApplicationCaptureBuffer"},
27 {12, nullptr, "AcquireLastForegroundCaptureBuffer"},
28 {13, nullptr, "ReleaseLastForegroundCaptureBuffer"},
29 {14, nullptr, "AcquireCallerAppletCaptureBuffer"},
30 {15, nullptr, "ReleaseCallerAppletCaptureBuffer"},
31 {16, nullptr, "AcquireLastApplicationCaptureBufferEx"},
32 {17, nullptr, "AcquireLastForegroundCaptureBufferEx"},
33 {18, nullptr, "AcquireCallerAppletCaptureBufferEx"},
34 {20, D<&IDisplayController::ClearCaptureBuffer>, "ClearCaptureBuffer"},
35 {21, nullptr, "ClearAppletTransitionBuffer"},
36 {22, D<&IDisplayController::AcquireLastApplicationCaptureSharedBuffer>, "AcquireLastApplicationCaptureSharedBuffer"},
37 {23, D<&IDisplayController::ReleaseLastApplicationCaptureSharedBuffer>, "ReleaseLastApplicationCaptureSharedBuffer"},
38 {24, D<&IDisplayController::AcquireLastForegroundCaptureSharedBuffer>, "AcquireLastForegroundCaptureSharedBuffer"},
39 {25, D<&IDisplayController::ReleaseLastForegroundCaptureSharedBuffer>, "ReleaseLastForegroundCaptureSharedBuffer"},
40 {26, D<&IDisplayController::AcquireCallerAppletCaptureSharedBuffer>, "AcquireCallerAppletCaptureSharedBuffer"},
41 {27, D<&IDisplayController::ReleaseCallerAppletCaptureSharedBuffer>, "ReleaseCallerAppletCaptureSharedBuffer"},
42 {28, nullptr, "TakeScreenShotOfOwnLayerEx"},
43 };
44 // clang-format on
45
46 RegisterHandlers(functions);
47}
48
49IDisplayController::~IDisplayController() = default;
50
51Result IDisplayController::GetCallerAppletCaptureImageEx(
52 Out<bool> out_was_written, OutBuffer<BufferAttr_HipcMapAlias> out_image_data) {
53 LOG_WARNING(Service_AM, "(STUBBED) called");
54 *out_was_written = true;
55 R_SUCCEED();
56}
57
58Result IDisplayController::TakeScreenShotOfOwnLayer(bool unknown0, s32 fbshare_layer_index) {
59 LOG_WARNING(Service_AM, "(STUBBED) called");
60 R_SUCCEED();
61}
62
63Result IDisplayController::ClearCaptureBuffer(bool unknown0, s32 fbshare_layer_index, u32 color) {
64 LOG_WARNING(Service_AM, "(STUBBED) called, unknown0={} fbshare_layer_index={} color={:#x}",
65 unknown0, fbshare_layer_index, color);
66 R_SUCCEED();
67}
68
69Result IDisplayController::AcquireLastForegroundCaptureSharedBuffer(
70 Out<bool> out_was_written, Out<s32> out_fbshare_layer_index) {
71 LOG_WARNING(Service_AM, "(STUBBED) called");
72 R_RETURN(applet->system_buffer_manager.WriteAppletCaptureBuffer(out_was_written,
73 out_fbshare_layer_index));
74}
75
76Result IDisplayController::ReleaseLastForegroundCaptureSharedBuffer() {
77 LOG_WARNING(Service_AM, "(STUBBED) called");
78 R_SUCCEED();
79}
80
81Result IDisplayController::AcquireCallerAppletCaptureSharedBuffer(
82 Out<bool> out_was_written, Out<s32> out_fbshare_layer_index) {
83 LOG_WARNING(Service_AM, "(STUBBED) called");
84 R_RETURN(applet->system_buffer_manager.WriteAppletCaptureBuffer(out_was_written,
85 out_fbshare_layer_index));
86}
87
88Result IDisplayController::ReleaseCallerAppletCaptureSharedBuffer() {
89 LOG_WARNING(Service_AM, "(STUBBED) called");
90 R_SUCCEED();
91}
92
93Result IDisplayController::AcquireLastApplicationCaptureSharedBuffer(
94 Out<bool> out_was_written, Out<s32> out_fbshare_layer_index) {
95 LOG_WARNING(Service_AM, "(STUBBED) called");
96 R_RETURN(applet->system_buffer_manager.WriteAppletCaptureBuffer(out_was_written,
97 out_fbshare_layer_index));
98}
99
100Result IDisplayController::ReleaseLastApplicationCaptureSharedBuffer() {
101 LOG_WARNING(Service_AM, "(STUBBED) called");
102 R_SUCCEED();
103}
104
105} // namespace Service::AM
diff --git a/src/core/hle/service/am/service/display_controller.h b/src/core/hle/service/am/service/display_controller.h
new file mode 100644
index 000000000..406fae21a
--- /dev/null
+++ b/src/core/hle/service/am/service/display_controller.h
@@ -0,0 +1,36 @@
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;
12
13class IDisplayController final : public ServiceFramework<IDisplayController> {
14public:
15 explicit IDisplayController(Core::System& system_, std::shared_ptr<Applet> applet_);
16 ~IDisplayController() override;
17
18private:
19 Result GetCallerAppletCaptureImageEx(Out<bool> out_was_written,
20 OutBuffer<BufferAttr_HipcMapAlias> out_image_data);
21 Result TakeScreenShotOfOwnLayer(bool unknown0, s32 fbshare_layer_index);
22 Result ClearCaptureBuffer(bool unknown0, s32 fbshare_layer_index, u32 color);
23 Result AcquireLastForegroundCaptureSharedBuffer(Out<bool> out_was_written,
24 Out<s32> out_fbshare_layer_index);
25 Result ReleaseLastForegroundCaptureSharedBuffer();
26 Result AcquireCallerAppletCaptureSharedBuffer(Out<bool> out_was_written,
27 Out<s32> out_fbshare_layer_index);
28 Result ReleaseCallerAppletCaptureSharedBuffer();
29 Result AcquireLastApplicationCaptureSharedBuffer(Out<bool> out_was_written,
30 Out<s32> out_fbshare_layer_index);
31 Result ReleaseLastApplicationCaptureSharedBuffer();
32
33 const std::shared_ptr<Applet> applet;
34};
35
36} // 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 d609871fb..589d53c20 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/display_controller.h"
5#include "core/hle/service/am/global_state_controller.h" 4#include "core/hle/service/am/global_state_controller.h"
6#include "core/hle/service/am/home_menu_functions.h" 5#include "core/hle/service/am/home_menu_functions.h"
7#include "core/hle/service/am/library_applet_creator.h" 6#include "core/hle/service/am/library_applet_creator.h"
@@ -12,6 +11,7 @@
12#include "core/hle/service/am/service/audio_controller.h" 11#include "core/hle/service/am/service/audio_controller.h"
13#include "core/hle/service/am/service/common_state_getter.h" 12#include "core/hle/service/am/service/common_state_getter.h"
14#include "core/hle/service/am/service/debug_functions.h" 13#include "core/hle/service/am/service/debug_functions.h"
14#include "core/hle/service/am/service/display_controller.h"
15#include "core/hle/service/am/service/library_applet_proxy.h" 15#include "core/hle/service/am/service/library_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"
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 d4ebe3ae0..4bfbd1067 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/display_controller.h"
6#include "core/hle/service/am/global_state_controller.h" 5#include "core/hle/service/am/global_state_controller.h"
7#include "core/hle/service/am/home_menu_functions.h" 6#include "core/hle/service/am/home_menu_functions.h"
8#include "core/hle/service/am/library_applet_creator.h" 7#include "core/hle/service/am/library_applet_creator.h"
@@ -13,6 +12,7 @@
13#include "core/hle/service/am/service/audio_controller.h" 12#include "core/hle/service/am/service/audio_controller.h"
14#include "core/hle/service/am/service/common_state_getter.h" 13#include "core/hle/service/am/service/common_state_getter.h"
15#include "core/hle/service/am/service/debug_functions.h" 14#include "core/hle/service/am/service/debug_functions.h"
15#include "core/hle/service/am/service/display_controller.h"
16#include "core/hle/service/am/service/system_applet_proxy.h" 16#include "core/hle/service/am/service/system_applet_proxy.h"
17#include "core/hle/service/am/window_controller.h" 17#include "core/hle/service/am/window_controller.h"
18#include "core/hle/service/cmif_serialization.h" 18#include "core/hle/service/cmif_serialization.h"