input_common: Minor typo issues (#9922)
This commit is contained in:
parent
a7792e5ff8
commit
757aafa582
|
@ -46,7 +46,7 @@ enum class PollingMode {
|
||||||
// Constant polling of buttons, analogs and motion data
|
// Constant polling of buttons, analogs and motion data
|
||||||
Active,
|
Active,
|
||||||
// Only update on button change, digital analogs
|
// Only update on button change, digital analogs
|
||||||
Pasive,
|
Passive,
|
||||||
// Enable near field communication polling
|
// Enable near field communication polling
|
||||||
NFC,
|
NFC,
|
||||||
// Enable infrared camera polling
|
// Enable infrared camera polling
|
||||||
|
|
|
@ -307,8 +307,8 @@ Common::Input::DriverResult Joycons::SetPollingMode(const PadIdentifier& identif
|
||||||
switch (polling_mode) {
|
switch (polling_mode) {
|
||||||
case Common::Input::PollingMode::Active:
|
case Common::Input::PollingMode::Active:
|
||||||
return static_cast<Common::Input::DriverResult>(handle->SetActiveMode());
|
return static_cast<Common::Input::DriverResult>(handle->SetActiveMode());
|
||||||
case Common::Input::PollingMode::Pasive:
|
case Common::Input::PollingMode::Passive:
|
||||||
return static_cast<Common::Input::DriverResult>(handle->SetPasiveMode());
|
return static_cast<Common::Input::DriverResult>(handle->SetPassiveMode());
|
||||||
case Common::Input::PollingMode::IR:
|
case Common::Input::PollingMode::IR:
|
||||||
return static_cast<Common::Input::DriverResult>(handle->SetIrMode());
|
return static_cast<Common::Input::DriverResult>(handle->SetIrMode());
|
||||||
case Common::Input::PollingMode::NFC:
|
case Common::Input::PollingMode::NFC:
|
||||||
|
|
|
@ -60,6 +60,6 @@ private:
|
||||||
std::string file_path{};
|
std::string file_path{};
|
||||||
State state{State::Initialized};
|
State state{State::Initialized};
|
||||||
std::vector<u8> nfc_data;
|
std::vector<u8> nfc_data;
|
||||||
Common::Input::PollingMode polling_mode{Common::Input::PollingMode::Pasive};
|
Common::Input::PollingMode polling_mode{Common::Input::PollingMode::Passive};
|
||||||
};
|
};
|
||||||
} // namespace InputCommon
|
} // namespace InputCommon
|
||||||
|
|
|
@ -410,7 +410,7 @@ DriverResult JoyconDriver::SetIrsConfig(IrsMode mode_, IrsResolution format_) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
DriverResult JoyconDriver::SetPasiveMode() {
|
DriverResult JoyconDriver::SetPassiveMode() {
|
||||||
std::scoped_lock lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
motion_enabled = false;
|
motion_enabled = false;
|
||||||
hidbus_enabled = false;
|
hidbus_enabled = false;
|
||||||
|
|
|
@ -44,7 +44,7 @@ public:
|
||||||
DriverResult SetVibration(const VibrationValue& vibration);
|
DriverResult SetVibration(const VibrationValue& vibration);
|
||||||
DriverResult SetLedConfig(u8 led_pattern);
|
DriverResult SetLedConfig(u8 led_pattern);
|
||||||
DriverResult SetIrsConfig(IrsMode mode_, IrsResolution format_);
|
DriverResult SetIrsConfig(IrsMode mode_, IrsResolution format_);
|
||||||
DriverResult SetPasiveMode();
|
DriverResult SetPassiveMode();
|
||||||
DriverResult SetActiveMode();
|
DriverResult SetActiveMode();
|
||||||
DriverResult SetIrMode();
|
DriverResult SetIrMode();
|
||||||
DriverResult SetNfcMode();
|
DriverResult SetNfcMode();
|
||||||
|
|
|
@ -78,7 +78,7 @@ enum class PadButton : u32 {
|
||||||
Capture = 0x200000,
|
Capture = 0x200000,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class PasivePadButton : u32 {
|
enum class PassivePadButton : u32 {
|
||||||
Down_A = 0x0001,
|
Down_A = 0x0001,
|
||||||
Right_X = 0x0002,
|
Right_X = 0x0002,
|
||||||
Left_B = 0x0004,
|
Left_B = 0x0004,
|
||||||
|
@ -95,7 +95,7 @@ enum class PasivePadButton : u32 {
|
||||||
ZL_ZR = 0x8000,
|
ZL_ZR = 0x8000,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class PasivePadStick : u8 {
|
enum class PassivePadStick : u8 {
|
||||||
Right = 0x00,
|
Right = 0x00,
|
||||||
RightDown = 0x01,
|
RightDown = 0x01,
|
||||||
Down = 0x02,
|
Down = 0x02,
|
||||||
|
|
|
@ -48,13 +48,13 @@ void JoyconPoller::ReadPassiveMode(std::span<u8> buffer) {
|
||||||
|
|
||||||
switch (device_type) {
|
switch (device_type) {
|
||||||
case ControllerType::Left:
|
case ControllerType::Left:
|
||||||
UpdatePasiveLeftPadInput(data);
|
UpdatePassiveLeftPadInput(data);
|
||||||
break;
|
break;
|
||||||
case ControllerType::Right:
|
case ControllerType::Right:
|
||||||
UpdatePasiveRightPadInput(data);
|
UpdatePassiveRightPadInput(data);
|
||||||
break;
|
break;
|
||||||
case ControllerType::Pro:
|
case ControllerType::Pro:
|
||||||
UpdatePasiveProPadInput(data);
|
UpdatePassiveProPadInput(data);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -210,12 +210,12 @@ void JoyconPoller::UpdateActiveProPadInput(const InputReportActive& input,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void JoyconPoller::UpdatePasiveLeftPadInput(const InputReportPassive& input) {
|
void JoyconPoller::UpdatePassiveLeftPadInput(const InputReportPassive& input) {
|
||||||
static constexpr std::array<PasivePadButton, 11> left_buttons{
|
static constexpr std::array<PassivePadButton, 11> left_buttons{
|
||||||
PasivePadButton::Down_A, PasivePadButton::Right_X, PasivePadButton::Left_B,
|
PassivePadButton::Down_A, PassivePadButton::Right_X, PassivePadButton::Left_B,
|
||||||
PasivePadButton::Up_Y, PasivePadButton::SL, PasivePadButton::SR,
|
PassivePadButton::Up_Y, PassivePadButton::SL, PassivePadButton::SR,
|
||||||
PasivePadButton::L_R, PasivePadButton::ZL_ZR, PasivePadButton::Minus,
|
PassivePadButton::L_R, PassivePadButton::ZL_ZR, PassivePadButton::Minus,
|
||||||
PasivePadButton::Capture, PasivePadButton::StickL,
|
PassivePadButton::Capture, PassivePadButton::StickL,
|
||||||
};
|
};
|
||||||
|
|
||||||
for (auto left_button : left_buttons) {
|
for (auto left_button : left_buttons) {
|
||||||
|
@ -225,17 +225,17 @@ void JoyconPoller::UpdatePasiveLeftPadInput(const InputReportPassive& input) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto [left_axis_x, left_axis_y] =
|
const auto [left_axis_x, left_axis_y] =
|
||||||
GetPassiveAxisValue(static_cast<PasivePadStick>(input.stick_state));
|
GetPassiveAxisValue(static_cast<PassivePadStick>(input.stick_state));
|
||||||
callbacks.on_stick_data(static_cast<int>(PadAxes::LeftStickX), left_axis_x);
|
callbacks.on_stick_data(static_cast<int>(PadAxes::LeftStickX), left_axis_x);
|
||||||
callbacks.on_stick_data(static_cast<int>(PadAxes::LeftStickY), left_axis_y);
|
callbacks.on_stick_data(static_cast<int>(PadAxes::LeftStickY), left_axis_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JoyconPoller::UpdatePasiveRightPadInput(const InputReportPassive& input) {
|
void JoyconPoller::UpdatePassiveRightPadInput(const InputReportPassive& input) {
|
||||||
static constexpr std::array<PasivePadButton, 11> right_buttons{
|
static constexpr std::array<PassivePadButton, 11> right_buttons{
|
||||||
PasivePadButton::Down_A, PasivePadButton::Right_X, PasivePadButton::Left_B,
|
PassivePadButton::Down_A, PassivePadButton::Right_X, PassivePadButton::Left_B,
|
||||||
PasivePadButton::Up_Y, PasivePadButton::SL, PasivePadButton::SR,
|
PassivePadButton::Up_Y, PassivePadButton::SL, PassivePadButton::SR,
|
||||||
PasivePadButton::L_R, PasivePadButton::ZL_ZR, PasivePadButton::Plus,
|
PassivePadButton::L_R, PassivePadButton::ZL_ZR, PassivePadButton::Plus,
|
||||||
PasivePadButton::Home, PasivePadButton::StickR,
|
PassivePadButton::Home, PassivePadButton::StickR,
|
||||||
};
|
};
|
||||||
|
|
||||||
for (auto right_button : right_buttons) {
|
for (auto right_button : right_buttons) {
|
||||||
|
@ -245,18 +245,18 @@ void JoyconPoller::UpdatePasiveRightPadInput(const InputReportPassive& input) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto [right_axis_x, right_axis_y] =
|
const auto [right_axis_x, right_axis_y] =
|
||||||
GetPassiveAxisValue(static_cast<PasivePadStick>(input.stick_state));
|
GetPassiveAxisValue(static_cast<PassivePadStick>(input.stick_state));
|
||||||
callbacks.on_stick_data(static_cast<int>(PadAxes::RightStickX), right_axis_x);
|
callbacks.on_stick_data(static_cast<int>(PadAxes::RightStickX), right_axis_x);
|
||||||
callbacks.on_stick_data(static_cast<int>(PadAxes::RightStickY), right_axis_y);
|
callbacks.on_stick_data(static_cast<int>(PadAxes::RightStickY), right_axis_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JoyconPoller::UpdatePasiveProPadInput(const InputReportPassive& input) {
|
void JoyconPoller::UpdatePassiveProPadInput(const InputReportPassive& input) {
|
||||||
static constexpr std::array<PasivePadButton, 14> pro_buttons{
|
static constexpr std::array<PassivePadButton, 14> pro_buttons{
|
||||||
PasivePadButton::Down_A, PasivePadButton::Right_X, PasivePadButton::Left_B,
|
PassivePadButton::Down_A, PassivePadButton::Right_X, PassivePadButton::Left_B,
|
||||||
PasivePadButton::Up_Y, PasivePadButton::SL, PasivePadButton::SR,
|
PassivePadButton::Up_Y, PassivePadButton::SL, PassivePadButton::SR,
|
||||||
PasivePadButton::L_R, PasivePadButton::ZL_ZR, PasivePadButton::Minus,
|
PassivePadButton::L_R, PassivePadButton::ZL_ZR, PassivePadButton::Minus,
|
||||||
PasivePadButton::Plus, PasivePadButton::Capture, PasivePadButton::Home,
|
PassivePadButton::Plus, PassivePadButton::Capture, PassivePadButton::Home,
|
||||||
PasivePadButton::StickL, PasivePadButton::StickR,
|
PassivePadButton::StickL, PassivePadButton::StickR,
|
||||||
};
|
};
|
||||||
|
|
||||||
for (auto pro_button : pro_buttons) {
|
for (auto pro_button : pro_buttons) {
|
||||||
|
@ -266,9 +266,9 @@ void JoyconPoller::UpdatePasiveProPadInput(const InputReportPassive& input) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto [left_axis_x, left_axis_y] =
|
const auto [left_axis_x, left_axis_y] =
|
||||||
GetPassiveAxisValue(static_cast<PasivePadStick>(input.stick_state && 0xf));
|
GetPassiveAxisValue(static_cast<PassivePadStick>(input.stick_state & 0xf));
|
||||||
const auto [right_axis_x, right_axis_y] =
|
const auto [right_axis_x, right_axis_y] =
|
||||||
GetPassiveAxisValue(static_cast<PasivePadStick>(input.stick_state >> 4));
|
GetPassiveAxisValue(static_cast<PassivePadStick>(input.stick_state >> 4));
|
||||||
callbacks.on_stick_data(static_cast<int>(PadAxes::LeftStickX), left_axis_x);
|
callbacks.on_stick_data(static_cast<int>(PadAxes::LeftStickX), left_axis_x);
|
||||||
callbacks.on_stick_data(static_cast<int>(PadAxes::LeftStickY), left_axis_y);
|
callbacks.on_stick_data(static_cast<int>(PadAxes::LeftStickY), left_axis_y);
|
||||||
callbacks.on_stick_data(static_cast<int>(PadAxes::RightStickX), right_axis_x);
|
callbacks.on_stick_data(static_cast<int>(PadAxes::RightStickX), right_axis_x);
|
||||||
|
@ -283,25 +283,25 @@ f32 JoyconPoller::GetAxisValue(u16 raw_value, Joycon::JoyStickAxisCalibration ca
|
||||||
return value / calibration.min;
|
return value / calibration.min;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<f32, f32> JoyconPoller::GetPassiveAxisValue(PasivePadStick raw_value) const {
|
std::pair<f32, f32> JoyconPoller::GetPassiveAxisValue(PassivePadStick raw_value) const {
|
||||||
switch (raw_value) {
|
switch (raw_value) {
|
||||||
case PasivePadStick::Right:
|
case PassivePadStick::Right:
|
||||||
return {1.0f, 0.0f};
|
return {1.0f, 0.0f};
|
||||||
case PasivePadStick::RightDown:
|
case PassivePadStick::RightDown:
|
||||||
return {1.0f, -1.0f};
|
return {1.0f, -1.0f};
|
||||||
case PasivePadStick::Down:
|
case PassivePadStick::Down:
|
||||||
return {0.0f, -1.0f};
|
return {0.0f, -1.0f};
|
||||||
case PasivePadStick::DownLeft:
|
case PassivePadStick::DownLeft:
|
||||||
return {-1.0f, -1.0f};
|
return {-1.0f, -1.0f};
|
||||||
case PasivePadStick::Left:
|
case PassivePadStick::Left:
|
||||||
return {-1.0f, 0.0f};
|
return {-1.0f, 0.0f};
|
||||||
case PasivePadStick::LeftUp:
|
case PassivePadStick::LeftUp:
|
||||||
return {-1.0f, 1.0f};
|
return {-1.0f, 1.0f};
|
||||||
case PasivePadStick::Up:
|
case PassivePadStick::Up:
|
||||||
return {0.0f, 1.0f};
|
return {0.0f, 1.0f};
|
||||||
case PasivePadStick::UpRight:
|
case PassivePadStick::UpRight:
|
||||||
return {1.0f, 1.0f};
|
return {1.0f, 1.0f};
|
||||||
case PasivePadStick::Neutral:
|
case PassivePadStick::Neutral:
|
||||||
default:
|
default:
|
||||||
return {0.0f, 0.0f};
|
return {0.0f, 0.0f};
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,15 +46,15 @@ private:
|
||||||
const MotionStatus& motion_status);
|
const MotionStatus& motion_status);
|
||||||
void UpdateActiveProPadInput(const InputReportActive& input, const MotionStatus& motion_status);
|
void UpdateActiveProPadInput(const InputReportActive& input, const MotionStatus& motion_status);
|
||||||
|
|
||||||
void UpdatePasiveLeftPadInput(const InputReportPassive& buffer);
|
void UpdatePassiveLeftPadInput(const InputReportPassive& buffer);
|
||||||
void UpdatePasiveRightPadInput(const InputReportPassive& buffer);
|
void UpdatePassiveRightPadInput(const InputReportPassive& buffer);
|
||||||
void UpdatePasiveProPadInput(const InputReportPassive& buffer);
|
void UpdatePassiveProPadInput(const InputReportPassive& buffer);
|
||||||
|
|
||||||
/// Returns a calibrated joystick axis from raw axis data
|
/// Returns a calibrated joystick axis from raw axis data
|
||||||
f32 GetAxisValue(u16 raw_value, JoyStickAxisCalibration calibration) const;
|
f32 GetAxisValue(u16 raw_value, JoyStickAxisCalibration calibration) const;
|
||||||
|
|
||||||
/// Returns a digital joystick axis from passive axis data
|
/// Returns a digital joystick axis from passive axis data
|
||||||
std::pair<f32, f32> GetPassiveAxisValue(PasivePadStick raw_value) const;
|
std::pair<f32, f32> GetPassiveAxisValue(PassivePadStick raw_value) const;
|
||||||
|
|
||||||
/// Returns a calibrated accelerometer axis from raw motion data
|
/// Returns a calibrated accelerometer axis from raw motion data
|
||||||
f32 GetAccelerometerValue(s16 raw, const MotionSensorCalibration& cal,
|
f32 GetAccelerometerValue(s16 raw, const MotionSensorCalibration& cal,
|
||||||
|
|
Loading…
Reference in New Issue