summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Lioncash2016-12-10 07:51:50 -0500
committerGravatar linkmauve2016-12-11 00:07:27 +0000
commit963aedd8ccc207d5b65b97bd46b930771f2bda6e (patch)
treeab238398e6f8a37e4cd105d19dcec54f82ec1bb2 /src
parentconfigure_input: Modernize and cleanup input configuration tab (diff)
downloadyuzu-963aedd8ccc207d5b65b97bd46b930771f2bda6e.tar.gz
yuzu-963aedd8ccc207d5b65b97bd46b930771f2bda6e.tar.xz
yuzu-963aedd8ccc207d5b65b97bd46b930771f2bda6e.zip
Add all services to the Service namespace
Previously there was a split where some of the services were in the Service namespace and others were not.
Diffstat (limited to 'src')
-rw-r--r--src/audio_core/audio_core.cpp4
-rw-r--r--src/audio_core/hle/pipe.cpp2
-rw-r--r--src/citra_qt/debugger/graphics.cpp16
-rw-r--r--src/core/hle/applets/swkbd.cpp4
-rw-r--r--src/core/hle/service/ac_u.cpp40
-rw-r--r--src/core/hle/service/ac_u.h17
-rw-r--r--src/core/hle/service/act_a.cpp14
-rw-r--r--src/core/hle/service/act_a.h13
-rw-r--r--src/core/hle/service/act_u.cpp14
-rw-r--r--src/core/hle/service/act_u.h13
-rw-r--r--src/core/hle/service/csnd_snd.cpp22
-rw-r--r--src/core/hle/service/csnd_snd.h21
-rw-r--r--src/core/hle/service/dsp_dsp.cpp7
-rw-r--r--src/core/hle/service/dsp_dsp.h7
-rw-r--r--src/core/hle/service/err_f.cpp16
-rw-r--r--src/core/hle/service/err_f.h13
-rw-r--r--src/core/hle/service/gsp_gpu.cpp46
-rw-r--r--src/core/hle/service/gsp_gpu.h17
-rw-r--r--src/core/hle/service/gsp_lcd.cpp14
-rw-r--r--src/core/hle/service/gsp_lcd.h14
-rw-r--r--src/core/hle/service/http_c.cpp14
-rw-r--r--src/core/hle/service/http_c.h13
-rw-r--r--src/core/hle/service/ldr_ro/cro_helper.cpp9
-rw-r--r--src/core/hle/service/ldr_ro/cro_helper.h9
-rw-r--r--src/core/hle/service/ldr_ro/ldr_ro.cpp32
-rw-r--r--src/core/hle/service/ldr_ro/ldr_ro.h13
-rw-r--r--src/core/hle/service/ldr_ro/memory_synchronizer.cpp9
-rw-r--r--src/core/hle/service/ldr_ro/memory_synchronizer.h9
-rw-r--r--src/core/hle/service/mic_u.cpp48
-rw-r--r--src/core/hle/service/mic_u.h17
-rw-r--r--src/core/hle/service/ns_s.cpp14
-rw-r--r--src/core/hle/service/ns_s.h14
-rw-r--r--src/core/hle/service/nwm_uds.cpp22
-rw-r--r--src/core/hle/service/nwm_uds.h17
-rw-r--r--src/core/hle/service/pm_app.cpp14
-rw-r--r--src/core/hle/service/pm_app.h13
-rw-r--r--src/core/hle/service/service.cpp34
-rw-r--r--src/core/hle/service/soc_u.cpp54
-rw-r--r--src/core/hle/service/soc_u.h15
-rw-r--r--src/core/hle/service/srv.cpp24
-rw-r--r--src/core/hle/service/srv.h13
-rw-r--r--src/core/hle/service/ssl_c.cpp18
-rw-r--r--src/core/hle/service/ssl_c.h13
-rw-r--r--src/core/hle/service/y2r_u.cpp106
-rw-r--r--src/core/hle/service/y2r_u.h15
-rw-r--r--src/core/hw/gpu.cpp10
-rw-r--r--src/core/hw/y2r.cpp2
-rw-r--r--src/core/hw/y2r.h9
-rw-r--r--src/video_core/command_processor.cpp2
-rw-r--r--src/video_core/gpu_debugger.h11
50 files changed, 408 insertions, 499 deletions
diff --git a/src/audio_core/audio_core.cpp b/src/audio_core/audio_core.cpp
index 1065e2222..ba6acf28e 100644
--- a/src/audio_core/audio_core.cpp
+++ b/src/audio_core/audio_core.cpp
@@ -23,9 +23,9 @@ static constexpr u64 audio_frame_ticks = 1310252ull; ///< Units: ARM11 cycles
23static void AudioTickCallback(u64 /*userdata*/, int cycles_late) { 23static void AudioTickCallback(u64 /*userdata*/, int cycles_late) {
24 if (DSP::HLE::Tick()) { 24 if (DSP::HLE::Tick()) {
25 // TODO(merry): Signal all the other interrupts as appropriate. 25 // TODO(merry): Signal all the other interrupts as appropriate.
26 DSP_DSP::SignalPipeInterrupt(DSP::HLE::DspPipe::Audio); 26 Service::DSP_DSP::SignalPipeInterrupt(DSP::HLE::DspPipe::Audio);
27 // HACK(merry): Added to prevent regressions. Will remove soon. 27 // HACK(merry): Added to prevent regressions. Will remove soon.
28 DSP_DSP::SignalPipeInterrupt(DSP::HLE::DspPipe::Binary); 28 Service::DSP_DSP::SignalPipeInterrupt(DSP::HLE::DspPipe::Binary);
29 } 29 }
30 30
31 // Reschedule recurrent event 31 // Reschedule recurrent event
diff --git a/src/audio_core/hle/pipe.cpp b/src/audio_core/hle/pipe.cpp
index bc69acbc2..24074a514 100644
--- a/src/audio_core/hle/pipe.cpp
+++ b/src/audio_core/hle/pipe.cpp
@@ -104,7 +104,7 @@ static void AudioPipeWriteStructAddresses() {
104 WriteU16(DspPipe::Audio, addr); 104 WriteU16(DspPipe::Audio, addr);
105 } 105 }
106 // Signal that we have data on this pipe. 106 // Signal that we have data on this pipe.
107 DSP_DSP::SignalPipeInterrupt(DspPipe::Audio); 107 Service::DSP_DSP::SignalPipeInterrupt(DspPipe::Audio);
108} 108}
109 109
110void PipeWrite(DspPipe pipe_number, const std::vector<u8>& buffer) { 110void PipeWrite(DspPipe pipe_number, const std::vector<u8>& buffer) {
diff --git a/src/citra_qt/debugger/graphics.cpp b/src/citra_qt/debugger/graphics.cpp
index ef6712bfa..ef337827a 100644
--- a/src/citra_qt/debugger/graphics.cpp
+++ b/src/citra_qt/debugger/graphics.cpp
@@ -22,15 +22,15 @@ QVariant GPUCommandStreamItemModel::data(const QModelIndex& index, int role) con
22 return QVariant(); 22 return QVariant();
23 23
24 int command_index = index.row(); 24 int command_index = index.row();
25 const GSP_GPU::Command& command = GetDebugger()->ReadGXCommandHistory(command_index); 25 const Service::GSP::Command& command = GetDebugger()->ReadGXCommandHistory(command_index);
26 if (role == Qt::DisplayRole) { 26 if (role == Qt::DisplayRole) {
27 std::map<GSP_GPU::CommandId, const char*> command_names = { 27 std::map<Service::GSP::CommandId, const char*> command_names = {
28 {GSP_GPU::CommandId::REQUEST_DMA, "REQUEST_DMA"}, 28 {Service::GSP::CommandId::REQUEST_DMA, "REQUEST_DMA"},
29 {GSP_GPU::CommandId::SUBMIT_GPU_CMDLIST, "SUBMIT_GPU_CMDLIST"}, 29 {Service::GSP::CommandId::SUBMIT_GPU_CMDLIST, "SUBMIT_GPU_CMDLIST"},
30 {GSP_GPU::CommandId::SET_MEMORY_FILL, "SET_MEMORY_FILL"}, 30 {Service::GSP::CommandId::SET_MEMORY_FILL, "SET_MEMORY_FILL"},
31 {GSP_GPU::CommandId::SET_DISPLAY_TRANSFER, "SET_DISPLAY_TRANSFER"}, 31 {Service::GSP::CommandId::SET_DISPLAY_TRANSFER, "SET_DISPLAY_TRANSFER"},
32 {GSP_GPU::CommandId::SET_TEXTURE_COPY, "SET_TEXTURE_COPY"}, 32 {Service::GSP::CommandId::SET_TEXTURE_COPY, "SET_TEXTURE_COPY"},
33 {GSP_GPU::CommandId::CACHE_FLUSH, "CACHE_FLUSH"}, 33 {Service::GSP::CommandId::CACHE_FLUSH, "CACHE_FLUSH"},
34 }; 34 };
35 const u32* command_data = reinterpret_cast<const u32*>(&command); 35 const u32* command_data = reinterpret_cast<const u32*>(&command);
36 QString str = QString("%1 %2 %3 %4 %5 %6 %7 %8 %9") 36 QString str = QString("%1 %2 %3 %4 %5 %6 %7 %8 %9")
diff --git a/src/core/hle/applets/swkbd.cpp b/src/core/hle/applets/swkbd.cpp
index edd30d7ef..059297fbc 100644
--- a/src/core/hle/applets/swkbd.cpp
+++ b/src/core/hle/applets/swkbd.cpp
@@ -94,13 +94,13 @@ void SoftwareKeyboard::Update() {
94} 94}
95 95
96void SoftwareKeyboard::DrawScreenKeyboard() { 96void SoftwareKeyboard::DrawScreenKeyboard() {
97 auto bottom_screen = GSP_GPU::GetFrameBufferInfo(0, 1); 97 auto bottom_screen = Service::GSP::GetFrameBufferInfo(0, 1);
98 auto info = bottom_screen->framebuffer_info[bottom_screen->index]; 98 auto info = bottom_screen->framebuffer_info[bottom_screen->index];
99 99
100 // TODO(Subv): Draw the HLE keyboard, for now just zero-fill the framebuffer 100 // TODO(Subv): Draw the HLE keyboard, for now just zero-fill the framebuffer
101 Memory::ZeroBlock(info.address_left, info.stride * 320); 101 Memory::ZeroBlock(info.address_left, info.stride * 320);
102 102
103 GSP_GPU::SetBufferSwap(1, info); 103 Service::GSP::SetBufferSwap(1, info);
104} 104}
105 105
106void SoftwareKeyboard::Finalize() { 106void SoftwareKeyboard::Finalize() {
diff --git a/src/core/hle/service/ac_u.cpp b/src/core/hle/service/ac_u.cpp
index fe367aca5..36204db4d 100644
--- a/src/core/hle/service/ac_u.cpp
+++ b/src/core/hle/service/ac_u.cpp
@@ -2,14 +2,14 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <array>
6
5#include "common/logging/log.h" 7#include "common/logging/log.h"
6#include "core/hle/kernel/event.h" 8#include "core/hle/kernel/event.h"
7#include "core/hle/service/ac_u.h" 9#include "core/hle/service/ac_u.h"
8 10
9//////////////////////////////////////////////////////////////////////////////////////////////////// 11namespace Service {
10// Namespace AC_U 12namespace AC {
11
12namespace AC_U {
13 13
14struct ACConfig { 14struct ACConfig {
15 std::array<u8, 0x200> data; 15 std::array<u8, 0x200> data;
@@ -31,7 +31,7 @@ static Kernel::SharedPtr<Kernel::Event> disconnect_event;
31 * Outputs: 31 * Outputs:
32 * 1 : Result of function, 0 on success, otherwise error code 32 * 1 : Result of function, 0 on success, otherwise error code
33 */ 33 */
34static void CreateDefaultConfig(Service::Interface* self) { 34static void CreateDefaultConfig(Interface* self) {
35 u32* cmd_buff = Kernel::GetCommandBuffer(); 35 u32* cmd_buff = Kernel::GetCommandBuffer();
36 36
37 u32 ac_config_addr = cmd_buff[65]; 37 u32 ac_config_addr = cmd_buff[65];
@@ -56,7 +56,7 @@ static void CreateDefaultConfig(Service::Interface* self) {
56 * Outputs: 56 * Outputs:
57 * 1 : Result of function, 0 on success, otherwise error code 57 * 1 : Result of function, 0 on success, otherwise error code
58 */ 58 */
59static void ConnectAsync(Service::Interface* self) { 59static void ConnectAsync(Interface* self) {
60 u32* cmd_buff = Kernel::GetCommandBuffer(); 60 u32* cmd_buff = Kernel::GetCommandBuffer();
61 61
62 connect_event = Kernel::g_handle_table.Get<Kernel::Event>(cmd_buff[4]); 62 connect_event = Kernel::g_handle_table.Get<Kernel::Event>(cmd_buff[4]);
@@ -77,7 +77,7 @@ static void ConnectAsync(Service::Interface* self) {
77 * Outputs: 77 * Outputs:
78 * 1 : Result of function, 0 on success, otherwise error code 78 * 1 : Result of function, 0 on success, otherwise error code
79 */ 79 */
80static void GetConnectResult(Service::Interface* self) { 80static void GetConnectResult(Interface* self) {
81 u32* cmd_buff = Kernel::GetCommandBuffer(); 81 u32* cmd_buff = Kernel::GetCommandBuffer();
82 82
83 cmd_buff[1] = RESULT_SUCCESS.raw; // No error 83 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
@@ -94,7 +94,7 @@ static void GetConnectResult(Service::Interface* self) {
94 * Outputs: 94 * Outputs:
95 * 1 : Result of function, 0 on success, otherwise error code 95 * 1 : Result of function, 0 on success, otherwise error code
96 */ 96 */
97static void CloseAsync(Service::Interface* self) { 97static void CloseAsync(Interface* self) {
98 u32* cmd_buff = Kernel::GetCommandBuffer(); 98 u32* cmd_buff = Kernel::GetCommandBuffer();
99 99
100 if (ac_connected && disconnect_event) { 100 if (ac_connected && disconnect_event) {
@@ -120,7 +120,7 @@ static void CloseAsync(Service::Interface* self) {
120 * Outputs: 120 * Outputs:
121 * 1 : Result of function, 0 on success, otherwise error code 121 * 1 : Result of function, 0 on success, otherwise error code
122 */ 122 */
123static void GetCloseResult(Service::Interface* self) { 123static void GetCloseResult(Interface* self) {
124 u32* cmd_buff = Kernel::GetCommandBuffer(); 124 u32* cmd_buff = Kernel::GetCommandBuffer();
125 125
126 cmd_buff[1] = RESULT_SUCCESS.raw; // No error 126 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
@@ -134,7 +134,7 @@ static void GetCloseResult(Service::Interface* self) {
134 * 1 : Result of function, 0 on success, otherwise error code 134 * 1 : Result of function, 0 on success, otherwise error code
135 * 2 : Output connection type, 0 = none, 1 = Old3DS Internet, 2 = New3DS Internet. 135 * 2 : Output connection type, 0 = none, 1 = Old3DS Internet, 2 = New3DS Internet.
136 */ 136 */
137static void GetWifiStatus(Service::Interface* self) { 137static void GetWifiStatus(Interface* self) {
138 u32* cmd_buff = Kernel::GetCommandBuffer(); 138 u32* cmd_buff = Kernel::GetCommandBuffer();
139 139
140 // TODO(purpasmart96): This function is only a stub, 140 // TODO(purpasmart96): This function is only a stub,
@@ -155,7 +155,7 @@ static void GetWifiStatus(Service::Interface* self) {
155 * 1 : Result of function, 0 on success, otherwise error code 155 * 1 : Result of function, 0 on success, otherwise error code
156 * 2 : Infra Priority 156 * 2 : Infra Priority
157 */ 157 */
158static void GetInfraPriority(Service::Interface* self) { 158static void GetInfraPriority(Interface* self) {
159 u32* cmd_buff = Kernel::GetCommandBuffer(); 159 u32* cmd_buff = Kernel::GetCommandBuffer();
160 160
161 cmd_buff[1] = RESULT_SUCCESS.raw; // No error 161 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
@@ -177,7 +177,7 @@ static void GetInfraPriority(Service::Interface* self) {
177 * 1 : Result of function, 0 on success, otherwise error code 177 * 1 : Result of function, 0 on success, otherwise error code
178 * 2 : Infra Priority 178 * 2 : Infra Priority
179 */ 179 */
180static void SetRequestEulaVersion(Service::Interface* self) { 180static void SetRequestEulaVersion(Interface* self) {
181 u32* cmd_buff = Kernel::GetCommandBuffer(); 181 u32* cmd_buff = Kernel::GetCommandBuffer();
182 182
183 u32 major = cmd_buff[1] & 0xFF; 183 u32 major = cmd_buff[1] & 0xFF;
@@ -203,7 +203,7 @@ static void SetRequestEulaVersion(Service::Interface* self) {
203 * Outputs: 203 * Outputs:
204 * 1 : Result of function, 0 on success, otherwise error code 204 * 1 : Result of function, 0 on success, otherwise error code
205 */ 205 */
206static void RegisterDisconnectEvent(Service::Interface* self) { 206static void RegisterDisconnectEvent(Interface* self) {
207 u32* cmd_buff = Kernel::GetCommandBuffer(); 207 u32* cmd_buff = Kernel::GetCommandBuffer();
208 208
209 disconnect_event = Kernel::g_handle_table.Get<Kernel::Event>(cmd_buff[4]); 209 disconnect_event = Kernel::g_handle_table.Get<Kernel::Event>(cmd_buff[4]);
@@ -221,7 +221,7 @@ static void RegisterDisconnectEvent(Service::Interface* self) {
221 * 1 : Result of function, 0 on success, otherwise error code 221 * 1 : Result of function, 0 on success, otherwise error code
222 * 2 : bool, is connected 222 * 2 : bool, is connected
223 */ 223 */
224static void IsConnected(Service::Interface* self) { 224static void IsConnected(Interface* self) {
225 u32* cmd_buff = Kernel::GetCommandBuffer(); 225 u32* cmd_buff = Kernel::GetCommandBuffer();
226 226
227 cmd_buff[1] = RESULT_SUCCESS.raw; // No error 227 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
@@ -237,7 +237,7 @@ static void IsConnected(Service::Interface* self) {
237 * Outputs: 237 * Outputs:
238 * 1 : Result of function, 0 on success, otherwise error code 238 * 1 : Result of function, 0 on success, otherwise error code
239 */ 239 */
240static void SetClientVersion(Service::Interface* self) { 240static void SetClientVersion(Interface* self) {
241 u32* cmd_buff = Kernel::GetCommandBuffer(); 241 u32* cmd_buff = Kernel::GetCommandBuffer();
242 242
243 const u32 version = cmd_buff[1]; 243 const u32 version = cmd_buff[1];
@@ -271,10 +271,7 @@ const Interface::FunctionInfo FunctionTable[] = {
271 {0x00400042, SetClientVersion, "SetClientVersion"}, 271 {0x00400042, SetClientVersion, "SetClientVersion"},
272}; 272};
273 273
274//////////////////////////////////////////////////////////////////////////////////////////////////// 274AC_U::AC_U() {
275// Interface class
276
277Interface::Interface() {
278 Register(FunctionTable); 275 Register(FunctionTable);
279 276
280 ac_connected = false; 277 ac_connected = false;
@@ -284,10 +281,11 @@ Interface::Interface() {
284 disconnect_event = nullptr; 281 disconnect_event = nullptr;
285} 282}
286 283
287Interface::~Interface() { 284AC_U::~AC_U() {
288 close_event = nullptr; 285 close_event = nullptr;
289 connect_event = nullptr; 286 connect_event = nullptr;
290 disconnect_event = nullptr; 287 disconnect_event = nullptr;
291} 288}
292 289
293} // namespace 290} // namespace AC
291} // namespace Service
diff --git a/src/core/hle/service/ac_u.h b/src/core/hle/service/ac_u.h
index 6592b21c9..573c32d7e 100644
--- a/src/core/hle/service/ac_u.h
+++ b/src/core/hle/service/ac_u.h
@@ -6,21 +6,18 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9//////////////////////////////////////////////////////////////////////////////////////////////////// 9namespace Service {
10// Namespace AC_U 10namespace AC {
11 11
12// socket service "ac:u" 12class AC_U final : public Interface {
13
14namespace AC_U {
15
16class Interface : public Service::Interface {
17public: 13public:
18 Interface(); 14 AC_U();
19 ~Interface(); 15 ~AC_U();
20 16
21 std::string GetPortName() const override { 17 std::string GetPortName() const override {
22 return "ac:u"; 18 return "ac:u";
23 } 19 }
24}; 20};
25 21
26} // namespace 22} // namespace AC
23} // namespace Service
diff --git a/src/core/hle/service/act_a.cpp b/src/core/hle/service/act_a.cpp
index 35ba71f79..9880aafff 100644
--- a/src/core/hle/service/act_a.cpp
+++ b/src/core/hle/service/act_a.cpp
@@ -4,10 +4,8 @@
4 4
5#include "core/hle/service/act_a.h" 5#include "core/hle/service/act_a.h"
6 6
7//////////////////////////////////////////////////////////////////////////////////////////////////// 7namespace Service {
8// Namespace ACT_A 8namespace ACT {
9
10namespace ACT_A {
11 9
12const Interface::FunctionInfo FunctionTable[] = { 10const Interface::FunctionInfo FunctionTable[] = {
13 // act:u shared commands 11 // act:u shared commands
@@ -23,11 +21,9 @@ const Interface::FunctionInfo FunctionTable[] = {
23 {0x04230082, nullptr, "ValidateMailAddress"}, 21 {0x04230082, nullptr, "ValidateMailAddress"},
24}; 22};
25 23
26//////////////////////////////////////////////////////////////////////////////////////////////////// 24ACT_A::ACT_A() {
27// Interface class
28
29Interface::Interface() {
30 Register(FunctionTable); 25 Register(FunctionTable);
31} 26}
32 27
33} // namespace 28} // namespace ACT
29} // namespace Service
diff --git a/src/core/hle/service/act_a.h b/src/core/hle/service/act_a.h
index 765cae644..e3adb03e5 100644
--- a/src/core/hle/service/act_a.h
+++ b/src/core/hle/service/act_a.h
@@ -6,18 +6,17 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9//////////////////////////////////////////////////////////////////////////////////////////////////// 9namespace Service {
10// Namespace ACT_A 10namespace ACT {
11 11
12namespace ACT_A { 12class ACT_A final : public Service::Interface {
13
14class Interface : public Service::Interface {
15public: 13public:
16 Interface(); 14 ACT_A();
17 15
18 std::string GetPortName() const override { 16 std::string GetPortName() const override {
19 return "act:a"; 17 return "act:a";
20 } 18 }
21}; 19};
22 20
23} // namespace 21} // namespace ACT
22} // namespace Service
diff --git a/src/core/hle/service/act_u.cpp b/src/core/hle/service/act_u.cpp
index 1b871d441..b4f69c57d 100644
--- a/src/core/hle/service/act_u.cpp
+++ b/src/core/hle/service/act_u.cpp
@@ -4,10 +4,8 @@
4 4
5#include "core/hle/service/act_u.h" 5#include "core/hle/service/act_u.h"
6 6
7//////////////////////////////////////////////////////////////////////////////////////////////////// 7namespace Service {
8// Namespace ACT_U 8namespace ACT {
9
10namespace ACT_U {
11 9
12const Interface::FunctionInfo FunctionTable[] = { 10const Interface::FunctionInfo FunctionTable[] = {
13 // clang-format off 11 // clang-format off
@@ -19,11 +17,9 @@ const Interface::FunctionInfo FunctionTable[] = {
19 // clang-format on 17 // clang-format on
20}; 18};
21 19
22//////////////////////////////////////////////////////////////////////////////////////////////////// 20ACT_U::ACT_U() {
23// Interface class
24
25Interface::Interface() {
26 Register(FunctionTable); 21 Register(FunctionTable);
27} 22}
28 23
29} // namespace 24} // namespace ACT
25} // namespace Service
diff --git a/src/core/hle/service/act_u.h b/src/core/hle/service/act_u.h
index be41454a4..9d8538fbf 100644
--- a/src/core/hle/service/act_u.h
+++ b/src/core/hle/service/act_u.h
@@ -6,18 +6,17 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9//////////////////////////////////////////////////////////////////////////////////////////////////// 9namespace Service {
10// Namespace ACT_U 10namespace ACT {
11 11
12namespace ACT_U { 12class ACT_U final : public Interface {
13
14class Interface : public Service::Interface {
15public: 13public:
16 Interface(); 14 ACT_U();
17 15
18 std::string GetPortName() const override { 16 std::string GetPortName() const override {
19 return "act:u"; 17 return "act:u";
20 } 18 }
21}; 19};
22 20
23} // namespace 21} // namespace ACT
22} // namespace Service
diff --git a/src/core/hle/service/csnd_snd.cpp b/src/core/hle/service/csnd_snd.cpp
index 20c759ad7..6544e89a2 100644
--- a/src/core/hle/service/csnd_snd.cpp
+++ b/src/core/hle/service/csnd_snd.cpp
@@ -9,10 +9,8 @@
9#include "core/hle/kernel/shared_memory.h" 9#include "core/hle/kernel/shared_memory.h"
10#include "core/hle/service/csnd_snd.h" 10#include "core/hle/service/csnd_snd.h"
11 11
12//////////////////////////////////////////////////////////////////////////////////////////////////// 12namespace Service {
13// Namespace CSND_SND 13namespace CSND {
14
15namespace CSND_SND {
16 14
17const Interface::FunctionInfo FunctionTable[] = { 15const Interface::FunctionInfo FunctionTable[] = {
18 {0x00010140, Initialize, "Initialize"}, 16 {0x00010140, Initialize, "Initialize"},
@@ -29,17 +27,14 @@ const Interface::FunctionInfo FunctionTable[] = {
29 {0x000C0000, nullptr, "Reset"}, 27 {0x000C0000, nullptr, "Reset"},
30}; 28};
31 29
32//////////////////////////////////////////////////////////////////////////////////////////////////// 30CSND_SND::CSND_SND() {
33// Interface class
34
35Interface::Interface() {
36 Register(FunctionTable); 31 Register(FunctionTable);
37} 32}
38 33
39static Kernel::SharedPtr<Kernel::SharedMemory> shared_memory = nullptr; 34static Kernel::SharedPtr<Kernel::SharedMemory> shared_memory = nullptr;
40static Kernel::SharedPtr<Kernel::Mutex> mutex = nullptr; 35static Kernel::SharedPtr<Kernel::Mutex> mutex = nullptr;
41 36
42void Initialize(Service::Interface* self) { 37void Initialize(Interface* self) {
43 u32* cmd_buff = Kernel::GetCommandBuffer(); 38 u32* cmd_buff = Kernel::GetCommandBuffer();
44 39
45 u32 size = Common::AlignUp(cmd_buff[1], Memory::PAGE_SIZE); 40 u32 size = Common::AlignUp(cmd_buff[1], Memory::PAGE_SIZE);
@@ -56,7 +51,7 @@ void Initialize(Service::Interface* self) {
56 cmd_buff[4] = Kernel::g_handle_table.Create(shared_memory).MoveFrom(); 51 cmd_buff[4] = Kernel::g_handle_table.Create(shared_memory).MoveFrom();
57} 52}
58 53
59void ExecuteType0Commands(Service::Interface* self) { 54void ExecuteType0Commands(Interface* self) {
60 u32* const cmd_buff = Kernel::GetCommandBuffer(); 55 u32* const cmd_buff = Kernel::GetCommandBuffer();
61 u8* const ptr = shared_memory->GetPointer(cmd_buff[1]); 56 u8* const ptr = shared_memory->GetPointer(cmd_buff[1]);
62 57
@@ -74,15 +69,16 @@ void ExecuteType0Commands(Service::Interface* self) {
74 } 69 }
75} 70}
76 71
77void AcquireSoundChannels(Service::Interface* self) { 72void AcquireSoundChannels(Interface* self) {
78 u32* cmd_buff = Kernel::GetCommandBuffer(); 73 u32* cmd_buff = Kernel::GetCommandBuffer();
79 cmd_buff[1] = 0; 74 cmd_buff[1] = 0;
80 cmd_buff[2] = 0xFFFFFF00; 75 cmd_buff[2] = 0xFFFFFF00;
81} 76}
82 77
83void Shutdown(Service::Interface* self) { 78void Shutdown(Interface* self) {
84 shared_memory = nullptr; 79 shared_memory = nullptr;
85 mutex = nullptr; 80 mutex = nullptr;
86} 81}
87 82
88} // namespace 83} // namespace CSND
84} // namespace Service
diff --git a/src/core/hle/service/csnd_snd.h b/src/core/hle/service/csnd_snd.h
index a146d116b..c8d83fa7d 100644
--- a/src/core/hle/service/csnd_snd.h
+++ b/src/core/hle/service/csnd_snd.h
@@ -6,14 +6,12 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9//////////////////////////////////////////////////////////////////////////////////////////////////// 9namespace Service {
10// Namespace CSND_SND 10namespace CSND {
11 11
12namespace CSND_SND { 12class CSND_SND final : public Interface {
13
14class Interface : public Service::Interface {
15public: 13public:
16 Interface(); 14 CSND_SND();
17 15
18 std::string GetPortName() const override { 16 std::string GetPortName() const override {
19 return "csnd:SND"; 17 return "csnd:SND";
@@ -28,9 +26,10 @@ struct Type0Command {
28 u8 parameters[20]; 26 u8 parameters[20];
29}; 27};
30 28
31void Initialize(Service::Interface* self); 29void Initialize(Interface* self);
32void ExecuteType0Commands(Service::Interface* self); 30void ExecuteType0Commands(Interface* self);
33void AcquireSoundChannels(Service::Interface* self); 31void AcquireSoundChannels(Interface* self);
34void Shutdown(Service::Interface* self); 32void Shutdown(Interface* self);
35 33
36} // namespace 34} // namespace CSND
35} // namespace Service
diff --git a/src/core/hle/service/dsp_dsp.cpp b/src/core/hle/service/dsp_dsp.cpp
index a15aa3696..fe8a6c2d6 100644
--- a/src/core/hle/service/dsp_dsp.cpp
+++ b/src/core/hle/service/dsp_dsp.cpp
@@ -12,9 +12,7 @@
12 12
13using DspPipe = DSP::HLE::DspPipe; 13using DspPipe = DSP::HLE::DspPipe;
14 14
15//////////////////////////////////////////////////////////////////////////////////////////////////// 15namespace Service {
16// Namespace DSP_DSP
17
18namespace DSP_DSP { 16namespace DSP_DSP {
19 17
20static Kernel::SharedPtr<Kernel::Event> semaphore_event; 18static Kernel::SharedPtr<Kernel::Event> semaphore_event;
@@ -582,4 +580,5 @@ Interface::~Interface() {
582 interrupt_events = {}; 580 interrupt_events = {};
583} 581}
584 582
585} // namespace 583} // namespace DSP_DSP
584} // namespace Service
diff --git a/src/core/hle/service/dsp_dsp.h b/src/core/hle/service/dsp_dsp.h
index 3e97da6eb..691d6f716 100644
--- a/src/core/hle/service/dsp_dsp.h
+++ b/src/core/hle/service/dsp_dsp.h
@@ -13,12 +13,10 @@ enum class DspPipe;
13} 13}
14} 14}
15 15
16//////////////////////////////////////////////////////////////////////////////////////////////////// 16namespace Service {
17// Namespace DSP_DSP
18
19namespace DSP_DSP { 17namespace DSP_DSP {
20 18
21class Interface : public Service::Interface { 19class Interface final : public Service::Interface {
22public: 20public:
23 Interface(); 21 Interface();
24 ~Interface() override; 22 ~Interface() override;
@@ -35,3 +33,4 @@ public:
35void SignalPipeInterrupt(DSP::HLE::DspPipe pipe); 33void SignalPipeInterrupt(DSP::HLE::DspPipe pipe);
36 34
37} // namespace DSP_DSP 35} // namespace DSP_DSP
36} // namespace Service
diff --git a/src/core/hle/service/err_f.cpp b/src/core/hle/service/err_f.cpp
index 9905757c7..cd0a1a598 100644
--- a/src/core/hle/service/err_f.cpp
+++ b/src/core/hle/service/err_f.cpp
@@ -13,10 +13,8 @@
13#include "core/hle/result.h" 13#include "core/hle/result.h"
14#include "core/hle/service/err_f.h" 14#include "core/hle/service/err_f.h"
15 15
16//////////////////////////////////////////////////////////////////////////////////////////////////// 16namespace Service {
17// Namespace ERR_F 17namespace ERR {
18
19namespace ERR_F {
20 18
21enum class FatalErrType : u32 { 19enum class FatalErrType : u32 {
22 Generic = 0, 20 Generic = 0,
@@ -167,7 +165,7 @@ static void LogGenericInfo(const ErrInfo::ErrInfoCommon& errinfo_common) {
167 * 0 : Header code 165 * 0 : Header code
168 * 1 : Result code 166 * 1 : Result code
169 */ 167 */
170static void ThrowFatalError(Service::Interface* self) { 168static void ThrowFatalError(Interface* self) {
171 u32* cmd_buff = Kernel::GetCommandBuffer(); 169 u32* cmd_buff = Kernel::GetCommandBuffer();
172 170
173 LOG_CRITICAL(Service_ERR, "Fatal error"); 171 LOG_CRITICAL(Service_ERR, "Fatal error");
@@ -256,11 +254,9 @@ const Interface::FunctionInfo FunctionTable[] = {
256 // clang-format on 254 // clang-format on
257}; 255};
258 256
259//////////////////////////////////////////////////////////////////////////////////////////////////// 257ERR_F::ERR_F() {
260// Interface class
261
262Interface::Interface() {
263 Register(FunctionTable); 258 Register(FunctionTable);
264} 259}
265 260
266} // namespace 261} // namespace ERR
262} // namespace Service
diff --git a/src/core/hle/service/err_f.h b/src/core/hle/service/err_f.h
index 892d8af9b..5b27fc871 100644
--- a/src/core/hle/service/err_f.h
+++ b/src/core/hle/service/err_f.h
@@ -6,18 +6,17 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9//////////////////////////////////////////////////////////////////////////////////////////////////// 9namespace Service {
10// Namespace ERR_F 10namespace ERR {
11 11
12namespace ERR_F { 12class ERR_F final : public Interface {
13
14class Interface : public Service::Interface {
15public: 13public:
16 Interface(); 14 ERR_F();
17 15
18 std::string GetPortName() const override { 16 std::string GetPortName() const override {
19 return "err:f"; 17 return "err:f";
20 } 18 }
21}; 19};
22 20
23} // namespace 21} // namespace ERR
22} // namespace Service
diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp
index 78cb761be..49f4836b4 100644
--- a/src/core/hle/service/gsp_gpu.cpp
+++ b/src/core/hle/service/gsp_gpu.cpp
@@ -18,13 +18,11 @@
18// Main graphics debugger object - TODO: Here is probably not the best place for this 18// Main graphics debugger object - TODO: Here is probably not the best place for this
19GraphicsDebugger g_debugger; 19GraphicsDebugger g_debugger;
20 20
21// Beginning address of HW regs 21namespace Service {
22const static u32 REGS_BEGIN = 0x1EB00000; 22namespace GSP {
23
24////////////////////////////////////////////////////////////////////////////////////////////////////
25// Namespace GSP_GPU
26 23
27namespace GSP_GPU { 24// Beginning address of HW regs
25const u32 REGS_BEGIN = 0x1EB00000;
28 26
29const ResultCode ERR_GSP_REGS_OUTOFRANGE_OR_MISALIGNED( 27const ResultCode ERR_GSP_REGS_OUTOFRANGE_OR_MISALIGNED(
30 ErrorDescription::OutofRangeOrMisalignedAddress, ErrorModule::GX, ErrorSummary::InvalidArgument, 28 ErrorDescription::OutofRangeOrMisalignedAddress, ErrorModule::GX, ErrorSummary::InvalidArgument,
@@ -179,7 +177,7 @@ static ResultCode WriteHWRegsWithMask(u32 base_address, u32 size_in_bytes, VAddr
179 * 2 : number of registers to write sequentially 177 * 2 : number of registers to write sequentially
180 * 4 : pointer to source data array 178 * 4 : pointer to source data array
181 */ 179 */
182static void WriteHWRegs(Service::Interface* self) { 180static void WriteHWRegs(Interface* self) {
183 u32* cmd_buff = Kernel::GetCommandBuffer(); 181 u32* cmd_buff = Kernel::GetCommandBuffer();
184 u32 reg_addr = cmd_buff[1]; 182 u32 reg_addr = cmd_buff[1];
185 u32 size = cmd_buff[2]; 183 u32 size = cmd_buff[2];
@@ -199,7 +197,7 @@ static void WriteHWRegs(Service::Interface* self) {
199 * 4 : pointer to source data array 197 * 4 : pointer to source data array
200 * 6 : pointer to mask array 198 * 6 : pointer to mask array
201 */ 199 */
202static void WriteHWRegsWithMask(Service::Interface* self) { 200static void WriteHWRegsWithMask(Interface* self) {
203 u32* cmd_buff = Kernel::GetCommandBuffer(); 201 u32* cmd_buff = Kernel::GetCommandBuffer();
204 u32 reg_addr = cmd_buff[1]; 202 u32 reg_addr = cmd_buff[1];
205 u32 size = cmd_buff[2]; 203 u32 size = cmd_buff[2];
@@ -211,7 +209,7 @@ static void WriteHWRegsWithMask(Service::Interface* self) {
211} 209}
212 210
213/// Read a GSP GPU hardware register 211/// Read a GSP GPU hardware register
214static void ReadHWRegs(Service::Interface* self) { 212static void ReadHWRegs(Interface* self) {
215 u32* cmd_buff = Kernel::GetCommandBuffer(); 213 u32* cmd_buff = Kernel::GetCommandBuffer();
216 u32 reg_addr = cmd_buff[1]; 214 u32 reg_addr = cmd_buff[1];
217 u32 size = cmd_buff[2]; 215 u32 size = cmd_buff[2];
@@ -298,7 +296,7 @@ ResultCode SetBufferSwap(u32 screen_id, const FrameBufferInfo& info) {
298 * Outputs: 296 * Outputs:
299 * 1: Result code 297 * 1: Result code
300 */ 298 */
301static void SetBufferSwap(Service::Interface* self) { 299static void SetBufferSwap(Interface* self) {
302 u32* cmd_buff = Kernel::GetCommandBuffer(); 300 u32* cmd_buff = Kernel::GetCommandBuffer();
303 u32 screen_id = cmd_buff[1]; 301 u32 screen_id = cmd_buff[1];
304 FrameBufferInfo* fb_info = (FrameBufferInfo*)&cmd_buff[2]; 302 FrameBufferInfo* fb_info = (FrameBufferInfo*)&cmd_buff[2];
@@ -319,7 +317,7 @@ static void SetBufferSwap(Service::Interface* self) {
319 * Outputs: 317 * Outputs:
320 * 1 : Result of function, 0 on success, otherwise error code 318 * 1 : Result of function, 0 on success, otherwise error code
321 */ 319 */
322static void FlushDataCache(Service::Interface* self) { 320static void FlushDataCache(Interface* self) {
323 u32* cmd_buff = Kernel::GetCommandBuffer(); 321 u32* cmd_buff = Kernel::GetCommandBuffer();
324 u32 address = cmd_buff[1]; 322 u32 address = cmd_buff[1];
325 u32 size = cmd_buff[2]; 323 u32 size = cmd_buff[2];
@@ -340,7 +338,7 @@ static void FlushDataCache(Service::Interface* self) {
340 * Outputs: 338 * Outputs:
341 * 1 : Result of function, 0 on success, otherwise error code 339 * 1 : Result of function, 0 on success, otherwise error code
342 */ 340 */
343static void SetAxiConfigQoSMode(Service::Interface* self) { 341static void SetAxiConfigQoSMode(Interface* self) {
344 u32* cmd_buff = Kernel::GetCommandBuffer(); 342 u32* cmd_buff = Kernel::GetCommandBuffer();
345 u32 mode = cmd_buff[1]; 343 u32 mode = cmd_buff[1];
346 344
@@ -359,7 +357,7 @@ static void SetAxiConfigQoSMode(Service::Interface* self) {
359 * 2 : Thread index into GSP command buffer 357 * 2 : Thread index into GSP command buffer
360 * 4 : Handle to GSP shared memory 358 * 4 : Handle to GSP shared memory
361 */ 359 */
362static void RegisterInterruptRelayQueue(Service::Interface* self) { 360static void RegisterInterruptRelayQueue(Interface* self) {
363 u32* cmd_buff = Kernel::GetCommandBuffer(); 361 u32* cmd_buff = Kernel::GetCommandBuffer();
364 u32 flags = cmd_buff[1]; 362 u32 flags = cmd_buff[1];
365 363
@@ -391,7 +389,7 @@ static void RegisterInterruptRelayQueue(Service::Interface* self) {
391 * Outputs: 389 * Outputs:
392 * 1 : Result of function, 0 on success, otherwise error code 390 * 1 : Result of function, 0 on success, otherwise error code
393 */ 391 */
394static void UnregisterInterruptRelayQueue(Service::Interface* self) { 392static void UnregisterInterruptRelayQueue(Interface* self) {
395 u32* cmd_buff = Kernel::GetCommandBuffer(); 393 u32* cmd_buff = Kernel::GetCommandBuffer();
396 394
397 g_thread_id = 0; 395 g_thread_id = 0;
@@ -592,7 +590,7 @@ static void ExecuteCommand(const Command& command, u32 thread_id) {
592 * Outputs: 590 * Outputs:
593 * 1: Result code 591 * 1: Result code
594 */ 592 */
595static void SetLcdForceBlack(Service::Interface* self) { 593static void SetLcdForceBlack(Interface* self) {
596 u32* cmd_buff = Kernel::GetCommandBuffer(); 594 u32* cmd_buff = Kernel::GetCommandBuffer();
597 595
598 bool enable_black = cmd_buff[1] != 0; 596 bool enable_black = cmd_buff[1] != 0;
@@ -609,7 +607,7 @@ static void SetLcdForceBlack(Service::Interface* self) {
609} 607}
610 608
611/// This triggers handling of the GX command written to the command buffer in shared memory. 609/// This triggers handling of the GX command written to the command buffer in shared memory.
612static void TriggerCmdReqQueue(Service::Interface* self) { 610static void TriggerCmdReqQueue(Interface* self) {
613 // Iterate through each thread's command queue... 611 // Iterate through each thread's command queue...
614 for (unsigned thread_id = 0; thread_id < 0x4; ++thread_id) { 612 for (unsigned thread_id = 0; thread_id < 0x4; ++thread_id) {
615 CommandBuffer* command_buffer = (CommandBuffer*)GetCommandBuffer(thread_id); 613 CommandBuffer* command_buffer = (CommandBuffer*)GetCommandBuffer(thread_id);
@@ -648,7 +646,7 @@ static void TriggerCmdReqQueue(Service::Interface* self) {
648 * 8: Bottom screen framebuffer format 646 * 8: Bottom screen framebuffer format
649 * 9: Bottom screen framebuffer width 647 * 9: Bottom screen framebuffer width
650 */ 648 */
651static void ImportDisplayCaptureInfo(Service::Interface* self) { 649static void ImportDisplayCaptureInfo(Interface* self) {
652 u32* cmd_buff = Kernel::GetCommandBuffer(); 650 u32* cmd_buff = Kernel::GetCommandBuffer();
653 651
654 // TODO(Subv): We're always returning the framebuffer structures for thread_id = 0, 652 // TODO(Subv): We're always returning the framebuffer structures for thread_id = 0,
@@ -680,7 +678,7 @@ static void ImportDisplayCaptureInfo(Service::Interface* self) {
680 * Outputs: 678 * Outputs:
681 * 1: Result code 679 * 1: Result code
682 */ 680 */
683static void AcquireRight(Service::Interface* self) { 681static void AcquireRight(Interface* self) {
684 u32* cmd_buff = Kernel::GetCommandBuffer(); 682 u32* cmd_buff = Kernel::GetCommandBuffer();
685 683
686 gpu_right_acquired = true; 684 gpu_right_acquired = true;
@@ -695,7 +693,7 @@ static void AcquireRight(Service::Interface* self) {
695 * Outputs: 693 * Outputs:
696 * 1: Result code 694 * 1: Result code
697 */ 695 */
698static void ReleaseRight(Service::Interface* self) { 696static void ReleaseRight(Interface* self) {
699 u32* cmd_buff = Kernel::GetCommandBuffer(); 697 u32* cmd_buff = Kernel::GetCommandBuffer();
700 698
701 gpu_right_acquired = false; 699 gpu_right_acquired = false;
@@ -739,10 +737,7 @@ const Interface::FunctionInfo FunctionTable[] = {
739 {0x001F0082, nullptr, "StoreDataCache"}, 737 {0x001F0082, nullptr, "StoreDataCache"},
740}; 738};
741 739
742//////////////////////////////////////////////////////////////////////////////////////////////////// 740GSP_GPU::GSP_GPU() {
743// Interface class
744
745Interface::Interface() {
746 Register(FunctionTable); 741 Register(FunctionTable);
747 742
748 g_interrupt_event = nullptr; 743 g_interrupt_event = nullptr;
@@ -757,10 +752,11 @@ Interface::Interface() {
757 first_initialization = true; 752 first_initialization = true;
758} 753}
759 754
760Interface::~Interface() { 755GSP_GPU::~GSP_GPU() {
761 g_interrupt_event = nullptr; 756 g_interrupt_event = nullptr;
762 g_shared_memory = nullptr; 757 g_shared_memory = nullptr;
763 gpu_right_acquired = false; 758 gpu_right_acquired = false;
764} 759}
765 760
766} // namespace 761} // namespace GSP
762} // namespace Service
diff --git a/src/core/hle/service/gsp_gpu.h b/src/core/hle/service/gsp_gpu.h
index 79a72f77d..c6e24073b 100644
--- a/src/core/hle/service/gsp_gpu.h
+++ b/src/core/hle/service/gsp_gpu.h
@@ -11,10 +11,8 @@
11#include "core/hle/result.h" 11#include "core/hle/result.h"
12#include "core/hle/service/service.h" 12#include "core/hle/service/service.h"
13 13
14//////////////////////////////////////////////////////////////////////////////////////////////////// 14namespace Service {
15// Namespace GSP_GPU 15namespace GSP {
16
17namespace GSP_GPU {
18 16
19/// GSP interrupt ID 17/// GSP interrupt ID
20enum class InterruptId : u8 { 18enum class InterruptId : u8 {
@@ -176,11 +174,10 @@ struct CommandBuffer {
176}; 174};
177static_assert(sizeof(CommandBuffer) == 0x200, "CommandBuffer struct has incorrect size"); 175static_assert(sizeof(CommandBuffer) == 0x200, "CommandBuffer struct has incorrect size");
178 176
179/// Interface to "srv:" service 177class GSP_GPU final : public Interface {
180class Interface : public Service::Interface {
181public: 178public:
182 Interface(); 179 GSP_GPU();
183 ~Interface() override; 180 ~GSP_GPU() override;
184 181
185 std::string GetPortName() const override { 182 std::string GetPortName() const override {
186 return "gsp::Gpu"; 183 return "gsp::Gpu";
@@ -203,4 +200,6 @@ ResultCode SetBufferSwap(u32 screen_id, const FrameBufferInfo& info);
203 * @returns FramebufferUpdate Information about the specified framebuffer. 200 * @returns FramebufferUpdate Information about the specified framebuffer.
204 */ 201 */
205FrameBufferUpdate* GetFrameBufferInfo(u32 thread_id, u32 screen_index); 202FrameBufferUpdate* GetFrameBufferInfo(u32 thread_id, u32 screen_index);
206} // namespace 203
204} // namespace GSP
205} // namespace Service
diff --git a/src/core/hle/service/gsp_lcd.cpp b/src/core/hle/service/gsp_lcd.cpp
index 3fdf5cca4..89cb4a3cc 100644
--- a/src/core/hle/service/gsp_lcd.cpp
+++ b/src/core/hle/service/gsp_lcd.cpp
@@ -4,10 +4,8 @@
4 4
5#include "core/hle/service/gsp_lcd.h" 5#include "core/hle/service/gsp_lcd.h"
6 6
7//////////////////////////////////////////////////////////////////////////////////////////////////// 7namespace Service {
8// Namespace GSP_LCD 8namespace GSP {
9
10namespace GSP_LCD {
11 9
12const Interface::FunctionInfo FunctionTable[] = { 10const Interface::FunctionInfo FunctionTable[] = {
13 // clang-format off 11 // clang-format off
@@ -23,11 +21,9 @@ const Interface::FunctionInfo FunctionTable[] = {
23 // clang-format on 21 // clang-format on
24}; 22};
25 23
26//////////////////////////////////////////////////////////////////////////////////////////////////// 24GSP_LCD::GSP_LCD() {
27// Interface class
28
29Interface::Interface() {
30 Register(FunctionTable); 25 Register(FunctionTable);
31} 26}
32 27
33} // namespace 28} // namespace GSP
29} // namespace Service
diff --git a/src/core/hle/service/gsp_lcd.h b/src/core/hle/service/gsp_lcd.h
index 56b3cfe86..e9686a5e7 100644
--- a/src/core/hle/service/gsp_lcd.h
+++ b/src/core/hle/service/gsp_lcd.h
@@ -6,19 +6,17 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9//////////////////////////////////////////////////////////////////////////////////////////////////// 9namespace Service {
10// Namespace GSP_LCD 10namespace GSP {
11 11
12namespace GSP_LCD { 12class GSP_LCD final : public Interface {
13
14/// Interface to "gsp::Lcd" service
15class Interface : public Service::Interface {
16public: 13public:
17 Interface(); 14 GSP_LCD();
18 15
19 std::string GetPortName() const override { 16 std::string GetPortName() const override {
20 return "gsp::Lcd"; 17 return "gsp::Lcd";
21 } 18 }
22}; 19};
23 20
24} // namespace 21} // namespace GSP
22} // namespace Service
diff --git a/src/core/hle/service/http_c.cpp b/src/core/hle/service/http_c.cpp
index 65c7babe5..b01d6e031 100644
--- a/src/core/hle/service/http_c.cpp
+++ b/src/core/hle/service/http_c.cpp
@@ -4,10 +4,8 @@
4 4
5#include "core/hle/service/http_c.h" 5#include "core/hle/service/http_c.h"
6 6
7//////////////////////////////////////////////////////////////////////////////////////////////////// 7namespace Service {
8// Namespace HTTP_C 8namespace HTTP {
9
10namespace HTTP_C {
11 9
12const Interface::FunctionInfo FunctionTable[] = { 10const Interface::FunctionInfo FunctionTable[] = {
13 {0x00010044, nullptr, "Initialize"}, 11 {0x00010044, nullptr, "Initialize"},
@@ -66,11 +64,9 @@ const Interface::FunctionInfo FunctionTable[] = {
66 {0x00390000, nullptr, "Finalize"}, 64 {0x00390000, nullptr, "Finalize"},
67}; 65};
68 66
69//////////////////////////////////////////////////////////////////////////////////////////////////// 67HTTP_C::HTTP_C() {
70// Interface class
71
72Interface::Interface() {
73 Register(FunctionTable); 68 Register(FunctionTable);
74} 69}
75 70
76} // namespace 71} // namespace HTTP
72} // namespace Service
diff --git a/src/core/hle/service/http_c.h b/src/core/hle/service/http_c.h
index 5ea3d1df3..cff279c02 100644
--- a/src/core/hle/service/http_c.h
+++ b/src/core/hle/service/http_c.h
@@ -6,18 +6,17 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9//////////////////////////////////////////////////////////////////////////////////////////////////// 9namespace Service {
10// Namespace HTTP_C 10namespace HTTP {
11 11
12namespace HTTP_C { 12class HTTP_C final : public Interface {
13
14class Interface : public Service::Interface {
15public: 13public:
16 Interface(); 14 HTTP_C();
17 15
18 std::string GetPortName() const override { 16 std::string GetPortName() const override {
19 return "http:C"; 17 return "http:C";
20 } 18 }
21}; 19};
22 20
23} // namespace 21} // namespace HTTP
22} // namespace Service
diff --git a/src/core/hle/service/ldr_ro/cro_helper.cpp b/src/core/hle/service/ldr_ro/cro_helper.cpp
index 4f0aa77eb..f78545f37 100644
--- a/src/core/hle/service/ldr_ro/cro_helper.cpp
+++ b/src/core/hle/service/ldr_ro/cro_helper.cpp
@@ -7,10 +7,8 @@
7#include "common/scope_exit.h" 7#include "common/scope_exit.h"
8#include "core/hle/service/ldr_ro/cro_helper.h" 8#include "core/hle/service/ldr_ro/cro_helper.h"
9 9
10//////////////////////////////////////////////////////////////////////////////////////////////////// 10namespace Service {
11// Namespace LDR_RO 11namespace LDR {
12
13namespace LDR_RO {
14 12
15static const ResultCode ERROR_BUFFER_TOO_SMALL = // 0xE0E12C1F 13static const ResultCode ERROR_BUFFER_TOO_SMALL = // 0xE0E12C1F
16 ResultCode(static_cast<ErrorDescription>(31), ErrorModule::RO, ErrorSummary::InvalidArgument, 14 ResultCode(static_cast<ErrorDescription>(31), ErrorModule::RO, ErrorSummary::InvalidArgument,
@@ -1493,4 +1491,5 @@ std::tuple<VAddr, u32> CROHelper::GetExecutablePages() const {
1493 return std::make_tuple(0, 0); 1491 return std::make_tuple(0, 0);
1494} 1492}
1495 1493
1496} // namespace 1494} // namespace LDR
1495} // namespace Service
diff --git a/src/core/hle/service/ldr_ro/cro_helper.h b/src/core/hle/service/ldr_ro/cro_helper.h
index 6a0d0d3bf..060d5a55f 100644
--- a/src/core/hle/service/ldr_ro/cro_helper.h
+++ b/src/core/hle/service/ldr_ro/cro_helper.h
@@ -11,10 +11,8 @@
11#include "core/hle/result.h" 11#include "core/hle/result.h"
12#include "core/memory.h" 12#include "core/memory.h"
13 13
14//////////////////////////////////////////////////////////////////////////////////////////////////// 14namespace Service {
15// Namespace LDR_RO 15namespace LDR {
16
17namespace LDR_RO {
18 16
19// GCC versions < 5.0 do not implement std::is_trivially_copyable. 17// GCC versions < 5.0 do not implement std::is_trivially_copyable.
20// Excluding MSVC because it has weird behaviour for std::is_trivially_copyable. 18// Excluding MSVC because it has weird behaviour for std::is_trivially_copyable.
@@ -710,4 +708,5 @@ private:
710 ResultCode ApplyExitRelocations(VAddr crs_address); 708 ResultCode ApplyExitRelocations(VAddr crs_address);
711}; 709};
712 710
713} // namespace 711} // namespace LDR
712} // namespace Service
diff --git a/src/core/hle/service/ldr_ro/ldr_ro.cpp b/src/core/hle/service/ldr_ro/ldr_ro.cpp
index ec183d1f5..9e5d6a318 100644
--- a/src/core/hle/service/ldr_ro/ldr_ro.cpp
+++ b/src/core/hle/service/ldr_ro/ldr_ro.cpp
@@ -12,10 +12,8 @@
12#include "core/hle/service/ldr_ro/ldr_ro.h" 12#include "core/hle/service/ldr_ro/ldr_ro.h"
13#include "core/hle/service/ldr_ro/memory_synchronizer.h" 13#include "core/hle/service/ldr_ro/memory_synchronizer.h"
14 14
15//////////////////////////////////////////////////////////////////////////////////////////////////// 15namespace Service {
16// Namespace LDR_RO 16namespace LDR {
17
18namespace LDR_RO {
19 17
20static const ResultCode ERROR_ALREADY_INITIALIZED = // 0xD9612FF9 18static const ResultCode ERROR_ALREADY_INITIALIZED = // 0xD9612FF9
21 ResultCode(ErrorDescription::AlreadyInitialized, ErrorModule::RO, ErrorSummary::Internal, 19 ResultCode(ErrorDescription::AlreadyInitialized, ErrorModule::RO, ErrorSummary::Internal,
@@ -71,7 +69,7 @@ static bool VerifyBufferState(VAddr buffer_ptr, u32 size) {
71 * 0 : Return header 69 * 0 : Return header
72 * 1 : Result of function, 0 on success, otherwise error code 70 * 1 : Result of function, 0 on success, otherwise error code
73 */ 71 */
74static void Initialize(Service::Interface* self) { 72static void Initialize(Interface* self) {
75 u32* cmd_buff = Kernel::GetCommandBuffer(); 73 u32* cmd_buff = Kernel::GetCommandBuffer();
76 VAddr crs_buffer_ptr = cmd_buff[1]; 74 VAddr crs_buffer_ptr = cmd_buff[1];
77 u32 crs_size = cmd_buff[2]; 75 u32 crs_size = cmd_buff[2];
@@ -196,7 +194,7 @@ static void Initialize(Service::Interface* self) {
196 * 0 : Return header 194 * 0 : Return header
197 * 1 : Result of function, 0 on success, otherwise error code 195 * 1 : Result of function, 0 on success, otherwise error code
198 */ 196 */
199static void LoadCRR(Service::Interface* self) { 197static void LoadCRR(Interface* self) {
200 u32* cmd_buff = Kernel::GetCommandBuffer(); 198 u32* cmd_buff = Kernel::GetCommandBuffer();
201 u32 crr_buffer_ptr = cmd_buff[1]; 199 u32 crr_buffer_ptr = cmd_buff[1];
202 u32 crr_size = cmd_buff[2]; 200 u32 crr_size = cmd_buff[2];
@@ -229,7 +227,7 @@ static void LoadCRR(Service::Interface* self) {
229 * 0 : Return header 227 * 0 : Return header
230 * 1 : Result of function, 0 on success, otherwise error code 228 * 1 : Result of function, 0 on success, otherwise error code
231 */ 229 */
232static void UnloadCRR(Service::Interface* self) { 230static void UnloadCRR(Interface* self) {
233 u32* cmd_buff = Kernel::GetCommandBuffer(); 231 u32* cmd_buff = Kernel::GetCommandBuffer();
234 u32 crr_buffer_ptr = cmd_buff[1]; 232 u32 crr_buffer_ptr = cmd_buff[1];
235 u32 descriptor = cmd_buff[2]; 233 u32 descriptor = cmd_buff[2];
@@ -276,7 +274,7 @@ static void UnloadCRR(Service::Interface* self) {
276 * unified one of two, with an additional parameter link_on_load_bug_fix. 274 * unified one of two, with an additional parameter link_on_load_bug_fix.
277 * There is a dispatcher template below. 275 * There is a dispatcher template below.
278 */ 276 */
279static void LoadCRO(Service::Interface* self, bool link_on_load_bug_fix) { 277static void LoadCRO(Interface* self, bool link_on_load_bug_fix) {
280 u32* cmd_buff = Kernel::GetCommandBuffer(); 278 u32* cmd_buff = Kernel::GetCommandBuffer();
281 VAddr cro_buffer_ptr = cmd_buff[1]; 279 VAddr cro_buffer_ptr = cmd_buff[1];
282 VAddr cro_address = cmd_buff[2]; 280 VAddr cro_address = cmd_buff[2];
@@ -469,7 +467,7 @@ static void LoadCRO(Service::Interface* self, bool link_on_load_bug_fix) {
469} 467}
470 468
471template <bool link_on_load_bug_fix> 469template <bool link_on_load_bug_fix>
472static void LoadCRO(Service::Interface* self) { 470static void LoadCRO(Interface* self) {
473 LoadCRO(self, link_on_load_bug_fix); 471 LoadCRO(self, link_on_load_bug_fix);
474} 472}
475 473
@@ -486,7 +484,7 @@ static void LoadCRO(Service::Interface* self) {
486 * 0 : Return header 484 * 0 : Return header
487 * 1 : Result of function, 0 on success, otherwise error code 485 * 1 : Result of function, 0 on success, otherwise error code
488 */ 486 */
489static void UnloadCRO(Service::Interface* self) { 487static void UnloadCRO(Interface* self) {
490 u32* cmd_buff = Kernel::GetCommandBuffer(); 488 u32* cmd_buff = Kernel::GetCommandBuffer();
491 VAddr cro_address = cmd_buff[1]; 489 VAddr cro_address = cmd_buff[1];
492 u32 zero = cmd_buff[2]; 490 u32 zero = cmd_buff[2];
@@ -580,7 +578,7 @@ static void UnloadCRO(Service::Interface* self) {
580 * 0 : Return header 578 * 0 : Return header
581 * 1 : Result of function, 0 on success, otherwise error code 579 * 1 : Result of function, 0 on success, otherwise error code
582 */ 580 */
583static void LinkCRO(Service::Interface* self) { 581static void LinkCRO(Interface* self) {
584 u32* cmd_buff = Kernel::GetCommandBuffer(); 582 u32* cmd_buff = Kernel::GetCommandBuffer();
585 VAddr cro_address = cmd_buff[1]; 583 VAddr cro_address = cmd_buff[1];
586 u32 descriptor = cmd_buff[2]; 584 u32 descriptor = cmd_buff[2];
@@ -642,7 +640,7 @@ static void LinkCRO(Service::Interface* self) {
642 * 0 : Return header 640 * 0 : Return header
643 * 1 : Result of function, 0 on success, otherwise error code 641 * 1 : Result of function, 0 on success, otherwise error code
644 */ 642 */
645static void UnlinkCRO(Service::Interface* self) { 643static void UnlinkCRO(Interface* self) {
646 u32* cmd_buff = Kernel::GetCommandBuffer(); 644 u32* cmd_buff = Kernel::GetCommandBuffer();
647 VAddr cro_address = cmd_buff[1]; 645 VAddr cro_address = cmd_buff[1];
648 u32 descriptor = cmd_buff[2]; 646 u32 descriptor = cmd_buff[2];
@@ -704,7 +702,7 @@ static void UnlinkCRO(Service::Interface* self) {
704 * 0 : Return header 702 * 0 : Return header
705 * 1 : Result of function, 0 on success, otherwise error code 703 * 1 : Result of function, 0 on success, otherwise error code
706 */ 704 */
707static void Shutdown(Service::Interface* self) { 705static void Shutdown(Interface* self) {
708 u32* cmd_buff = Kernel::GetCommandBuffer(); 706 u32* cmd_buff = Kernel::GetCommandBuffer();
709 VAddr crs_buffer_ptr = cmd_buff[1]; 707 VAddr crs_buffer_ptr = cmd_buff[1];
710 u32 descriptor = cmd_buff[2]; 708 u32 descriptor = cmd_buff[2];
@@ -762,14 +760,12 @@ const Interface::FunctionInfo FunctionTable[] = {
762 // clang-format on 760 // clang-format on
763}; 761};
764 762
765//////////////////////////////////////////////////////////////////////////////////////////////////// 763LDR_RO::LDR_RO() {
766// Interface class
767
768Interface::Interface() {
769 Register(FunctionTable); 764 Register(FunctionTable);
770 765
771 loaded_crs = 0; 766 loaded_crs = 0;
772 memory_synchronizer.Clear(); 767 memory_synchronizer.Clear();
773} 768}
774 769
775} // namespace 770} // namespace LDR
771} // namespace Service
diff --git a/src/core/hle/service/ldr_ro/ldr_ro.h b/src/core/hle/service/ldr_ro/ldr_ro.h
index 331637cde..0f6fe7b60 100644
--- a/src/core/hle/service/ldr_ro/ldr_ro.h
+++ b/src/core/hle/service/ldr_ro/ldr_ro.h
@@ -6,18 +6,17 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9//////////////////////////////////////////////////////////////////////////////////////////////////// 9namespace Service {
10// Namespace LDR_RO 10namespace LDR {
11 11
12namespace LDR_RO { 12class LDR_RO final : public Interface {
13
14class Interface : public Service::Interface {
15public: 13public:
16 Interface(); 14 LDR_RO();
17 15
18 std::string GetPortName() const override { 16 std::string GetPortName() const override {
19 return "ldr:ro"; 17 return "ldr:ro";
20 } 18 }
21}; 19};
22 20
23} // namespace 21} // namespace LDR
22} // namespace Service
diff --git a/src/core/hle/service/ldr_ro/memory_synchronizer.cpp b/src/core/hle/service/ldr_ro/memory_synchronizer.cpp
index 989887264..0d44bf6bd 100644
--- a/src/core/hle/service/ldr_ro/memory_synchronizer.cpp
+++ b/src/core/hle/service/ldr_ro/memory_synchronizer.cpp
@@ -6,10 +6,8 @@
6#include "common/assert.h" 6#include "common/assert.h"
7#include "core/hle/service/ldr_ro/memory_synchronizer.h" 7#include "core/hle/service/ldr_ro/memory_synchronizer.h"
8 8
9//////////////////////////////////////////////////////////////////////////////////////////////////// 9namespace Service {
10// Namespace LDR_RO 10namespace LDR {
11
12namespace LDR_RO {
13 11
14auto MemorySynchronizer::FindMemoryBlock(VAddr mapping, VAddr original) { 12auto MemorySynchronizer::FindMemoryBlock(VAddr mapping, VAddr original) {
15 auto block = std::find_if(memory_blocks.begin(), memory_blocks.end(), 13 auto block = std::find_if(memory_blocks.begin(), memory_blocks.end(),
@@ -40,4 +38,5 @@ void MemorySynchronizer::SynchronizeOriginalMemory() {
40 } 38 }
41} 39}
42 40
43} // namespace 41} // namespace LDR
42} // namespace Service
diff --git a/src/core/hle/service/ldr_ro/memory_synchronizer.h b/src/core/hle/service/ldr_ro/memory_synchronizer.h
index 883ee4acf..438293a58 100644
--- a/src/core/hle/service/ldr_ro/memory_synchronizer.h
+++ b/src/core/hle/service/ldr_ro/memory_synchronizer.h
@@ -7,10 +7,8 @@
7#include <vector> 7#include <vector>
8#include "core/memory.h" 8#include "core/memory.h"
9 9
10//////////////////////////////////////////////////////////////////////////////////////////////////// 10namespace Service {
11// Namespace LDR_RO 11namespace LDR {
12
13namespace LDR_RO {
14 12
15/** 13/**
16 * This is a work-around before we implement memory aliasing. 14 * This is a work-around before we implement memory aliasing.
@@ -40,4 +38,5 @@ private:
40 auto FindMemoryBlock(VAddr mapping, VAddr original); 38 auto FindMemoryBlock(VAddr mapping, VAddr original);
41}; 39};
42 40
43} // namespace 41} // namespace LDR
42} // namespace Service
diff --git a/src/core/hle/service/mic_u.cpp b/src/core/hle/service/mic_u.cpp
index 1f851d328..7ced36439 100644
--- a/src/core/hle/service/mic_u.cpp
+++ b/src/core/hle/service/mic_u.cpp
@@ -7,10 +7,8 @@
7#include "core/hle/kernel/shared_memory.h" 7#include "core/hle/kernel/shared_memory.h"
8#include "core/hle/service/mic_u.h" 8#include "core/hle/service/mic_u.h"
9 9
10//////////////////////////////////////////////////////////////////////////////////////////////////// 10namespace Service {
11// Namespace MIC_U 11namespace MIC {
12
13namespace MIC_U {
14 12
15enum class Encoding : u8 { 13enum class Encoding : u8 {
16 PCM8 = 0, 14 PCM8 = 0,
@@ -49,7 +47,7 @@ static bool audio_buffer_loop;
49 * Outputs: 47 * Outputs:
50 * 1 : Result of function, 0 on success, otherwise error code 48 * 1 : Result of function, 0 on success, otherwise error code
51 */ 49 */
52static void MapSharedMem(Service::Interface* self) { 50static void MapSharedMem(Interface* self) {
53 u32* cmd_buff = Kernel::GetCommandBuffer(); 51 u32* cmd_buff = Kernel::GetCommandBuffer();
54 u32 size = cmd_buff[1]; 52 u32 size = cmd_buff[1];
55 Handle mem_handle = cmd_buff[3]; 53 Handle mem_handle = cmd_buff[3];
@@ -68,7 +66,7 @@ static void MapSharedMem(Service::Interface* self) {
68 * Outputs: 66 * Outputs:
69 * 1 : Result of function, 0 on success, otherwise error code 67 * 1 : Result of function, 0 on success, otherwise error code
70 */ 68 */
71static void UnmapSharedMem(Service::Interface* self) { 69static void UnmapSharedMem(Interface* self) {
72 u32* cmd_buff = Kernel::GetCommandBuffer(); 70 u32* cmd_buff = Kernel::GetCommandBuffer();
73 71
74 cmd_buff[1] = RESULT_SUCCESS.raw; // No error 72 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
@@ -87,7 +85,7 @@ static void UnmapSharedMem(Service::Interface* self) {
87 * Outputs: 85 * Outputs:
88 * 1 : Result of function, 0 on success, otherwise error code 86 * 1 : Result of function, 0 on success, otherwise error code
89 */ 87 */
90static void StartSampling(Service::Interface* self) { 88static void StartSampling(Interface* self) {
91 u32* cmd_buff = Kernel::GetCommandBuffer(); 89 u32* cmd_buff = Kernel::GetCommandBuffer();
92 90
93 encoding = static_cast<Encoding>(cmd_buff[1] & 0xFF); 91 encoding = static_cast<Encoding>(cmd_buff[1] & 0xFF);
@@ -111,7 +109,7 @@ static void StartSampling(Service::Interface* self) {
111 * Outputs: 109 * Outputs:
112 * 1 : Result of function, 0 on success, otherwise error code 110 * 1 : Result of function, 0 on success, otherwise error code
113 */ 111 */
114static void AdjustSampling(Service::Interface* self) { 112static void AdjustSampling(Interface* self) {
115 u32* cmd_buff = Kernel::GetCommandBuffer(); 113 u32* cmd_buff = Kernel::GetCommandBuffer();
116 sample_rate = static_cast<SampleRate>(cmd_buff[1] & 0xFF); 114 sample_rate = static_cast<SampleRate>(cmd_buff[1] & 0xFF);
117 cmd_buff[1] = RESULT_SUCCESS.raw; // No error 115 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
@@ -125,7 +123,7 @@ static void AdjustSampling(Service::Interface* self) {
125 * Outputs: 123 * Outputs:
126 * 1 : Result of function, 0 on success, otherwise error code 124 * 1 : Result of function, 0 on success, otherwise error code
127 */ 125 */
128static void StopSampling(Service::Interface* self) { 126static void StopSampling(Interface* self) {
129 u32* cmd_buff = Kernel::GetCommandBuffer(); 127 u32* cmd_buff = Kernel::GetCommandBuffer();
130 cmd_buff[1] = RESULT_SUCCESS.raw; // No error 128 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
131 is_sampling = false; 129 is_sampling = false;
@@ -140,7 +138,7 @@ static void StopSampling(Service::Interface* self) {
140 * 1 : Result of function, 0 on success, otherwise error code 138 * 1 : Result of function, 0 on success, otherwise error code
141 * 2 : 0 = sampling, non-zero = sampling 139 * 2 : 0 = sampling, non-zero = sampling
142 */ 140 */
143static void IsSampling(Service::Interface* self) { 141static void IsSampling(Interface* self) {
144 u32* cmd_buff = Kernel::GetCommandBuffer(); 142 u32* cmd_buff = Kernel::GetCommandBuffer();
145 cmd_buff[1] = RESULT_SUCCESS.raw; // No error 143 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
146 cmd_buff[2] = is_sampling; 144 cmd_buff[2] = is_sampling;
@@ -155,7 +153,7 @@ static void IsSampling(Service::Interface* self) {
155 * 1 : Result of function, 0 on success, otherwise error code 153 * 1 : Result of function, 0 on success, otherwise error code
156 * 3 : Event handle 154 * 3 : Event handle
157 */ 155 */
158static void GetBufferFullEvent(Service::Interface* self) { 156static void GetBufferFullEvent(Interface* self) {
159 u32* cmd_buff = Kernel::GetCommandBuffer(); 157 u32* cmd_buff = Kernel::GetCommandBuffer();
160 cmd_buff[1] = RESULT_SUCCESS.raw; // No error 158 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
161 cmd_buff[3] = Kernel::g_handle_table.Create(buffer_full_event).MoveFrom(); 159 cmd_buff[3] = Kernel::g_handle_table.Create(buffer_full_event).MoveFrom();
@@ -170,7 +168,7 @@ static void GetBufferFullEvent(Service::Interface* self) {
170 * Outputs: 168 * Outputs:
171 * 1 : Result of function, 0 on success, otherwise error code 169 * 1 : Result of function, 0 on success, otherwise error code
172 */ 170 */
173static void SetGain(Service::Interface* self) { 171static void SetGain(Interface* self) {
174 u32* cmd_buff = Kernel::GetCommandBuffer(); 172 u32* cmd_buff = Kernel::GetCommandBuffer();
175 mic_gain = cmd_buff[1] & 0xFF; 173 mic_gain = cmd_buff[1] & 0xFF;
176 cmd_buff[1] = RESULT_SUCCESS.raw; // No error 174 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
@@ -185,7 +183,7 @@ static void SetGain(Service::Interface* self) {
185 * 1 : Result of function, 0 on success, otherwise error code 183 * 1 : Result of function, 0 on success, otherwise error code
186 * 2 : Gain 184 * 2 : Gain
187 */ 185 */
188static void GetGain(Service::Interface* self) { 186static void GetGain(Interface* self) {
189 u32* cmd_buff = Kernel::GetCommandBuffer(); 187 u32* cmd_buff = Kernel::GetCommandBuffer();
190 cmd_buff[1] = RESULT_SUCCESS.raw; // No error 188 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
191 cmd_buff[2] = mic_gain; 189 cmd_buff[2] = mic_gain;
@@ -200,7 +198,7 @@ static void GetGain(Service::Interface* self) {
200 * Outputs: 198 * Outputs:
201 * 1 : Result of function, 0 on success, otherwise error code 199 * 1 : Result of function, 0 on success, otherwise error code
202 */ 200 */
203static void SetPower(Service::Interface* self) { 201static void SetPower(Interface* self) {
204 u32* cmd_buff = Kernel::GetCommandBuffer(); 202 u32* cmd_buff = Kernel::GetCommandBuffer();
205 mic_power = static_cast<bool>(cmd_buff[1] & 0xFF); 203 mic_power = static_cast<bool>(cmd_buff[1] & 0xFF);
206 cmd_buff[1] = RESULT_SUCCESS.raw; // No error 204 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
@@ -215,7 +213,7 @@ static void SetPower(Service::Interface* self) {
215 * 1 : Result of function, 0 on success, otherwise error code 213 * 1 : Result of function, 0 on success, otherwise error code
216 * 2 : Power 214 * 2 : Power
217 */ 215 */
218static void GetPower(Service::Interface* self) { 216static void GetPower(Interface* self) {
219 u32* cmd_buff = Kernel::GetCommandBuffer(); 217 u32* cmd_buff = Kernel::GetCommandBuffer();
220 cmd_buff[1] = RESULT_SUCCESS.raw; // No error 218 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
221 cmd_buff[2] = mic_power; 219 cmd_buff[2] = mic_power;
@@ -232,7 +230,7 @@ static void GetPower(Service::Interface* self) {
232 * Outputs: 230 * Outputs:
233 * 1 : Result of function, 0 on success, otherwise error code 231 * 1 : Result of function, 0 on success, otherwise error code
234 */ 232 */
235static void SetIirFilterMic(Service::Interface* self) { 233static void SetIirFilterMic(Interface* self) {
236 u32* cmd_buff = Kernel::GetCommandBuffer(); 234 u32* cmd_buff = Kernel::GetCommandBuffer();
237 235
238 u32 size = cmd_buff[1]; 236 u32 size = cmd_buff[1];
@@ -250,7 +248,7 @@ static void SetIirFilterMic(Service::Interface* self) {
250 * Outputs: 248 * Outputs:
251 * 1 : Result of function, 0 on success, otherwise error code 249 * 1 : Result of function, 0 on success, otherwise error code
252 */ 250 */
253static void SetClamp(Service::Interface* self) { 251static void SetClamp(Interface* self) {
254 u32* cmd_buff = Kernel::GetCommandBuffer(); 252 u32* cmd_buff = Kernel::GetCommandBuffer();
255 clamp = static_cast<bool>(cmd_buff[1] & 0xFF); 253 clamp = static_cast<bool>(cmd_buff[1] & 0xFF);
256 cmd_buff[1] = RESULT_SUCCESS.raw; // No error 254 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
@@ -265,7 +263,7 @@ static void SetClamp(Service::Interface* self) {
265 * 1 : Result of function, 0 on success, otherwise error code 263 * 1 : Result of function, 0 on success, otherwise error code
266 * 2 : Clamp (0 = don't clamp, non-zero = clamp) 264 * 2 : Clamp (0 = don't clamp, non-zero = clamp)
267 */ 265 */
268static void GetClamp(Service::Interface* self) { 266static void GetClamp(Interface* self) {
269 u32* cmd_buff = Kernel::GetCommandBuffer(); 267 u32* cmd_buff = Kernel::GetCommandBuffer();
270 cmd_buff[1] = RESULT_SUCCESS.raw; // No error 268 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
271 cmd_buff[2] = clamp; 269 cmd_buff[2] = clamp;
@@ -280,7 +278,7 @@ static void GetClamp(Service::Interface* self) {
280 * Outputs: 278 * Outputs:
281 * 1 : Result of function, 0 on success, otherwise error code 279 * 1 : Result of function, 0 on success, otherwise error code
282 */ 280 */
283static void SetAllowShellClosed(Service::Interface* self) { 281static void SetAllowShellClosed(Interface* self) {
284 u32* cmd_buff = Kernel::GetCommandBuffer(); 282 u32* cmd_buff = Kernel::GetCommandBuffer();
285 allow_shell_closed = static_cast<bool>(cmd_buff[1] & 0xFF); 283 allow_shell_closed = static_cast<bool>(cmd_buff[1] & 0xFF);
286 cmd_buff[1] = RESULT_SUCCESS.raw; // No error 284 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
@@ -294,7 +292,7 @@ static void SetAllowShellClosed(Service::Interface* self) {
294 * Outputs: 292 * Outputs:
295 * 1 : Result of function, 0 on success, otherwise error code 293 * 1 : Result of function, 0 on success, otherwise error code
296 */ 294 */
297static void SetClientVersion(Service::Interface* self) { 295static void SetClientVersion(Interface* self) {
298 u32* cmd_buff = Kernel::GetCommandBuffer(); 296 u32* cmd_buff = Kernel::GetCommandBuffer();
299 297
300 const u32 version = cmd_buff[1]; 298 const u32 version = cmd_buff[1];
@@ -324,10 +322,7 @@ const Interface::FunctionInfo FunctionTable[] = {
324 {0x00100040, SetClientVersion, "SetClientVersion"}, 322 {0x00100040, SetClientVersion, "SetClientVersion"},
325}; 323};
326 324
327//////////////////////////////////////////////////////////////////////////////////////////////////// 325MIC_U::MIC_U() {
328// Interface class
329
330Interface::Interface() {
331 Register(FunctionTable); 326 Register(FunctionTable);
332 shared_memory = nullptr; 327 shared_memory = nullptr;
333 buffer_full_event = 328 buffer_full_event =
@@ -338,9 +333,10 @@ Interface::Interface() {
338 clamp = false; 333 clamp = false;
339} 334}
340 335
341Interface::~Interface() { 336MIC_U::~MIC_U() {
342 shared_memory = nullptr; 337 shared_memory = nullptr;
343 buffer_full_event = nullptr; 338 buffer_full_event = nullptr;
344} 339}
345 340
346} // namespace 341} // namespace MIC
342} // namespace Service
diff --git a/src/core/hle/service/mic_u.h b/src/core/hle/service/mic_u.h
index 1cff7390e..ec2b67ab8 100644
--- a/src/core/hle/service/mic_u.h
+++ b/src/core/hle/service/mic_u.h
@@ -6,21 +6,18 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9//////////////////////////////////////////////////////////////////////////////////////////////////// 9namespace Service {
10// Namespace MIC_U 10namespace MIC {
11 11
12// mic service 12class MIC_U final : public Interface {
13
14namespace MIC_U {
15
16class Interface : public Service::Interface {
17public: 13public:
18 Interface(); 14 MIC_U();
19 ~Interface(); 15 ~MIC_U();
20 16
21 std::string GetPortName() const override { 17 std::string GetPortName() const override {
22 return "mic:u"; 18 return "mic:u";
23 } 19 }
24}; 20};
25 21
26} // namespace 22} // namespace MIC
23} // namespace Service
diff --git a/src/core/hle/service/ns_s.cpp b/src/core/hle/service/ns_s.cpp
index 6693f7c08..215c9aacc 100644
--- a/src/core/hle/service/ns_s.cpp
+++ b/src/core/hle/service/ns_s.cpp
@@ -4,10 +4,8 @@
4 4
5#include "core/hle/service/ns_s.h" 5#include "core/hle/service/ns_s.h"
6 6
7//////////////////////////////////////////////////////////////////////////////////////////////////// 7namespace Service {
8// Namespace NS_S 8namespace NS {
9
10namespace NS_S {
11 9
12const Interface::FunctionInfo FunctionTable[] = { 10const Interface::FunctionInfo FunctionTable[] = {
13 {0x000100C0, nullptr, "LaunchFIRM"}, 11 {0x000100C0, nullptr, "LaunchFIRM"},
@@ -27,11 +25,9 @@ const Interface::FunctionInfo FunctionTable[] = {
27 {0x00160000, nullptr, "RebootSystemClean"}, 25 {0x00160000, nullptr, "RebootSystemClean"},
28}; 26};
29 27
30//////////////////////////////////////////////////////////////////////////////////////////////////// 28NS_S::NS_S() {
31// Interface class
32
33Interface::Interface() {
34 Register(FunctionTable); 29 Register(FunctionTable);
35} 30}
36 31
37} // namespace 32} // namespace NS
33} // namespace Service
diff --git a/src/core/hle/service/ns_s.h b/src/core/hle/service/ns_s.h
index 8d8e849b8..90288a521 100644
--- a/src/core/hle/service/ns_s.h
+++ b/src/core/hle/service/ns_s.h
@@ -6,19 +6,17 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9//////////////////////////////////////////////////////////////////////////////////////////////////// 9namespace Service {
10// Namespace NS_S 10namespace NS {
11 11
12namespace NS_S { 12class NS_S final : public Interface {
13
14/// Interface to "NS:S" service
15class Interface : public Service::Interface {
16public: 13public:
17 Interface(); 14 NS_S();
18 15
19 std::string GetPortName() const override { 16 std::string GetPortName() const override {
20 return "ns:s"; 17 return "ns:s";
21 } 18 }
22}; 19};
23 20
24} // namespace 21} // namespace NS
22} // namespace Service
diff --git a/src/core/hle/service/nwm_uds.cpp b/src/core/hle/service/nwm_uds.cpp
index 8a2b00614..e3160d4b4 100644
--- a/src/core/hle/service/nwm_uds.cpp
+++ b/src/core/hle/service/nwm_uds.cpp
@@ -7,10 +7,8 @@
7#include "core/hle/kernel/event.h" 7#include "core/hle/kernel/event.h"
8#include "core/hle/service/nwm_uds.h" 8#include "core/hle/service/nwm_uds.h"
9 9
10//////////////////////////////////////////////////////////////////////////////////////////////////// 10namespace Service {
11// Namespace NWM_UDS 11namespace NWM {
12
13namespace NWM_UDS {
14 12
15static Kernel::SharedPtr<Kernel::Event> handle_event; 13static Kernel::SharedPtr<Kernel::Event> handle_event;
16 14
@@ -22,7 +20,7 @@ static Kernel::SharedPtr<Kernel::Event> handle_event;
22 * 0 : Return header 20 * 0 : Return header
23 * 1 : Result of function, 0 on success, otherwise error code 21 * 1 : Result of function, 0 on success, otherwise error code
24 */ 22 */
25static void Shutdown(Service::Interface* self) { 23static void Shutdown(Interface* self) {
26 u32* cmd_buff = Kernel::GetCommandBuffer(); 24 u32* cmd_buff = Kernel::GetCommandBuffer();
27 25
28 // TODO(purpasmart): Verify return header on HW 26 // TODO(purpasmart): Verify return header on HW
@@ -50,7 +48,7 @@ static void Shutdown(Service::Interface* self) {
50 * 0 : Return header 48 * 0 : Return header
51 * 1 : Result of function, 0 on success, otherwise error code 49 * 1 : Result of function, 0 on success, otherwise error code
52 */ 50 */
53static void RecvBeaconBroadcastData(Service::Interface* self) { 51static void RecvBeaconBroadcastData(Interface* self) {
54 u32* cmd_buff = Kernel::GetCommandBuffer(); 52 u32* cmd_buff = Kernel::GetCommandBuffer();
55 u32 out_buffer_size = cmd_buff[1]; 53 u32 out_buffer_size = cmd_buff[1];
56 u32 unk1 = cmd_buff[2]; 54 u32 unk1 = cmd_buff[2];
@@ -90,7 +88,7 @@ static void RecvBeaconBroadcastData(Service::Interface* self) {
90 * 2 : Value 0 88 * 2 : Value 0
91 * 3 : Output handle 89 * 3 : Output handle
92 */ 90 */
93static void InitializeWithVersion(Service::Interface* self) { 91static void InitializeWithVersion(Interface* self) {
94 u32* cmd_buff = Kernel::GetCommandBuffer(); 92 u32* cmd_buff = Kernel::GetCommandBuffer();
95 u32 unk1 = cmd_buff[1]; 93 u32 unk1 = cmd_buff[1];
96 u32 unk2 = cmd_buff[12]; 94 u32 unk2 = cmd_buff[12];
@@ -148,17 +146,15 @@ const Interface::FunctionInfo FunctionTable[] = {
148 {0x00220402, nullptr, "ScanOnConnection"}, 146 {0x00220402, nullptr, "ScanOnConnection"},
149}; 147};
150 148
151//////////////////////////////////////////////////////////////////////////////////////////////////// 149NWM_UDS::NWM_UDS() {
152// Interface class
153
154Interface::Interface() {
155 handle_event = Kernel::Event::Create(Kernel::ResetType::OneShot, "NWM_UDS::handle_event"); 150 handle_event = Kernel::Event::Create(Kernel::ResetType::OneShot, "NWM_UDS::handle_event");
156 151
157 Register(FunctionTable); 152 Register(FunctionTable);
158} 153}
159 154
160Interface::~Interface() { 155NWM_UDS::~NWM_UDS() {
161 handle_event = nullptr; 156 handle_event = nullptr;
162} 157}
163 158
164} // namespace 159} // namespace NWM
160} // namespace Service
diff --git a/src/core/hle/service/nwm_uds.h b/src/core/hle/service/nwm_uds.h
index 0ced2359c..55db748f6 100644
--- a/src/core/hle/service/nwm_uds.h
+++ b/src/core/hle/service/nwm_uds.h
@@ -6,21 +6,20 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9//////////////////////////////////////////////////////////////////////////////////////////////////// 9// Local-WLAN service
10// Namespace NWM_UDS
11 10
12// local-WLAN service 11namespace Service {
12namespace NWM {
13 13
14namespace NWM_UDS { 14class NWM_UDS final : public Interface {
15
16class Interface : public Service::Interface {
17public: 15public:
18 Interface(); 16 NWM_UDS();
19 ~Interface() override; 17 ~NWM_UDS() override;
20 18
21 std::string GetPortName() const override { 19 std::string GetPortName() const override {
22 return "nwm::UDS"; 20 return "nwm::UDS";
23 } 21 }
24}; 22};
25 23
26} // namespace 24} // namespace NWM
25} // namespace Service
diff --git a/src/core/hle/service/pm_app.cpp b/src/core/hle/service/pm_app.cpp
index 194d7c40d..caa16f952 100644
--- a/src/core/hle/service/pm_app.cpp
+++ b/src/core/hle/service/pm_app.cpp
@@ -4,10 +4,8 @@
4 4
5#include "core/hle/service/pm_app.h" 5#include "core/hle/service/pm_app.h"
6 6
7//////////////////////////////////////////////////////////////////////////////////////////////////// 7namespace Service {
8// Namespace PM_APP 8namespace PM {
9
10namespace PM_APP {
11 9
12const Interface::FunctionInfo FunctionTable[] = { 10const Interface::FunctionInfo FunctionTable[] = {
13 // clang-format off 11 // clang-format off
@@ -27,11 +25,9 @@ const Interface::FunctionInfo FunctionTable[] = {
27 // clang-format on 25 // clang-format on
28}; 26};
29 27
30//////////////////////////////////////////////////////////////////////////////////////////////////// 28PM_APP::PM_APP() {
31// Interface class
32
33Interface::Interface() {
34 Register(FunctionTable); 29 Register(FunctionTable);
35} 30}
36 31
37} // namespace 32} // namespace PM
33} // namespace Service
diff --git a/src/core/hle/service/pm_app.h b/src/core/hle/service/pm_app.h
index c1fb1f9da..151c69f3d 100644
--- a/src/core/hle/service/pm_app.h
+++ b/src/core/hle/service/pm_app.h
@@ -6,18 +6,17 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9//////////////////////////////////////////////////////////////////////////////////////////////////// 9namespace Service {
10// Namespace PM_APP 10namespace PM {
11 11
12namespace PM_APP { 12class PM_APP final : public Interface {
13
14class Interface : public Service::Interface {
15public: 13public:
16 Interface(); 14 PM_APP();
17 15
18 std::string GetPortName() const override { 16 std::string GetPortName() const override {
19 return "pm:app"; 17 return "pm:app";
20 } 18 }
21}; 19};
22 20
23} // namespace 21} // namespace PM
22} // namespace Service
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index 407ca4139..effecc043 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -109,8 +109,8 @@ void AddService(Interface* interface_) {
109 109
110/// Initialize ServiceManager 110/// Initialize ServiceManager
111void Init() { 111void Init() {
112 AddNamedPort(new SRV::Interface); 112 AddNamedPort(new SRV::SRV);
113 AddNamedPort(new ERR_F::Interface); 113 AddNamedPort(new ERR::ERR_F);
114 114
115 FS::ArchiveInit(); 115 FS::ArchiveInit();
116 AM::Init(); 116 AM::Init();
@@ -131,22 +131,22 @@ void Init() {
131 PTM::Init(); 131 PTM::Init();
132 QTM::Init(); 132 QTM::Init();
133 133
134 AddService(new AC_U::Interface); 134 AddService(new AC::AC_U);
135 AddService(new ACT_A::Interface); 135 AddService(new ACT::ACT_A);
136 AddService(new ACT_U::Interface); 136 AddService(new ACT::ACT_U);
137 AddService(new CSND_SND::Interface); 137 AddService(new CSND::CSND_SND);
138 AddService(new DSP_DSP::Interface); 138 AddService(new DSP_DSP::Interface);
139 AddService(new GSP_GPU::Interface); 139 AddService(new GSP::GSP_GPU);
140 AddService(new GSP_LCD::Interface); 140 AddService(new GSP::GSP_LCD);
141 AddService(new HTTP_C::Interface); 141 AddService(new HTTP::HTTP_C);
142 AddService(new LDR_RO::Interface); 142 AddService(new LDR::LDR_RO);
143 AddService(new MIC_U::Interface); 143 AddService(new MIC::MIC_U);
144 AddService(new NS_S::Interface); 144 AddService(new NS::NS_S);
145 AddService(new NWM_UDS::Interface); 145 AddService(new NWM::NWM_UDS);
146 AddService(new PM_APP::Interface); 146 AddService(new PM::PM_APP);
147 AddService(new SOC_U::Interface); 147 AddService(new SOC::SOC_U);
148 AddService(new SSL_C::Interface); 148 AddService(new SSL::SSL_C);
149 AddService(new Y2R_U::Interface); 149 AddService(new Y2R::Y2R_U);
150 150
151 LOG_DEBUG(Service, "initialized OK"); 151 LOG_DEBUG(Service, "initialized OK");
152} 152}
diff --git a/src/core/hle/service/soc_u.cpp b/src/core/hle/service/soc_u.cpp
index 46b75db25..fd251fc0a 100644
--- a/src/core/hle/service/soc_u.cpp
+++ b/src/core/hle/service/soc_u.cpp
@@ -53,12 +53,10 @@
53#define closesocket(x) close(x) 53#define closesocket(x) close(x)
54#endif 54#endif
55 55
56static const s32 SOCKET_ERROR_VALUE = -1; 56namespace Service {
57namespace SOC {
57 58
58//////////////////////////////////////////////////////////////////////////////////////////////////// 59const s32 SOCKET_ERROR_VALUE = -1;
59// Namespace SOC_U
60
61namespace SOC_U {
62 60
63/// Holds the translation from system network errors to 3DS network errors 61/// Holds the translation from system network errors to 3DS network errors
64static const std::unordered_map<int, int> error_map = {{ 62static const std::unordered_map<int, int> error_map = {{
@@ -339,7 +337,7 @@ static void CleanupSockets() {
339 open_sockets.clear(); 337 open_sockets.clear();
340} 338}
341 339
342static void Socket(Service::Interface* self) { 340static void Socket(Interface* self) {
343 u32* cmd_buffer = Kernel::GetCommandBuffer(); 341 u32* cmd_buffer = Kernel::GetCommandBuffer();
344 u32 domain = cmd_buffer[1]; // Address family 342 u32 domain = cmd_buffer[1]; // Address family
345 u32 type = cmd_buffer[2]; 343 u32 type = cmd_buffer[2];
@@ -378,7 +376,7 @@ static void Socket(Service::Interface* self) {
378 cmd_buffer[2] = socket_handle; 376 cmd_buffer[2] = socket_handle;
379} 377}
380 378
381static void Bind(Service::Interface* self) { 379static void Bind(Interface* self) {
382 u32* cmd_buffer = Kernel::GetCommandBuffer(); 380 u32* cmd_buffer = Kernel::GetCommandBuffer();
383 u32 socket_handle = cmd_buffer[1]; 381 u32 socket_handle = cmd_buffer[1];
384 u32 len = cmd_buffer[2]; 382 u32 len = cmd_buffer[2];
@@ -406,7 +404,7 @@ static void Bind(Service::Interface* self) {
406 cmd_buffer[2] = res; 404 cmd_buffer[2] = res;
407} 405}
408 406
409static void Fcntl(Service::Interface* self) { 407static void Fcntl(Interface* self) {
410 u32* cmd_buffer = Kernel::GetCommandBuffer(); 408 u32* cmd_buffer = Kernel::GetCommandBuffer();
411 u32 socket_handle = cmd_buffer[1]; 409 u32 socket_handle = cmd_buffer[1];
412 u32 ctr_cmd = cmd_buffer[2]; 410 u32 ctr_cmd = cmd_buffer[2];
@@ -475,7 +473,7 @@ static void Fcntl(Service::Interface* self) {
475 } 473 }
476} 474}
477 475
478static void Listen(Service::Interface* self) { 476static void Listen(Interface* self) {
479 u32* cmd_buffer = Kernel::GetCommandBuffer(); 477 u32* cmd_buffer = Kernel::GetCommandBuffer();
480 u32 socket_handle = cmd_buffer[1]; 478 u32 socket_handle = cmd_buffer[1];
481 u32 backlog = cmd_buffer[2]; 479 u32 backlog = cmd_buffer[2];
@@ -490,7 +488,7 @@ static void Listen(Service::Interface* self) {
490 cmd_buffer[2] = ret; 488 cmd_buffer[2] = ret;
491} 489}
492 490
493static void Accept(Service::Interface* self) { 491static void Accept(Interface* self) {
494 // TODO(Subv): Calling this function on a blocking socket will block the emu thread, 492 // TODO(Subv): Calling this function on a blocking socket will block the emu thread,
495 // preventing graceful shutdown when closing the emulator, this can be fixed by always 493 // preventing graceful shutdown when closing the emulator, this can be fixed by always
496 // performing nonblocking operations and spinlock until the data is available 494 // performing nonblocking operations and spinlock until the data is available
@@ -518,7 +516,7 @@ static void Accept(Service::Interface* self) {
518 cmd_buffer[3] = IPC::StaticBufferDesc(static_cast<u32>(max_addr_len), 0); 516 cmd_buffer[3] = IPC::StaticBufferDesc(static_cast<u32>(max_addr_len), 0);
519} 517}
520 518
521static void GetHostId(Service::Interface* self) { 519static void GetHostId(Interface* self) {
522 u32* cmd_buffer = Kernel::GetCommandBuffer(); 520 u32* cmd_buffer = Kernel::GetCommandBuffer();
523 521
524 char name[128]; 522 char name[128];
@@ -536,7 +534,7 @@ static void GetHostId(Service::Interface* self) {
536 freeaddrinfo(res); 534 freeaddrinfo(res);
537} 535}
538 536
539static void Close(Service::Interface* self) { 537static void Close(Interface* self) {
540 u32* cmd_buffer = Kernel::GetCommandBuffer(); 538 u32* cmd_buffer = Kernel::GetCommandBuffer();
541 u32 socket_handle = cmd_buffer[1]; 539 u32 socket_handle = cmd_buffer[1];
542 540
@@ -553,7 +551,7 @@ static void Close(Service::Interface* self) {
553 cmd_buffer[1] = result; 551 cmd_buffer[1] = result;
554} 552}
555 553
556static void SendTo(Service::Interface* self) { 554static void SendTo(Interface* self) {
557 u32* cmd_buffer = Kernel::GetCommandBuffer(); 555 u32* cmd_buffer = Kernel::GetCommandBuffer();
558 u32 socket_handle = cmd_buffer[1]; 556 u32 socket_handle = cmd_buffer[1];
559 u32 len = cmd_buffer[2]; 557 u32 len = cmd_buffer[2];
@@ -597,7 +595,7 @@ static void SendTo(Service::Interface* self) {
597 cmd_buffer[1] = result; 595 cmd_buffer[1] = result;
598} 596}
599 597
600static void RecvFrom(Service::Interface* self) { 598static void RecvFrom(Interface* self) {
601 // TODO(Subv): Calling this function on a blocking socket will block the emu thread, 599 // TODO(Subv): Calling this function on a blocking socket will block the emu thread,
602 // preventing graceful shutdown when closing the emulator, this can be fixed by always 600 // preventing graceful shutdown when closing the emulator, this can be fixed by always
603 // performing nonblocking operations and spinlock until the data is available 601 // performing nonblocking operations and spinlock until the data is available
@@ -654,7 +652,7 @@ static void RecvFrom(Service::Interface* self) {
654 cmd_buffer[3] = total_received; 652 cmd_buffer[3] = total_received;
655} 653}
656 654
657static void Poll(Service::Interface* self) { 655static void Poll(Interface* self) {
658 u32* cmd_buffer = Kernel::GetCommandBuffer(); 656 u32* cmd_buffer = Kernel::GetCommandBuffer();
659 u32 nfds = cmd_buffer[1]; 657 u32 nfds = cmd_buffer[1];
660 int timeout = cmd_buffer[2]; 658 int timeout = cmd_buffer[2];
@@ -692,7 +690,7 @@ static void Poll(Service::Interface* self) {
692 cmd_buffer[2] = ret; 690 cmd_buffer[2] = ret;
693} 691}
694 692
695static void GetSockName(Service::Interface* self) { 693static void GetSockName(Interface* self) {
696 u32* cmd_buffer = Kernel::GetCommandBuffer(); 694 u32* cmd_buffer = Kernel::GetCommandBuffer();
697 u32 socket_handle = cmd_buffer[1]; 695 u32 socket_handle = cmd_buffer[1];
698 socklen_t ctr_len = cmd_buffer[2]; 696 socklen_t ctr_len = cmd_buffer[2];
@@ -720,7 +718,7 @@ static void GetSockName(Service::Interface* self) {
720 cmd_buffer[1] = result; 718 cmd_buffer[1] = result;
721} 719}
722 720
723static void Shutdown(Service::Interface* self) { 721static void Shutdown(Interface* self) {
724 u32* cmd_buffer = Kernel::GetCommandBuffer(); 722 u32* cmd_buffer = Kernel::GetCommandBuffer();
725 u32 socket_handle = cmd_buffer[1]; 723 u32 socket_handle = cmd_buffer[1];
726 int how = cmd_buffer[2]; 724 int how = cmd_buffer[2];
@@ -733,7 +731,7 @@ static void Shutdown(Service::Interface* self) {
733 cmd_buffer[1] = result; 731 cmd_buffer[1] = result;
734} 732}
735 733
736static void GetPeerName(Service::Interface* self) { 734static void GetPeerName(Interface* self) {
737 u32* cmd_buffer = Kernel::GetCommandBuffer(); 735 u32* cmd_buffer = Kernel::GetCommandBuffer();
738 u32 socket_handle = cmd_buffer[1]; 736 u32 socket_handle = cmd_buffer[1];
739 socklen_t len = cmd_buffer[2]; 737 socklen_t len = cmd_buffer[2];
@@ -761,7 +759,7 @@ static void GetPeerName(Service::Interface* self) {
761 cmd_buffer[1] = result; 759 cmd_buffer[1] = result;
762} 760}
763 761
764static void Connect(Service::Interface* self) { 762static void Connect(Interface* self) {
765 // TODO(Subv): Calling this function on a blocking socket will block the emu thread, 763 // TODO(Subv): Calling this function on a blocking socket will block the emu thread,
766 // preventing graceful shutdown when closing the emulator, this can be fixed by always 764 // preventing graceful shutdown when closing the emulator, this can be fixed by always
767 // performing nonblocking operations and spinlock until the data is available 765 // performing nonblocking operations and spinlock until the data is available
@@ -790,7 +788,7 @@ static void Connect(Service::Interface* self) {
790 cmd_buffer[2] = ret; 788 cmd_buffer[2] = ret;
791} 789}
792 790
793static void InitializeSockets(Service::Interface* self) { 791static void InitializeSockets(Interface* self) {
794// TODO(Subv): Implement 792// TODO(Subv): Implement
795#ifdef _WIN32 793#ifdef _WIN32
796 WSADATA data; 794 WSADATA data;
@@ -802,7 +800,7 @@ static void InitializeSockets(Service::Interface* self) {
802 cmd_buffer[1] = RESULT_SUCCESS.raw; 800 cmd_buffer[1] = RESULT_SUCCESS.raw;
803} 801}
804 802
805static void ShutdownSockets(Service::Interface* self) { 803static void ShutdownSockets(Interface* self) {
806 // TODO(Subv): Implement 804 // TODO(Subv): Implement
807 CleanupSockets(); 805 CleanupSockets();
808 806
@@ -814,7 +812,7 @@ static void ShutdownSockets(Service::Interface* self) {
814 cmd_buffer[1] = 0; 812 cmd_buffer[1] = 0;
815} 813}
816 814
817static void GetSockOpt(Service::Interface* self) { 815static void GetSockOpt(Interface* self) {
818 u32* cmd_buffer = Kernel::GetCommandBuffer(); 816 u32* cmd_buffer = Kernel::GetCommandBuffer();
819 u32 socket_handle = cmd_buffer[1]; 817 u32 socket_handle = cmd_buffer[1];
820 u32 level = cmd_buffer[2]; 818 u32 level = cmd_buffer[2];
@@ -849,7 +847,7 @@ static void GetSockOpt(Service::Interface* self) {
849 cmd_buffer[3] = optlen; 847 cmd_buffer[3] = optlen;
850} 848}
851 849
852static void SetSockOpt(Service::Interface* self) { 850static void SetSockOpt(Interface* self) {
853 u32* cmd_buffer = Kernel::GetCommandBuffer(); 851 u32* cmd_buffer = Kernel::GetCommandBuffer();
854 u32 socket_handle = cmd_buffer[1]; 852 u32 socket_handle = cmd_buffer[1];
855 u32 level = cmd_buffer[2]; 853 u32 level = cmd_buffer[2];
@@ -916,18 +914,16 @@ const Interface::FunctionInfo FunctionTable[] = {
916 {0x00230040, nullptr, "AddGlobalSocket"}, 914 {0x00230040, nullptr, "AddGlobalSocket"},
917}; 915};
918 916
919//////////////////////////////////////////////////////////////////////////////////////////////////// 917SOC_U::SOC_U() {
920// Interface class
921
922Interface::Interface() {
923 Register(FunctionTable); 918 Register(FunctionTable);
924} 919}
925 920
926Interface::~Interface() { 921SOC_U::~SOC_U() {
927 CleanupSockets(); 922 CleanupSockets();
928#ifdef _WIN32 923#ifdef _WIN32
929 WSACleanup(); 924 WSACleanup();
930#endif 925#endif
931} 926}
932 927
933} // namespace 928} // namespace SOC
929} // namespace Service
diff --git a/src/core/hle/service/soc_u.h b/src/core/hle/service/soc_u.h
index 8d02ed30f..5f829fc1c 100644
--- a/src/core/hle/service/soc_u.h
+++ b/src/core/hle/service/soc_u.h
@@ -7,19 +7,18 @@
7#include <string> 7#include <string>
8#include "core/hle/service/service.h" 8#include "core/hle/service/service.h"
9 9
10//////////////////////////////////////////////////////////////////////////////////////////////////// 10namespace Service {
11// Namespace SOC_U 11namespace SOC {
12 12
13namespace SOC_U { 13class SOC_U final : public Interface {
14
15class Interface : public Service::Interface {
16public: 14public:
17 Interface(); 15 SOC_U();
18 ~Interface(); 16 ~SOC_U();
19 17
20 std::string GetPortName() const override { 18 std::string GetPortName() const override {
21 return "soc:U"; 19 return "soc:U";
22 } 20 }
23}; 21};
24 22
25} // namespace 23} // namespace SOC
24} // namespace Service
diff --git a/src/core/hle/service/srv.cpp b/src/core/hle/service/srv.cpp
index b25be413a..f8df38c42 100644
--- a/src/core/hle/service/srv.cpp
+++ b/src/core/hle/service/srv.cpp
@@ -7,9 +7,7 @@
7#include "core/hle/kernel/event.h" 7#include "core/hle/kernel/event.h"
8#include "core/hle/service/srv.h" 8#include "core/hle/service/srv.h"
9 9
10//////////////////////////////////////////////////////////////////////////////////////////////////// 10namespace Service {
11// Namespace SRV
12
13namespace SRV { 11namespace SRV {
14 12
15static Kernel::SharedPtr<Kernel::Event> event_handle; 13static Kernel::SharedPtr<Kernel::Event> event_handle;
@@ -23,7 +21,7 @@ static Kernel::SharedPtr<Kernel::Event> event_handle;
23 * 0: 0x00010040 21 * 0: 0x00010040
24 * 1: ResultCode 22 * 1: ResultCode
25 */ 23 */
26static void RegisterClient(Service::Interface* self) { 24static void RegisterClient(Interface* self) {
27 u32* cmd_buff = Kernel::GetCommandBuffer(); 25 u32* cmd_buff = Kernel::GetCommandBuffer();
28 26
29 if (cmd_buff[1] != IPC::CallingPidDesc()) { 27 if (cmd_buff[1] != IPC::CallingPidDesc()) {
@@ -48,7 +46,7 @@ static void RegisterClient(Service::Interface* self) {
48 * 2: Translation descriptor: 0x20 46 * 2: Translation descriptor: 0x20
49 * 3: Handle to semaphore signaled on process notification 47 * 3: Handle to semaphore signaled on process notification
50 */ 48 */
51static void EnableNotification(Service::Interface* self) { 49static void EnableNotification(Interface* self) {
52 u32* cmd_buff = Kernel::GetCommandBuffer(); 50 u32* cmd_buff = Kernel::GetCommandBuffer();
53 51
54 // TODO(bunnei): Change to a semaphore once these have been implemented 52 // TODO(bunnei): Change to a semaphore once these have been implemented
@@ -73,7 +71,7 @@ static void EnableNotification(Service::Interface* self) {
73 * 1: ResultCode 71 * 1: ResultCode
74 * 3: Service handle 72 * 3: Service handle
75 */ 73 */
76static void GetServiceHandle(Service::Interface* self) { 74static void GetServiceHandle(Interface* self) {
77 ResultCode res = RESULT_SUCCESS; 75 ResultCode res = RESULT_SUCCESS;
78 u32* cmd_buff = Kernel::GetCommandBuffer(); 76 u32* cmd_buff = Kernel::GetCommandBuffer();
79 77
@@ -99,7 +97,7 @@ static void GetServiceHandle(Service::Interface* self) {
99 * 0: 0x00090040 97 * 0: 0x00090040
100 * 1: ResultCode 98 * 1: ResultCode
101 */ 99 */
102static void Subscribe(Service::Interface* self) { 100static void Subscribe(Interface* self) {
103 u32* cmd_buff = Kernel::GetCommandBuffer(); 101 u32* cmd_buff = Kernel::GetCommandBuffer();
104 102
105 u32 notification_id = cmd_buff[1]; 103 u32 notification_id = cmd_buff[1];
@@ -118,7 +116,7 @@ static void Subscribe(Service::Interface* self) {
118 * 0: 0x000A0040 116 * 0: 0x000A0040
119 * 1: ResultCode 117 * 1: ResultCode
120 */ 118 */
121static void Unsubscribe(Service::Interface* self) { 119static void Unsubscribe(Interface* self) {
122 u32* cmd_buff = Kernel::GetCommandBuffer(); 120 u32* cmd_buff = Kernel::GetCommandBuffer();
123 121
124 u32 notification_id = cmd_buff[1]; 122 u32 notification_id = cmd_buff[1];
@@ -138,7 +136,7 @@ static void Unsubscribe(Service::Interface* self) {
138 * 0: 0x000C0040 136 * 0: 0x000C0040
139 * 1: ResultCode 137 * 1: ResultCode
140 */ 138 */
141static void PublishToSubscriber(Service::Interface* self) { 139static void PublishToSubscriber(Interface* self) {
142 u32* cmd_buff = Kernel::GetCommandBuffer(); 140 u32* cmd_buff = Kernel::GetCommandBuffer();
143 141
144 u32 notification_id = cmd_buff[1]; 142 u32 notification_id = cmd_buff[1];
@@ -167,16 +165,14 @@ const Interface::FunctionInfo FunctionTable[] = {
167 {0x000E00C0, nullptr, "IsServiceRegistered"}, 165 {0x000E00C0, nullptr, "IsServiceRegistered"},
168}; 166};
169 167
170//////////////////////////////////////////////////////////////////////////////////////////////////// 168SRV::SRV() {
171// Interface class
172
173Interface::Interface() {
174 Register(FunctionTable); 169 Register(FunctionTable);
175 event_handle = nullptr; 170 event_handle = nullptr;
176} 171}
177 172
178Interface::~Interface() { 173SRV::~SRV() {
179 event_handle = nullptr; 174 event_handle = nullptr;
180} 175}
181 176
182} // namespace SRV 177} // namespace SRV
178} // namespace Service
diff --git a/src/core/hle/service/srv.h b/src/core/hle/service/srv.h
index 96c89b025..6041ca42d 100644
--- a/src/core/hle/service/srv.h
+++ b/src/core/hle/service/srv.h
@@ -4,20 +4,19 @@
4 4
5#include "core/hle/service/service.h" 5#include "core/hle/service/service.h"
6 6
7//////////////////////////////////////////////////////////////////////////////////////////////////// 7namespace Service {
8// Namespace SRV
9
10namespace SRV { 8namespace SRV {
11 9
12/// Interface to "srv:" service 10/// Interface to "srv:" service
13class Interface : public Service::Interface { 11class SRV final : public Interface {
14public: 12public:
15 Interface(); 13 SRV();
16 ~Interface() override; 14 ~SRV() override;
17 15
18 std::string GetPortName() const override { 16 std::string GetPortName() const override {
19 return "srv:"; 17 return "srv:";
20 } 18 }
21}; 19};
22 20
23} // namespace 21} // namespace SRV
22} // namespace Service
diff --git a/src/core/hle/service/ssl_c.cpp b/src/core/hle/service/ssl_c.cpp
index 6d36e5a24..09ced9d7a 100644
--- a/src/core/hle/service/ssl_c.cpp
+++ b/src/core/hle/service/ssl_c.cpp
@@ -6,15 +6,13 @@
6#include "common/common_types.h" 6#include "common/common_types.h"
7#include "core/hle/service/ssl_c.h" 7#include "core/hle/service/ssl_c.h"
8 8
9//////////////////////////////////////////////////////////////////////////////////////////////////// 9namespace Service {
10// Namespace SSL_C 10namespace SSL {
11
12namespace SSL_C {
13 11
14// TODO: Implement a proper CSPRNG in the future when actual security is needed 12// TODO: Implement a proper CSPRNG in the future when actual security is needed
15static std::mt19937 rand_gen; 13static std::mt19937 rand_gen;
16 14
17static void Initialize(Service::Interface* self) { 15static void Initialize(Interface* self) {
18 u32* cmd_buff = Kernel::GetCommandBuffer(); 16 u32* cmd_buff = Kernel::GetCommandBuffer();
19 17
20 // Seed random number generator when the SSL service is initialized 18 // Seed random number generator when the SSL service is initialized
@@ -25,7 +23,7 @@ static void Initialize(Service::Interface* self) {
25 cmd_buff[1] = RESULT_SUCCESS.raw; 23 cmd_buff[1] = RESULT_SUCCESS.raw;
26} 24}
27 25
28static void GenerateRandomData(Service::Interface* self) { 26static void GenerateRandomData(Interface* self) {
29 u32* cmd_buff = Kernel::GetCommandBuffer(); 27 u32* cmd_buff = Kernel::GetCommandBuffer();
30 28
31 u32 size = cmd_buff[1]; 29 u32 size = cmd_buff[1];
@@ -84,11 +82,9 @@ const Interface::FunctionInfo FunctionTable[] = {
84 {0x001F0082, nullptr, "ContextInitSharedmem"}, 82 {0x001F0082, nullptr, "ContextInitSharedmem"},
85}; 83};
86 84
87//////////////////////////////////////////////////////////////////////////////////////////////////// 85SSL_C::SSL_C() {
88// Interface class
89
90Interface::Interface() {
91 Register(FunctionTable); 86 Register(FunctionTable);
92} 87}
93 88
94} // namespace 89} // namespace SSL_C
90} // namespace Service
diff --git a/src/core/hle/service/ssl_c.h b/src/core/hle/service/ssl_c.h
index 58e87c1cb..fc50a2eb2 100644
--- a/src/core/hle/service/ssl_c.h
+++ b/src/core/hle/service/ssl_c.h
@@ -6,18 +6,17 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9//////////////////////////////////////////////////////////////////////////////////////////////////// 9namespace Service {
10// Namespace SSL_C 10namespace SSL {
11 11
12namespace SSL_C { 12class SSL_C final : public Interface {
13
14class Interface : public Service::Interface {
15public: 13public:
16 Interface(); 14 SSL_C();
17 15
18 std::string GetPortName() const override { 16 std::string GetPortName() const override {
19 return "ssl:C"; 17 return "ssl:C";
20 } 18 }
21}; 19};
22 20
23} // namespace 21} // namespace SSL
22} // namespace Service
diff --git a/src/core/hle/service/y2r_u.cpp b/src/core/hle/service/y2r_u.cpp
index 097e09d28..a20194107 100644
--- a/src/core/hle/service/y2r_u.cpp
+++ b/src/core/hle/service/y2r_u.cpp
@@ -11,10 +11,8 @@
11#include "core/hle/service/y2r_u.h" 11#include "core/hle/service/y2r_u.h"
12#include "core/hw/y2r.h" 12#include "core/hw/y2r.h"
13 13
14//////////////////////////////////////////////////////////////////////////////////////////////////// 14namespace Service {
15// Namespace Y2R_U 15namespace Y2R {
16
17namespace Y2R_U {
18 16
19struct ConversionParameters { 17struct ConversionParameters {
20 InputFormat input_format; 18 InputFormat input_format;
@@ -83,7 +81,7 @@ ResultCode ConversionConfiguration::SetStandardCoefficient(
83 return RESULT_SUCCESS; 81 return RESULT_SUCCESS;
84} 82}
85 83
86static void SetInputFormat(Service::Interface* self) { 84static void SetInputFormat(Interface* self) {
87 u32* cmd_buff = Kernel::GetCommandBuffer(); 85 u32* cmd_buff = Kernel::GetCommandBuffer();
88 86
89 conversion.input_format = static_cast<InputFormat>(cmd_buff[1]); 87 conversion.input_format = static_cast<InputFormat>(cmd_buff[1]);
@@ -94,7 +92,7 @@ static void SetInputFormat(Service::Interface* self) {
94 LOG_DEBUG(Service_Y2R, "called input_format=%hhu", conversion.input_format); 92 LOG_DEBUG(Service_Y2R, "called input_format=%hhu", conversion.input_format);
95} 93}
96 94
97static void GetInputFormat(Service::Interface* self) { 95static void GetInputFormat(Interface* self) {
98 u32* cmd_buff = Kernel::GetCommandBuffer(); 96 u32* cmd_buff = Kernel::GetCommandBuffer();
99 97
100 cmd_buff[0] = IPC::MakeHeader(0x2, 2, 0); 98 cmd_buff[0] = IPC::MakeHeader(0x2, 2, 0);
@@ -104,7 +102,7 @@ static void GetInputFormat(Service::Interface* self) {
104 LOG_DEBUG(Service_Y2R, "called input_format=%hhu", conversion.input_format); 102 LOG_DEBUG(Service_Y2R, "called input_format=%hhu", conversion.input_format);
105} 103}
106 104
107static void SetOutputFormat(Service::Interface* self) { 105static void SetOutputFormat(Interface* self) {
108 u32* cmd_buff = Kernel::GetCommandBuffer(); 106 u32* cmd_buff = Kernel::GetCommandBuffer();
109 107
110 conversion.output_format = static_cast<OutputFormat>(cmd_buff[1]); 108 conversion.output_format = static_cast<OutputFormat>(cmd_buff[1]);
@@ -115,7 +113,7 @@ static void SetOutputFormat(Service::Interface* self) {
115 LOG_DEBUG(Service_Y2R, "called output_format=%hhu", conversion.output_format); 113 LOG_DEBUG(Service_Y2R, "called output_format=%hhu", conversion.output_format);
116} 114}
117 115
118static void GetOutputFormat(Service::Interface* self) { 116static void GetOutputFormat(Interface* self) {
119 u32* cmd_buff = Kernel::GetCommandBuffer(); 117 u32* cmd_buff = Kernel::GetCommandBuffer();
120 118
121 cmd_buff[0] = IPC::MakeHeader(0x4, 2, 0); 119 cmd_buff[0] = IPC::MakeHeader(0x4, 2, 0);
@@ -125,7 +123,7 @@ static void GetOutputFormat(Service::Interface* self) {
125 LOG_DEBUG(Service_Y2R, "called output_format=%hhu", conversion.output_format); 123 LOG_DEBUG(Service_Y2R, "called output_format=%hhu", conversion.output_format);
126} 124}
127 125
128static void SetRotation(Service::Interface* self) { 126static void SetRotation(Interface* self) {
129 u32* cmd_buff = Kernel::GetCommandBuffer(); 127 u32* cmd_buff = Kernel::GetCommandBuffer();
130 128
131 conversion.rotation = static_cast<Rotation>(cmd_buff[1]); 129 conversion.rotation = static_cast<Rotation>(cmd_buff[1]);
@@ -136,7 +134,7 @@ static void SetRotation(Service::Interface* self) {
136 LOG_DEBUG(Service_Y2R, "called rotation=%hhu", conversion.rotation); 134 LOG_DEBUG(Service_Y2R, "called rotation=%hhu", conversion.rotation);
137} 135}
138 136
139static void GetRotation(Service::Interface* self) { 137static void GetRotation(Interface* self) {
140 u32* cmd_buff = Kernel::GetCommandBuffer(); 138 u32* cmd_buff = Kernel::GetCommandBuffer();
141 139
142 cmd_buff[0] = IPC::MakeHeader(0x6, 2, 0); 140 cmd_buff[0] = IPC::MakeHeader(0x6, 2, 0);
@@ -146,7 +144,7 @@ static void GetRotation(Service::Interface* self) {
146 LOG_DEBUG(Service_Y2R, "called rotation=%hhu", conversion.rotation); 144 LOG_DEBUG(Service_Y2R, "called rotation=%hhu", conversion.rotation);
147} 145}
148 146
149static void SetBlockAlignment(Service::Interface* self) { 147static void SetBlockAlignment(Interface* self) {
150 u32* cmd_buff = Kernel::GetCommandBuffer(); 148 u32* cmd_buff = Kernel::GetCommandBuffer();
151 149
152 conversion.block_alignment = static_cast<BlockAlignment>(cmd_buff[1]); 150 conversion.block_alignment = static_cast<BlockAlignment>(cmd_buff[1]);
@@ -157,7 +155,7 @@ static void SetBlockAlignment(Service::Interface* self) {
157 LOG_DEBUG(Service_Y2R, "called block_alignment=%hhu", conversion.block_alignment); 155 LOG_DEBUG(Service_Y2R, "called block_alignment=%hhu", conversion.block_alignment);
158} 156}
159 157
160static void GetBlockAlignment(Service::Interface* self) { 158static void GetBlockAlignment(Interface* self) {
161 u32* cmd_buff = Kernel::GetCommandBuffer(); 159 u32* cmd_buff = Kernel::GetCommandBuffer();
162 160
163 cmd_buff[0] = IPC::MakeHeader(0x8, 2, 0); 161 cmd_buff[0] = IPC::MakeHeader(0x8, 2, 0);
@@ -174,7 +172,7 @@ static void GetBlockAlignment(Service::Interface* self) {
174 * Outputs: 172 * Outputs:
175 * 1 : Result of function, 0 on success, otherwise error code 173 * 1 : Result of function, 0 on success, otherwise error code
176 */ 174 */
177static void SetSpacialDithering(Service::Interface* self) { 175static void SetSpacialDithering(Interface* self) {
178 u32* cmd_buff = Kernel::GetCommandBuffer(); 176 u32* cmd_buff = Kernel::GetCommandBuffer();
179 spacial_dithering_enabled = cmd_buff[1] & 0xF; 177 spacial_dithering_enabled = cmd_buff[1] & 0xF;
180 178
@@ -190,7 +188,7 @@ static void SetSpacialDithering(Service::Interface* self) {
190 * 1 : Result of function, 0 on success, otherwise error code 188 * 1 : Result of function, 0 on success, otherwise error code
191 * 2 : u8, 0 = Disabled, 1 = Enabled 189 * 2 : u8, 0 = Disabled, 1 = Enabled
192 */ 190 */
193static void GetSpacialDithering(Service::Interface* self) { 191static void GetSpacialDithering(Interface* self) {
194 u32* cmd_buff = Kernel::GetCommandBuffer(); 192 u32* cmd_buff = Kernel::GetCommandBuffer();
195 193
196 cmd_buff[0] = IPC::MakeHeader(0xA, 2, 0); 194 cmd_buff[0] = IPC::MakeHeader(0xA, 2, 0);
@@ -207,7 +205,7 @@ static void GetSpacialDithering(Service::Interface* self) {
207 * Outputs: 205 * Outputs:
208 * 1 : Result of function, 0 on success, otherwise error code 206 * 1 : Result of function, 0 on success, otherwise error code
209 */ 207 */
210static void SetTemporalDithering(Service::Interface* self) { 208static void SetTemporalDithering(Interface* self) {
211 u32* cmd_buff = Kernel::GetCommandBuffer(); 209 u32* cmd_buff = Kernel::GetCommandBuffer();
212 temporal_dithering_enabled = cmd_buff[1] & 0xF; 210 temporal_dithering_enabled = cmd_buff[1] & 0xF;
213 211
@@ -223,7 +221,7 @@ static void SetTemporalDithering(Service::Interface* self) {
223 * 1 : Result of function, 0 on success, otherwise error code 221 * 1 : Result of function, 0 on success, otherwise error code
224 * 2 : u8, 0 = Disabled, 1 = Enabled 222 * 2 : u8, 0 = Disabled, 1 = Enabled
225 */ 223 */
226static void GetTemporalDithering(Service::Interface* self) { 224static void GetTemporalDithering(Interface* self) {
227 u32* cmd_buff = Kernel::GetCommandBuffer(); 225 u32* cmd_buff = Kernel::GetCommandBuffer();
228 226
229 cmd_buff[0] = IPC::MakeHeader(0xC, 2, 0); 227 cmd_buff[0] = IPC::MakeHeader(0xC, 2, 0);
@@ -240,7 +238,7 @@ static void GetTemporalDithering(Service::Interface* self) {
240 * Outputs: 238 * Outputs:
241 * 1 : Result of function, 0 on success, otherwise error code 239 * 1 : Result of function, 0 on success, otherwise error code
242 */ 240 */
243static void SetTransferEndInterrupt(Service::Interface* self) { 241static void SetTransferEndInterrupt(Interface* self) {
244 u32* cmd_buff = Kernel::GetCommandBuffer(); 242 u32* cmd_buff = Kernel::GetCommandBuffer();
245 transfer_end_interrupt_enabled = cmd_buff[1] & 0xf; 243 transfer_end_interrupt_enabled = cmd_buff[1] & 0xf;
246 244
@@ -256,7 +254,7 @@ static void SetTransferEndInterrupt(Service::Interface* self) {
256 * 1 : Result of function, 0 on success, otherwise error code 254 * 1 : Result of function, 0 on success, otherwise error code
257 * 2 : u8, 0 = Disabled, 1 = Enabled 255 * 2 : u8, 0 = Disabled, 1 = Enabled
258 */ 256 */
259static void GetTransferEndInterrupt(Service::Interface* self) { 257static void GetTransferEndInterrupt(Interface* self) {
260 u32* cmd_buff = Kernel::GetCommandBuffer(); 258 u32* cmd_buff = Kernel::GetCommandBuffer();
261 259
262 cmd_buff[0] = IPC::MakeHeader(0xE, 2, 0); 260 cmd_buff[0] = IPC::MakeHeader(0xE, 2, 0);
@@ -272,7 +270,7 @@ static void GetTransferEndInterrupt(Service::Interface* self) {
272 * 1 : Result of function, 0 on success, otherwise error code 270 * 1 : Result of function, 0 on success, otherwise error code
273 * 3 : The handle of the completion event 271 * 3 : The handle of the completion event
274 */ 272 */
275static void GetTransferEndEvent(Service::Interface* self) { 273static void GetTransferEndEvent(Interface* self) {
276 u32* cmd_buff = Kernel::GetCommandBuffer(); 274 u32* cmd_buff = Kernel::GetCommandBuffer();
277 275
278 cmd_buff[0] = IPC::MakeHeader(0xF, 2, 0); 276 cmd_buff[0] = IPC::MakeHeader(0xF, 2, 0);
@@ -282,7 +280,7 @@ static void GetTransferEndEvent(Service::Interface* self) {
282 LOG_DEBUG(Service_Y2R, "called"); 280 LOG_DEBUG(Service_Y2R, "called");
283} 281}
284 282
285static void SetSendingY(Service::Interface* self) { 283static void SetSendingY(Interface* self) {
286 u32* cmd_buff = Kernel::GetCommandBuffer(); 284 u32* cmd_buff = Kernel::GetCommandBuffer();
287 285
288 conversion.src_Y.address = cmd_buff[1]; 286 conversion.src_Y.address = cmd_buff[1];
@@ -299,7 +297,7 @@ static void SetSendingY(Service::Interface* self) {
299 cmd_buff[6]); 297 cmd_buff[6]);
300} 298}
301 299
302static void SetSendingU(Service::Interface* self) { 300static void SetSendingU(Interface* self) {
303 u32* cmd_buff = Kernel::GetCommandBuffer(); 301 u32* cmd_buff = Kernel::GetCommandBuffer();
304 302
305 conversion.src_U.address = cmd_buff[1]; 303 conversion.src_U.address = cmd_buff[1];
@@ -316,7 +314,7 @@ static void SetSendingU(Service::Interface* self) {
316 cmd_buff[6]); 314 cmd_buff[6]);
317} 315}
318 316
319static void SetSendingV(Service::Interface* self) { 317static void SetSendingV(Interface* self) {
320 u32* cmd_buff = Kernel::GetCommandBuffer(); 318 u32* cmd_buff = Kernel::GetCommandBuffer();
321 319
322 conversion.src_V.address = cmd_buff[1]; 320 conversion.src_V.address = cmd_buff[1];
@@ -333,7 +331,7 @@ static void SetSendingV(Service::Interface* self) {
333 cmd_buff[6]); 331 cmd_buff[6]);
334} 332}
335 333
336static void SetSendingYUYV(Service::Interface* self) { 334static void SetSendingYUYV(Interface* self) {
337 u32* cmd_buff = Kernel::GetCommandBuffer(); 335 u32* cmd_buff = Kernel::GetCommandBuffer();
338 336
339 conversion.src_YUYV.address = cmd_buff[1]; 337 conversion.src_YUYV.address = cmd_buff[1];
@@ -356,7 +354,7 @@ static void SetSendingYUYV(Service::Interface* self) {
356 * 1 : Result of the function, 0 on success, otherwise error code 354 * 1 : Result of the function, 0 on success, otherwise error code
357 * 2 : u8, 0 = Not Finished, 1 = Finished 355 * 2 : u8, 0 = Not Finished, 1 = Finished
358 */ 356 */
359static void IsFinishedSendingYuv(Service::Interface* self) { 357static void IsFinishedSendingYuv(Interface* self) {
360 u32* cmd_buff = Kernel::GetCommandBuffer(); 358 u32* cmd_buff = Kernel::GetCommandBuffer();
361 359
362 cmd_buff[0] = IPC::MakeHeader(0x14, 2, 0); 360 cmd_buff[0] = IPC::MakeHeader(0x14, 2, 0);
@@ -372,7 +370,7 @@ static void IsFinishedSendingYuv(Service::Interface* self) {
372 * 1 : Result of the function, 0 on success, otherwise error code 370 * 1 : Result of the function, 0 on success, otherwise error code
373 * 2 : u8, 0 = Not Finished, 1 = Finished 371 * 2 : u8, 0 = Not Finished, 1 = Finished
374 */ 372 */
375static void IsFinishedSendingY(Service::Interface* self) { 373static void IsFinishedSendingY(Interface* self) {
376 u32* cmd_buff = Kernel::GetCommandBuffer(); 374 u32* cmd_buff = Kernel::GetCommandBuffer();
377 375
378 cmd_buff[0] = IPC::MakeHeader(0x15, 2, 0); 376 cmd_buff[0] = IPC::MakeHeader(0x15, 2, 0);
@@ -388,7 +386,7 @@ static void IsFinishedSendingY(Service::Interface* self) {
388 * 1 : Result of the function, 0 on success, otherwise error code 386 * 1 : Result of the function, 0 on success, otherwise error code
389 * 2 : u8, 0 = Not Finished, 1 = Finished 387 * 2 : u8, 0 = Not Finished, 1 = Finished
390 */ 388 */
391static void IsFinishedSendingU(Service::Interface* self) { 389static void IsFinishedSendingU(Interface* self) {
392 u32* cmd_buff = Kernel::GetCommandBuffer(); 390 u32* cmd_buff = Kernel::GetCommandBuffer();
393 391
394 cmd_buff[0] = IPC::MakeHeader(0x16, 2, 0); 392 cmd_buff[0] = IPC::MakeHeader(0x16, 2, 0);
@@ -404,7 +402,7 @@ static void IsFinishedSendingU(Service::Interface* self) {
404 * 1 : Result of the function, 0 on success, otherwise error code 402 * 1 : Result of the function, 0 on success, otherwise error code
405 * 2 : u8, 0 = Not Finished, 1 = Finished 403 * 2 : u8, 0 = Not Finished, 1 = Finished
406 */ 404 */
407static void IsFinishedSendingV(Service::Interface* self) { 405static void IsFinishedSendingV(Interface* self) {
408 u32* cmd_buff = Kernel::GetCommandBuffer(); 406 u32* cmd_buff = Kernel::GetCommandBuffer();
409 407
410 cmd_buff[0] = IPC::MakeHeader(0x17, 2, 0); 408 cmd_buff[0] = IPC::MakeHeader(0x17, 2, 0);
@@ -414,7 +412,7 @@ static void IsFinishedSendingV(Service::Interface* self) {
414 LOG_WARNING(Service_Y2R, "(STUBBED) called"); 412 LOG_WARNING(Service_Y2R, "(STUBBED) called");
415} 413}
416 414
417static void SetReceiving(Service::Interface* self) { 415static void SetReceiving(Interface* self) {
418 u32* cmd_buff = Kernel::GetCommandBuffer(); 416 u32* cmd_buff = Kernel::GetCommandBuffer();
419 417
420 conversion.dst.address = cmd_buff[1]; 418 conversion.dst.address = cmd_buff[1];
@@ -437,7 +435,7 @@ static void SetReceiving(Service::Interface* self) {
437 * 1 : Result of the function, 0 on success, otherwise error code 435 * 1 : Result of the function, 0 on success, otherwise error code
438 * 2 : u8, 0 = Not Finished, 1 = Finished 436 * 2 : u8, 0 = Not Finished, 1 = Finished
439 */ 437 */
440static void IsFinishedReceiving(Service::Interface* self) { 438static void IsFinishedReceiving(Interface* self) {
441 u32* cmd_buff = Kernel::GetCommandBuffer(); 439 u32* cmd_buff = Kernel::GetCommandBuffer();
442 440
443 cmd_buff[0] = IPC::MakeHeader(0x19, 2, 0); 441 cmd_buff[0] = IPC::MakeHeader(0x19, 2, 0);
@@ -447,7 +445,7 @@ static void IsFinishedReceiving(Service::Interface* self) {
447 LOG_WARNING(Service_Y2R, "(STUBBED) called"); 445 LOG_WARNING(Service_Y2R, "(STUBBED) called");
448} 446}
449 447
450static void SetInputLineWidth(Service::Interface* self) { 448static void SetInputLineWidth(Interface* self) {
451 u32* cmd_buff = Kernel::GetCommandBuffer(); 449 u32* cmd_buff = Kernel::GetCommandBuffer();
452 450
453 cmd_buff[0] = IPC::MakeHeader(0x1A, 1, 0); 451 cmd_buff[0] = IPC::MakeHeader(0x1A, 1, 0);
@@ -456,7 +454,7 @@ static void SetInputLineWidth(Service::Interface* self) {
456 LOG_DEBUG(Service_Y2R, "called input_line_width=%u", cmd_buff[1]); 454 LOG_DEBUG(Service_Y2R, "called input_line_width=%u", cmd_buff[1]);
457} 455}
458 456
459static void GetInputLineWidth(Service::Interface* self) { 457static void GetInputLineWidth(Interface* self) {
460 u32* cmd_buff = Kernel::GetCommandBuffer(); 458 u32* cmd_buff = Kernel::GetCommandBuffer();
461 459
462 cmd_buff[0] = IPC::MakeHeader(0x1B, 2, 0); 460 cmd_buff[0] = IPC::MakeHeader(0x1B, 2, 0);
@@ -466,7 +464,7 @@ static void GetInputLineWidth(Service::Interface* self) {
466 LOG_DEBUG(Service_Y2R, "called input_line_width=%u", conversion.input_line_width); 464 LOG_DEBUG(Service_Y2R, "called input_line_width=%u", conversion.input_line_width);
467} 465}
468 466
469static void SetInputLines(Service::Interface* self) { 467static void SetInputLines(Interface* self) {
470 u32* cmd_buff = Kernel::GetCommandBuffer(); 468 u32* cmd_buff = Kernel::GetCommandBuffer();
471 469
472 cmd_buff[0] = IPC::MakeHeader(0x1C, 1, 0); 470 cmd_buff[0] = IPC::MakeHeader(0x1C, 1, 0);
@@ -475,7 +473,7 @@ static void SetInputLines(Service::Interface* self) {
475 LOG_DEBUG(Service_Y2R, "called input_lines=%u", cmd_buff[1]); 473 LOG_DEBUG(Service_Y2R, "called input_lines=%u", cmd_buff[1]);
476} 474}
477 475
478static void GetInputLines(Service::Interface* self) { 476static void GetInputLines(Interface* self) {
479 u32* cmd_buff = Kernel::GetCommandBuffer(); 477 u32* cmd_buff = Kernel::GetCommandBuffer();
480 478
481 cmd_buff[0] = IPC::MakeHeader(0x1D, 2, 0); 479 cmd_buff[0] = IPC::MakeHeader(0x1D, 2, 0);
@@ -485,7 +483,7 @@ static void GetInputLines(Service::Interface* self) {
485 LOG_DEBUG(Service_Y2R, "called input_lines=%u", conversion.input_lines); 483 LOG_DEBUG(Service_Y2R, "called input_lines=%u", conversion.input_lines);
486} 484}
487 485
488static void SetCoefficient(Service::Interface* self) { 486static void SetCoefficient(Interface* self) {
489 u32* cmd_buff = Kernel::GetCommandBuffer(); 487 u32* cmd_buff = Kernel::GetCommandBuffer();
490 488
491 const u16* coefficients = reinterpret_cast<const u16*>(&cmd_buff[1]); 489 const u16* coefficients = reinterpret_cast<const u16*>(&cmd_buff[1]);
@@ -499,7 +497,7 @@ static void SetCoefficient(Service::Interface* self) {
499 coefficients[5], coefficients[6], coefficients[7]); 497 coefficients[5], coefficients[6], coefficients[7]);
500} 498}
501 499
502static void GetCoefficient(Service::Interface* self) { 500static void GetCoefficient(Interface* self) {
503 u32* cmd_buff = Kernel::GetCommandBuffer(); 501 u32* cmd_buff = Kernel::GetCommandBuffer();
504 502
505 cmd_buff[0] = IPC::MakeHeader(0x1F, 5, 0); 503 cmd_buff[0] = IPC::MakeHeader(0x1F, 5, 0);
@@ -509,7 +507,7 @@ static void GetCoefficient(Service::Interface* self) {
509 LOG_DEBUG(Service_Y2R, "called"); 507 LOG_DEBUG(Service_Y2R, "called");
510} 508}
511 509
512static void SetStandardCoefficient(Service::Interface* self) { 510static void SetStandardCoefficient(Interface* self) {
513 u32* cmd_buff = Kernel::GetCommandBuffer(); 511 u32* cmd_buff = Kernel::GetCommandBuffer();
514 512
515 u32 index = cmd_buff[1]; 513 u32 index = cmd_buff[1];
@@ -520,7 +518,7 @@ static void SetStandardCoefficient(Service::Interface* self) {
520 LOG_DEBUG(Service_Y2R, "called standard_coefficient=%u", index); 518 LOG_DEBUG(Service_Y2R, "called standard_coefficient=%u", index);
521} 519}
522 520
523static void GetStandardCoefficient(Service::Interface* self) { 521static void GetStandardCoefficient(Interface* self) {
524 u32* cmd_buff = Kernel::GetCommandBuffer(); 522 u32* cmd_buff = Kernel::GetCommandBuffer();
525 523
526 u32 index = cmd_buff[1]; 524 u32 index = cmd_buff[1];
@@ -539,7 +537,7 @@ static void GetStandardCoefficient(Service::Interface* self) {
539 } 537 }
540} 538}
541 539
542static void SetAlpha(Service::Interface* self) { 540static void SetAlpha(Interface* self) {
543 u32* cmd_buff = Kernel::GetCommandBuffer(); 541 u32* cmd_buff = Kernel::GetCommandBuffer();
544 542
545 conversion.alpha = cmd_buff[1]; 543 conversion.alpha = cmd_buff[1];
@@ -550,7 +548,7 @@ static void SetAlpha(Service::Interface* self) {
550 LOG_DEBUG(Service_Y2R, "called alpha=%hu", conversion.alpha); 548 LOG_DEBUG(Service_Y2R, "called alpha=%hu", conversion.alpha);
551} 549}
552 550
553static void GetAlpha(Service::Interface* self) { 551static void GetAlpha(Interface* self) {
554 u32* cmd_buff = Kernel::GetCommandBuffer(); 552 u32* cmd_buff = Kernel::GetCommandBuffer();
555 553
556 cmd_buff[0] = IPC::MakeHeader(0x23, 2, 0); 554 cmd_buff[0] = IPC::MakeHeader(0x23, 2, 0);
@@ -560,7 +558,7 @@ static void GetAlpha(Service::Interface* self) {
560 LOG_DEBUG(Service_Y2R, "called alpha=%hu", conversion.alpha); 558 LOG_DEBUG(Service_Y2R, "called alpha=%hu", conversion.alpha);
561} 559}
562 560
563static void SetDitheringWeightParams(Service::Interface* self) { 561static void SetDitheringWeightParams(Interface* self) {
564 u32* cmd_buff = Kernel::GetCommandBuffer(); 562 u32* cmd_buff = Kernel::GetCommandBuffer();
565 std::memcpy(&dithering_weight_params, &cmd_buff[1], sizeof(DitheringWeightParams)); 563 std::memcpy(&dithering_weight_params, &cmd_buff[1], sizeof(DitheringWeightParams));
566 564
@@ -570,7 +568,7 @@ static void SetDitheringWeightParams(Service::Interface* self) {
570 LOG_DEBUG(Service_Y2R, "called"); 568 LOG_DEBUG(Service_Y2R, "called");
571} 569}
572 570
573static void GetDitheringWeightParams(Service::Interface* self) { 571static void GetDitheringWeightParams(Interface* self) {
574 u32* cmd_buff = Kernel::GetCommandBuffer(); 572 u32* cmd_buff = Kernel::GetCommandBuffer();
575 573
576 cmd_buff[0] = IPC::MakeHeader(0x25, 9, 0); 574 cmd_buff[0] = IPC::MakeHeader(0x25, 9, 0);
@@ -580,7 +578,7 @@ static void GetDitheringWeightParams(Service::Interface* self) {
580 LOG_DEBUG(Service_Y2R, "called"); 578 LOG_DEBUG(Service_Y2R, "called");
581} 579}
582 580
583static void StartConversion(Service::Interface* self) { 581static void StartConversion(Interface* self) {
584 u32* cmd_buff = Kernel::GetCommandBuffer(); 582 u32* cmd_buff = Kernel::GetCommandBuffer();
585 583
586 // dst_image_size would seem to be perfect for this, but it doesn't include the gap :( 584 // dst_image_size would seem to be perfect for this, but it doesn't include the gap :(
@@ -599,7 +597,7 @@ static void StartConversion(Service::Interface* self) {
599 LOG_DEBUG(Service_Y2R, "called"); 597 LOG_DEBUG(Service_Y2R, "called");
600} 598}
601 599
602static void StopConversion(Service::Interface* self) { 600static void StopConversion(Interface* self) {
603 u32* cmd_buff = Kernel::GetCommandBuffer(); 601 u32* cmd_buff = Kernel::GetCommandBuffer();
604 602
605 cmd_buff[0] = IPC::MakeHeader(0x27, 1, 0); 603 cmd_buff[0] = IPC::MakeHeader(0x27, 1, 0);
@@ -614,7 +612,7 @@ static void StopConversion(Service::Interface* self) {
614 * 1 : Result of function, 0 on success, otherwise error code 612 * 1 : Result of function, 0 on success, otherwise error code
615 * 2 : 1 if there's a conversion running, otherwise 0. 613 * 2 : 1 if there's a conversion running, otherwise 0.
616 */ 614 */
617static void IsBusyConversion(Service::Interface* self) { 615static void IsBusyConversion(Interface* self) {
618 u32* cmd_buff = Kernel::GetCommandBuffer(); 616 u32* cmd_buff = Kernel::GetCommandBuffer();
619 617
620 cmd_buff[0] = IPC::MakeHeader(0x28, 2, 0); 618 cmd_buff[0] = IPC::MakeHeader(0x28, 2, 0);
@@ -627,7 +625,7 @@ static void IsBusyConversion(Service::Interface* self) {
627/** 625/**
628 * Y2R_U::SetPackageParameter service function 626 * Y2R_U::SetPackageParameter service function
629 */ 627 */
630static void SetPackageParameter(Service::Interface* self) { 628static void SetPackageParameter(Interface* self) {
631 u32* cmd_buff = Kernel::GetCommandBuffer(); 629 u32* cmd_buff = Kernel::GetCommandBuffer();
632 630
633 auto params = reinterpret_cast<const ConversionParameters*>(&cmd_buff[1]); 631 auto params = reinterpret_cast<const ConversionParameters*>(&cmd_buff[1]);
@@ -668,7 +666,7 @@ cleanup:
668 params->padding, params->alpha); 666 params->padding, params->alpha);
669} 667}
670 668
671static void PingProcess(Service::Interface* self) { 669static void PingProcess(Interface* self) {
672 u32* cmd_buff = Kernel::GetCommandBuffer(); 670 u32* cmd_buff = Kernel::GetCommandBuffer();
673 671
674 cmd_buff[0] = IPC::MakeHeader(0x2A, 2, 0); 672 cmd_buff[0] = IPC::MakeHeader(0x2A, 2, 0);
@@ -678,7 +676,7 @@ static void PingProcess(Service::Interface* self) {
678 LOG_WARNING(Service_Y2R, "(STUBBED) called"); 676 LOG_WARNING(Service_Y2R, "(STUBBED) called");
679} 677}
680 678
681static void DriverInitialize(Service::Interface* self) { 679static void DriverInitialize(Interface* self) {
682 u32* cmd_buff = Kernel::GetCommandBuffer(); 680 u32* cmd_buff = Kernel::GetCommandBuffer();
683 681
684 conversion.input_format = InputFormat::YUV422_Indiv8; 682 conversion.input_format = InputFormat::YUV422_Indiv8;
@@ -704,7 +702,7 @@ static void DriverInitialize(Service::Interface* self) {
704 LOG_DEBUG(Service_Y2R, "called"); 702 LOG_DEBUG(Service_Y2R, "called");
705} 703}
706 704
707static void DriverFinalize(Service::Interface* self) { 705static void DriverFinalize(Interface* self) {
708 u32* cmd_buff = Kernel::GetCommandBuffer(); 706 u32* cmd_buff = Kernel::GetCommandBuffer();
709 707
710 cmd_buff[0] = IPC::MakeHeader(0x2C, 1, 0); 708 cmd_buff[0] = IPC::MakeHeader(0x2C, 1, 0);
@@ -713,7 +711,7 @@ static void DriverFinalize(Service::Interface* self) {
713 LOG_DEBUG(Service_Y2R, "called"); 711 LOG_DEBUG(Service_Y2R, "called");
714} 712}
715 713
716static void GetPackageParameter(Service::Interface* self) { 714static void GetPackageParameter(Interface* self) {
717 u32* cmd_buff = Kernel::GetCommandBuffer(); 715 u32* cmd_buff = Kernel::GetCommandBuffer();
718 716
719 cmd_buff[0] = IPC::MakeHeader(0x2D, 4, 0); 717 cmd_buff[0] = IPC::MakeHeader(0x2D, 4, 0);
@@ -771,18 +769,16 @@ const Interface::FunctionInfo FunctionTable[] = {
771 {0x002D0000, GetPackageParameter, "GetPackageParameter"}, 769 {0x002D0000, GetPackageParameter, "GetPackageParameter"},
772}; 770};
773 771
774//////////////////////////////////////////////////////////////////////////////////////////////////// 772Y2R_U::Y2R_U() {
775// Interface class
776
777Interface::Interface() {
778 completion_event = Kernel::Event::Create(Kernel::ResetType::OneShot, "Y2R:Completed"); 773 completion_event = Kernel::Event::Create(Kernel::ResetType::OneShot, "Y2R:Completed");
779 std::memset(&conversion, 0, sizeof(conversion)); 774 std::memset(&conversion, 0, sizeof(conversion));
780 775
781 Register(FunctionTable); 776 Register(FunctionTable);
782} 777}
783 778
784Interface::~Interface() { 779Y2R_U::~Y2R_U() {
785 completion_event = nullptr; 780 completion_event = nullptr;
786} 781}
787 782
788} // namespace 783} // namespace Y2R
784} // namespace Service \ No newline at end of file
diff --git a/src/core/hle/service/y2r_u.h b/src/core/hle/service/y2r_u.h
index 1b47b5322..dddeed0be 100644
--- a/src/core/hle/service/y2r_u.h
+++ b/src/core/hle/service/y2r_u.h
@@ -10,10 +10,8 @@
10#include "core/hle/result.h" 10#include "core/hle/result.h"
11#include "core/hle/service/service.h" 11#include "core/hle/service/service.h"
12 12
13//////////////////////////////////////////////////////////////////////////////////////////////////// 13namespace Service {
14// Namespace Y2R_U 14namespace Y2R {
15
16namespace Y2R_U {
17 15
18enum class InputFormat : u8 { 16enum class InputFormat : u8 {
19 /// 8-bit input, with YUV components in separate planes and 4:2:2 subsampling. 17 /// 8-bit input, with YUV components in separate planes and 4:2:2 subsampling.
@@ -127,14 +125,15 @@ struct DitheringWeightParams {
127 u16 w3_xOdd_yOdd; 125 u16 w3_xOdd_yOdd;
128}; 126};
129 127
130class Interface : public Service::Interface { 128class Y2R_U final : public Interface {
131public: 129public:
132 Interface(); 130 Y2R_U();
133 ~Interface() override; 131 ~Y2R_U() override;
134 132
135 std::string GetPortName() const override { 133 std::string GetPortName() const override {
136 return "y2r:u"; 134 return "y2r:u";
137 } 135 }
138}; 136};
139 137
140} // namespace 138} // namespace Y2R
139} // namespace Service
diff --git a/src/core/hw/gpu.cpp b/src/core/hw/gpu.cpp
index 1503b45da..1a1ee90b2 100644
--- a/src/core/hw/gpu.cpp
+++ b/src/core/hw/gpu.cpp
@@ -430,9 +430,9 @@ inline void Write(u32 addr, const T data) {
430 // TODO: hwtest this 430 // TODO: hwtest this
431 if (config.GetStartAddress() != 0) { 431 if (config.GetStartAddress() != 0) {
432 if (!is_second_filler) { 432 if (!is_second_filler) {
433 GSP_GPU::SignalInterrupt(GSP_GPU::InterruptId::PSC0); 433 Service::GSP::SignalInterrupt(Service::GSP::InterruptId::PSC0);
434 } else { 434 } else {
435 GSP_GPU::SignalInterrupt(GSP_GPU::InterruptId::PSC1); 435 Service::GSP::SignalInterrupt(Service::GSP::InterruptId::PSC1);
436 } 436 }
437 } 437 }
438 438
@@ -473,7 +473,7 @@ inline void Write(u32 addr, const T data) {
473 } 473 }
474 474
475 g_regs.display_transfer_config.trigger = 0; 475 g_regs.display_transfer_config.trigger = 0;
476 GSP_GPU::SignalInterrupt(GSP_GPU::InterruptId::PPF); 476 Service::GSP::SignalInterrupt(Service::GSP::InterruptId::PPF);
477 } 477 }
478 break; 478 break;
479 } 479 }
@@ -548,8 +548,8 @@ static void VBlankCallback(u64 userdata, int cycles_late) {
548 // screen, or if both use the same interrupts and these two instead determine the 548 // screen, or if both use the same interrupts and these two instead determine the
549 // beginning and end of the VBlank period. If needed, split the interrupt firing into 549 // beginning and end of the VBlank period. If needed, split the interrupt firing into
550 // two different intervals. 550 // two different intervals.
551 GSP_GPU::SignalInterrupt(GSP_GPU::InterruptId::PDC0); 551 Service::GSP::SignalInterrupt(Service::GSP::InterruptId::PDC0);
552 GSP_GPU::SignalInterrupt(GSP_GPU::InterruptId::PDC1); 552 Service::GSP::SignalInterrupt(Service::GSP::InterruptId::PDC1);
553 553
554 // Check for user input updates 554 // Check for user input updates
555 Service::HID::Update(); 555 Service::HID::Update();
diff --git a/src/core/hw/y2r.cpp b/src/core/hw/y2r.cpp
index 6a6c707a2..e697f84b3 100644
--- a/src/core/hw/y2r.cpp
+++ b/src/core/hw/y2r.cpp
@@ -18,7 +18,7 @@
18namespace HW { 18namespace HW {
19namespace Y2R { 19namespace Y2R {
20 20
21using namespace Y2R_U; 21using namespace Service::Y2R;
22 22
23static const size_t MAX_TILES = 1024 / 8; 23static const size_t MAX_TILES = 1024 / 8;
24static const size_t TILE_SIZE = 8 * 8; 24static const size_t TILE_SIZE = 8 * 8;
diff --git a/src/core/hw/y2r.h b/src/core/hw/y2r.h
index 6b6e71bec..25fcd781c 100644
--- a/src/core/hw/y2r.h
+++ b/src/core/hw/y2r.h
@@ -2,13 +2,16 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5namespace Y2R_U { 5#pragma once
6
7namespace Service {
8namespace Y2R {
6struct ConversionConfiguration; 9struct ConversionConfiguration;
7} 10}
11}
8 12
9namespace HW { 13namespace HW {
10namespace Y2R { 14namespace Y2R {
11 15void PerformConversion(Service::Y2R::ConversionConfiguration& cvt);
12void PerformConversion(Y2R_U::ConversionConfiguration& cvt);
13} 16}
14} 17}
diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp
index c80c96762..0495a9fac 100644
--- a/src/video_core/command_processor.cpp
+++ b/src/video_core/command_processor.cpp
@@ -68,7 +68,7 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) {
68 switch (id) { 68 switch (id) {
69 // Trigger IRQ 69 // Trigger IRQ
70 case PICA_REG_INDEX(trigger_irq): 70 case PICA_REG_INDEX(trigger_irq):
71 GSP_GPU::SignalInterrupt(GSP_GPU::InterruptId::P3D); 71 Service::GSP::SignalInterrupt(Service::GSP::InterruptId::P3D);
72 break; 72 break;
73 73
74 case PICA_REG_INDEX_WORKAROUND(triangle_topology, 0x25E): 74 case PICA_REG_INDEX_WORKAROUND(triangle_topology, 0x25E):
diff --git a/src/video_core/gpu_debugger.h b/src/video_core/gpu_debugger.h
index 3c6636d66..c1f9b43c2 100644
--- a/src/video_core/gpu_debugger.h
+++ b/src/video_core/gpu_debugger.h
@@ -28,7 +28,8 @@ public:
28 * @note All methods in this class are called from the GSP thread 28 * @note All methods in this class are called from the GSP thread
29 */ 29 */
30 virtual void GXCommandProcessed(int total_command_count) { 30 virtual void GXCommandProcessed(int total_command_count) {
31 const GSP_GPU::Command& cmd = observed->ReadGXCommandHistory(total_command_count - 1); 31 const Service::GSP::Command& cmd =
32 observed->ReadGXCommandHistory(total_command_count - 1);
32 LOG_TRACE(Debug_GPU, "Received command: id=%x", (int)cmd.id.Value()); 33 LOG_TRACE(Debug_GPU, "Received command: id=%x", (int)cmd.id.Value());
33 } 34 }
34 35
@@ -48,16 +49,16 @@ public:
48 return; 49 return;
49 50
50 gx_command_history.emplace_back(); 51 gx_command_history.emplace_back();
51 GSP_GPU::Command& cmd = gx_command_history.back(); 52 Service::GSP::Command& cmd = gx_command_history.back();
52 53
53 memcpy(&cmd, command_data, sizeof(GSP_GPU::Command)); 54 memcpy(&cmd, command_data, sizeof(Service::GSP::Command));
54 55
55 ForEachObserver([this](DebuggerObserver* observer) { 56 ForEachObserver([this](DebuggerObserver* observer) {
56 observer->GXCommandProcessed(static_cast<int>(this->gx_command_history.size())); 57 observer->GXCommandProcessed(static_cast<int>(this->gx_command_history.size()));
57 }); 58 });
58 } 59 }
59 60
60 const GSP_GPU::Command& ReadGXCommandHistory(int index) const { 61 const Service::GSP::Command& ReadGXCommandHistory(int index) const {
61 // TODO: Is this thread-safe? 62 // TODO: Is this thread-safe?
62 return gx_command_history[index]; 63 return gx_command_history[index];
63 } 64 }
@@ -80,5 +81,5 @@ private:
80 81
81 std::vector<DebuggerObserver*> observers; 82 std::vector<DebuggerObserver*> observers;
82 83
83 std::vector<GSP_GPU::Command> gx_command_history; 84 std::vector<Service::GSP::Command> gx_command_history;
84}; 85};