summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/hid
diff options
context:
space:
mode:
authorZach Hilman <zachhilman@gmail.com>2018-11-27 15:18:29 +0100
committerZach Hilman <zachhilman@gmail.com>2018-11-29 14:48:40 +0100
commita342bcc9b130e9bd78720e09e04c92dcac8840d0 (patch)
treedf1d16c2a71b121fc449b53fc931c6fac8ccf82a /src/core/hle/service/hid
parentcore: Port all current usages of Event to Readable/WritableEvent (diff)
downloadyuzu-a342bcc9b130e9bd78720e09e04c92dcac8840d0.tar
yuzu-a342bcc9b130e9bd78720e09e04c92dcac8840d0.tar.gz
yuzu-a342bcc9b130e9bd78720e09e04c92dcac8840d0.tar.bz2
yuzu-a342bcc9b130e9bd78720e09e04c92dcac8840d0.tar.lz
yuzu-a342bcc9b130e9bd78720e09e04c92dcac8840d0.tar.xz
yuzu-a342bcc9b130e9bd78720e09e04c92dcac8840d0.tar.zst
yuzu-a342bcc9b130e9bd78720e09e04c92dcac8840d0.zip
Diffstat (limited to 'src/core/hle/service/hid')
-rw-r--r--src/core/hle/service/hid/controllers/npad.cpp12
-rw-r--r--src/core/hle/service/hid/controllers/npad.h8
2 files changed, 7 insertions, 13 deletions
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp
index df39a6dc4..342c2eb81 100644
--- a/src/core/hle/service/hid/controllers/npad.cpp
+++ b/src/core/hle/service/hid/controllers/npad.cpp
@@ -169,7 +169,7 @@ void Controller_NPad::InitNewlyAddedControler(std::size_t controller_idx) {
void Controller_NPad::OnInit() {
auto& kernel = Core::System::GetInstance().Kernel();
- styleset_changed_event = Kernel::WritableEvent::CreateRegisteredEventPair(
+ styleset_changed_event = Kernel::WritableEvent::CreateEventPair(
kernel, Kernel::ResetType::OneShot, "npad:NpadStyleSetChanged");
if (!IsControllerActivated()) {
@@ -496,7 +496,7 @@ void Controller_NPad::SetSupportedNPadIdTypes(u8* data, std::size_t length) {
had_controller_update = true;
}
if (had_controller_update) {
- styleset_changed_event->Signal();
+ styleset_changed_event.writable->Signal();
}
}
}
@@ -511,7 +511,7 @@ std::size_t Controller_NPad::GetSupportedNPadIdTypesSize() const {
}
void Controller_NPad::SetHoldType(NpadHoldType joy_hold_type) {
- styleset_changed_event->Signal();
+ styleset_changed_event.writable->Signal();
hold_type = joy_hold_type;
}
@@ -543,10 +543,8 @@ void Controller_NPad::VibrateController(const std::vector<u32>& controller_ids,
Kernel::SharedPtr<Kernel::ReadableEvent> Controller_NPad::GetStyleSetChangedEvent() const {
// TODO(ogniK): Figure out the best time to signal this event. This event seems that it should
// be signalled at least once, and signaled after a new controller is connected?
- styleset_changed_event->Signal();
- const auto& event{
- Core::System::GetInstance().Kernel().FindNamedEvent("npad:NpadStyleSetChanged")};
- return event->second;
+ styleset_changed_event.writable->Signal();
+ return styleset_changed_event.readable;
}
Controller_NPad::Vibration Controller_NPad::GetLastVibration() const {
diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h
index c960d0f57..29851f16a 100644
--- a/src/core/hle/service/hid/controllers/npad.h
+++ b/src/core/hle/service/hid/controllers/npad.h
@@ -9,14 +9,10 @@
#include "common/common_types.h"
#include "core/frontend/input.h"
#include "core/hle/kernel/object.h"
+#include "core/hle/kernel/writable_event.h"
#include "core/hle/service/hid/controllers/controller_base.h"
#include "core/settings.h"
-namespace Kernel {
-class ReadableEvent;
-class WritableEvent;
-} // namespace Kernel
-
namespace Service::HID {
constexpr u32 NPAD_HANDHELD = 32;
@@ -308,7 +304,7 @@ private:
sticks;
std::vector<u32> supported_npad_id_types{};
NpadHoldType hold_type{NpadHoldType::Vertical};
- Kernel::SharedPtr<Kernel::WritableEvent> styleset_changed_event;
+ Kernel::EventPair styleset_changed_event;
Vibration last_processed_vibration{};
std::array<ControllerHolder, 10> connected_controllers{};
bool can_controllers_vibrate{true};