summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Lioncash2018-07-27 17:32:45 -0400
committerGravatar Lioncash2018-07-27 17:38:30 -0400
commit7931cc0ceb744ff03cce0affeb5535d1766e95d2 (patch)
tree74cf5161dab18a86eedc105542ecb55f8192ed4a
parentMerge pull request #845 from lioncash/nfc (diff)
downloadyuzu-7931cc0ceb744ff03cce0affeb5535d1766e95d2.tar.gz
yuzu-7931cc0ceb744ff03cce0affeb5535d1766e95d2.tar.xz
yuzu-7931cc0ceb744ff03cce0affeb5535d1766e95d2.zip
service: Add ncm services
Adds the basic skeleton for the ncm services based off information on Switch Brew.
-rw-r--r--src/common/logging/backend.cpp1
-rw-r--r--src/common/logging/log.h1
-rw-r--r--src/core/CMakeLists.txt2
-rw-r--r--src/core/hle/service/ncm/ncm.cpp59
-rw-r--r--src/core/hle/service/ncm/ncm.h15
-rw-r--r--src/core/hle/service/service.cpp2
6 files changed, 80 insertions, 0 deletions
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp
index 30537b27b..67a803e23 100644
--- a/src/common/logging/backend.cpp
+++ b/src/common/logging/backend.cpp
@@ -177,6 +177,7 @@ void FileBackend::Write(const Entry& entry) {
177 SUB(Service, LDN) \ 177 SUB(Service, LDN) \
178 SUB(Service, LM) \ 178 SUB(Service, LM) \
179 SUB(Service, MM) \ 179 SUB(Service, MM) \
180 SUB(Service, NCM) \
180 SUB(Service, NFC) \ 181 SUB(Service, NFC) \
181 SUB(Service, NFP) \ 182 SUB(Service, NFP) \
182 SUB(Service, NIFM) \ 183 SUB(Service, NIFM) \
diff --git a/src/common/logging/log.h b/src/common/logging/log.h
index 805f82d2f..a3e805794 100644
--- a/src/common/logging/log.h
+++ b/src/common/logging/log.h
@@ -64,6 +64,7 @@ enum class Class : ClassType {
64 Service_LDN, ///< The LDN (Local domain network) service 64 Service_LDN, ///< The LDN (Local domain network) service
65 Service_LM, ///< The LM (Logger) service 65 Service_LM, ///< The LM (Logger) service
66 Service_MM, ///< The MM (Multimedia) service 66 Service_MM, ///< The MM (Multimedia) service
67 Service_NCM, ///< The NCM service
67 Service_NFC, ///< The NFC (Near-field communication) service 68 Service_NFC, ///< The NFC (Near-field communication) service
68 Service_NFP, ///< The NFP service 69 Service_NFP, ///< The NFP service
69 Service_NIFM, ///< The NIFM (Network interface) service 70 Service_NIFM, ///< The NIFM (Network interface) service
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index b367c2a27..7b60f9163 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -176,6 +176,8 @@ add_library(core STATIC
176 hle/service/lm/lm.h 176 hle/service/lm/lm.h
177 hle/service/mm/mm_u.cpp 177 hle/service/mm/mm_u.cpp
178 hle/service/mm/mm_u.h 178 hle/service/mm/mm_u.h
179 hle/service/ncm/ncm.cpp
180 hle/service/ncm/ncm.h
179 hle/service/nfc/nfc.cpp 181 hle/service/nfc/nfc.cpp
180 hle/service/nfc/nfc.h 182 hle/service/nfc/nfc.h
181 hle/service/nfp/nfp.cpp 183 hle/service/nfp/nfp.cpp
diff --git a/src/core/hle/service/ncm/ncm.cpp b/src/core/hle/service/ncm/ncm.cpp
new file mode 100644
index 000000000..0297edca0
--- /dev/null
+++ b/src/core/hle/service/ncm/ncm.cpp
@@ -0,0 +1,59 @@
1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include <memory>
6
7#include "core/hle/service/ncm/ncm.h"
8#include "core/hle/service/service.h"
9#include "core/hle/service/sm/sm.h"
10
11namespace Service::NCM {
12
13class LocationResolver final : public ServiceFramework<LocationResolver> {
14public:
15 explicit LocationResolver() : ServiceFramework{"lr"} {
16 // clang-format off
17 static const FunctionInfo functions[] = {
18 {0, nullptr, "OpenLocationResolver"},
19 {1, nullptr, "OpenRegisteredLocationResolver"},
20 {2, nullptr, "RefreshLocationResolver"},
21 {3, nullptr, "OpenAddOnContentLocationResolver"},
22 };
23 // clang-format on
24
25 RegisterHandlers(functions);
26 }
27};
28
29class NCM final : public ServiceFramework<NCM> {
30public:
31 explicit NCM() : ServiceFramework{"ncm"} {
32 // clang-format off
33 static const FunctionInfo functions[] = {
34 {0, nullptr, "CreateContentStorage"},
35 {1, nullptr, "CreateContentMetaDatabase"},
36 {2, nullptr, "VerifyContentStorage"},
37 {3, nullptr, "VerifyContentMetaDatabase"},
38 {4, nullptr, "OpenContentStorage"},
39 {5, nullptr, "OpenContentMetaDatabase"},
40 {6, nullptr, "CloseContentStorageForcibly"},
41 {7, nullptr, "CloseContentMetaDatabaseForcibly"},
42 {8, nullptr, "CleanupContentMetaDatabase"},
43 {9, nullptr, "OpenContentStorage2"},
44 {10, nullptr, "CloseContentStorage"},
45 {11, nullptr, "OpenContentMetaDatabase2"},
46 {12, nullptr, "CloseContentMetaDatabase"},
47 };
48 // clang-format on
49
50 RegisterHandlers(functions);
51 }
52};
53
54void InstallInterfaces(SM::ServiceManager& sm) {
55 std::make_shared<LocationResolver>()->InstallAsService(sm);
56 std::make_shared<NCM>()->InstallAsService(sm);
57}
58
59} // namespace Service::NCM
diff --git a/src/core/hle/service/ncm/ncm.h b/src/core/hle/service/ncm/ncm.h
new file mode 100644
index 000000000..7bc8518a6
--- /dev/null
+++ b/src/core/hle/service/ncm/ncm.h
@@ -0,0 +1,15 @@
1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7namespace Service::SM {
8class ServiceManager;
9}
10
11namespace Service::NCM {
12
13void InstallInterfaces(SM::ServiceManager& sm);
14
15} // namespace Service::NCM
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index 8026d27a7..de3723980 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -35,6 +35,7 @@
35#include "core/hle/service/ldr/ldr.h" 35#include "core/hle/service/ldr/ldr.h"
36#include "core/hle/service/lm/lm.h" 36#include "core/hle/service/lm/lm.h"
37#include "core/hle/service/mm/mm_u.h" 37#include "core/hle/service/mm/mm_u.h"
38#include "core/hle/service/ncm/ncm.h"
38#include "core/hle/service/nfc/nfc.h" 39#include "core/hle/service/nfc/nfc.h"
39#include "core/hle/service/nfp/nfp.h" 40#include "core/hle/service/nfp/nfp.h"
40#include "core/hle/service/nifm/nifm.h" 41#include "core/hle/service/nifm/nifm.h"
@@ -212,6 +213,7 @@ void Init(std::shared_ptr<SM::ServiceManager>& sm) {
212 LDR::InstallInterfaces(*sm); 213 LDR::InstallInterfaces(*sm);
213 LM::InstallInterfaces(*sm); 214 LM::InstallInterfaces(*sm);
214 MM::InstallInterfaces(*sm); 215 MM::InstallInterfaces(*sm);
216 NCM::InstallInterfaces(*sm);
215 NFC::InstallInterfaces(*sm); 217 NFC::InstallInterfaces(*sm);
216 NFP::InstallInterfaces(*sm); 218 NFP::InstallInterfaces(*sm);
217 NIFM::InstallInterfaces(*sm); 219 NIFM::InstallInterfaces(*sm);