diff options
-rw-r--r-- | src/core/hle/service/hid/controllers/npad.cpp | 10 | ||||
-rwxr-xr-x | src/input_common/analog_from_button.cpp | 14 |
2 files changed, 19 insertions, 5 deletions
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index 15c09f04c..c1e32b28c 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp @@ -287,13 +287,13 @@ void Controller_NPad::RequestPadStateUpdate(u32 npad_id) { analog_state[static_cast<std::size_t>(JoystickId::Joystick_Left)]->GetAnalogDirectionStatus( Input::AnalogDirection::DOWN)); - pad_state.r_stick_up.Assign(analog_state[static_cast<std::size_t>(JoystickId::Joystick_Right)] - ->GetAnalogDirectionStatus(Input::AnalogDirection::RIGHT)); - pad_state.r_stick_left.Assign(analog_state[static_cast<std::size_t>(JoystickId::Joystick_Right)] - ->GetAnalogDirectionStatus(Input::AnalogDirection::LEFT)); pad_state.r_stick_right.Assign( analog_state[static_cast<std::size_t>(JoystickId::Joystick_Right)] - ->GetAnalogDirectionStatus(Input::AnalogDirection::UP)); + ->GetAnalogDirectionStatus(Input::AnalogDirection::RIGHT)); + pad_state.r_stick_left.Assign(analog_state[static_cast<std::size_t>(JoystickId::Joystick_Right)] + ->GetAnalogDirectionStatus(Input::AnalogDirection::LEFT)); + pad_state.r_stick_up.Assign(analog_state[static_cast<std::size_t>(JoystickId::Joystick_Right)] + ->GetAnalogDirectionStatus(Input::AnalogDirection::UP)); pad_state.r_stick_down.Assign(analog_state[static_cast<std::size_t>(JoystickId::Joystick_Right)] ->GetAnalogDirectionStatus(Input::AnalogDirection::DOWN)); diff --git a/src/input_common/analog_from_button.cpp b/src/input_common/analog_from_button.cpp index e1a260762..6cabdaa3c 100755 --- a/src/input_common/analog_from_button.cpp +++ b/src/input_common/analog_from_button.cpp @@ -34,6 +34,20 @@ public: y * coef * (x == 0 ? 1.0f : SQRT_HALF)); } + bool GetAnalogDirectionStatus(Input::AnalogDirection direction) const override { + switch (direction) { + case Input::AnalogDirection::RIGHT: + return right->GetStatus(); + case Input::AnalogDirection::LEFT: + return left->GetStatus(); + case Input::AnalogDirection::UP: + return up->GetStatus(); + case Input::AnalogDirection::DOWN: + return down->GetStatus(); + } + return false; + } + private: Button up; Button down; |