summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/hid/controllers
diff options
context:
space:
mode:
authorZach Hilman <zachhilman@gmail.com>2018-11-27 00:34:07 +0100
committerZach Hilman <zachhilman@gmail.com>2018-11-29 14:45:41 +0100
commitff610103b58b3e0dd39fafb539a1cc0bc0fae577 (patch)
treecbd54b09f9270f6f1d92a2f45a5ccdb307569093 /src/core/hle/service/hid/controllers
parenthle_ipc: Use event pair for SleepClientThread (diff)
downloadyuzu-ff610103b58b3e0dd39fafb539a1cc0bc0fae577.tar
yuzu-ff610103b58b3e0dd39fafb539a1cc0bc0fae577.tar.gz
yuzu-ff610103b58b3e0dd39fafb539a1cc0bc0fae577.tar.bz2
yuzu-ff610103b58b3e0dd39fafb539a1cc0bc0fae577.tar.lz
yuzu-ff610103b58b3e0dd39fafb539a1cc0bc0fae577.tar.xz
yuzu-ff610103b58b3e0dd39fafb539a1cc0bc0fae577.tar.zst
yuzu-ff610103b58b3e0dd39fafb539a1cc0bc0fae577.zip
Diffstat (limited to 'src/core/hle/service/hid/controllers')
-rw-r--r--src/core/hle/service/hid/controllers/npad.cpp14
-rw-r--r--src/core/hle/service/hid/controllers/npad.h11
2 files changed, 17 insertions, 8 deletions
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp
index 22e87a50a..df39a6dc4 100644
--- a/src/core/hle/service/hid/controllers/npad.cpp
+++ b/src/core/hle/service/hid/controllers/npad.cpp
@@ -12,7 +12,9 @@
#include "core/core.h"
#include "core/core_timing.h"
#include "core/frontend/input.h"
-#include "core/hle/kernel/event.h"
+#include "core/hle/kernel/kernel.h"
+#include "core/hle/kernel/readable_event.h"
+#include "core/hle/kernel/writable_event.h"
#include "core/hle/service/hid/controllers/npad.h"
#include "core/settings.h"
@@ -167,8 +169,8 @@ void Controller_NPad::InitNewlyAddedControler(std::size_t controller_idx) {
void Controller_NPad::OnInit() {
auto& kernel = Core::System::GetInstance().Kernel();
- styleset_changed_event =
- Kernel::Event::Create(kernel, Kernel::ResetType::OneShot, "npad:NpadStyleSetChanged");
+ styleset_changed_event = Kernel::WritableEvent::CreateRegisteredEventPair(
+ kernel, Kernel::ResetType::OneShot, "npad:NpadStyleSetChanged");
if (!IsControllerActivated()) {
return;
@@ -538,11 +540,13 @@ void Controller_NPad::VibrateController(const std::vector<u32>& controller_ids,
last_processed_vibration = vibrations.back();
}
-Kernel::SharedPtr<Kernel::Event> Controller_NPad::GetStyleSetChangedEvent() const {
+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();
- return styleset_changed_event;
+ const auto& event{
+ Core::System::GetInstance().Kernel().FindNamedEvent("npad:NpadStyleSetChanged")};
+ return event->second;
}
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 abff6544d..c960d0f57 100644
--- a/src/core/hle/service/hid/controllers/npad.h
+++ b/src/core/hle/service/hid/controllers/npad.h
@@ -8,10 +8,15 @@
#include "common/bit_field.h"
#include "common/common_types.h"
#include "core/frontend/input.h"
-#include "core/hle/kernel/event.h"
+#include "core/hle/kernel/object.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;
@@ -108,7 +113,7 @@ public:
void VibrateController(const std::vector<u32>& controller_ids,
const std::vector<Vibration>& vibrations);
- Kernel::SharedPtr<Kernel::Event> GetStyleSetChangedEvent() const;
+ Kernel::SharedPtr<Kernel::ReadableEvent> GetStyleSetChangedEvent() const;
Vibration GetLastVibration() const;
void AddNewController(NPadControllerType controller);
@@ -303,7 +308,7 @@ private:
sticks;
std::vector<u32> supported_npad_id_types{};
NpadHoldType hold_type{NpadHoldType::Vertical};
- Kernel::SharedPtr<Kernel::Event> styleset_changed_event;
+ Kernel::SharedPtr<Kernel::WritableEvent> styleset_changed_event;
Vibration last_processed_vibration{};
std::array<ControllerHolder, 10> connected_controllers{};
bool can_controllers_vibrate{true};