diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/common/logging/backend.cpp | 1 | ||||
| -rw-r--r-- | src/common/logging/log.h | 1 | ||||
| -rw-r--r-- | src/core/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/core/hle/service/nfc/nfc.cpp | 183 | ||||
| -rw-r--r-- | src/core/hle/service/nfc/nfc.h | 15 | ||||
| -rw-r--r-- | src/core/hle/service/service.cpp | 2 |
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) { | |||
| 176 | SUB(Service, LDN) \ | 176 | SUB(Service, LDN) \ |
| 177 | SUB(Service, LM) \ | 177 | SUB(Service, LM) \ |
| 178 | SUB(Service, MM) \ | 178 | SUB(Service, MM) \ |
| 179 | SUB(Service, NFC) \ | ||
| 179 | SUB(Service, NFP) \ | 180 | SUB(Service, NFP) \ |
| 180 | SUB(Service, NIFM) \ | 181 | SUB(Service, NIFM) \ |
| 181 | SUB(Service, NS) \ | 182 | 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 { | |||
| 63 | Service_LDN, ///< The LDN (Local domain network) service | 63 | Service_LDN, ///< The LDN (Local domain network) service |
| 64 | Service_LM, ///< The LM (Logger) service | 64 | Service_LM, ///< The LM (Logger) service |
| 65 | Service_MM, ///< The MM (Multimedia) service | 65 | Service_MM, ///< The MM (Multimedia) service |
| 66 | Service_NFC, ///< The NFC (Near-field communication) service | ||
| 66 | Service_NFP, ///< The NFP service | 67 | Service_NFP, ///< The NFP service |
| 67 | Service_NIFM, ///< The NIFM (Network interface) service | 68 | Service_NIFM, ///< The NIFM (Network interface) service |
| 68 | Service_NS, ///< The NS services | 69 | 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 | |||
| 172 | hle/service/lm/lm.h | 172 | hle/service/lm/lm.h |
| 173 | hle/service/mm/mm_u.cpp | 173 | hle/service/mm/mm_u.cpp |
| 174 | hle/service/mm/mm_u.h | 174 | hle/service/mm/mm_u.h |
| 175 | hle/service/nfc/nfc.cpp | ||
| 176 | hle/service/nfc/nfc.h | ||
| 175 | hle/service/nfp/nfp.cpp | 177 | hle/service/nfp/nfp.cpp |
| 176 | hle/service/nfp/nfp.h | 178 | hle/service/nfp/nfp.h |
| 177 | hle/service/nfp/nfp_user.cpp | 179 | 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 @@ | |||
| 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/nfc/nfc.h" | ||
| 8 | #include "core/hle/service/service.h" | ||
| 9 | #include "core/hle/service/sm/sm.h" | ||
| 10 | |||
| 11 | namespace Service::NFC { | ||
| 12 | |||
| 13 | class IAm final : public ServiceFramework<IAm> { | ||
| 14 | public: | ||
| 15 | explicit IAm() : ServiceFramework{"IAm"} { | ||
| 16 | // clang-format off | ||
| 17 | static const FunctionInfo functions[] = { | ||
| 18 | {0, nullptr, "Initialize"}, | ||
| 19 | {1, nullptr, "Finalize"}, | ||
| 20 | {2, nullptr, "NotifyForegroundApplet"}, | ||
| 21 | }; | ||
| 22 | // clang-format on | ||
| 23 | |||
| 24 | RegisterHandlers(functions); | ||
| 25 | } | ||
| 26 | }; | ||
| 27 | |||
| 28 | class NFC_AM final : public ServiceFramework<NFC_AM> { | ||
| 29 | public: | ||
| 30 | explicit NFC_AM() : ServiceFramework{"nfc:am"} { | ||
| 31 | // clang-format off | ||
| 32 | static const FunctionInfo functions[] = { | ||
| 33 | {0, nullptr, "CreateAmInterface"}, | ||
| 34 | }; | ||
| 35 | // clang-format on | ||
| 36 | |||
| 37 | RegisterHandlers(functions); | ||
| 38 | } | ||
| 39 | }; | ||
| 40 | |||
| 41 | class MFIUser final : public ServiceFramework<MFIUser> { | ||
| 42 | public: | ||
| 43 | explicit MFIUser() : ServiceFramework{"IUser"} { | ||
| 44 | // clang-format off | ||
| 45 | static const FunctionInfo functions[] = { | ||
| 46 | {0, nullptr, "Initialize"}, | ||
| 47 | {1, nullptr, "Finalize"}, | ||
| 48 | {2, nullptr, "ListDevices"}, | ||
| 49 | {3, nullptr, "StartDetection"}, | ||
| 50 | {4, nullptr, "StopDetection"}, | ||
| 51 | {5, nullptr, "Read"}, | ||
| 52 | {6, nullptr, "Write"}, | ||
| 53 | {7, nullptr, "GetTagInfo"}, | ||
| 54 | {8, nullptr, "GetActivateEventHandle"}, | ||
| 55 | {9, nullptr, "GetDeactivateEventHandle"}, | ||
| 56 | {10, nullptr, "GetState"}, | ||
| 57 | {11, nullptr, "GetDeviceState"}, | ||
| 58 | {12, nullptr, "GetNpadId"}, | ||
| 59 | {13, nullptr, "GetAvailabilityChangeEventHandle"}, | ||
| 60 | }; | ||
| 61 | // clang-format on | ||
| 62 | |||
| 63 | RegisterHandlers(functions); | ||
| 64 | } | ||
| 65 | }; | ||
| 66 | |||
| 67 | class NFC_MF_U final : public ServiceFramework<NFC_MF_U> { | ||
| 68 | public: | ||
| 69 | explicit NFC_MF_U() : ServiceFramework{"nfc:mf:u"} { | ||
| 70 | // clang-format off | ||
| 71 | static const FunctionInfo functions[] = { | ||
| 72 | {0, nullptr, "CreateUserInterface"}, | ||
| 73 | }; | ||
| 74 | // clang-format on | ||
| 75 | |||
| 76 | RegisterHandlers(functions); | ||
| 77 | } | ||
| 78 | }; | ||
| 79 | |||
| 80 | class IUser final : public ServiceFramework<IUser> { | ||
| 81 | public: | ||
| 82 | explicit IUser() : ServiceFramework{"IUser"} { | ||
| 83 | // clang-format off | ||
| 84 | static const FunctionInfo functions[] = { | ||
| 85 | {0, nullptr, "Initialize"}, | ||
| 86 | {1, nullptr, "Finalize"}, | ||
| 87 | {2, nullptr, "GetState"}, | ||
| 88 | {3, nullptr, "IsNfcEnabled"}, | ||
| 89 | {400, nullptr, "Initialize"}, | ||
| 90 | {401, nullptr, "Finalize"}, | ||
| 91 | {402, nullptr, "GetState"}, | ||
| 92 | {403, nullptr, "IsNfcEnabled"}, | ||
| 93 | {404, nullptr, "ListDevices"}, | ||
| 94 | {405, nullptr, "GetDeviceState"}, | ||
| 95 | {406, nullptr, "GetNpadId"}, | ||
| 96 | {407, nullptr, "AttachAvailabilityChangeEvent"}, | ||
| 97 | {408, nullptr, "StartDetection"}, | ||
| 98 | {409, nullptr, "StopDetection"}, | ||
| 99 | {410, nullptr, "GetTagInfo"}, | ||
| 100 | {411, nullptr, "AttachActivateEvent"}, | ||
| 101 | {412, nullptr, "AttachDeactivateEvent"}, | ||
| 102 | {1000, nullptr, "ReadMifare"}, | ||
| 103 | {1001, nullptr, "WriteMifare"}, | ||
| 104 | {1300, nullptr, "SendCommandByPassThrough"}, | ||
| 105 | {1301, nullptr, "KeepPassThroughSession"}, | ||
| 106 | {1302, nullptr, "ReleasePassThroughSession"}, | ||
| 107 | }; | ||
| 108 | // clang-format on | ||
| 109 | |||
| 110 | RegisterHandlers(functions); | ||
| 111 | } | ||
| 112 | }; | ||
| 113 | |||
| 114 | class NFC_U final : public ServiceFramework<NFC_U> { | ||
| 115 | public: | ||
| 116 | explicit NFC_U() : ServiceFramework{"nfc:u"} { | ||
| 117 | // clang-format off | ||
| 118 | static const FunctionInfo functions[] = { | ||
| 119 | {0, nullptr, "CreateUserInterface"}, | ||
| 120 | }; | ||
| 121 | // clang-format on | ||
| 122 | |||
| 123 | RegisterHandlers(functions); | ||
| 124 | } | ||
| 125 | }; | ||
| 126 | |||
| 127 | class ISystem final : public ServiceFramework<ISystem> { | ||
| 128 | public: | ||
| 129 | explicit ISystem() : ServiceFramework{"ISystem"} { | ||
| 130 | // clang-format off | ||
| 131 | static const FunctionInfo functions[] = { | ||
| 132 | {0, nullptr, "Initialize"}, | ||
| 133 | {1, nullptr, "Finalize"}, | ||
| 134 | {2, nullptr, "GetState"}, | ||
| 135 | {3, nullptr, "IsNfcEnabled"}, | ||
| 136 | {100, nullptr, "SetNfcEnabled"}, | ||
| 137 | {400, nullptr, "InitializeSystem"}, | ||
| 138 | {401, nullptr, "FinalizeSystem"}, | ||
| 139 | {402, nullptr, "GetState"}, | ||
| 140 | {403, nullptr, "IsNfcEnabled"}, | ||
| 141 | {404, nullptr, "ListDevices"}, | ||
| 142 | {405, nullptr, "GetDeviceState"}, | ||
| 143 | {406, nullptr, "GetNpadId"}, | ||
| 144 | {407, nullptr, "AttachAvailabilityChangeEvent"}, | ||
| 145 | {408, nullptr, "StartDetection"}, | ||
| 146 | {409, nullptr, "StopDetection"}, | ||
| 147 | {410, nullptr, "GetTagInfo"}, | ||
| 148 | {411, nullptr, "AttachActivateEvent"}, | ||
| 149 | {412, nullptr, "AttachDeactivateEvent"}, | ||
| 150 | {500, nullptr, "SetNfcEnabled"}, | ||
| 151 | {1000, nullptr, "ReadMifare"}, | ||
| 152 | {1001, nullptr, "WriteMifare"}, | ||
| 153 | {1300, nullptr, "SendCommandByPassThrough"}, | ||
| 154 | {1301, nullptr, "KeepPassThroughSession"}, | ||
| 155 | {1302, nullptr, "ReleasePassThroughSession"}, | ||
| 156 | }; | ||
| 157 | // clang-format on | ||
| 158 | |||
| 159 | RegisterHandlers(functions); | ||
| 160 | } | ||
| 161 | }; | ||
| 162 | |||
| 163 | class NFC_SYS final : public ServiceFramework<NFC_SYS> { | ||
| 164 | public: | ||
| 165 | explicit NFC_SYS() : ServiceFramework{"nfc:sys"} { | ||
| 166 | // clang-format off | ||
| 167 | static const FunctionInfo functions[] = { | ||
| 168 | {0, nullptr, "CreateSystemInterface"}, | ||
| 169 | }; | ||
| 170 | // clang-format on | ||
| 171 | |||
| 172 | RegisterHandlers(functions); | ||
| 173 | } | ||
| 174 | }; | ||
| 175 | |||
| 176 | void InstallInterfaces(SM::ServiceManager& sm) { | ||
| 177 | std::make_shared<NFC_AM>()->InstallAsService(sm); | ||
| 178 | std::make_shared<NFC_MF_U>()->InstallAsService(sm); | ||
| 179 | std::make_shared<NFC_U>()->InstallAsService(sm); | ||
| 180 | std::make_shared<NFC_SYS>()->InstallAsService(sm); | ||
| 181 | } | ||
| 182 | |||
| 183 | } // 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 @@ | |||
| 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 | |||
| 7 | namespace Service::SM { | ||
| 8 | class ServiceManager; | ||
| 9 | } | ||
| 10 | |||
| 11 | namespace Service::NFC { | ||
| 12 | |||
| 13 | void InstallInterfaces(SM::ServiceManager& sm); | ||
| 14 | |||
| 15 | } // 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 @@ | |||
| 33 | #include "core/hle/service/ldr/ldr.h" | 33 | #include "core/hle/service/ldr/ldr.h" |
| 34 | #include "core/hle/service/lm/lm.h" | 34 | #include "core/hle/service/lm/lm.h" |
| 35 | #include "core/hle/service/mm/mm_u.h" | 35 | #include "core/hle/service/mm/mm_u.h" |
| 36 | #include "core/hle/service/nfc/nfc.h" | ||
| 36 | #include "core/hle/service/nfp/nfp.h" | 37 | #include "core/hle/service/nfp/nfp.h" |
| 37 | #include "core/hle/service/nifm/nifm.h" | 38 | #include "core/hle/service/nifm/nifm.h" |
| 38 | #include "core/hle/service/nim/nim.h" | 39 | #include "core/hle/service/nim/nim.h" |
| @@ -207,6 +208,7 @@ void Init(std::shared_ptr<SM::ServiceManager>& sm) { | |||
| 207 | LDR::InstallInterfaces(*sm); | 208 | LDR::InstallInterfaces(*sm); |
| 208 | LM::InstallInterfaces(*sm); | 209 | LM::InstallInterfaces(*sm); |
| 209 | MM::InstallInterfaces(*sm); | 210 | MM::InstallInterfaces(*sm); |
| 211 | NFC::InstallInterfaces(*sm); | ||
| 210 | NFP::InstallInterfaces(*sm); | 212 | NFP::InstallInterfaces(*sm); |
| 211 | NIFM::InstallInterfaces(*sm); | 213 | NIFM::InstallInterfaces(*sm); |
| 212 | NIM::InstallInterfaces(*sm); | 214 | NIM::InstallInterfaces(*sm); |