Modify DInput and touch analog to not clamp to a circle. Tries to fix #2316

This commit is contained in:
Henrik Rydgard 2013-06-19 20:46:36 +02:00
parent 61b510b753
commit fa335c83d3
2 changed files with 17 additions and 3 deletions

View File

@ -16,6 +16,8 @@
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include <limits.h>
#include <algorithm>
#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)

2
native

@ -1 +1 @@
Subproject commit 0e5cab2b0c2eb3fb1dac5bccc107e77697d65969
Subproject commit d1df63036a93139ca66615f143bc390659c689da