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 | 222 | ||||
| -rw-r--r-- | src/core/hle/service/nfc/nfc.h | 15 | ||||
| -rw-r--r-- | src/core/hle/service/service.cpp | 2 |
6 files changed, 243 insertions, 0 deletions
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp index db3ee0837..30537b27b 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, NFC) \ | ||
| 180 | SUB(Service, NFP) \ | 181 | SUB(Service, NFP) \ |
| 181 | SUB(Service, NIFM) \ | 182 | SUB(Service, NIFM) \ |
| 182 | SUB(Service, NS) \ | 183 | SUB(Service, NS) \ |
diff --git a/src/common/logging/log.h b/src/common/logging/log.h index d22cb2966..805f82d2f 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_NFC, ///< The NFC (Near-field communication) service | ||
| 67 | Service_NFP, ///< The NFP service | 68 | Service_NFP, ///< The NFP service |
| 68 | Service_NIFM, ///< The NIFM (Network interface) service | 69 | Service_NIFM, ///< The NIFM (Network interface) service |
| 69 | Service_NS, ///< The NS services | 70 | Service_NS, ///< The NS services |
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 525ba39bc..b367c2a27 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/nfc/nfc.cpp | ||
| 180 | hle/service/nfc/nfc.h | ||
| 179 | hle/service/nfp/nfp.cpp | 181 | hle/service/nfp/nfp.cpp |
| 180 | hle/service/nfp/nfp.h | 182 | hle/service/nfp/nfp.h |
| 181 | hle/service/nfp/nfp_user.cpp | 183 | 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..8fec97db8 --- /dev/null +++ b/src/core/hle/service/nfc/nfc.cpp | |||
| @@ -0,0 +1,222 @@ | |||
| 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 "common/logging/log.h" | ||
| 8 | #include "core/hle/ipc_helpers.h" | ||
| 9 | #include "core/hle/kernel/hle_ipc.h" | ||
| 10 | #include "core/hle/service/nfc/nfc.h" | ||
| 11 | #include "core/hle/service/service.h" | ||
| 12 | #include "core/hle/service/sm/sm.h" | ||
| 13 | |||
| 14 | namespace Service::NFC { | ||
| 15 | |||
| 16 | class IAm final : public ServiceFramework<IAm> { | ||
| 17 | public: | ||
| 18 | explicit IAm() : ServiceFramework{"IAm"} { | ||
| 19 | // clang-format off | ||
| 20 | static const FunctionInfo functions[] = { | ||
| 21 | {0, nullptr, "Initialize"}, | ||
| 22 | {1, nullptr, "Finalize"}, | ||
| 23 | {2, nullptr, "NotifyForegroundApplet"}, | ||
| 24 | }; | ||
| 25 | // clang-format on | ||
| 26 | |||
| 27 | RegisterHandlers(functions); | ||
| 28 | } | ||
| 29 | }; | ||
| 30 | |||
| 31 | class NFC_AM final : public ServiceFramework<NFC_AM> { | ||
| 32 | public: | ||
| 33 | explicit NFC_AM() : ServiceFramework{"nfc:am"} { | ||
| 34 | // clang-format off | ||
| 35 | static const FunctionInfo functions[] = { | ||
| 36 | {0, &NFC_AM::CreateAmInterface, "CreateAmInterface"}, | ||
| 37 | }; | ||
| 38 | // clang-format on | ||
| 39 | |||
| 40 | RegisterHandlers(functions); | ||
| 41 | } | ||
| 42 | |||
| 43 | private: | ||
| 44 | void CreateAmInterface(Kernel::HLERequestContext& ctx) { | ||
| 45 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 46 | rb.Push(RESULT_SUCCESS); | ||
| 47 | rb.PushIpcInterface<IAm>(); | ||
| 48 | |||
| 49 | LOG_DEBUG(Service_NFC, "called"); | ||
| 50 | } | ||
| 51 | }; | ||
| 52 | |||
| 53 | class MFIUser final : public ServiceFramework<MFIUser> { | ||
| 54 | public: | ||
| 55 | explicit MFIUser() : ServiceFramework{"IUser"} { | ||
| 56 | // clang-format off | ||
| 57 | static const FunctionInfo functions[] = { | ||
| 58 | {0, nullptr, "Initialize"}, | ||
| 59 | {1, nullptr, "Finalize"}, | ||
| 60 | {2, nullptr, "ListDevices"}, | ||
| 61 | {3, nullptr, "StartDetection"}, | ||
| 62 | {4, nullptr, "StopDetection"}, | ||
| 63 | {5, nullptr, "Read"}, | ||
| 64 | {6, nullptr, "Write"}, | ||
| 65 | {7, nullptr, "GetTagInfo"}, | ||
| 66 | {8, nullptr, "GetActivateEventHandle"}, | ||
| 67 | {9, nullptr, "GetDeactivateEventHandle"}, | ||
| 68 | {10, nullptr, "GetState"}, | ||
| 69 | {11, nullptr, "GetDeviceState"}, | ||
| 70 | {12, nullptr, "GetNpadId"}, | ||
| 71 | {13, nullptr, "GetAvailabilityChangeEventHandle"}, | ||
| 72 | }; | ||
| 73 | // clang-format on | ||
| 74 | |||
| 75 | RegisterHandlers(functions); | ||
| 76 | } | ||
| 77 | }; | ||
| 78 | |||
| 79 | class NFC_MF_U final : public ServiceFramework<NFC_MF_U> { | ||
| 80 | public: | ||
| 81 | explicit NFC_MF_U() : ServiceFramework{"nfc:mf:u"} { | ||
| 82 | // clang-format off | ||
| 83 | static const FunctionInfo functions[] = { | ||
| 84 | {0, &NFC_MF_U::CreateUserInterface, "CreateUserInterface"}, | ||
| 85 | }; | ||
| 86 | // clang-format on | ||
| 87 | |||
| 88 | RegisterHandlers(functions); | ||
| 89 | } | ||
| 90 | |||
| 91 | private: | ||
| 92 | void CreateUserInterface(Kernel::HLERequestContext& ctx) { | ||
| 93 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 94 | rb.Push(RESULT_SUCCESS); | ||
| 95 | rb.PushIpcInterface<MFIUser>(); | ||
| 96 | |||
| 97 | LOG_DEBUG(Service_NFC, "called"); | ||
| 98 | } | ||
| 99 | }; | ||
| 100 | |||
| 101 | class IUser final : public ServiceFramework<IUser> { | ||
| 102 | public: | ||
| 103 | explicit IUser() : ServiceFramework{"IUser"} { | ||
| 104 | // clang-format off | ||
| 105 | static const FunctionInfo functions[] = { | ||
| 106 | {0, nullptr, "Initialize"}, | ||
| 107 | {1, nullptr, "Finalize"}, | ||
| 108 | {2, nullptr, "GetState"}, | ||
| 109 | {3, nullptr, "IsNfcEnabled"}, | ||
| 110 | {400, nullptr, "Initialize"}, | ||
| 111 | {401, nullptr, "Finalize"}, | ||
| 112 | {402, nullptr, "GetState"}, | ||
| 113 | {403, nullptr, "IsNfcEnabled"}, | ||
| 114 | {404, nullptr, "ListDevices"}, | ||
| 115 | {405, nullptr, "GetDeviceState"}, | ||
| 116 | {406, nullptr, "GetNpadId"}, | ||
| 117 | {407, nullptr, "AttachAvailabilityChangeEvent"}, | ||
| 118 | {408, nullptr, "StartDetection"}, | ||
| 119 | {409, nullptr, "StopDetection"}, | ||
| 120 | {410, nullptr, "GetTagInfo"}, | ||
| 121 | {411, nullptr, "AttachActivateEvent"}, | ||
| 122 | {412, nullptr, "AttachDeactivateEvent"}, | ||
| 123 | {1000, nullptr, "ReadMifare"}, | ||
| 124 | {1001, nullptr, "WriteMifare"}, | ||
| 125 | {1300, nullptr, "SendCommandByPassThrough"}, | ||
| 126 | {1301, nullptr, "KeepPassThroughSession"}, | ||
| 127 | {1302, nullptr, "ReleasePassThroughSession"}, | ||
| 128 | }; | ||
| 129 | // clang-format on | ||
| 130 | |||
| 131 | RegisterHandlers(functions); | ||
| 132 | } | ||
| 133 | }; | ||
| 134 | |||
| 135 | class NFC_U final : public ServiceFramework<NFC_U> { | ||
| 136 | public: | ||
| 137 | explicit NFC_U() : ServiceFramework{"nfc:u"} { | ||
| 138 | // clang-format off | ||
| 139 | static const FunctionInfo functions[] = { | ||
| 140 | {0, &NFC_U::CreateUserInterface, "CreateUserInterface"}, | ||
| 141 | }; | ||
| 142 | // clang-format on | ||
| 143 | |||
| 144 | RegisterHandlers(functions); | ||
| 145 | } | ||
| 146 | |||
| 147 | private: | ||
| 148 | void CreateUserInterface(Kernel::HLERequestContext& ctx) { | ||
| 149 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 150 | rb.Push(RESULT_SUCCESS); | ||
| 151 | rb.PushIpcInterface<IUser>(); | ||
| 152 | |||
| 153 | LOG_DEBUG(Service_NFC, "called"); | ||
| 154 | } | ||
| 155 | }; | ||
| 156 | |||
| 157 | class ISystem final : public ServiceFramework<ISystem> { | ||
| 158 | public: | ||
| 159 | explicit ISystem() : ServiceFramework{"ISystem"} { | ||
| 160 | // clang-format off | ||
| 161 | static const FunctionInfo functions[] = { | ||
| 162 | {0, nullptr, "Initialize"}, | ||
| 163 | {1, nullptr, "Finalize"}, | ||
| 164 | {2, nullptr, "GetState"}, | ||
| 165 | {3, nullptr, "IsNfcEnabled"}, | ||
| 166 | {100, nullptr, "SetNfcEnabled"}, | ||
| 167 | {400, nullptr, "InitializeSystem"}, | ||
| 168 | {401, nullptr, "FinalizeSystem"}, | ||
| 169 | {402, nullptr, "GetState"}, | ||
| 170 | {403, nullptr, "IsNfcEnabled"}, | ||
| 171 | {404, nullptr, "ListDevices"}, | ||
| 172 | {405, nullptr, "GetDeviceState"}, | ||
| 173 | {406, nullptr, "GetNpadId"}, | ||
| 174 | {407, nullptr, "AttachAvailabilityChangeEvent"}, | ||
| 175 | {408, nullptr, "StartDetection"}, | ||
| 176 | {409, nullptr, "StopDetection"}, | ||
| 177 | {410, nullptr, "GetTagInfo"}, | ||
| 178 | {411, nullptr, "AttachActivateEvent"}, | ||
| 179 | {412, nullptr, "AttachDeactivateEvent"}, | ||
| 180 | {500, nullptr, "SetNfcEnabled"}, | ||
| 181 | {1000, nullptr, "ReadMifare"}, | ||
| 182 | {1001, nullptr, "WriteMifare"}, | ||
| 183 | {1300, nullptr, "SendCommandByPassThrough"}, | ||
| 184 | {1301, nullptr, "KeepPassThroughSession"}, | ||
| 185 | {1302, nullptr, "ReleasePassThroughSession"}, | ||
| 186 | }; | ||
| 187 | // clang-format on | ||
| 188 | |||
| 189 | RegisterHandlers(functions); | ||
| 190 | } | ||
| 191 | }; | ||
| 192 | |||
| 193 | class NFC_SYS final : public ServiceFramework<NFC_SYS> { | ||
| 194 | public: | ||
| 195 | explicit NFC_SYS() : ServiceFramework{"nfc:sys"} { | ||
| 196 | // clang-format off | ||
| 197 | static const FunctionInfo functions[] = { | ||
| 198 | {0, &NFC_SYS::CreateSystemInterface, "CreateSystemInterface"}, | ||
| 199 | }; | ||
| 200 | // clang-format on | ||
| 201 | |||
| 202 | RegisterHandlers(functions); | ||
| 203 | } | ||
| 204 | |||
| 205 | private: | ||
| 206 | void CreateSystemInterface(Kernel::HLERequestContext& ctx) { | ||
| 207 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 208 | rb.Push(RESULT_SUCCESS); | ||
| 209 | rb.PushIpcInterface<ISystem>(); | ||
| 210 | |||
| 211 | LOG_DEBUG(Service_NFC, "called"); | ||
| 212 | } | ||
| 213 | }; | ||
| 214 | |||
| 215 | void InstallInterfaces(SM::ServiceManager& sm) { | ||
| 216 | std::make_shared<NFC_AM>()->InstallAsService(sm); | ||
| 217 | std::make_shared<NFC_MF_U>()->InstallAsService(sm); | ||
| 218 | std::make_shared<NFC_U>()->InstallAsService(sm); | ||
| 219 | std::make_shared<NFC_SYS>()->InstallAsService(sm); | ||
| 220 | } | ||
| 221 | |||
| 222 | } // 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 d2c05cc92..8026d27a7 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/nfc/nfc.h" | ||
| 38 | #include "core/hle/service/nfp/nfp.h" | 39 | #include "core/hle/service/nfp/nfp.h" |
| 39 | #include "core/hle/service/nifm/nifm.h" | 40 | #include "core/hle/service/nifm/nifm.h" |
| 40 | #include "core/hle/service/nim/nim.h" | 41 | #include "core/hle/service/nim/nim.h" |
| @@ -211,6 +212,7 @@ void Init(std::shared_ptr<SM::ServiceManager>& sm) { | |||
| 211 | LDR::InstallInterfaces(*sm); | 212 | LDR::InstallInterfaces(*sm); |
| 212 | LM::InstallInterfaces(*sm); | 213 | LM::InstallInterfaces(*sm); |
| 213 | MM::InstallInterfaces(*sm); | 214 | MM::InstallInterfaces(*sm); |
| 215 | NFC::InstallInterfaces(*sm); | ||
| 214 | NFP::InstallInterfaces(*sm); | 216 | NFP::InstallInterfaces(*sm); |
| 215 | NIFM::InstallInterfaces(*sm); | 217 | NIFM::InstallInterfaces(*sm); |
| 216 | NIM::InstallInterfaces(*sm); | 218 | NIM::InstallInterfaces(*sm); |