summaryrefslogtreecommitdiffstats
path: root/src/input_common/helpers/joycon_protocol/irs.cpp
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2023-01-30 15:02:12 +0100
committerGitHub <noreply@github.com>2023-01-30 15:02:12 +0100
commite74660673b68e7226b7e934efe5eac620f7a98e6 (patch)
tree355def233607668733581b2b5194d0e54e1b7995 /src/input_common/helpers/joycon_protocol/irs.cpp
parentMerge pull request #9631 from vonchenplus/vulkan_clear (diff)
parentinput_common: joycon: Remove Magic numbers from common protocol (diff)
downloadyuzu-e74660673b68e7226b7e934efe5eac620f7a98e6.tar
yuzu-e74660673b68e7226b7e934efe5eac620f7a98e6.tar.gz
yuzu-e74660673b68e7226b7e934efe5eac620f7a98e6.tar.bz2
yuzu-e74660673b68e7226b7e934efe5eac620f7a98e6.tar.lz
yuzu-e74660673b68e7226b7e934efe5eac620f7a98e6.tar.xz
yuzu-e74660673b68e7226b7e934efe5eac620f7a98e6.tar.zst
yuzu-e74660673b68e7226b7e934efe5eac620f7a98e6.zip
Diffstat (limited to 'src/input_common/helpers/joycon_protocol/irs.cpp')
-rw-r--r--src/input_common/helpers/joycon_protocol/irs.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/input_common/helpers/joycon_protocol/irs.cpp b/src/input_common/helpers/joycon_protocol/irs.cpp
index 09e17bc5b..731fd5981 100644
--- a/src/input_common/helpers/joycon_protocol/irs.cpp
+++ b/src/input_common/helpers/joycon_protocol/irs.cpp
@@ -132,7 +132,7 @@ DriverResult IrsProtocol::RequestImage(std::span<u8> buffer) {
DriverResult IrsProtocol::ConfigureIrs() {
LOG_DEBUG(Input, "Configure IRS");
constexpr std::size_t max_tries = 28;
- std::vector<u8> output;
+ SubCommandResponse output{};
std::size_t tries = 0;
const IrsConfigure irs_configuration{
@@ -158,7 +158,7 @@ DriverResult IrsProtocol::ConfigureIrs() {
if (tries++ >= max_tries) {
return DriverResult::WrongReply;
}
- } while (output[15] != 0x0b);
+ } while (output.command_data[0] != 0x0b);
return DriverResult::Success;
}
@@ -167,7 +167,7 @@ DriverResult IrsProtocol::WriteRegistersStep1() {
LOG_DEBUG(Input, "WriteRegistersStep1");
DriverResult result{DriverResult::Success};
constexpr std::size_t max_tries = 28;
- std::vector<u8> output;
+ SubCommandResponse output{};
std::size_t tries = 0;
const IrsWriteRegisters irs_registers{
@@ -218,7 +218,8 @@ DriverResult IrsProtocol::WriteRegistersStep1() {
if (tries++ >= max_tries) {
return DriverResult::WrongReply;
}
- } while (!(output[15] == 0x13 && output[17] == 0x07) && output[15] != 0x23);
+ } while (!(output.command_data[0] == 0x13 && output.command_data[2] == 0x07) &&
+ output.command_data[0] != 0x23);
return DriverResult::Success;
}
@@ -226,7 +227,7 @@ DriverResult IrsProtocol::WriteRegistersStep1() {
DriverResult IrsProtocol::WriteRegistersStep2() {
LOG_DEBUG(Input, "WriteRegistersStep2");
constexpr std::size_t max_tries = 28;
- std::vector<u8> output;
+ SubCommandResponse output{};
std::size_t tries = 0;
const IrsWriteRegisters irs_registers{
@@ -260,7 +261,7 @@ DriverResult IrsProtocol::WriteRegistersStep2() {
if (tries++ >= max_tries) {
return DriverResult::WrongReply;
}
- } while (output[15] != 0x13 && output[15] != 0x23);
+ } while (output.command_data[0] != 0x13 && output.command_data[0] != 0x23);
return DriverResult::Success;
}