Some work towards better control handling, includes stickyfix from native

This commit is contained in:
Henrik Rydgard committed 2013-03-30 23:55:28 +01:00
1 parent 33abcdafd6
commit afa21588d7
15 files changed
+49 -31

No files matched your search

+24 -4
View File
@@ -1,3 +1,4 @@
#include "input/input_state.h"
#include "KeyboardDevice.h"
#include "../Common/CommonTypes.h"
#include "../Core/HLE/sceCtrl.h"
@@ -18,6 +19,21 @@ static const unsigned short key_ctrl_map[] = {
VK_RIGHT, CTRL_RIGHT,
};
static const unsigned short key_pad_map[] = {
VK_SPACE, PAD_BUTTON_START,
'V', PAD_BUTTON_SELECT,
'A', PAD_BUTTON_X,
'S', PAD_BUTTON_Y,
'X', PAD_BUTTON_B,
'Z', PAD_BUTTON_A,
'Q', PAD_BUTTON_LBUMPER,
'W', PAD_BUTTON_RBUMPER,
VK_UP, PAD_BUTTON_UP,
VK_DOWN, PAD_BUTTON_DOWN,
VK_LEFT, PAD_BUTTON_LEFT,
VK_RIGHT, PAD_BUTTON_RIGHT,
};
static const unsigned short analog_ctrl_map[] = {
'I', CTRL_UP,
'K', CTRL_DOWN,
@@ -25,7 +41,7 @@ static const unsigned short analog_ctrl_map[] = {
'L', CTRL_RIGHT,
};
int KeyboardDevice::UpdateState() {
int KeyboardDevice::UpdateState(InputState &input_state) {
bool alternate = GetAsyncKeyState(VK_SHIFT) != 0;
static u32 alternator = 0;
bool doAlternate = alternate && (alternator++ % 10) < 5;
@@ -33,9 +49,11 @@ int KeyboardDevice::UpdateState() {
for (int i = 0; i < sizeof(key_ctrl_map)/sizeof(key_ctrl_map[0]); i += 2) {
if (!GetAsyncKeyState(key_ctrl_map[i]) || doAlternate)
__CtrlButtonUp(key_ctrl_map[i+1]);
else {
else
__CtrlButtonDown(key_ctrl_map[i+1]);
}
//if (GetAsyncKeyState(key_pad_map[i]) && !doAlternate)
// input_state.pad_buttons |= key_pad_map[i+1];
}
float analogX = 0;
@@ -61,6 +79,8 @@ int KeyboardDevice::UpdateState() {
}
}
__CtrlSetAnalog(analogX, analogY);
// __CtrlSetAnalog(analogX, analogY);
input_state.pad_lstick_x = analogX;
input_state.pad_lstick_y = analogY;
return 0;
}