diff options
author | David Marcec <dmarcecguzman@gmail.com> | 2018-10-18 12:45:10 +0200 |
---|---|---|
committer | Zach Hilman <zachhilman@gmail.com> | 2018-11-19 05:21:33 +0100 |
commit | 362b28d0529eeb815f428594200c611d525a0d6f (patch) | |
tree | eb1bb3814c0c04a857bb90590b7ee615b4c94b23 /src/core | |
parent | Changed polling rate of hid and Right joycon rotation (diff) | |
download | yuzu-362b28d0529eeb815f428594200c611d525a0d6f.tar yuzu-362b28d0529eeb815f428594200c611d525a0d6f.tar.gz yuzu-362b28d0529eeb815f428594200c611d525a0d6f.tar.bz2 yuzu-362b28d0529eeb815f428594200c611d525a0d6f.tar.lz yuzu-362b28d0529eeb815f428594200c611d525a0d6f.tar.xz yuzu-362b28d0529eeb815f428594200c611d525a0d6f.tar.zst yuzu-362b28d0529eeb815f428594200c611d525a0d6f.zip |
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/hle/service/hid/controllers/npad.cpp | 31 | ||||
-rw-r--r-- | src/core/hle/service/hid/controllers/npad.h | 4 |
2 files changed, 35 insertions, 0 deletions
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index fd677d281..3eb59599f 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp @@ -712,6 +712,37 @@ void Controller_NPad::SetVibrationEnabled(bool can_vibrate) { can_controllers_vibrate = can_vibrate; } +void Controller_NPad::ClearAllConnectedControllers() { + std::for_each(connected_controllers.begin(), connected_controllers.end(), + [](ControllerHolder& controller) { + if (controller.is_connected && controller.type != NPadControllerType::None) { + controller.type = NPadControllerType::None; + controller.is_connected = false; + } + }); +} +void Controller_NPad::DisconnectAllConnectedControllers() { + std::for_each(connected_controllers.begin(), connected_controllers.end(), + [](ControllerHolder& controller) { controller.is_connected = false; }); +} + +void Controller_NPad::ConnectAllDisconnectedControllers() { + std::for_each(connected_controllers.begin(), connected_controllers.end(), + [](ControllerHolder& controller) { + if (controller.type != NPadControllerType::None && !controller.is_connected) { + controller.is_connected = false; + } + }); +} + +void Controller_NPad::ClearAllControllers() { + std::for_each(connected_controllers.begin(), connected_controllers.end(), + [](ControllerHolder& controller) { + controller.type = NPadControllerType::None; + controller.is_connected = false; + }); +} + bool Controller_NPad::IsControllerSupported(NPadControllerType controller) const { const bool support_handheld = std::find(supported_npad_id_types.begin(), supported_npad_id_types.end(), NPAD_HANDHELD) != diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h index f702990c7..7222bca72 100644 --- a/src/core/hle/service/hid/controllers/npad.h +++ b/src/core/hle/service/hid/controllers/npad.h @@ -113,6 +113,10 @@ public: void DisconnectNPad(u32 npad_id); LedPattern GetLedPattern(u32 npad_id); void SetVibrationEnabled(bool can_vibrate); + void ClearAllConnectedControllers(); + void DisconnectAllConnectedControllers(); + void ConnectAllDisconnectedControllers(); + void ClearAllControllers(); private: struct CommonHeader { |