diff --git a/Windows/DinputDevice.cpp b/Windows/DinputDevice.cpp index 14bed98fc4..f39e0d3bb1 100644 --- a/Windows/DinputDevice.cpp +++ b/Windows/DinputDevice.cpp @@ -16,6 +16,8 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include +#include + #include "Core/HLE/sceCtrl.h" #include "DinputDevice.h" #include "ControlMapping.h" @@ -25,6 +27,11 @@ #include "Xinput.h" #pragma comment(lib,"dinput8.lib") +#ifdef min +#undef min +#undef max +#endif + unsigned int dinput_ctrl_map[] = { 11, PAD_BUTTON_MENU, // Open PauseScreen 10, PAD_BUTTON_BACK, // Toggle PauseScreen & Back Setting Page @@ -183,8 +190,15 @@ int DinputDevice::UpdateState(InputState &input_state) if (analog) { - input_state.pad_lstick_x += (float)js.lX / 10000.f; - input_state.pad_lstick_y += -((float)js.lY / 10000.f); + float x = (float)js.lX / 10000.f; + float y = -((float)js.lY / 10000.f); + + // Expand and clamp. Hack to let us reach the corners on most pads. + x = std::min(1.0f, std::max(-1.0f, x * 1.2f)); + y = std::min(1.0f, std::max(-1.0f, y * 1.2f)); + + input_state.pad_lstick_x += x; + input_state.pad_lstick_y += y; } for (u8 i = 0; i < sizeof(dinput_ctrl_map)/sizeof(dinput_ctrl_map[0]); i += 2) diff --git a/native b/native index 0e5cab2b0c..d1df63036a 160000 --- a/native +++ b/native @@ -1 +1 @@ -Subproject commit 0e5cab2b0c2eb3fb1dac5bccc107e77697d65969 +Subproject commit d1df63036a93139ca66615f143bc390659c689da