summaryrefslogtreecommitdiffstats
path: root/src/input_common/helpers/joycon_protocol/ringcon.cpp
diff options
context:
space:
mode:
authorgerman77 <juangerman-13@hotmail.com>2022-12-23 15:32:02 +0100
committerNarr the Reg <juangerman-13@hotmail.com>2023-01-20 01:05:22 +0100
commite1a3bda4d9881cb99c36b64733b814a3bb437f13 (patch)
treea9c0d864b023a810f48c129bb8bd6e84afb2ed2b /src/input_common/helpers/joycon_protocol/ringcon.cpp
parentcore: hid: Fix input regressions (diff)
downloadyuzu-e1a3bda4d9881cb99c36b64733b814a3bb437f13.tar
yuzu-e1a3bda4d9881cb99c36b64733b814a3bb437f13.tar.gz
yuzu-e1a3bda4d9881cb99c36b64733b814a3bb437f13.tar.bz2
yuzu-e1a3bda4d9881cb99c36b64733b814a3bb437f13.tar.lz
yuzu-e1a3bda4d9881cb99c36b64733b814a3bb437f13.tar.xz
yuzu-e1a3bda4d9881cb99c36b64733b814a3bb437f13.tar.zst
yuzu-e1a3bda4d9881cb99c36b64733b814a3bb437f13.zip
Diffstat (limited to 'src/input_common/helpers/joycon_protocol/ringcon.cpp')
-rw-r--r--src/input_common/helpers/joycon_protocol/ringcon.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/input_common/helpers/joycon_protocol/ringcon.cpp b/src/input_common/helpers/joycon_protocol/ringcon.cpp
index 47769f344..8adad57dd 100644
--- a/src/input_common/helpers/joycon_protocol/ringcon.cpp
+++ b/src/input_common/helpers/joycon_protocol/ringcon.cpp
@@ -7,7 +7,7 @@
namespace InputCommon::Joycon {
RingConProtocol::RingConProtocol(std::shared_ptr<JoyconHandle> handle)
- : JoyconCommonProtocol(handle) {}
+ : JoyconCommonProtocol(std::move(handle)) {}
DriverResult RingConProtocol::EnableRingCon() {
LOG_DEBUG(Input, "Enable Ringcon");
@@ -78,7 +78,7 @@ DriverResult RingConProtocol::IsRingConnected(bool& is_connected) {
is_connected = false;
do {
- std::vector<u8> empty_data(0);
+ std::array<u8, 1> empty_data{};
const auto result = SendSubCommand(SubCommand::UNKNOWN_RINGCON, empty_data, output);
if (result != DriverResult::Success) {
@@ -101,11 +101,11 @@ DriverResult RingConProtocol::ConfigureRing() {
std::vector<u8> output;
std::size_t tries = 0;
+ static constexpr std::array<u8, 37> ring_config{
+ 0x06, 0x03, 0x25, 0x06, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x16, 0xED, 0x34, 0x36,
+ 0x00, 0x00, 0x00, 0x0A, 0x64, 0x0B, 0xE6, 0xA9, 0x22, 0x00, 0x00, 0x04, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0xA8, 0xE1, 0x34, 0x36};
do {
- std::vector<u8> ring_config{0x06, 0x03, 0x25, 0x06, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x16,
- 0xED, 0x34, 0x36, 0x00, 0x00, 0x00, 0x0A, 0x64, 0x0B, 0xE6,
- 0xA9, 0x22, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x90, 0xA8, 0xE1, 0x34, 0x36};
result = SendSubCommand(SubCommand::UNKNOWN_RINGCON3, ring_config, output);
if (result != DriverResult::Success) {
@@ -116,13 +116,13 @@ DriverResult RingConProtocol::ConfigureRing() {
}
} while (output[14] != 0x5C);
- std::vector<u8> ringcon_data{0x04, 0x01, 0x01, 0x02};
+ static constexpr std::array<u8, 4> ringcon_data{0x04, 0x01, 0x01, 0x02};
result = SendSubCommand(SubCommand::UNKNOWN_RINGCON2, ringcon_data, output);
return result;
}
-bool RingConProtocol::IsEnabled() {
+bool RingConProtocol::IsEnabled() const {
return is_enabled;
}