diff options
Diffstat (limited to 'src/core/hle/service/nfp')
-rw-r--r-- | src/core/hle/service/nfp/nfp.cpp | 29 | ||||
-rw-r--r-- | src/core/hle/service/nfp/nfp.h | 8 |
2 files changed, 14 insertions, 23 deletions
diff --git a/src/core/hle/service/nfp/nfp.cpp b/src/core/hle/service/nfp/nfp.cpp index 75c605364..d5df112a0 100644 --- a/src/core/hle/service/nfp/nfp.cpp +++ b/src/core/hle/service/nfp/nfp.cpp @@ -25,8 +25,8 @@ constexpr ResultCode ERR_TAG_FAILED(ErrorModule::NFP, Module::Interface::Interface(std::shared_ptr<Module> module, const char* name) : ServiceFramework(name), module(std::move(module)) { auto& kernel = Core::System::GetInstance().Kernel(); - nfc_tag_load = Kernel::WritableEvent::CreateRegisteredEventPair( - kernel, Kernel::ResetType::OneShot, "IUser:NFCTagDetected"); + nfc_tag_load = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::OneShot, + "IUser:NFCTagDetected"); } Module::Interface::~Interface() = default; @@ -65,9 +65,9 @@ public: RegisterHandlers(functions); auto& kernel = Core::System::GetInstance().Kernel(); - deactivate_event = Kernel::WritableEvent::CreateRegisteredEventPair( + deactivate_event = Kernel::WritableEvent::CreateEventPair( kernel, Kernel::ResetType::OneShot, "IUser:DeactivateEvent"); - availability_change_event = Kernel::WritableEvent::CreateRegisteredEventPair( + availability_change_event = Kernel::WritableEvent::CreateEventPair( kernel, Kernel::ResetType::OneShot, "IUser:AvailabilityChangeEvent"); } @@ -166,10 +166,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(RESULT_SUCCESS); - - const auto& event{ - Core::System::GetInstance().Kernel().FindNamedEvent("IUser:DeactivateEvent")}; - rb.PushCopyObjects(event->second); + rb.PushCopyObjects(deactivate_event.readable); } void StopDetection(Kernel::HLERequestContext& ctx) { @@ -178,7 +175,7 @@ private: switch (device_state) { case DeviceState::TagFound: case DeviceState::TagNearby: - deactivate_event->Signal(); + deactivate_event.writable->Signal(); device_state = DeviceState::Initialized; break; case DeviceState::SearchingForTag: @@ -269,9 +266,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(RESULT_SUCCESS); - const auto& event{ - Core::System::GetInstance().Kernel().FindNamedEvent("IUser:AvailabilityChangeEvent")}; - rb.PushCopyObjects(event->second); + rb.PushCopyObjects(availability_change_event.readable); } void GetRegisterInfo(Kernel::HLERequestContext& ctx) { @@ -326,8 +321,8 @@ private: const u32 npad_id{0}; // Player 1 controller State state{State::NonInitialized}; DeviceState device_state{DeviceState::Initialized}; - Kernel::SharedPtr<Kernel::WritableEvent> deactivate_event; - Kernel::SharedPtr<Kernel::WritableEvent> availability_change_event; + Kernel::EventPair deactivate_event; + Kernel::EventPair availability_change_event; const Module::Interface& nfp_interface; }; @@ -346,14 +341,14 @@ bool Module::Interface::LoadAmiibo(const std::vector<u8>& buffer) { } std::memcpy(&amiibo, buffer.data(), sizeof(amiibo)); - nfc_tag_load->Signal(); + nfc_tag_load.writable->Signal(); return true; } const Kernel::SharedPtr<Kernel::ReadableEvent>& Module::Interface::GetNFCEvent() const { - const auto& event{Core::System::GetInstance().Kernel().FindNamedEvent("IUser:NFCTagDetected")}; - return event->second; + return nfc_tag_load.readable; } + const Module::Interface::AmiiboFile& Module::Interface::GetAmiiboBuffer() const { return amiibo; } diff --git a/src/core/hle/service/nfp/nfp.h b/src/core/hle/service/nfp/nfp.h index 0ab1ca997..437c10aad 100644 --- a/src/core/hle/service/nfp/nfp.h +++ b/src/core/hle/service/nfp/nfp.h @@ -6,13 +6,9 @@ #include <array> #include <vector> +#include "core/hle/kernel/writable_event.h" #include "core/hle/service/service.h" -namespace Kernel { -class ReadableEvent; -class WritableEvent; -} // namespace Kernel - namespace Service::NFP { class Module final { @@ -41,7 +37,7 @@ public: const AmiiboFile& GetAmiiboBuffer() const; private: - Kernel::SharedPtr<Kernel::WritableEvent> nfc_tag_load{}; + Kernel::EventPair nfc_tag_load{}; AmiiboFile amiibo{}; protected: |