diff options
| author | bunnei <bunneidev@gmail.com> | 2022-04-21 22:21:59 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-21 22:21:59 -0700 |
| commit | e72179e9fd61113d31d7b446c7c6c04d0e8bcdde (patch) | |
| tree | ee42eede68cb935595769104e0b94d55b1530141 /src/input_common/drivers/gc_adapter.cpp | |
| parent | c0f328e7d45d0cb060414e92772a309361937cc7 (diff) | |
| parent | f27e097244516f8f66aa5ee87979eb6eabadb0af (diff) | |
Merge pull request #7978 from german77/sideway
input_common: Map sticks correctly when mapped sideways
Diffstat (limited to 'src/input_common/drivers/gc_adapter.cpp')
| -rw-r--r-- | src/input_common/drivers/gc_adapter.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/input_common/drivers/gc_adapter.cpp b/src/input_common/drivers/gc_adapter.cpp index 155caae424..8abd41726e 100644 --- a/src/input_common/drivers/gc_adapter.cpp +++ b/src/input_common/drivers/gc_adapter.cpp @@ -524,4 +524,20 @@ Common::Input::ButtonNames GCAdapter::GetUIName(const Common::ParamPackage& para return Common::Input::ButtonNames::Invalid; } +bool GCAdapter::IsStickInverted(const Common::ParamPackage& params) { + if (!params.Has("port")) { + return false; + } + + const auto x_axis = static_cast<PadAxes>(params.Get("axis_x", 0)); + const auto y_axis = static_cast<PadAxes>(params.Get("axis_y", 0)); + if (x_axis != PadAxes::StickY && x_axis != PadAxes::SubstickY) { + return false; + } + if (y_axis != PadAxes::StickX && y_axis != PadAxes::SubstickX) { + return false; + } + return true; +} + } // namespace InputCommon |
