diff options
| -rw-r--r-- | src/core/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | src/core/hle/service/nfp/nfp.cpp | 187 | ||||
| -rw-r--r-- | src/core/hle/service/nfp/nfp_interface.cpp (renamed from src/core/hle/service/nfp/nfp_user.cpp) | 89 | ||||
| -rw-r--r-- | src/core/hle/service/nfp/nfp_interface.h (renamed from src/core/hle/service/nfp/nfp_user.h) | 18 |
4 files changed, 227 insertions, 71 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 4e677f287..8817a99c9 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -570,10 +570,10 @@ add_library(core STATIC | |||
| 570 | hle/service/nfp/nfp.h | 570 | hle/service/nfp/nfp.h |
| 571 | hle/service/nfp/nfp_device.cpp | 571 | hle/service/nfp/nfp_device.cpp |
| 572 | hle/service/nfp/nfp_device.h | 572 | hle/service/nfp/nfp_device.h |
| 573 | hle/service/nfp/nfp_interface.cpp | ||
| 574 | hle/service/nfp/nfp_interface.h | ||
| 573 | hle/service/nfp/nfp_result.h | 575 | hle/service/nfp/nfp_result.h |
| 574 | hle/service/nfp/nfp_types.h | 576 | hle/service/nfp/nfp_types.h |
| 575 | hle/service/nfp/nfp_user.cpp | ||
| 576 | hle/service/nfp/nfp_user.h | ||
| 577 | hle/service/ngct/ngct.cpp | 577 | hle/service/ngct/ngct.cpp |
| 578 | hle/service/ngct/ngct.h | 578 | hle/service/ngct/ngct.h |
| 579 | hle/service/nifm/nifm.cpp | 579 | hle/service/nifm/nifm.cpp |
diff --git a/src/core/hle/service/nfp/nfp.cpp b/src/core/hle/service/nfp/nfp.cpp index e262dc2f2..e57e932c8 100644 --- a/src/core/hle/service/nfp/nfp.cpp +++ b/src/core/hle/service/nfp/nfp.cpp | |||
| @@ -4,11 +4,138 @@ | |||
| 4 | #include "common/logging/log.h" | 4 | #include "common/logging/log.h" |
| 5 | #include "core/hle/service/ipc_helpers.h" | 5 | #include "core/hle/service/ipc_helpers.h" |
| 6 | #include "core/hle/service/nfp/nfp.h" | 6 | #include "core/hle/service/nfp/nfp.h" |
| 7 | #include "core/hle/service/nfp/nfp_user.h" | 7 | #include "core/hle/service/nfp/nfp_interface.h" |
| 8 | #include "core/hle/service/server_manager.h" | 8 | #include "core/hle/service/server_manager.h" |
| 9 | 9 | ||
| 10 | namespace Service::NFP { | 10 | namespace Service::NFP { |
| 11 | 11 | ||
| 12 | class IUser final : public Interface { | ||
| 13 | public: | ||
| 14 | explicit IUser(Core::System& system_) : Interface(system_, "NFP:IUser") { | ||
| 15 | // clang-format off | ||
| 16 | static const FunctionInfo functions[] = { | ||
| 17 | {0, &IUser::Initialize, "Initialize"}, | ||
| 18 | {1, &IUser::Finalize, "Finalize"}, | ||
| 19 | {2, &IUser::ListDevices, "ListDevices"}, | ||
| 20 | {3, &IUser::StartDetection, "StartDetection"}, | ||
| 21 | {4, &IUser::StopDetection, "StopDetection"}, | ||
| 22 | {5, &IUser::Mount, "Mount"}, | ||
| 23 | {6, &IUser::Unmount, "Unmount"}, | ||
| 24 | {7, &IUser::OpenApplicationArea, "OpenApplicationArea"}, | ||
| 25 | {8, &IUser::GetApplicationArea, "GetApplicationArea"}, | ||
| 26 | {9, &IUser::SetApplicationArea, "SetApplicationArea"}, | ||
| 27 | {10, &IUser::Flush, "Flush"}, | ||
| 28 | {11, &IUser::Restore, "Restore"}, | ||
| 29 | {12, &IUser::CreateApplicationArea, "CreateApplicationArea"}, | ||
| 30 | {13, &IUser::GetTagInfo, "GetTagInfo"}, | ||
| 31 | {14, &IUser::GetRegisterInfo, "GetRegisterInfo"}, | ||
| 32 | {15, &IUser::GetCommonInfo, "GetCommonInfo"}, | ||
| 33 | {16, &IUser::GetModelInfo, "GetModelInfo"}, | ||
| 34 | {17, &IUser::AttachActivateEvent, "AttachActivateEvent"}, | ||
| 35 | {18, &IUser::AttachDeactivateEvent, "AttachDeactivateEvent"}, | ||
| 36 | {19, &IUser::GetState, "GetState"}, | ||
| 37 | {20, &IUser::GetDeviceState, "GetDeviceState"}, | ||
| 38 | {21, &IUser::GetNpadId, "GetNpadId"}, | ||
| 39 | {22, &IUser::GetApplicationAreaSize, "GetApplicationAreaSize"}, | ||
| 40 | {23, &IUser::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"}, | ||
| 41 | {24, &IUser::RecreateApplicationArea, "RecreateApplicationArea"}, | ||
| 42 | }; | ||
| 43 | // clang-format on | ||
| 44 | |||
| 45 | RegisterHandlers(functions); | ||
| 46 | } | ||
| 47 | }; | ||
| 48 | |||
| 49 | class ISystem final : public Interface { | ||
| 50 | public: | ||
| 51 | explicit ISystem(Core::System& system_) : Interface(system_, "NFP:ISystem") { | ||
| 52 | // clang-format off | ||
| 53 | static const FunctionInfo functions[] = { | ||
| 54 | {0, nullptr, "InitializeSystem"}, | ||
| 55 | {1, nullptr, "FinalizeSystem"}, | ||
| 56 | {2, &ISystem::ListDevices, "ListDevices"}, | ||
| 57 | {3, &ISystem::StartDetection, "StartDetection"}, | ||
| 58 | {4, &ISystem::StopDetection, "StopDetection"}, | ||
| 59 | {5, &ISystem::Mount, "Mount"}, | ||
| 60 | {6, &ISystem::Unmount, "Unmount"}, | ||
| 61 | {10, &ISystem::Flush, "Flush"}, | ||
| 62 | {11, &ISystem::Restore, "Restore"}, | ||
| 63 | {12, &ISystem::CreateApplicationArea, "CreateApplicationArea"}, | ||
| 64 | {13, &ISystem::GetTagInfo, "GetTagInfo"}, | ||
| 65 | {14, &ISystem::GetRegisterInfo, "GetRegisterInfo"}, | ||
| 66 | {15, &ISystem::GetCommonInfo, "GetCommonInfo"}, | ||
| 67 | {16, &ISystem::GetModelInfo, "GetModelInfo"}, | ||
| 68 | {17, &ISystem::AttachActivateEvent, "AttachActivateEvent"}, | ||
| 69 | {18, &ISystem::AttachDeactivateEvent, "AttachDeactivateEvent"}, | ||
| 70 | {19, &ISystem::GetState, "GetState"}, | ||
| 71 | {20, &ISystem::GetDeviceState, "GetDeviceState"}, | ||
| 72 | {21, &ISystem::GetNpadId, "GetNpadId"}, | ||
| 73 | {23, &ISystem::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"}, | ||
| 74 | {100, nullptr, "Format"}, | ||
| 75 | {101, nullptr, "GetAdminInfo"}, | ||
| 76 | {102, nullptr, "GetRegisterInfoPrivate"}, | ||
| 77 | {103, nullptr, "SetRegisterInfoPrivate"}, | ||
| 78 | {104, nullptr, "DeleteRegisterInfo"}, | ||
| 79 | {105, nullptr, "DeleteApplicationArea"}, | ||
| 80 | {106, nullptr, "ExistsApplicationArea"}, | ||
| 81 | }; | ||
| 82 | // clang-format on | ||
| 83 | |||
| 84 | RegisterHandlers(functions); | ||
| 85 | } | ||
| 86 | }; | ||
| 87 | |||
| 88 | class IDebug final : public Interface { | ||
| 89 | public: | ||
| 90 | explicit IDebug(Core::System& system_) : Interface(system_, "NFP:IDebug") { | ||
| 91 | // clang-format off | ||
| 92 | static const FunctionInfo functions[] = { | ||
| 93 | {0, nullptr, "InitializeDebug"}, | ||
| 94 | {1, nullptr, "FinalizeDebug"}, | ||
| 95 | {2, &IDebug::ListDevices, "ListDevices"}, | ||
| 96 | {3, &IDebug::StartDetection, "StartDetection"}, | ||
| 97 | {4, &IDebug::StopDetection, "StopDetection"}, | ||
| 98 | {5, &IDebug::Mount, "Mount"}, | ||
| 99 | {6, &IDebug::Unmount, "Unmount"}, | ||
| 100 | {7, &IDebug::OpenApplicationArea, "OpenApplicationArea"}, | ||
| 101 | {8, &IDebug::GetApplicationArea, "GetApplicationArea"}, | ||
| 102 | {9, &IDebug::SetApplicationArea, "SetApplicationArea"}, | ||
| 103 | {10, &IDebug::Flush, "Flush"}, | ||
| 104 | {11, &IDebug::Restore, "Restore"}, | ||
| 105 | {12, &IDebug::CreateApplicationArea, "CreateApplicationArea"}, | ||
| 106 | {13, &IDebug::GetTagInfo, "GetTagInfo"}, | ||
| 107 | {14, &IDebug::GetRegisterInfo, "GetRegisterInfo"}, | ||
| 108 | {15, &IDebug::GetCommonInfo, "GetCommonInfo"}, | ||
| 109 | {16, &IDebug::GetModelInfo, "GetModelInfo"}, | ||
| 110 | {17, &IDebug::AttachActivateEvent, "AttachActivateEvent"}, | ||
| 111 | {18, &IDebug::AttachDeactivateEvent, "AttachDeactivateEvent"}, | ||
| 112 | {19, &IDebug::GetState, "GetState"}, | ||
| 113 | {20, &IDebug::GetDeviceState, "GetDeviceState"}, | ||
| 114 | {21, &IDebug::GetNpadId, "GetNpadId"}, | ||
| 115 | {22, &IDebug::GetApplicationAreaSize, "GetApplicationAreaSize"}, | ||
| 116 | {23, &IDebug::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"}, | ||
| 117 | {24, &IDebug::RecreateApplicationArea, "RecreateApplicationArea"}, | ||
| 118 | {100, nullptr, "Format"}, | ||
| 119 | {101, nullptr, "GetAdminInfo"}, | ||
| 120 | {102, nullptr, "GetRegisterInfoPrivate"}, | ||
| 121 | {103, nullptr, "SetRegisterInfoPrivate"}, | ||
| 122 | {104, nullptr, "DeleteRegisterInfo"}, | ||
| 123 | {105, nullptr, "DeleteApplicationArea"}, | ||
| 124 | {106, nullptr, "ExistsApplicationArea"}, | ||
| 125 | {200, nullptr, "GetAll"}, | ||
| 126 | {201, nullptr, "SetAll"}, | ||
| 127 | {202, nullptr, "FlushDebug"}, | ||
| 128 | {203, nullptr, "BreakTag"}, | ||
| 129 | {204, nullptr, "ReadBackupData"}, | ||
| 130 | {205, nullptr, "WriteBackupData"}, | ||
| 131 | {206, nullptr, "WriteNtf"}, | ||
| 132 | }; | ||
| 133 | // clang-format on | ||
| 134 | |||
| 135 | RegisterHandlers(functions); | ||
| 136 | } | ||
| 137 | }; | ||
| 138 | |||
| 12 | class IUserManager final : public ServiceFramework<IUserManager> { | 139 | class IUserManager final : public ServiceFramework<IUserManager> { |
| 13 | public: | 140 | public: |
| 14 | explicit IUserManager(Core::System& system_) : ServiceFramework{system_, "nfp:user"} { | 141 | explicit IUserManager(Core::System& system_) : ServiceFramework{system_, "nfp:user"} { |
| @@ -37,10 +164,68 @@ private: | |||
| 37 | std::shared_ptr<IUser> user_interface; | 164 | std::shared_ptr<IUser> user_interface; |
| 38 | }; | 165 | }; |
| 39 | 166 | ||
| 167 | class ISystemManager final : public ServiceFramework<ISystemManager> { | ||
| 168 | public: | ||
| 169 | explicit ISystemManager(Core::System& system_) : ServiceFramework{system_, "nfp:sys"} { | ||
| 170 | // clang-format off | ||
| 171 | static const FunctionInfo functions[] = { | ||
| 172 | {0, &ISystemManager::CreateSystemInterface, "CreateSystemInterface"}, | ||
| 173 | }; | ||
| 174 | // clang-format on | ||
| 175 | |||
| 176 | RegisterHandlers(functions); | ||
| 177 | } | ||
| 178 | |||
| 179 | private: | ||
| 180 | void CreateSystemInterface(HLERequestContext& ctx) { | ||
| 181 | LOG_DEBUG(Service_NFP, "called"); | ||
| 182 | |||
| 183 | if (system_interface == nullptr) { | ||
| 184 | system_interface = std::make_shared<ISystem>(system); | ||
| 185 | } | ||
| 186 | |||
| 187 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 188 | rb.Push(ResultSuccess); | ||
| 189 | rb.PushIpcInterface<ISystem>(system_interface); | ||
| 190 | } | ||
| 191 | |||
| 192 | std::shared_ptr<ISystem> system_interface; | ||
| 193 | }; | ||
| 194 | |||
| 195 | class IDebugManager final : public ServiceFramework<IDebugManager> { | ||
| 196 | public: | ||
| 197 | explicit IDebugManager(Core::System& system_) : ServiceFramework{system_, "nfp:dbg"} { | ||
| 198 | // clang-format off | ||
| 199 | static const FunctionInfo functions[] = { | ||
| 200 | {0, &IDebugManager::CreateDebugInterface, "CreateDebugInterface"}, | ||
| 201 | }; | ||
| 202 | // clang-format on | ||
| 203 | |||
| 204 | RegisterHandlers(functions); | ||
| 205 | } | ||
| 206 | |||
| 207 | private: | ||
| 208 | void CreateDebugInterface(HLERequestContext& ctx) { | ||
| 209 | LOG_DEBUG(Service_NFP, "called"); | ||
| 210 | |||
| 211 | if (system_interface == nullptr) { | ||
| 212 | system_interface = std::make_shared<IDebug>(system); | ||
| 213 | } | ||
| 214 | |||
| 215 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 216 | rb.Push(ResultSuccess); | ||
| 217 | rb.PushIpcInterface<IDebug>(system_interface); | ||
| 218 | } | ||
| 219 | |||
| 220 | std::shared_ptr<IDebug> system_interface; | ||
| 221 | }; | ||
| 222 | |||
| 40 | void LoopProcess(Core::System& system) { | 223 | void LoopProcess(Core::System& system) { |
| 41 | auto server_manager = std::make_unique<ServerManager>(system); | 224 | auto server_manager = std::make_unique<ServerManager>(system); |
| 42 | 225 | ||
| 43 | server_manager->RegisterNamedService("nfp:user", std::make_shared<IUserManager>(system)); | 226 | server_manager->RegisterNamedService("nfp:user", std::make_shared<IUserManager>(system)); |
| 227 | server_manager->RegisterNamedService("nfp:sys", std::make_shared<ISystemManager>(system)); | ||
| 228 | server_manager->RegisterNamedService("nfp:dbg", std::make_shared<IDebugManager>(system)); | ||
| 44 | ServerManager::RunServer(std::move(server_manager)); | 229 | ServerManager::RunServer(std::move(server_manager)); |
| 45 | } | 230 | } |
| 46 | 231 | ||
diff --git a/src/core/hle/service/nfp/nfp_user.cpp b/src/core/hle/service/nfp/nfp_interface.cpp index 4e8534113..e131703cb 100644 --- a/src/core/hle/service/nfp/nfp_user.cpp +++ b/src/core/hle/service/nfp/nfp_interface.cpp | |||
| @@ -7,42 +7,13 @@ | |||
| 7 | #include "core/hle/kernel/k_event.h" | 7 | #include "core/hle/kernel/k_event.h" |
| 8 | #include "core/hle/service/ipc_helpers.h" | 8 | #include "core/hle/service/ipc_helpers.h" |
| 9 | #include "core/hle/service/nfp/nfp_device.h" | 9 | #include "core/hle/service/nfp/nfp_device.h" |
| 10 | #include "core/hle/service/nfp/nfp_interface.h" | ||
| 10 | #include "core/hle/service/nfp/nfp_result.h" | 11 | #include "core/hle/service/nfp/nfp_result.h" |
| 11 | #include "core/hle/service/nfp/nfp_user.h" | ||
| 12 | 12 | ||
| 13 | namespace Service::NFP { | 13 | namespace Service::NFP { |
| 14 | 14 | ||
| 15 | IUser::IUser(Core::System& system_) | 15 | Interface::Interface(Core::System& system_, const char* name) |
| 16 | : ServiceFramework{system_, "NFP::IUser"}, service_context{system_, service_name} { | 16 | : ServiceFramework{system_, name}, service_context{system_, service_name} { |
| 17 | static const FunctionInfo functions[] = { | ||
| 18 | {0, &IUser::Initialize, "Initialize"}, | ||
| 19 | {1, &IUser::Finalize, "Finalize"}, | ||
| 20 | {2, &IUser::ListDevices, "ListDevices"}, | ||
| 21 | {3, &IUser::StartDetection, "StartDetection"}, | ||
| 22 | {4, &IUser::StopDetection, "StopDetection"}, | ||
| 23 | {5, &IUser::Mount, "Mount"}, | ||
| 24 | {6, &IUser::Unmount, "Unmount"}, | ||
| 25 | {7, &IUser::OpenApplicationArea, "OpenApplicationArea"}, | ||
| 26 | {8, &IUser::GetApplicationArea, "GetApplicationArea"}, | ||
| 27 | {9, &IUser::SetApplicationArea, "SetApplicationArea"}, | ||
| 28 | {10, &IUser::Flush, "Flush"}, | ||
| 29 | {11, &IUser::Restore, "Restore"}, | ||
| 30 | {12, &IUser::CreateApplicationArea, "CreateApplicationArea"}, | ||
| 31 | {13, &IUser::GetTagInfo, "GetTagInfo"}, | ||
| 32 | {14, &IUser::GetRegisterInfo, "GetRegisterInfo"}, | ||
| 33 | {15, &IUser::GetCommonInfo, "GetCommonInfo"}, | ||
| 34 | {16, &IUser::GetModelInfo, "GetModelInfo"}, | ||
| 35 | {17, &IUser::AttachActivateEvent, "AttachActivateEvent"}, | ||
| 36 | {18, &IUser::AttachDeactivateEvent, "AttachDeactivateEvent"}, | ||
| 37 | {19, &IUser::GetState, "GetState"}, | ||
| 38 | {20, &IUser::GetDeviceState, "GetDeviceState"}, | ||
| 39 | {21, &IUser::GetNpadId, "GetNpadId"}, | ||
| 40 | {22, &IUser::GetApplicationAreaSize, "GetApplicationAreaSize"}, | ||
| 41 | {23, &IUser::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"}, | ||
| 42 | {24, &IUser::RecreateApplicationArea, "RecreateApplicationArea"}, | ||
| 43 | }; | ||
| 44 | RegisterHandlers(functions); | ||
| 45 | |||
| 46 | availability_change_event = service_context.CreateEvent("IUser:AvailabilityChangeEvent"); | 17 | availability_change_event = service_context.CreateEvent("IUser:AvailabilityChangeEvent"); |
| 47 | 18 | ||
| 48 | for (u32 device_index = 0; device_index < 10; device_index++) { | 19 | for (u32 device_index = 0; device_index < 10; device_index++) { |
| @@ -52,11 +23,11 @@ IUser::IUser(Core::System& system_) | |||
| 52 | } | 23 | } |
| 53 | } | 24 | } |
| 54 | 25 | ||
| 55 | IUser ::~IUser() { | 26 | Interface::~Interface() { |
| 56 | availability_change_event->Close(); | 27 | availability_change_event->Close(); |
| 57 | } | 28 | } |
| 58 | 29 | ||
| 59 | void IUser::Initialize(HLERequestContext& ctx) { | 30 | void Interface::Initialize(HLERequestContext& ctx) { |
| 60 | LOG_INFO(Service_NFP, "called"); | 31 | LOG_INFO(Service_NFP, "called"); |
| 61 | 32 | ||
| 62 | state = State::Initialized; | 33 | state = State::Initialized; |
| @@ -69,7 +40,7 @@ void IUser::Initialize(HLERequestContext& ctx) { | |||
| 69 | rb.Push(ResultSuccess); | 40 | rb.Push(ResultSuccess); |
| 70 | } | 41 | } |
| 71 | 42 | ||
| 72 | void IUser::Finalize(HLERequestContext& ctx) { | 43 | void Interface::Finalize(HLERequestContext& ctx) { |
| 73 | LOG_INFO(Service_NFP, "called"); | 44 | LOG_INFO(Service_NFP, "called"); |
| 74 | 45 | ||
| 75 | state = State::NonInitialized; | 46 | state = State::NonInitialized; |
| @@ -82,7 +53,7 @@ void IUser::Finalize(HLERequestContext& ctx) { | |||
| 82 | rb.Push(ResultSuccess); | 53 | rb.Push(ResultSuccess); |
| 83 | } | 54 | } |
| 84 | 55 | ||
| 85 | void IUser::ListDevices(HLERequestContext& ctx) { | 56 | void Interface::ListDevices(HLERequestContext& ctx) { |
| 86 | LOG_DEBUG(Service_NFP, "called"); | 57 | LOG_DEBUG(Service_NFP, "called"); |
| 87 | 58 | ||
| 88 | if (state == State::NonInitialized) { | 59 | if (state == State::NonInitialized) { |
| @@ -128,7 +99,7 @@ void IUser::ListDevices(HLERequestContext& ctx) { | |||
| 128 | rb.Push(static_cast<s32>(nfp_devices.size())); | 99 | rb.Push(static_cast<s32>(nfp_devices.size())); |
| 129 | } | 100 | } |
| 130 | 101 | ||
| 131 | void IUser::StartDetection(HLERequestContext& ctx) { | 102 | void Interface::StartDetection(HLERequestContext& ctx) { |
| 132 | IPC::RequestParser rp{ctx}; | 103 | IPC::RequestParser rp{ctx}; |
| 133 | const auto device_handle{rp.Pop<u64>()}; | 104 | const auto device_handle{rp.Pop<u64>()}; |
| 134 | const auto nfp_protocol{rp.PopEnum<TagProtocol>()}; | 105 | const auto nfp_protocol{rp.PopEnum<TagProtocol>()}; |
| @@ -153,7 +124,7 @@ void IUser::StartDetection(HLERequestContext& ctx) { | |||
| 153 | rb.Push(result); | 124 | rb.Push(result); |
| 154 | } | 125 | } |
| 155 | 126 | ||
| 156 | void IUser::StopDetection(HLERequestContext& ctx) { | 127 | void Interface::StopDetection(HLERequestContext& ctx) { |
| 157 | IPC::RequestParser rp{ctx}; | 128 | IPC::RequestParser rp{ctx}; |
| 158 | const auto device_handle{rp.Pop<u64>()}; | 129 | const auto device_handle{rp.Pop<u64>()}; |
| 159 | LOG_INFO(Service_NFP, "called, device_handle={}", device_handle); | 130 | LOG_INFO(Service_NFP, "called, device_handle={}", device_handle); |
| @@ -177,7 +148,7 @@ void IUser::StopDetection(HLERequestContext& ctx) { | |||
| 177 | rb.Push(result); | 148 | rb.Push(result); |
| 178 | } | 149 | } |
| 179 | 150 | ||
| 180 | void IUser::Mount(HLERequestContext& ctx) { | 151 | void Interface::Mount(HLERequestContext& ctx) { |
| 181 | IPC::RequestParser rp{ctx}; | 152 | IPC::RequestParser rp{ctx}; |
| 182 | const auto device_handle{rp.Pop<u64>()}; | 153 | const auto device_handle{rp.Pop<u64>()}; |
| 183 | const auto model_type{rp.PopEnum<ModelType>()}; | 154 | const auto model_type{rp.PopEnum<ModelType>()}; |
| @@ -204,7 +175,7 @@ void IUser::Mount(HLERequestContext& ctx) { | |||
| 204 | rb.Push(result); | 175 | rb.Push(result); |
| 205 | } | 176 | } |
| 206 | 177 | ||
| 207 | void IUser::Unmount(HLERequestContext& ctx) { | 178 | void Interface::Unmount(HLERequestContext& ctx) { |
| 208 | IPC::RequestParser rp{ctx}; | 179 | IPC::RequestParser rp{ctx}; |
| 209 | const auto device_handle{rp.Pop<u64>()}; | 180 | const auto device_handle{rp.Pop<u64>()}; |
| 210 | LOG_INFO(Service_NFP, "called, device_handle={}", device_handle); | 181 | LOG_INFO(Service_NFP, "called, device_handle={}", device_handle); |
| @@ -228,7 +199,7 @@ void IUser::Unmount(HLERequestContext& ctx) { | |||
| 228 | rb.Push(result); | 199 | rb.Push(result); |
| 229 | } | 200 | } |
| 230 | 201 | ||
| 231 | void IUser::OpenApplicationArea(HLERequestContext& ctx) { | 202 | void Interface::OpenApplicationArea(HLERequestContext& ctx) { |
| 232 | IPC::RequestParser rp{ctx}; | 203 | IPC::RequestParser rp{ctx}; |
| 233 | const auto device_handle{rp.Pop<u64>()}; | 204 | const auto device_handle{rp.Pop<u64>()}; |
| 234 | const auto access_id{rp.Pop<u32>()}; | 205 | const auto access_id{rp.Pop<u32>()}; |
| @@ -253,7 +224,7 @@ void IUser::OpenApplicationArea(HLERequestContext& ctx) { | |||
| 253 | rb.Push(result); | 224 | rb.Push(result); |
| 254 | } | 225 | } |
| 255 | 226 | ||
| 256 | void IUser::GetApplicationArea(HLERequestContext& ctx) { | 227 | void Interface::GetApplicationArea(HLERequestContext& ctx) { |
| 257 | IPC::RequestParser rp{ctx}; | 228 | IPC::RequestParser rp{ctx}; |
| 258 | const auto device_handle{rp.Pop<u64>()}; | 229 | const auto device_handle{rp.Pop<u64>()}; |
| 259 | const auto data_size = ctx.GetWriteBufferSize(); | 230 | const auto data_size = ctx.GetWriteBufferSize(); |
| @@ -287,7 +258,7 @@ void IUser::GetApplicationArea(HLERequestContext& ctx) { | |||
| 287 | rb.Push(static_cast<u32>(data_size)); | 258 | rb.Push(static_cast<u32>(data_size)); |
| 288 | } | 259 | } |
| 289 | 260 | ||
| 290 | void IUser::SetApplicationArea(HLERequestContext& ctx) { | 261 | void Interface::SetApplicationArea(HLERequestContext& ctx) { |
| 291 | IPC::RequestParser rp{ctx}; | 262 | IPC::RequestParser rp{ctx}; |
| 292 | const auto device_handle{rp.Pop<u64>()}; | 263 | const auto device_handle{rp.Pop<u64>()}; |
| 293 | const auto data{ctx.ReadBuffer()}; | 264 | const auto data{ctx.ReadBuffer()}; |
| @@ -318,7 +289,7 @@ void IUser::SetApplicationArea(HLERequestContext& ctx) { | |||
| 318 | rb.Push(result); | 289 | rb.Push(result); |
| 319 | } | 290 | } |
| 320 | 291 | ||
| 321 | void IUser::Flush(HLERequestContext& ctx) { | 292 | void Interface::Flush(HLERequestContext& ctx) { |
| 322 | IPC::RequestParser rp{ctx}; | 293 | IPC::RequestParser rp{ctx}; |
| 323 | const auto device_handle{rp.Pop<u64>()}; | 294 | const auto device_handle{rp.Pop<u64>()}; |
| 324 | LOG_INFO(Service_NFP, "called, device_handle={}", device_handle); | 295 | LOG_INFO(Service_NFP, "called, device_handle={}", device_handle); |
| @@ -342,7 +313,7 @@ void IUser::Flush(HLERequestContext& ctx) { | |||
| 342 | rb.Push(result); | 313 | rb.Push(result); |
| 343 | } | 314 | } |
| 344 | 315 | ||
| 345 | void IUser::Restore(HLERequestContext& ctx) { | 316 | void Interface::Restore(HLERequestContext& ctx) { |
| 346 | IPC::RequestParser rp{ctx}; | 317 | IPC::RequestParser rp{ctx}; |
| 347 | const auto device_handle{rp.Pop<u64>()}; | 318 | const auto device_handle{rp.Pop<u64>()}; |
| 348 | LOG_WARNING(Service_NFP, "(STUBBED) called, device_handle={}", device_handle); | 319 | LOG_WARNING(Service_NFP, "(STUBBED) called, device_handle={}", device_handle); |
| @@ -366,7 +337,7 @@ void IUser::Restore(HLERequestContext& ctx) { | |||
| 366 | rb.Push(result); | 337 | rb.Push(result); |
| 367 | } | 338 | } |
| 368 | 339 | ||
| 369 | void IUser::CreateApplicationArea(HLERequestContext& ctx) { | 340 | void Interface::CreateApplicationArea(HLERequestContext& ctx) { |
| 370 | IPC::RequestParser rp{ctx}; | 341 | IPC::RequestParser rp{ctx}; |
| 371 | const auto device_handle{rp.Pop<u64>()}; | 342 | const auto device_handle{rp.Pop<u64>()}; |
| 372 | const auto access_id{rp.Pop<u32>()}; | 343 | const auto access_id{rp.Pop<u32>()}; |
| @@ -399,7 +370,7 @@ void IUser::CreateApplicationArea(HLERequestContext& ctx) { | |||
| 399 | rb.Push(result); | 370 | rb.Push(result); |
| 400 | } | 371 | } |
| 401 | 372 | ||
| 402 | void IUser::GetTagInfo(HLERequestContext& ctx) { | 373 | void Interface::GetTagInfo(HLERequestContext& ctx) { |
| 403 | IPC::RequestParser rp{ctx}; | 374 | IPC::RequestParser rp{ctx}; |
| 404 | const auto device_handle{rp.Pop<u64>()}; | 375 | const auto device_handle{rp.Pop<u64>()}; |
| 405 | LOG_INFO(Service_NFP, "called, device_handle={}", device_handle); | 376 | LOG_INFO(Service_NFP, "called, device_handle={}", device_handle); |
| @@ -425,7 +396,7 @@ void IUser::GetTagInfo(HLERequestContext& ctx) { | |||
| 425 | rb.Push(result); | 396 | rb.Push(result); |
| 426 | } | 397 | } |
| 427 | 398 | ||
| 428 | void IUser::GetRegisterInfo(HLERequestContext& ctx) { | 399 | void Interface::GetRegisterInfo(HLERequestContext& ctx) { |
| 429 | IPC::RequestParser rp{ctx}; | 400 | IPC::RequestParser rp{ctx}; |
| 430 | const auto device_handle{rp.Pop<u64>()}; | 401 | const auto device_handle{rp.Pop<u64>()}; |
| 431 | LOG_INFO(Service_NFP, "called, device_handle={}", device_handle); | 402 | LOG_INFO(Service_NFP, "called, device_handle={}", device_handle); |
| @@ -451,7 +422,7 @@ void IUser::GetRegisterInfo(HLERequestContext& ctx) { | |||
| 451 | rb.Push(result); | 422 | rb.Push(result); |
| 452 | } | 423 | } |
| 453 | 424 | ||
| 454 | void IUser::GetCommonInfo(HLERequestContext& ctx) { | 425 | void Interface::GetCommonInfo(HLERequestContext& ctx) { |
| 455 | IPC::RequestParser rp{ctx}; | 426 | IPC::RequestParser rp{ctx}; |
| 456 | const auto device_handle{rp.Pop<u64>()}; | 427 | const auto device_handle{rp.Pop<u64>()}; |
| 457 | LOG_INFO(Service_NFP, "called, device_handle={}", device_handle); | 428 | LOG_INFO(Service_NFP, "called, device_handle={}", device_handle); |
| @@ -477,7 +448,7 @@ void IUser::GetCommonInfo(HLERequestContext& ctx) { | |||
| 477 | rb.Push(result); | 448 | rb.Push(result); |
| 478 | } | 449 | } |
| 479 | 450 | ||
| 480 | void IUser::GetModelInfo(HLERequestContext& ctx) { | 451 | void Interface::GetModelInfo(HLERequestContext& ctx) { |
| 481 | IPC::RequestParser rp{ctx}; | 452 | IPC::RequestParser rp{ctx}; |
| 482 | const auto device_handle{rp.Pop<u64>()}; | 453 | const auto device_handle{rp.Pop<u64>()}; |
| 483 | LOG_INFO(Service_NFP, "called, device_handle={}", device_handle); | 454 | LOG_INFO(Service_NFP, "called, device_handle={}", device_handle); |
| @@ -503,7 +474,7 @@ void IUser::GetModelInfo(HLERequestContext& ctx) { | |||
| 503 | rb.Push(result); | 474 | rb.Push(result); |
| 504 | } | 475 | } |
| 505 | 476 | ||
| 506 | void IUser::AttachActivateEvent(HLERequestContext& ctx) { | 477 | void Interface::AttachActivateEvent(HLERequestContext& ctx) { |
| 507 | IPC::RequestParser rp{ctx}; | 478 | IPC::RequestParser rp{ctx}; |
| 508 | const auto device_handle{rp.Pop<u64>()}; | 479 | const auto device_handle{rp.Pop<u64>()}; |
| 509 | LOG_DEBUG(Service_NFP, "called, device_handle={}", device_handle); | 480 | LOG_DEBUG(Service_NFP, "called, device_handle={}", device_handle); |
| @@ -527,7 +498,7 @@ void IUser::AttachActivateEvent(HLERequestContext& ctx) { | |||
| 527 | rb.PushCopyObjects(device.value()->GetActivateEvent()); | 498 | rb.PushCopyObjects(device.value()->GetActivateEvent()); |
| 528 | } | 499 | } |
| 529 | 500 | ||
| 530 | void IUser::AttachDeactivateEvent(HLERequestContext& ctx) { | 501 | void Interface::AttachDeactivateEvent(HLERequestContext& ctx) { |
| 531 | IPC::RequestParser rp{ctx}; | 502 | IPC::RequestParser rp{ctx}; |
| 532 | const auto device_handle{rp.Pop<u64>()}; | 503 | const auto device_handle{rp.Pop<u64>()}; |
| 533 | LOG_DEBUG(Service_NFP, "called, device_handle={}", device_handle); | 504 | LOG_DEBUG(Service_NFP, "called, device_handle={}", device_handle); |
| @@ -551,7 +522,7 @@ void IUser::AttachDeactivateEvent(HLERequestContext& ctx) { | |||
| 551 | rb.PushCopyObjects(device.value()->GetDeactivateEvent()); | 522 | rb.PushCopyObjects(device.value()->GetDeactivateEvent()); |
| 552 | } | 523 | } |
| 553 | 524 | ||
| 554 | void IUser::GetState(HLERequestContext& ctx) { | 525 | void Interface::GetState(HLERequestContext& ctx) { |
| 555 | LOG_DEBUG(Service_NFP, "called"); | 526 | LOG_DEBUG(Service_NFP, "called"); |
| 556 | 527 | ||
| 557 | IPC::ResponseBuilder rb{ctx, 3}; | 528 | IPC::ResponseBuilder rb{ctx, 3}; |
| @@ -559,7 +530,7 @@ void IUser::GetState(HLERequestContext& ctx) { | |||
| 559 | rb.PushEnum(state); | 530 | rb.PushEnum(state); |
| 560 | } | 531 | } |
| 561 | 532 | ||
| 562 | void IUser::GetDeviceState(HLERequestContext& ctx) { | 533 | void Interface::GetDeviceState(HLERequestContext& ctx) { |
| 563 | IPC::RequestParser rp{ctx}; | 534 | IPC::RequestParser rp{ctx}; |
| 564 | const auto device_handle{rp.Pop<u64>()}; | 535 | const auto device_handle{rp.Pop<u64>()}; |
| 565 | LOG_DEBUG(Service_NFP, "called, device_handle={}", device_handle); | 536 | LOG_DEBUG(Service_NFP, "called, device_handle={}", device_handle); |
| @@ -577,7 +548,7 @@ void IUser::GetDeviceState(HLERequestContext& ctx) { | |||
| 577 | rb.PushEnum(device.value()->GetCurrentState()); | 548 | rb.PushEnum(device.value()->GetCurrentState()); |
| 578 | } | 549 | } |
| 579 | 550 | ||
| 580 | void IUser::GetNpadId(HLERequestContext& ctx) { | 551 | void Interface::GetNpadId(HLERequestContext& ctx) { |
| 581 | IPC::RequestParser rp{ctx}; | 552 | IPC::RequestParser rp{ctx}; |
| 582 | const auto device_handle{rp.Pop<u64>()}; | 553 | const auto device_handle{rp.Pop<u64>()}; |
| 583 | LOG_DEBUG(Service_NFP, "called, device_handle={}", device_handle); | 554 | LOG_DEBUG(Service_NFP, "called, device_handle={}", device_handle); |
| @@ -601,7 +572,7 @@ void IUser::GetNpadId(HLERequestContext& ctx) { | |||
| 601 | rb.PushEnum(device.value()->GetNpadId()); | 572 | rb.PushEnum(device.value()->GetNpadId()); |
| 602 | } | 573 | } |
| 603 | 574 | ||
| 604 | void IUser::GetApplicationAreaSize(HLERequestContext& ctx) { | 575 | void Interface::GetApplicationAreaSize(HLERequestContext& ctx) { |
| 605 | IPC::RequestParser rp{ctx}; | 576 | IPC::RequestParser rp{ctx}; |
| 606 | const auto device_handle{rp.Pop<u64>()}; | 577 | const auto device_handle{rp.Pop<u64>()}; |
| 607 | LOG_DEBUG(Service_NFP, "called, device_handle={}", device_handle); | 578 | LOG_DEBUG(Service_NFP, "called, device_handle={}", device_handle); |
| @@ -619,7 +590,7 @@ void IUser::GetApplicationAreaSize(HLERequestContext& ctx) { | |||
| 619 | rb.Push(device.value()->GetApplicationAreaSize()); | 590 | rb.Push(device.value()->GetApplicationAreaSize()); |
| 620 | } | 591 | } |
| 621 | 592 | ||
| 622 | void IUser::AttachAvailabilityChangeEvent(HLERequestContext& ctx) { | 593 | void Interface::AttachAvailabilityChangeEvent(HLERequestContext& ctx) { |
| 623 | LOG_INFO(Service_NFP, "called"); | 594 | LOG_INFO(Service_NFP, "called"); |
| 624 | 595 | ||
| 625 | if (state == State::NonInitialized) { | 596 | if (state == State::NonInitialized) { |
| @@ -633,7 +604,7 @@ void IUser::AttachAvailabilityChangeEvent(HLERequestContext& ctx) { | |||
| 633 | rb.PushCopyObjects(availability_change_event->GetReadableEvent()); | 604 | rb.PushCopyObjects(availability_change_event->GetReadableEvent()); |
| 634 | } | 605 | } |
| 635 | 606 | ||
| 636 | void IUser::RecreateApplicationArea(HLERequestContext& ctx) { | 607 | void Interface::RecreateApplicationArea(HLERequestContext& ctx) { |
| 637 | IPC::RequestParser rp{ctx}; | 608 | IPC::RequestParser rp{ctx}; |
| 638 | const auto device_handle{rp.Pop<u64>()}; | 609 | const auto device_handle{rp.Pop<u64>()}; |
| 639 | const auto access_id{rp.Pop<u32>()}; | 610 | const auto access_id{rp.Pop<u32>()}; |
| @@ -660,7 +631,7 @@ void IUser::RecreateApplicationArea(HLERequestContext& ctx) { | |||
| 660 | rb.Push(result); | 631 | rb.Push(result); |
| 661 | } | 632 | } |
| 662 | 633 | ||
| 663 | std::optional<std::shared_ptr<NfpDevice>> IUser::GetNfpDevice(u64 handle) { | 634 | std::optional<std::shared_ptr<NfpDevice>> Interface::GetNfpDevice(u64 handle) { |
| 664 | for (auto& device : devices) { | 635 | for (auto& device : devices) { |
| 665 | if (device->GetHandle() == handle) { | 636 | if (device->GetHandle() == handle) { |
| 666 | return device; | 637 | return device; |
diff --git a/src/core/hle/service/nfp/nfp_user.h b/src/core/hle/service/nfp/nfp_interface.h index 1f3ff2ea8..11f29c2ba 100644 --- a/src/core/hle/service/nfp/nfp_user.h +++ b/src/core/hle/service/nfp/nfp_interface.h | |||
| @@ -13,16 +13,10 @@ | |||
| 13 | namespace Service::NFP { | 13 | namespace Service::NFP { |
| 14 | class NfpDevice; | 14 | class NfpDevice; |
| 15 | 15 | ||
| 16 | class IUser final : public ServiceFramework<IUser> { | 16 | class Interface : public ServiceFramework<Interface> { |
| 17 | public: | 17 | public: |
| 18 | explicit IUser(Core::System& system_); | 18 | explicit Interface(Core::System& system_, const char* name); |
| 19 | ~IUser(); | 19 | ~Interface() override; |
| 20 | |||
| 21 | private: | ||
| 22 | enum class State : u32 { | ||
| 23 | NonInitialized, | ||
| 24 | Initialized, | ||
| 25 | }; | ||
| 26 | 20 | ||
| 27 | void Initialize(HLERequestContext& ctx); | 21 | void Initialize(HLERequestContext& ctx); |
| 28 | void Finalize(HLERequestContext& ctx); | 22 | void Finalize(HLERequestContext& ctx); |
| @@ -50,6 +44,12 @@ private: | |||
| 50 | void AttachAvailabilityChangeEvent(HLERequestContext& ctx); | 44 | void AttachAvailabilityChangeEvent(HLERequestContext& ctx); |
| 51 | void RecreateApplicationArea(HLERequestContext& ctx); | 45 | void RecreateApplicationArea(HLERequestContext& ctx); |
| 52 | 46 | ||
| 47 | private: | ||
| 48 | enum class State : u32 { | ||
| 49 | NonInitialized, | ||
| 50 | Initialized, | ||
| 51 | }; | ||
| 52 | |||
| 53 | std::optional<std::shared_ptr<NfpDevice>> GetNfpDevice(u64 handle); | 53 | std::optional<std::shared_ptr<NfpDevice>> GetNfpDevice(u64 handle); |
| 54 | 54 | ||
| 55 | KernelHelpers::ServiceContext service_context; | 55 | KernelHelpers::ServiceContext service_context; |