diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/emulation/overlay/InputOverlayDrawableJoystick.java b/Source/Android/src/org/dolphinemu/dolphinemu/emulation/overlay/InputOverlayDrawableJoystick.java index 791e5812e9..4f4e7d669b 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/emulation/overlay/InputOverlayDrawableJoystick.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/emulation/overlay/InputOverlayDrawableJoystick.java @@ -103,14 +103,10 @@ public final class InputOverlayDrawableJoystick extends BitmapDrawable public float[] getAxisValues() { float[] joyaxises = {0f, 0f, 0f, 0f}; - if (axises[0] >= 0.0f) - joyaxises[1] = Math.min(axises[0], 1.0f); - else - joyaxises[0] = Math.min(Math.abs(axises[0]), 1.0f); - if (axises[1] >= 0.0) - joyaxises[3] = Math.min(axises[1], 1.0f); - else - joyaxises[2] = Math.min(Math.abs(axises[1]), 1.0f); + joyaxises[1] = Math.min(axises[0], 1.0f); + joyaxises[0] = Math.min(axises[0], 0.0f); + joyaxises[3] = Math.min(axises[1], 1.0f); + joyaxises[2] = Math.min(axises[1], 0.0f); return joyaxises; } diff --git a/Source/Core/DolphinWX/Src/Android/ButtonManager.cpp b/Source/Core/DolphinWX/Src/Android/ButtonManager.cpp index 8ab83a3346..f3127678fa 100644 --- a/Source/Core/DolphinWX/Src/Android/ButtonManager.cpp +++ b/Source/Core/DolphinWX/Src/Android/ButtonManager.cpp @@ -140,7 +140,7 @@ namespace ButtonManager auto it = m_controllers.begin(); if (it == m_controllers.end()) return value; - return it->second->AxisValue(padID, axis); + return value != 0.0f ? value : it->second->AxisValue(padID, axis); } void TouchEvent(int padID, ButtonType button, int action) { diff --git a/Source/Core/InputCommon/Src/ControllerInterface/Android/Android.cpp b/Source/Core/InputCommon/Src/ControllerInterface/Android/Android.cpp index ec7a7a2a56..5213b196d1 100644 --- a/Source/Core/InputCommon/Src/ControllerInterface/Android/Android.cpp +++ b/Source/Core/InputCommon/Src/ControllerInterface/Android/Android.cpp @@ -59,10 +59,10 @@ Touchscreen::Touchscreen(int padID) AddInput(new Button(_padID, ButtonManager::BUTTON_DOWN)); AddInput(new Button(_padID, ButtonManager::BUTTON_LEFT)); AddInput(new Button(_padID, ButtonManager::BUTTON_RIGHT)); - AddAnalogInputs(new Axis(_padID, ButtonManager::STICK_MAIN_LEFT), new Axis(_padID, ButtonManager::STICK_MAIN_RIGHT)); - AddAnalogInputs(new Axis(_padID, ButtonManager::STICK_MAIN_UP), new Axis(_padID, ButtonManager::STICK_MAIN_DOWN)); - AddAnalogInputs(new Axis(_padID, ButtonManager::STICK_C_UP), new Axis(_padID, ButtonManager::STICK_C_DOWN)); - AddAnalogInputs(new Axis(_padID, ButtonManager::STICK_C_LEFT), new Axis(_padID, ButtonManager::STICK_C_RIGHT)); + AddAnalogInputs(new Axis(_padID, ButtonManager::STICK_MAIN_LEFT, -1.0f), new Axis(_padID, ButtonManager::STICK_MAIN_RIGHT)); + AddAnalogInputs(new Axis(_padID, ButtonManager::STICK_MAIN_UP, -1.0f), new Axis(_padID, ButtonManager::STICK_MAIN_DOWN)); + AddAnalogInputs(new Axis(_padID, ButtonManager::STICK_C_UP, -1.0f), new Axis(_padID, ButtonManager::STICK_C_DOWN)); + AddAnalogInputs(new Axis(_padID, ButtonManager::STICK_C_LEFT, -1.0f), new Axis(_padID, ButtonManager::STICK_C_RIGHT)); AddAnalogInputs(new Axis(_padID, ButtonManager::TRIGGER_L), new Axis(_padID, ButtonManager::TRIGGER_L)); AddAnalogInputs(new Axis(_padID, ButtonManager::TRIGGER_R), new Axis(_padID, ButtonManager::TRIGGER_R)); } @@ -88,7 +88,7 @@ std::string Touchscreen::Axis::GetName() const ControlState Touchscreen::Axis::GetState() const { - return ButtonManager::GetAxisValue(_padID, _index); + return ButtonManager::GetAxisValue(_padID, _index) * _neg; } } diff --git a/Source/Core/InputCommon/Src/ControllerInterface/Android/Android.h b/Source/Core/InputCommon/Src/ControllerInterface/Android/Android.h index 8b1fd99c23..93e528f013 100644 --- a/Source/Core/InputCommon/Src/ControllerInterface/Android/Android.h +++ b/Source/Core/InputCommon/Src/ControllerInterface/Android/Android.h @@ -43,11 +43,12 @@ private: { public: std::string GetName() const; - Axis(int padID, ButtonManager::ButtonType index) : _padID(padID), _index(index) {} + Axis(int padID, ButtonManager::ButtonType index, float neg = 1.0f) : _padID(padID), _index(index), _neg(neg) {} ControlState GetState() const; private: const int _padID; const ButtonManager::ButtonType _index; + const float _neg; }; public: