diff options
Diffstat (limited to 'src/input_common')
| -rw-r--r-- | src/input_common/drivers/gc_adapter.cpp | 4 | ||||
| -rw-r--r-- | src/input_common/helpers/joycon_protocol/irs.cpp | 4 | ||||
| -rw-r--r-- | src/input_common/helpers/joycon_protocol/joycon_types.h | 6 | ||||
| -rw-r--r-- | src/input_common/helpers/joycon_protocol/nfc.cpp | 8 | ||||
| -rw-r--r-- | src/input_common/helpers/joycon_protocol/rumble.cpp | 12 | ||||
| -rw-r--r-- | src/input_common/helpers/udp_protocol.h | 2 |
6 files changed, 18 insertions, 18 deletions
diff --git a/src/input_common/drivers/gc_adapter.cpp b/src/input_common/drivers/gc_adapter.cpp index 1ff296af5..f1184a5fa 100644 --- a/src/input_common/drivers/gc_adapter.cpp +++ b/src/input_common/drivers/gc_adapter.cpp | |||
| @@ -451,11 +451,11 @@ ButtonMapping GCAdapter::GetButtonMappingForDevice(const Common::ParamPackage& p | |||
| 451 | std::tuple{Settings::NativeButton::ZL, PadButton::TriggerL, PadAxes::TriggerLeft}, | 451 | std::tuple{Settings::NativeButton::ZL, PadButton::TriggerL, PadAxes::TriggerLeft}, |
| 452 | {Settings::NativeButton::ZR, PadButton::TriggerR, PadAxes::TriggerRight}, | 452 | {Settings::NativeButton::ZR, PadButton::TriggerR, PadAxes::TriggerRight}, |
| 453 | }; | 453 | }; |
| 454 | for (const auto& [switch_button, gcadapter_buton, gcadapter_axis] : switch_to_gcadapter_axis) { | 454 | for (const auto& [switch_button, gcadapter_button, gcadapter_axis] : switch_to_gcadapter_axis) { |
| 455 | Common::ParamPackage button_params{}; | 455 | Common::ParamPackage button_params{}; |
| 456 | button_params.Set("engine", GetEngineName()); | 456 | button_params.Set("engine", GetEngineName()); |
| 457 | button_params.Set("port", params.Get("port", 0)); | 457 | button_params.Set("port", params.Get("port", 0)); |
| 458 | button_params.Set("button", static_cast<s32>(gcadapter_buton)); | 458 | button_params.Set("button", static_cast<s32>(gcadapter_button)); |
| 459 | button_params.Set("axis", static_cast<s32>(gcadapter_axis)); | 459 | button_params.Set("axis", static_cast<s32>(gcadapter_axis)); |
| 460 | button_params.Set("threshold", 0.5f); | 460 | button_params.Set("threshold", 0.5f); |
| 461 | button_params.Set("range", 1.9f); | 461 | button_params.Set("range", 1.9f); |
diff --git a/src/input_common/helpers/joycon_protocol/irs.cpp b/src/input_common/helpers/joycon_protocol/irs.cpp index 68b0589e3..5bf72114d 100644 --- a/src/input_common/helpers/joycon_protocol/irs.cpp +++ b/src/input_common/helpers/joycon_protocol/irs.cpp | |||
| @@ -236,9 +236,9 @@ Common::Input::DriverResult IrsProtocol::WriteRegistersStep2() { | |||
| 236 | .number_of_registers = 0x8, | 236 | .number_of_registers = 0x8, |
| 237 | .registers = | 237 | .registers = |
| 238 | { | 238 | { |
| 239 | IrsRegister{IrRegistersAddress::LedIntensitiyMSB, | 239 | IrsRegister{IrRegistersAddress::LedIntensityMSB, |
| 240 | static_cast<u8>(led_intensity >> 8)}, | 240 | static_cast<u8>(led_intensity >> 8)}, |
| 241 | {IrRegistersAddress::LedIntensitiyLSB, static_cast<u8>(led_intensity & 0xff)}, | 241 | {IrRegistersAddress::LedIntensityLSB, static_cast<u8>(led_intensity & 0xff)}, |
| 242 | {IrRegistersAddress::ImageFlip, static_cast<u8>(image_flip)}, | 242 | {IrRegistersAddress::ImageFlip, static_cast<u8>(image_flip)}, |
| 243 | {IrRegistersAddress::DenoiseSmoothing, static_cast<u8>((denoise >> 16) & 0xff)}, | 243 | {IrRegistersAddress::DenoiseSmoothing, static_cast<u8>((denoise >> 16) & 0xff)}, |
| 244 | {IrRegistersAddress::DenoiseEdge, static_cast<u8>((denoise >> 8) & 0xff)}, | 244 | {IrRegistersAddress::DenoiseEdge, static_cast<u8>((denoise >> 8) & 0xff)}, |
diff --git a/src/input_common/helpers/joycon_protocol/joycon_types.h b/src/input_common/helpers/joycon_protocol/joycon_types.h index 77a43c67a..792f124e1 100644 --- a/src/input_common/helpers/joycon_protocol/joycon_types.h +++ b/src/input_common/helpers/joycon_protocol/joycon_types.h | |||
| @@ -282,7 +282,7 @@ enum class NFCCommand : u8 { | |||
| 282 | CancelAll = 0x00, | 282 | CancelAll = 0x00, |
| 283 | StartPolling = 0x01, | 283 | StartPolling = 0x01, |
| 284 | StopPolling = 0x02, | 284 | StopPolling = 0x02, |
| 285 | StartWaitingRecieve = 0x04, | 285 | StartWaitingReceive = 0x04, |
| 286 | ReadNtag = 0x06, | 286 | ReadNtag = 0x06, |
| 287 | WriteNtag = 0x08, | 287 | WriteNtag = 0x08, |
| 288 | Mifare = 0x0F, | 288 | Mifare = 0x0F, |
| @@ -382,8 +382,8 @@ enum class IrRegistersAddress : u16 { | |||
| 382 | FinalizeConfig = 0x0700, | 382 | FinalizeConfig = 0x0700, |
| 383 | LedFilter = 0x0e00, | 383 | LedFilter = 0x0e00, |
| 384 | Leds = 0x1000, | 384 | Leds = 0x1000, |
| 385 | LedIntensitiyMSB = 0x1100, | 385 | LedIntensityMSB = 0x1100, |
| 386 | LedIntensitiyLSB = 0x1200, | 386 | LedIntensityLSB = 0x1200, |
| 387 | ImageFlip = 0x2d00, | 387 | ImageFlip = 0x2d00, |
| 388 | Resolution = 0x2e00, | 388 | Resolution = 0x2e00, |
| 389 | DigitalGainLSB = 0x2e01, | 389 | DigitalGainLSB = 0x2e01, |
diff --git a/src/input_common/helpers/joycon_protocol/nfc.cpp b/src/input_common/helpers/joycon_protocol/nfc.cpp index 09953394b..db83f9ef4 100644 --- a/src/input_common/helpers/joycon_protocol/nfc.cpp +++ b/src/input_common/helpers/joycon_protocol/nfc.cpp | |||
| @@ -519,13 +519,13 @@ Common::Input::DriverResult NfcProtocol::GetMifareData( | |||
| 519 | } | 519 | } |
| 520 | 520 | ||
| 521 | if (output.mcu_report == MCUReport::NFCState && output.mcu_data[1] == 0x10) { | 521 | if (output.mcu_report == MCUReport::NFCState && output.mcu_data[1] == 0x10) { |
| 522 | constexpr std::size_t DATA_LENGHT = 0x10 + 1; | 522 | constexpr std::size_t DATA_LENGTH = 0x10 + 1; |
| 523 | constexpr std::size_t DATA_START = 11; | 523 | constexpr std::size_t DATA_START = 11; |
| 524 | const u8 number_of_elements = output.mcu_data[10]; | 524 | const u8 number_of_elements = output.mcu_data[10]; |
| 525 | for (std::size_t i = 0; i < number_of_elements; i++) { | 525 | for (std::size_t i = 0; i < number_of_elements; i++) { |
| 526 | out_data[i].sector = output.mcu_data[DATA_START + (i * DATA_LENGHT)]; | 526 | out_data[i].sector = output.mcu_data[DATA_START + (i * DATA_LENGTH)]; |
| 527 | memcpy(out_data[i].data.data(), | 527 | memcpy(out_data[i].data.data(), |
| 528 | output.mcu_data.data() + DATA_START + 1 + (i * DATA_LENGHT), | 528 | output.mcu_data.data() + DATA_START + 1 + (i * DATA_LENGTH), |
| 529 | sizeof(MifareReadData::data)); | 529 | sizeof(MifareReadData::data)); |
| 530 | } | 530 | } |
| 531 | package_index++; | 531 | package_index++; |
| @@ -659,7 +659,7 @@ Common::Input::DriverResult NfcProtocol::SendStopPollingRequest(MCUCommandRespon | |||
| 659 | Common::Input::DriverResult NfcProtocol::SendNextPackageRequest(MCUCommandResponse& output, | 659 | Common::Input::DriverResult NfcProtocol::SendNextPackageRequest(MCUCommandResponse& output, |
| 660 | u8 packet_id) { | 660 | u8 packet_id) { |
| 661 | NFCRequestState request{ | 661 | NFCRequestState request{ |
| 662 | .command_argument = NFCCommand::StartWaitingRecieve, | 662 | .command_argument = NFCCommand::StartWaitingReceive, |
| 663 | .block_id = {}, | 663 | .block_id = {}, |
| 664 | .packet_id = packet_id, | 664 | .packet_id = packet_id, |
| 665 | .packet_flag = MCUPacketFlag::LastCommandPacket, | 665 | .packet_flag = MCUPacketFlag::LastCommandPacket, |
diff --git a/src/input_common/helpers/joycon_protocol/rumble.cpp b/src/input_common/helpers/joycon_protocol/rumble.cpp index 7647f505e..9fd0b8470 100644 --- a/src/input_common/helpers/joycon_protocol/rumble.cpp +++ b/src/input_common/helpers/joycon_protocol/rumble.cpp | |||
| @@ -67,7 +67,7 @@ u8 RumbleProtocol::EncodeHighAmplitude(f32 amplitude) const { | |||
| 67 | // More information about these values can be found here: | 67 | // More information about these values can be found here: |
| 68 | // https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering/blob/master/rumble_data_table.md | 68 | // https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering/blob/master/rumble_data_table.md |
| 69 | 69 | ||
| 70 | static constexpr std::array<std::pair<f32, int>, 101> high_fequency_amplitude{ | 70 | static constexpr std::array<std::pair<f32, int>, 101> high_frequency_amplitude{ |
| 71 | std::pair<f32, int>{0.0f, 0x0}, | 71 | std::pair<f32, int>{0.0f, 0x0}, |
| 72 | {0.01f, 0x2}, | 72 | {0.01f, 0x2}, |
| 73 | {0.012f, 0x4}, | 73 | {0.012f, 0x4}, |
| @@ -171,20 +171,20 @@ u8 RumbleProtocol::EncodeHighAmplitude(f32 amplitude) const { | |||
| 171 | {1.003f, 0xc8}, | 171 | {1.003f, 0xc8}, |
| 172 | }; | 172 | }; |
| 173 | 173 | ||
| 174 | for (const auto& [amplitude_value, code] : high_fequency_amplitude) { | 174 | for (const auto& [amplitude_value, code] : high_frequency_amplitude) { |
| 175 | if (amplitude <= amplitude_value) { | 175 | if (amplitude <= amplitude_value) { |
| 176 | return static_cast<u8>(code); | 176 | return static_cast<u8>(code); |
| 177 | } | 177 | } |
| 178 | } | 178 | } |
| 179 | 179 | ||
| 180 | return static_cast<u8>(high_fequency_amplitude[high_fequency_amplitude.size() - 1].second); | 180 | return static_cast<u8>(high_frequency_amplitude[high_frequency_amplitude.size() - 1].second); |
| 181 | } | 181 | } |
| 182 | 182 | ||
| 183 | u16 RumbleProtocol::EncodeLowAmplitude(f32 amplitude) const { | 183 | u16 RumbleProtocol::EncodeLowAmplitude(f32 amplitude) const { |
| 184 | // More information about these values can be found here: | 184 | // More information about these values can be found here: |
| 185 | // https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering/blob/master/rumble_data_table.md | 185 | // https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering/blob/master/rumble_data_table.md |
| 186 | 186 | ||
| 187 | static constexpr std::array<std::pair<f32, int>, 101> high_fequency_amplitude{ | 187 | static constexpr std::array<std::pair<f32, int>, 101> high_frequency_amplitude{ |
| 188 | std::pair<f32, int>{0.0f, 0x0040}, | 188 | std::pair<f32, int>{0.0f, 0x0040}, |
| 189 | {0.01f, 0x8040}, | 189 | {0.01f, 0x8040}, |
| 190 | {0.012f, 0x0041}, | 190 | {0.012f, 0x0041}, |
| @@ -288,13 +288,13 @@ u16 RumbleProtocol::EncodeLowAmplitude(f32 amplitude) const { | |||
| 288 | {1.003f, 0x0072}, | 288 | {1.003f, 0x0072}, |
| 289 | }; | 289 | }; |
| 290 | 290 | ||
| 291 | for (const auto& [amplitude_value, code] : high_fequency_amplitude) { | 291 | for (const auto& [amplitude_value, code] : high_frequency_amplitude) { |
| 292 | if (amplitude <= amplitude_value) { | 292 | if (amplitude <= amplitude_value) { |
| 293 | return static_cast<u16>(code); | 293 | return static_cast<u16>(code); |
| 294 | } | 294 | } |
| 295 | } | 295 | } |
| 296 | 296 | ||
| 297 | return static_cast<u16>(high_fequency_amplitude[high_fequency_amplitude.size() - 1].second); | 297 | return static_cast<u16>(high_frequency_amplitude[high_frequency_amplitude.size() - 1].second); |
| 298 | } | 298 | } |
| 299 | 299 | ||
| 300 | } // namespace InputCommon::Joycon | 300 | } // namespace InputCommon::Joycon |
diff --git a/src/input_common/helpers/udp_protocol.h b/src/input_common/helpers/udp_protocol.h index d9643ffe0..dba9f87d9 100644 --- a/src/input_common/helpers/udp_protocol.h +++ b/src/input_common/helpers/udp_protocol.h | |||
| @@ -78,7 +78,7 @@ namespace Request { | |||
| 78 | enum RegisterFlags : u8 { | 78 | enum RegisterFlags : u8 { |
| 79 | AllPads, | 79 | AllPads, |
| 80 | PadID, | 80 | PadID, |
| 81 | PadMACAdddress, | 81 | PadMACAddress, |
| 82 | }; | 82 | }; |
| 83 | 83 | ||
| 84 | struct Version {}; | 84 | struct Version {}; |