summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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/nfc/nfc.cpp183
-rw-r--r--src/core/hle/service/nfc/nfc.h15
-rw-r--r--src/core/hle/service/service.cpp2
6 files changed, 204 insertions, 0 deletions
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp
index ad9edbcdf..bcdb69321 100644
--- a/src/common/logging/backend.cpp
+++ b/src/common/logging/backend.cpp
@@ -176,6 +176,7 @@ void FileBackend::Write(const Entry& entry) {
SUB(Service, LDN) \
SUB(Service, LM) \
SUB(Service, MM) \
+ SUB(Service, NFC) \
SUB(Service, NFP) \
SUB(Service, NIFM) \
SUB(Service, NS) \
diff --git a/src/common/logging/log.h b/src/common/logging/log.h
index ad3cbf5d1..3a61c7531 100644
--- a/src/common/logging/log.h
+++ b/src/common/logging/log.h
@@ -63,6 +63,7 @@ enum class Class : ClassType {
Service_LDN, ///< The LDN (Local domain network) service
Service_LM, ///< The LM (Logger) service
Service_MM, ///< The MM (Multimedia) service
+ Service_NFC, ///< The NFC (Near-field communication) service
Service_NFP, ///< The NFP service
Service_NIFM, ///< The NIFM (Network interface) service
Service_NS, ///< The NS services
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index b74e495ef..6fb1a4c7c 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -172,6 +172,8 @@ add_library(core STATIC
hle/service/lm/lm.h
hle/service/mm/mm_u.cpp
hle/service/mm/mm_u.h
+ hle/service/nfc/nfc.cpp
+ hle/service/nfc/nfc.h
hle/service/nfp/nfp.cpp
hle/service/nfp/nfp.h
hle/service/nfp/nfp_user.cpp
diff --git a/src/core/hle/service/nfc/nfc.cpp b/src/core/hle/service/nfc/nfc.cpp
new file mode 100644
index 000000000..c09d198ba
--- /dev/null
+++ b/src/core/hle/service/nfc/nfc.cpp
@@ -0,0 +1,183 @@
+// Copyright 2018 yuzu emulator team
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#include <memory>
+
+#include "core/hle/service/nfc/nfc.h"
+#include "core/hle/service/service.h"
+#include "core/hle/service/sm/sm.h"
+
+namespace Service::NFC {
+
+class IAm final : public ServiceFramework<IAm> {
+public:
+ explicit IAm() : ServiceFramework{"IAm"} {
+ // clang-format off
+ static const FunctionInfo functions[] = {
+ {0, nullptr, "Initialize"},
+ {1, nullptr, "Finalize"},
+ {2, nullptr, "NotifyForegroundApplet"},
+ };
+ // clang-format on
+
+ RegisterHandlers(functions);
+ }
+};
+
+class NFC_AM final : public ServiceFramework<NFC_AM> {
+public:
+ explicit NFC_AM() : ServiceFramework{"nfc:am"} {
+ // clang-format off
+ static const FunctionInfo functions[] = {
+ {0, nullptr, "CreateAmInterface"},
+ };
+ // clang-format on
+
+ RegisterHandlers(functions);
+ }
+};
+
+class MFIUser final : public ServiceFramework<MFIUser> {
+public:
+ explicit MFIUser() : ServiceFramework{"IUser"} {
+ // clang-format off
+ static const FunctionInfo functions[] = {
+ {0, nullptr, "Initialize"},
+ {1, nullptr, "Finalize"},
+ {2, nullptr, "ListDevices"},
+ {3, nullptr, "StartDetection"},
+ {4, nullptr, "StopDetection"},
+ {5, nullptr, "Read"},
+ {6, nullptr, "Write"},
+ {7, nullptr, "GetTagInfo"},
+ {8, nullptr, "GetActivateEventHandle"},
+ {9, nullptr, "GetDeactivateEventHandle"},
+ {10, nullptr, "GetState"},
+ {11, nullptr, "GetDeviceState"},
+ {12, nullptr, "GetNpadId"},
+ {13, nullptr, "GetAvailabilityChangeEventHandle"},
+ };
+ // clang-format on
+
+ RegisterHandlers(functions);
+ }
+};
+
+class NFC_MF_U final : public ServiceFramework<NFC_MF_U> {
+public:
+ explicit NFC_MF_U() : ServiceFramework{"nfc:mf:u"} {
+ // clang-format off
+ static const FunctionInfo functions[] = {
+ {0, nullptr, "CreateUserInterface"},
+ };
+ // clang-format on
+
+ RegisterHandlers(functions);
+ }
+};
+
+class IUser final : public ServiceFramework<IUser> {
+public:
+ explicit IUser() : ServiceFramework{"IUser"} {
+ // clang-format off
+ static const FunctionInfo functions[] = {
+ {0, nullptr, "Initialize"},
+ {1, nullptr, "Finalize"},
+ {2, nullptr, "GetState"},
+ {3, nullptr, "IsNfcEnabled"},
+ {400, nullptr, "Initialize"},
+ {401, nullptr, "Finalize"},
+ {402, nullptr, "GetState"},
+ {403, nullptr, "IsNfcEnabled"},
+ {404, nullptr, "ListDevices"},
+ {405, nullptr, "GetDeviceState"},
+ {406, nullptr, "GetNpadId"},
+ {407, nullptr, "AttachAvailabilityChangeEvent"},
+ {408, nullptr, "StartDetection"},
+ {409, nullptr, "StopDetection"},
+ {410, nullptr, "GetTagInfo"},
+ {411, nullptr, "AttachActivateEvent"},
+ {412, nullptr, "AttachDeactivateEvent"},
+ {1000, nullptr, "ReadMifare"},
+ {1001, nullptr, "WriteMifare"},
+ {1300, nullptr, "SendCommandByPassThrough"},
+ {1301, nullptr, "KeepPassThroughSession"},
+ {1302, nullptr, "ReleasePassThroughSession"},
+ };
+ // clang-format on
+
+ RegisterHandlers(functions);
+ }
+};
+
+class NFC_U final : public ServiceFramework<NFC_U> {
+public:
+ explicit NFC_U() : ServiceFramework{"nfc:u"} {
+ // clang-format off
+ static const FunctionInfo functions[] = {
+ {0, nullptr, "CreateUserInterface"},
+ };
+ // clang-format on
+
+ RegisterHandlers(functions);
+ }
+};
+
+class ISystem final : public ServiceFramework<ISystem> {
+public:
+ explicit ISystem() : ServiceFramework{"ISystem"} {
+ // clang-format off
+ static const FunctionInfo functions[] = {
+ {0, nullptr, "Initialize"},
+ {1, nullptr, "Finalize"},
+ {2, nullptr, "GetState"},
+ {3, nullptr, "IsNfcEnabled"},
+ {100, nullptr, "SetNfcEnabled"},
+ {400, nullptr, "InitializeSystem"},
+ {401, nullptr, "FinalizeSystem"},
+ {402, nullptr, "GetState"},
+ {403, nullptr, "IsNfcEnabled"},
+ {404, nullptr, "ListDevices"},
+ {405, nullptr, "GetDeviceState"},
+ {406, nullptr, "GetNpadId"},
+ {407, nullptr, "AttachAvailabilityChangeEvent"},
+ {408, nullptr, "StartDetection"},
+ {409, nullptr, "StopDetection"},
+ {410, nullptr, "GetTagInfo"},
+ {411, nullptr, "AttachActivateEvent"},
+ {412, nullptr, "AttachDeactivateEvent"},
+ {500, nullptr, "SetNfcEnabled"},
+ {1000, nullptr, "ReadMifare"},
+ {1001, nullptr, "WriteMifare"},
+ {1300, nullptr, "SendCommandByPassThrough"},
+ {1301, nullptr, "KeepPassThroughSession"},
+ {1302, nullptr, "ReleasePassThroughSession"},
+ };
+ // clang-format on
+
+ RegisterHandlers(functions);
+ }
+};
+
+class NFC_SYS final : public ServiceFramework<NFC_SYS> {
+public:
+ explicit NFC_SYS() : ServiceFramework{"nfc:sys"} {
+ // clang-format off
+ static const FunctionInfo functions[] = {
+ {0, nullptr, "CreateSystemInterface"},
+ };
+ // clang-format on
+
+ RegisterHandlers(functions);
+ }
+};
+
+void InstallInterfaces(SM::ServiceManager& sm) {
+ std::make_shared<NFC_AM>()->InstallAsService(sm);
+ std::make_shared<NFC_MF_U>()->InstallAsService(sm);
+ std::make_shared<NFC_U>()->InstallAsService(sm);
+ std::make_shared<NFC_SYS>()->InstallAsService(sm);
+}
+
+} // namespace Service::NFC
diff --git a/src/core/hle/service/nfc/nfc.h b/src/core/hle/service/nfc/nfc.h
new file mode 100644
index 000000000..4d2d815f9
--- /dev/null
+++ b/src/core/hle/service/nfc/nfc.h
@@ -0,0 +1,15 @@
+// Copyright 2018 yuzu emulator team
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+namespace Service::SM {
+class ServiceManager;
+}
+
+namespace Service::NFC {
+
+void InstallInterfaces(SM::ServiceManager& sm);
+
+} // namespace Service::NFC
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index 8b84fd349..443ab5857 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -33,6 +33,7 @@
#include "core/hle/service/ldr/ldr.h"
#include "core/hle/service/lm/lm.h"
#include "core/hle/service/mm/mm_u.h"
+#include "core/hle/service/nfc/nfc.h"
#include "core/hle/service/nfp/nfp.h"
#include "core/hle/service/nifm/nifm.h"
#include "core/hle/service/nim/nim.h"
@@ -207,6 +208,7 @@ void Init(std::shared_ptr<SM::ServiceManager>& sm) {
LDR::InstallInterfaces(*sm);
LM::InstallInterfaces(*sm);
MM::InstallInterfaces(*sm);
+ NFC::InstallInterfaces(*sm);
NFP::InstallInterfaces(*sm);
NIFM::InstallInterfaces(*sm);
NIM::InstallInterfaces(*sm);