summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Lioncash2016-12-08 02:43:27 -0500
committerGravatar Lioncash2016-12-08 03:24:41 -0500
commite8a960f6a1c86d15de03a26c22b868771a49929c (patch)
treed5e9b1e77149bc0b266a98e07757891cef319bfe /src
parentMerge pull request #2283 from lioncash/svc (diff)
downloadyuzu-e8a960f6a1c86d15de03a26c22b868771a49929c.tar.gz
yuzu-e8a960f6a1c86d15de03a26c22b868771a49929c.tar.xz
yuzu-e8a960f6a1c86d15de03a26c22b868771a49929c.zip
service: Add nfc services
3dbrew was used for the command information.
Diffstat (limited to 'src')
-rw-r--r--src/core/CMakeLists.txt6
-rw-r--r--src/core/hle/service/nfc/nfc.cpp18
-rw-r--r--src/core/hle/service/nfc/nfc.h14
-rw-r--r--src/core/hle/service/nfc/nfc_m.cpp44
-rw-r--r--src/core/hle/service/nfc/nfc_m.h22
-rw-r--r--src/core/hle/service/nfc/nfc_u.cpp41
-rw-r--r--src/core/hle/service/nfc/nfc_u.h22
-rw-r--r--src/core/hle/service/service.cpp62
8 files changed, 199 insertions, 30 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 8ce141e6a..a5b699047 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -107,6 +107,9 @@ set(SRCS
107 hle/service/mic_u.cpp 107 hle/service/mic_u.cpp
108 hle/service/ndm/ndm.cpp 108 hle/service/ndm/ndm.cpp
109 hle/service/ndm/ndm_u.cpp 109 hle/service/ndm/ndm_u.cpp
110 hle/service/nfc/nfc.cpp
111 hle/service/nfc/nfc_m.cpp
112 hle/service/nfc/nfc_u.cpp
110 hle/service/news/news.cpp 113 hle/service/news/news.cpp
111 hle/service/news/news_s.cpp 114 hle/service/news/news_s.cpp
112 hle/service/news/news_u.cpp 115 hle/service/news/news_u.cpp
@@ -258,6 +261,9 @@ set(HEADERS
258 hle/service/mic_u.h 261 hle/service/mic_u.h
259 hle/service/ndm/ndm.h 262 hle/service/ndm/ndm.h
260 hle/service/ndm/ndm_u.h 263 hle/service/ndm/ndm_u.h
264 hle/service/nfc/nfc.h
265 hle/service/nfc/nfc_m.h
266 hle/service/nfc/nfc_u.h
261 hle/service/news/news.h 267 hle/service/news/news.h
262 hle/service/news/news_s.h 268 hle/service/news/news_s.h
263 hle/service/news/news_u.h 269 hle/service/news/news_u.h
diff --git a/src/core/hle/service/nfc/nfc.cpp b/src/core/hle/service/nfc/nfc.cpp
new file mode 100644
index 000000000..d9738c6a1
--- /dev/null
+++ b/src/core/hle/service/nfc/nfc.cpp
@@ -0,0 +1,18 @@
1// Copyright 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include "core/hle/service/nfc/nfc.h"
6#include "core/hle/service/nfc/nfc_m.h"
7#include "core/hle/service/nfc/nfc_u.h"
8
9namespace Service {
10namespace NFC {
11
12void Init() {
13 AddService(new NFC_M());
14 AddService(new NFC_U());
15}
16
17} // namespace NFC
18} // namespace Service
diff --git a/src/core/hle/service/nfc/nfc.h b/src/core/hle/service/nfc/nfc.h
new file mode 100644
index 000000000..cd65a5fdc
--- /dev/null
+++ b/src/core/hle/service/nfc/nfc.h
@@ -0,0 +1,14 @@
1// Copyright 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7namespace Service {
8namespace NFC {
9
10/// Initialize all NFC services.
11void Init();
12
13} // namespace NFC
14} // namespace Service
diff --git a/src/core/hle/service/nfc/nfc_m.cpp b/src/core/hle/service/nfc/nfc_m.cpp
new file mode 100644
index 000000000..717335c11
--- /dev/null
+++ b/src/core/hle/service/nfc/nfc_m.cpp
@@ -0,0 +1,44 @@
1// Copyright 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include "core/hle/service/nfc/nfc_m.h"
6
7namespace Service {
8namespace NFC {
9
10const Interface::FunctionInfo FunctionTable[] = {
11 // clang-format off
12 // nfc:u shared commands
13 {0x00010040, nullptr, "Initialize"},
14 {0x00020040, nullptr, "Shutdown"},
15 {0x00030000, nullptr, "StartCommunication"},
16 {0x00040000, nullptr, "StopCommunication"},
17 {0x00050040, nullptr, "StartTagScanning"},
18 {0x00060000, nullptr, "StopTagScanning"},
19 {0x00070000, nullptr, "LoadAmiiboData"},
20 {0x00080000, nullptr, "ResetTagScanState"},
21 {0x00090002, nullptr, "UpdateStoredAmiiboData"},
22 {0x000D0000, nullptr, "GetTagState"},
23 {0x000F0000, nullptr, "CommunicationGetStatus"},
24 {0x00100000, nullptr, "GetTagInfo2"},
25 {0x00110000, nullptr, "GetTagInfo"},
26 {0x00120000, nullptr, "CommunicationGetResult"},
27 {0x00130040, nullptr, "OpenAppData"},
28 {0x00140384, nullptr, "InitializeWriteAppData"},
29 {0x00150040, nullptr, "ReadAppData"},
30 {0x00160242, nullptr, "WriteAppData"},
31 {0x00170000, nullptr, "GetAmiiboSettings"},
32 {0x00180000, nullptr, "GetAmiiboConfig"},
33 {0x00190000, nullptr, "GetAppDataInitStruct"},
34 // nfc:m
35 {0x04040A40, nullptr, "SetAmiiboSettings"}
36 // clang-format on
37};
38
39NFC_M::NFC_M() {
40 Register(FunctionTable);
41}
42
43} // namespace NFC
44} // namespace Service
diff --git a/src/core/hle/service/nfc/nfc_m.h b/src/core/hle/service/nfc/nfc_m.h
new file mode 100644
index 000000000..fae75535b
--- /dev/null
+++ b/src/core/hle/service/nfc/nfc_m.h
@@ -0,0 +1,22 @@
1// Copyright 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include "core/hle/service/service.h"
8
9namespace Service {
10namespace NFC {
11
12class NFC_M final : public Interface {
13public:
14 NFC_M();
15
16 std::string GetPortName() const override {
17 return "nfc:m";
18 }
19};
20
21} // namespace NFC
22} // namespace Service
diff --git a/src/core/hle/service/nfc/nfc_u.cpp b/src/core/hle/service/nfc/nfc_u.cpp
new file mode 100644
index 000000000..deffb0b4f
--- /dev/null
+++ b/src/core/hle/service/nfc/nfc_u.cpp
@@ -0,0 +1,41 @@
1// Copyright 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include "core/hle/service/nfc/nfc_u.h"
6
7namespace Service {
8namespace NFC {
9
10const Interface::FunctionInfo FunctionTable[] = {
11 // clang-format off
12 {0x00010040, nullptr, "Initialize"},
13 {0x00020040, nullptr, "Shutdown"},
14 {0x00030000, nullptr, "StartCommunication"},
15 {0x00040000, nullptr, "StopCommunication"},
16 {0x00050040, nullptr, "StartTagScanning"},
17 {0x00060000, nullptr, "StopTagScanning"},
18 {0x00070000, nullptr, "LoadAmiiboData"},
19 {0x00080000, nullptr, "ResetTagScanState"},
20 {0x00090002, nullptr, "UpdateStoredAmiiboData"},
21 {0x000D0000, nullptr, "GetTagState"},
22 {0x000F0000, nullptr, "CommunicationGetStatus"},
23 {0x00100000, nullptr, "GetTagInfo2"},
24 {0x00110000, nullptr, "GetTagInfo"},
25 {0x00120000, nullptr, "CommunicationGetResult"},
26 {0x00130040, nullptr, "OpenAppData"},
27 {0x00140384, nullptr, "InitializeWriteAppData"},
28 {0x00150040, nullptr, "ReadAppData"},
29 {0x00160242, nullptr, "WriteAppData"},
30 {0x00170000, nullptr, "GetAmiiboSettings"},
31 {0x00180000, nullptr, "GetAmiiboConfig"},
32 {0x00190000, nullptr, "GetAppDataInitStruct"},
33 // clang-format on
34};
35
36NFC_U::NFC_U() {
37 Register(FunctionTable);
38}
39
40} // namespace NFC
41} // namespace Service
diff --git a/src/core/hle/service/nfc/nfc_u.h b/src/core/hle/service/nfc/nfc_u.h
new file mode 100644
index 000000000..eb7507314
--- /dev/null
+++ b/src/core/hle/service/nfc/nfc_u.h
@@ -0,0 +1,22 @@
1// Copyright 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include "core/hle/service/service.h"
8
9namespace Service {
10namespace NFC {
11
12class NFC_U final : public Interface {
13public:
14 NFC_U();
15
16 std::string GetPortName() const override {
17 return "nfc:u";
18 }
19};
20
21} // namespace NFC
22} // namespace Service
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index ca7eeac8a..5f16c18fa 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -28,6 +28,7 @@
28#include "core/hle/service/mic_u.h" 28#include "core/hle/service/mic_u.h"
29#include "core/hle/service/ndm/ndm.h" 29#include "core/hle/service/ndm/ndm.h"
30#include "core/hle/service/news/news.h" 30#include "core/hle/service/news/news.h"
31#include "core/hle/service/nfc/nfc.h"
31#include "core/hle/service/nim/nim.h" 32#include "core/hle/service/nim/nim.h"
32#include "core/hle/service/ns_s.h" 33#include "core/hle/service/ns_s.h"
33#include "core/hle/service/nwm_uds.h" 34#include "core/hle/service/nwm_uds.h"
@@ -109,21 +110,22 @@ void Init() {
109 AddNamedPort(new SRV::Interface); 110 AddNamedPort(new SRV::Interface);
110 AddNamedPort(new ERR_F::Interface); 111 AddNamedPort(new ERR_F::Interface);
111 112
112 Service::FS::ArchiveInit(); 113 FS::ArchiveInit();
113 Service::AM::Init(); 114 AM::Init();
114 Service::APT::Init(); 115 APT::Init();
115 Service::BOSS::Init(); 116 BOSS::Init();
116 Service::CAM::Init(); 117 CAM::Init();
117 Service::CECD::Init(); 118 CECD::Init();
118 Service::CFG::Init(); 119 CFG::Init();
119 Service::DLP::Init(); 120 DLP::Init();
120 Service::FRD::Init(); 121 FRD::Init();
121 Service::HID::Init(); 122 HID::Init();
122 Service::IR::Init(); 123 IR::Init();
123 Service::NEWS::Init(); 124 NDM::Init();
124 Service::NDM::Init(); 125 NEWS::Init();
125 Service::NIM::Init(); 126 NFC::Init();
126 Service::PTM::Init(); 127 NIM::Init();
128 PTM::Init();
127 129
128 AddService(new AC_U::Interface); 130 AddService(new AC_U::Interface);
129 AddService(new ACT_A::Interface); 131 AddService(new ACT_A::Interface);
@@ -148,21 +150,21 @@ void Init() {
148/// Shutdown ServiceManager 150/// Shutdown ServiceManager
149void Shutdown() { 151void Shutdown() {
150 152
151 Service::PTM::Shutdown(); 153 PTM::Shutdown();
152 Service::NDM::Shutdown(); 154 NIM::Shutdown();
153 Service::NIM::Shutdown(); 155 NEWS::Shutdown();
154 Service::NEWS::Shutdown(); 156 NDM::Shutdown();
155 Service::IR::Shutdown(); 157 IR::Shutdown();
156 Service::HID::Shutdown(); 158 HID::Shutdown();
157 Service::FRD::Shutdown(); 159 FRD::Shutdown();
158 Service::DLP::Shutdown(); 160 DLP::Shutdown();
159 Service::CFG::Shutdown(); 161 CFG::Shutdown();
160 Service::CECD::Shutdown(); 162 CECD::Shutdown();
161 Service::CAM::Shutdown(); 163 CAM::Shutdown();
162 Service::BOSS::Shutdown(); 164 BOSS::Shutdown();
163 Service::APT::Shutdown(); 165 APT::Shutdown();
164 Service::AM::Shutdown(); 166 AM::Shutdown();
165 Service::FS::ArchiveShutdown(); 167 FS::ArchiveShutdown();
166 168
167 g_srv_services.clear(); 169 g_srv_services.clear();
168 g_kernel_named_ports.clear(); 170 g_kernel_named_ports.clear();