diff options
author | german77 <juangerman-13@hotmail.com> | 2021-11-21 12:59:51 -0600 |
---|---|---|
committer | Narr the Reg <juangerman-13@hotmail.com> | 2021-11-24 20:30:28 -0600 |
commit | c4760489a0386cdeaed68ecbed7f87532193743e (patch) | |
tree | 2ac91b9c1c6bb0bb70fe7bcf148b2469e96e7247 /src/input_common/input_poller.cpp | |
parent | 922aa9410a78ef9d6fd5b5d4455375d512333239 (diff) |
input_common: Fix SDL controller with inverted axis
Diffstat (limited to 'src/input_common/input_poller.cpp')
-rw-r--r-- | src/input_common/input_poller.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/input_common/input_poller.cpp b/src/input_common/input_poller.cpp index 92cf690cd..7e4eafded 100644 --- a/src/input_common/input_poller.cpp +++ b/src/input_common/input_poller.cpp @@ -146,7 +146,8 @@ public: Common::Input::AnalogProperties properties_y_, InputEngine* input_engine_) : identifier(identifier_), axis_x(axis_x_), axis_y(axis_y_), properties_x(properties_x_), - properties_y(properties_y_), input_engine(input_engine_) { + properties_y(properties_y_), + input_engine(input_engine_), invert_axis_y{input_engine_->GetEngineName() == "sdl"} { UpdateCallback engine_callback{[this]() { OnChange(); }}; const InputIdentifier x_input_identifier{ .identifier = identifier, @@ -181,6 +182,11 @@ public: .raw_value = input_engine->GetAxis(identifier, axis_y), .properties = properties_y, }; + // This is a workaround too keep compatibility with old yuzu versions. Vertical axis is + // inverted on SDL compared to Nintendo + if (invert_axis_y) { + status.y.raw_value = -status.y.raw_value; + } return status; } @@ -220,6 +226,7 @@ private: float last_axis_x_value; float last_axis_y_value; InputEngine* input_engine; + const bool invert_axis_y; }; class InputFromTouch final : public Common::Input::InputDevice { |