mirror of https://github.com/PCSX2/pcsx2.git
commit
3ea98b0c00
|
@ -50,30 +50,31 @@ Display Name=XInput Pad 0
|
||||||
Instance ID=XInput Pad 0
|
Instance ID=XInput Pad 0
|
||||||
API=4
|
API=4
|
||||||
Type=3
|
Type=3
|
||||||
Binding 0=0x00040000, 0, 20, 65536, 0, 0, 0
|
Binding 0=0x00200000, 0, 20, 65536, 0, 0, 1
|
||||||
Binding 1=0x00040001, 0, 22, 65536, 0, 0, 0
|
Binding 1=0x00200001, 0, 22, 65536, 0, 0, 1
|
||||||
Binding 2=0x00040002, 0, 23, 65536, 0, 0, 0
|
Binding 2=0x00200002, 0, 23, 65536, 0, 0, 1
|
||||||
Binding 3=0x00040003, 0, 21, 65536, 0, 0, 0
|
Binding 3=0x00200003, 0, 21, 65536, 0, 0, 1
|
||||||
Binding 4=0x00040004, 0, 19, 65536, 0, 0, 0
|
Binding 4=0x00200004, 0, 19, 65536, 0, 0, 1
|
||||||
Binding 5=0x00040005, 0, 16, 65536, 0, 0, 0
|
Binding 5=0x00200005, 0, 16, 65536, 0, 0, 1
|
||||||
Binding 6=0x00040006, 0, 17, 65536, 0, 0, 0
|
Binding 6=0x00200006, 0, 17, 65536, 0, 0, 1
|
||||||
Binding 7=0x00040007, 0, 18, 65536, 0, 0, 0
|
Binding 7=0x00200007, 0, 18, 65536, 0, 0, 1
|
||||||
Binding 8=0x00040008, 0, 26, 65536, 0, 0, 0
|
Binding 8=0x00200008, 0, 26, 65536, 0, 0, 1
|
||||||
Binding 9=0x00040009, 0, 27, 65536, 0, 0, 0
|
Binding 9=0x00200009, 0, 27, 65536, 0, 0, 1
|
||||||
Binding 10=0x0004000C, 0, 30, 65536, 0, 0, 0
|
Binding 10=0x0020000A, 0, 40, 65536, 0, 0, 1
|
||||||
Binding 11=0x0004000D, 0, 29, 65536, 0, 0, 0
|
Binding 11=0x0020000C, 0, 30, 65536, 0, 0, 1
|
||||||
Binding 12=0x0004000E, 0, 31, 65536, 0, 0, 0
|
Binding 12=0x0020000D, 0, 29, 65536, 0, 0, 1
|
||||||
Binding 13=0x0004000F, 0, 28, 65536, 0, 0, 0
|
Binding 13=0x0020000E, 0, 31, 65536, 0, 0, 1
|
||||||
Binding 14=0x00200010, 0, 24, 65536, 0, 0, 1
|
Binding 14=0x0020000F, 0, 28, 65536, 0, 0, 1
|
||||||
Binding 15=0x00200011, 0, 25, 65536, 0, 0, 1
|
Binding 15=0x00200010, 0, 24, 65536, 0, 0, 1
|
||||||
Binding 16=0x01020012, 0, 33, 87183, 0, 0, 13172
|
Binding 16=0x00200011, 0, 25, 65536, 0, 0, 1
|
||||||
Binding 17=0x02020012, 0, 35, 87183, 0, 0, 13172
|
Binding 17=0x01020013, 0, 33, 87183, 0, 0, 13172
|
||||||
Binding 18=0x01020013, 0, 32, 87183, 0, 0, 13172
|
Binding 18=0x02020013, 0, 35, 87183, 0, 0, 13172
|
||||||
Binding 19=0x02020013, 0, 34, 87183, 0, 0, 13172
|
Binding 19=0x01020014, 0, 32, 87183, 0, 0, 13172
|
||||||
Binding 20=0x01020014, 0, 37, 87183, 0, 0, 13172
|
Binding 20=0x02020014, 0, 34, 87183, 0, 0, 13172
|
||||||
Binding 21=0x02020014, 0, 39, 87183, 0, 0, 13172
|
Binding 21=0x01020015, 0, 37, 87183, 0, 0, 13172
|
||||||
Binding 22=0x01020015, 0, 36, 87183, 0, 0, 13172
|
Binding 22=0x02020015, 0, 39, 87183, 0, 0, 13172
|
||||||
Binding 23=0x02020015, 0, 38, 87183, 0, 0, 13172
|
Binding 23=0x01020016, 0, 36, 87183, 0, 0, 13172
|
||||||
|
Binding 24=0x02020016, 0, 38, 87183, 0, 0, 13172
|
||||||
FF Binding 0=Constant 0, 0, 0, 0, 65536, 1, 0
|
FF Binding 0=Constant 0, 0, 0, 0, 65536, 1, 0
|
||||||
FF Binding 1=Constant 0, 1, 0, 0, 0, 1, 65536
|
FF Binding 1=Constant 0, 1, 0, 0, 0, 1, 65536
|
||||||
[Device 1]
|
[Device 1]
|
||||||
|
@ -81,30 +82,31 @@ Display Name=XInput Pad 1
|
||||||
Instance ID=XInput Pad 1
|
Instance ID=XInput Pad 1
|
||||||
API=4
|
API=4
|
||||||
Type=3
|
Type=3
|
||||||
Binding 0=0x00040000, 1, 20, 65536, 0, 0, 0
|
Binding 0=0x00200000, 1, 20, 65536, 0, 0, 1
|
||||||
Binding 1=0x00040001, 1, 22, 65536, 0, 0, 0
|
Binding 1=0x00200001, 1, 22, 65536, 0, 0, 1
|
||||||
Binding 2=0x00040002, 1, 23, 65536, 0, 0, 0
|
Binding 2=0x00200002, 1, 23, 65536, 0, 0, 1
|
||||||
Binding 3=0x00040003, 1, 21, 65536, 0, 0, 0
|
Binding 3=0x00200003, 1, 21, 65536, 0, 0, 1
|
||||||
Binding 4=0x00040004, 1, 19, 65536, 0, 0, 0
|
Binding 4=0x00200004, 1, 19, 65536, 0, 0, 1
|
||||||
Binding 5=0x00040005, 1, 16, 65536, 0, 0, 0
|
Binding 5=0x00200005, 1, 16, 65536, 0, 0, 1
|
||||||
Binding 6=0x00040006, 1, 17, 65536, 0, 0, 0
|
Binding 6=0x00200006, 1, 17, 65536, 0, 0, 1
|
||||||
Binding 7=0x00040007, 1, 18, 65536, 0, 0, 0
|
Binding 7=0x00200007, 1, 18, 65536, 0, 0, 1
|
||||||
Binding 8=0x00040008, 1, 26, 65536, 0, 0, 0
|
Binding 8=0x00200008, 1, 26, 65536, 0, 0, 1
|
||||||
Binding 9=0x00040009, 1, 27, 65536, 0, 0, 0
|
Binding 9=0x00200009, 1, 27, 65536, 0, 0, 1
|
||||||
Binding 10=0x0004000C, 1, 30, 65536, 0, 0, 0
|
Binding 10=0x0020000A, 1, 40, 65536, 0, 0, 1
|
||||||
Binding 11=0x0004000D, 1, 29, 65536, 0, 0, 0
|
Binding 11=0x0020000C, 1, 30, 65536, 0, 0, 1
|
||||||
Binding 12=0x0004000E, 1, 31, 65536, 0, 0, 0
|
Binding 12=0x0020000D, 1, 29, 65536, 0, 0, 1
|
||||||
Binding 13=0x0004000F, 1, 28, 65536, 0, 0, 0
|
Binding 13=0x0020000E, 1, 31, 65536, 0, 0, 1
|
||||||
Binding 14=0x00200010, 1, 24, 65536, 0, 0, 1
|
Binding 14=0x0020000F, 1, 28, 65536, 0, 0, 1
|
||||||
Binding 15=0x00200011, 1, 25, 65536, 0, 0, 1
|
Binding 15=0x00200010, 1, 24, 65536, 0, 0, 1
|
||||||
Binding 16=0x01020012, 1, 33, 87183, 0, 0, 13172
|
Binding 16=0x00200011, 1, 25, 65536, 0, 0, 1
|
||||||
Binding 17=0x02020012, 1, 35, 87183, 0, 0, 13172
|
Binding 17=0x01020013, 1, 33, 87183, 0, 0, 13172
|
||||||
Binding 18=0x01020013, 1, 32, 87183, 0, 0, 13172
|
Binding 18=0x02020013, 1, 35, 87183, 0, 0, 13172
|
||||||
Binding 19=0x02020013, 1, 34, 87183, 0, 0, 13172
|
Binding 19=0x01020014, 1, 32, 87183, 0, 0, 13172
|
||||||
Binding 20=0x01020014, 1, 37, 87183, 0, 0, 13172
|
Binding 20=0x02020014, 1, 34, 87183, 0, 0, 13172
|
||||||
Binding 21=0x02020014, 1, 39, 87183, 0, 0, 13172
|
Binding 21=0x01020015, 1, 37, 87183, 0, 0, 13172
|
||||||
Binding 22=0x01020015, 1, 36, 87183, 0, 0, 13172
|
Binding 22=0x02020015, 1, 39, 87183, 0, 0, 13172
|
||||||
Binding 23=0x02020015, 1, 38, 87183, 0, 0, 13172
|
Binding 23=0x01020016, 1, 36, 87183, 0, 0, 13172
|
||||||
|
Binding 24=0x02020016, 1, 38, 87183, 0, 0, 13172
|
||||||
FF Binding 0=Constant 1, 0, 0, 0, 65536, 1, 0
|
FF Binding 0=Constant 1, 0, 0, 0, 65536, 1, 0
|
||||||
FF Binding 1=Constant 1, 1, 0, 0, 0, 1, 65536
|
FF Binding 1=Constant 1, 1, 0, 0, 0, 1, 65536
|
||||||
[Device 12]
|
[Device 12]
|
||||||
|
|
|
@ -419,8 +419,8 @@ Device *InputDeviceManager::GetActiveDevice(InitInfo *info, unsigned int *uid, i
|
||||||
if (((devices[i]->virtualControls[j].uid>>16) & 0xFF) == RELAXIS) {
|
if (((devices[i]->virtualControls[j].uid>>16) & 0xFF) == RELAXIS) {
|
||||||
diff = diff/4+1;
|
diff = diff/4+1;
|
||||||
}
|
}
|
||||||
// Less pressure needed to bind DS3 buttons.
|
// Less pressure needed to bind DS3/SCP buttons.
|
||||||
if (devices[i]->api == DS3 && (((devices[i]->virtualControls[j].uid>>16) & 0xFF) & BUTTON)) {
|
if ((devices[i]->api == DS3 || devices[i]->api == XINPUT) && (((devices[i]->virtualControls[j].uid>>16) & 0xFF) & BUTTON)) {
|
||||||
diff *= 4;
|
diff *= 4;
|
||||||
}
|
}
|
||||||
if (diff > bestDiff) {
|
if (diff > bestDiff) {
|
||||||
|
|
|
@ -21,13 +21,52 @@
|
||||||
#include "InputManager.h"
|
#include "InputManager.h"
|
||||||
#include "XInputEnum.h"
|
#include "XInputEnum.h"
|
||||||
|
|
||||||
|
// Extra enum
|
||||||
|
#define XINPUT_GAMEPAD_GUIDE 0x0400
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
float SCP_UP;
|
||||||
|
float SCP_RIGHT;
|
||||||
|
float SCP_DOWN;
|
||||||
|
float SCP_LEFT;
|
||||||
|
|
||||||
|
float SCP_LX;
|
||||||
|
float SCP_LY;
|
||||||
|
|
||||||
|
float SCP_L1;
|
||||||
|
float SCP_L2;
|
||||||
|
float SCP_L3;
|
||||||
|
|
||||||
|
float SCP_RX;
|
||||||
|
float SCP_RY;
|
||||||
|
|
||||||
|
float SCP_R1;
|
||||||
|
float SCP_R2;
|
||||||
|
float SCP_R3;
|
||||||
|
|
||||||
|
float SCP_T;
|
||||||
|
float SCP_C;
|
||||||
|
float SCP_X;
|
||||||
|
float SCP_S;
|
||||||
|
|
||||||
|
float SCP_SELECT;
|
||||||
|
float SCP_START;
|
||||||
|
|
||||||
|
float SCP_PS;
|
||||||
|
|
||||||
|
} SCP_EXTN;
|
||||||
|
|
||||||
|
|
||||||
// This way, I don't require that XInput junk be installed.
|
// This way, I don't require that XInput junk be installed.
|
||||||
typedef void (CALLBACK *_XInputEnable)(BOOL enable);
|
typedef void(CALLBACK *_XInputEnable)(BOOL enable);
|
||||||
typedef DWORD (CALLBACK *_XInputGetState)(DWORD dwUserIndex, XINPUT_STATE* pState);
|
typedef DWORD(CALLBACK *_XInputGetStateEx)(DWORD dwUserIndex, XINPUT_STATE* pState);
|
||||||
typedef DWORD (CALLBACK *_XInputSetState)(DWORD dwUserIndex, XINPUT_VIBRATION* pVibration);
|
typedef DWORD(CALLBACK *_XInputGetExtended)(DWORD dwUserIndex, SCP_EXTN* pPressure);
|
||||||
|
typedef DWORD(CALLBACK *_XInputSetState)(DWORD dwUserIndex, XINPUT_VIBRATION* pVibration);
|
||||||
|
|
||||||
_XInputEnable pXInputEnable = 0;
|
_XInputEnable pXInputEnable = 0;
|
||||||
_XInputGetState pXInputGetState = 0;
|
_XInputGetStateEx pXInputGetStateEx = 0;
|
||||||
|
_XInputGetExtended pXInputGetExtended = 0;
|
||||||
_XInputSetState pXInputSetState = 0;
|
_XInputSetState pXInputSetState = 0;
|
||||||
|
|
||||||
static int xInputActiveCount = 0;
|
static int xInputActiveCount = 0;
|
||||||
|
@ -55,15 +94,10 @@ public:
|
||||||
memset(&xInputVibration, 0, sizeof(xInputVibration));
|
memset(&xInputVibration, 0, sizeof(xInputVibration));
|
||||||
this->index = index;
|
this->index = index;
|
||||||
int i;
|
int i;
|
||||||
for (i=0; i<14; i++) {
|
for (i=0; i<17; i++) { // Skip empty bit
|
||||||
// The i > 9 accounts for the 2 bit skip in button flags.
|
AddPhysicalControl(PRESSURE_BTN, i + (i > 10), 0);
|
||||||
AddPhysicalControl(PSHBTN, i + 2*(i > 9), 0);
|
|
||||||
}
|
}
|
||||||
for (i=14; i<16; i++) {
|
for (; i<21; i++) {
|
||||||
// The i > 9 accounts for the 2 bit skip in button flags.
|
|
||||||
AddPhysicalControl(PRESSURE_BTN, i + 2*(i > 9), 0);
|
|
||||||
}
|
|
||||||
for (; i<20; i++) {
|
|
||||||
AddPhysicalControl(ABSAXIS, i + 2, 0);
|
AddPhysicalControl(ABSAXIS, i + 2, 0);
|
||||||
}
|
}
|
||||||
AddFFAxis(L"Slow Motor", 0);
|
AddFFAxis(L"Slow Motor", 0);
|
||||||
|
@ -83,6 +117,7 @@ public:
|
||||||
L"Right Thumb",
|
L"Right Thumb",
|
||||||
L"Left Shoulder",
|
L"Left Shoulder",
|
||||||
L"Right Shoulder",
|
L"Right Shoulder",
|
||||||
|
L"Guide",
|
||||||
L"A",
|
L"A",
|
||||||
L"B",
|
L"B",
|
||||||
L"X",
|
L"X",
|
||||||
|
@ -95,7 +130,7 @@ public:
|
||||||
L"Right Thumb Y",
|
L"Right Thumb Y",
|
||||||
};
|
};
|
||||||
unsigned int i = (unsigned int) (c - physicalControls);
|
unsigned int i = (unsigned int) (c - physicalControls);
|
||||||
if (i < 20) {
|
if (i < 21) {
|
||||||
return (wchar_t*)names[i];
|
return (wchar_t*)names[i];
|
||||||
}
|
}
|
||||||
return Device::GetPhysicalControlName(c);
|
return Device::GetPhysicalControlName(c);
|
||||||
|
@ -115,20 +150,45 @@ public:
|
||||||
int Update() {
|
int Update() {
|
||||||
if (!active) return 0;
|
if (!active) return 0;
|
||||||
XINPUT_STATE state;
|
XINPUT_STATE state;
|
||||||
if (ERROR_SUCCESS != pXInputGetState(index, &state)) {
|
if (ERROR_SUCCESS != pXInputGetStateEx(index, &state)) {
|
||||||
Deactivate();
|
Deactivate();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
SCP_EXTN pressure;
|
||||||
|
if (!pXInputGetExtended || (ERROR_SUCCESS != pXInputGetExtended(index, &pressure))) {
|
||||||
int buttons = state.Gamepad.wButtons;
|
int buttons = state.Gamepad.wButtons;
|
||||||
for (int i=0; i<14; i++) {
|
for (int i = 0; i < 15; i++) {
|
||||||
physicalControlState[i] = ((buttons >> physicalControls[i].id)&1)<<16;
|
physicalControlState[i] = ((buttons >> physicalControls[i].id) & 1) << 16;
|
||||||
|
}
|
||||||
|
physicalControlState[15] = (int)(state.Gamepad.bLeftTrigger * 257.005);
|
||||||
|
physicalControlState[16] = (int)(state.Gamepad.bRightTrigger * 257.005);
|
||||||
|
physicalControlState[17] = ShortToAxis(state.Gamepad.sThumbLX);
|
||||||
|
physicalControlState[18] = ShortToAxis(state.Gamepad.sThumbLY);
|
||||||
|
physicalControlState[19] = ShortToAxis(state.Gamepad.sThumbRX);
|
||||||
|
physicalControlState[20] = ShortToAxis(state.Gamepad.sThumbRY);
|
||||||
|
} else {
|
||||||
|
physicalControlState[0] = (int)(pressure.SCP_UP * FULLY_DOWN);
|
||||||
|
physicalControlState[1] = (int)(pressure.SCP_DOWN * FULLY_DOWN);
|
||||||
|
physicalControlState[2] = (int)(pressure.SCP_LEFT * FULLY_DOWN);
|
||||||
|
physicalControlState[3] = (int)(pressure.SCP_RIGHT * FULLY_DOWN);
|
||||||
|
physicalControlState[4] = (int)(pressure.SCP_START * FULLY_DOWN);
|
||||||
|
physicalControlState[5] = (int)(pressure.SCP_SELECT * FULLY_DOWN);
|
||||||
|
physicalControlState[6] = (int)(pressure.SCP_L3 * FULLY_DOWN);
|
||||||
|
physicalControlState[7] = (int)(pressure.SCP_R3 * FULLY_DOWN);
|
||||||
|
physicalControlState[8] = (int)(pressure.SCP_L1 * FULLY_DOWN);
|
||||||
|
physicalControlState[9] = (int)(pressure.SCP_R1 * FULLY_DOWN);
|
||||||
|
physicalControlState[10] = (int)(pressure.SCP_PS * FULLY_DOWN);
|
||||||
|
physicalControlState[11] = (int)(pressure.SCP_X * FULLY_DOWN);
|
||||||
|
physicalControlState[12] = (int)(pressure.SCP_C * FULLY_DOWN);
|
||||||
|
physicalControlState[13] = (int)(pressure.SCP_S * FULLY_DOWN);
|
||||||
|
physicalControlState[14] = (int)(pressure.SCP_T * FULLY_DOWN);
|
||||||
|
physicalControlState[15] = (int)(pressure.SCP_L2 * FULLY_DOWN);
|
||||||
|
physicalControlState[16] = (int)(pressure.SCP_R2 * FULLY_DOWN);
|
||||||
|
physicalControlState[17] = (int)(pressure.SCP_LX * FULLY_DOWN);
|
||||||
|
physicalControlState[18] = (int)(pressure.SCP_LY * FULLY_DOWN);
|
||||||
|
physicalControlState[19] = (int)(pressure.SCP_RX * FULLY_DOWN);
|
||||||
|
physicalControlState[20] = (int)(pressure.SCP_RY * FULLY_DOWN);
|
||||||
}
|
}
|
||||||
physicalControlState[14] = (((int)state.Gamepad.bLeftTrigger) + (state.Gamepad.bLeftTrigger>>7)) << 8;
|
|
||||||
physicalControlState[15] = (((int)state.Gamepad.bRightTrigger) + (state.Gamepad.bRightTrigger>>7)) << 8;
|
|
||||||
physicalControlState[16] = ShortToAxis(state.Gamepad.sThumbLX);
|
|
||||||
physicalControlState[17] = ShortToAxis(state.Gamepad.sThumbLY);
|
|
||||||
physicalControlState[18] = ShortToAxis(state.Gamepad.sThumbRX);
|
|
||||||
physicalControlState[19] = ShortToAxis(state.Gamepad.sThumbRY);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,7 +262,9 @@ void EnumXInputDevices() {
|
||||||
}
|
}
|
||||||
if (hMod) {
|
if (hMod) {
|
||||||
if ((pXInputEnable = (_XInputEnable) GetProcAddress(hMod, "XInputEnable")) &&
|
if ((pXInputEnable = (_XInputEnable) GetProcAddress(hMod, "XInputEnable")) &&
|
||||||
(pXInputGetState = (_XInputGetState) GetProcAddress(hMod, "XInputGetState"))) {
|
((pXInputGetStateEx = (_XInputGetStateEx) GetProcAddress(hMod, (LPCSTR)100)) || // Try Ex version first
|
||||||
|
(pXInputGetStateEx = (_XInputGetStateEx) GetProcAddress(hMod, "XinputGetState")))) {
|
||||||
|
pXInputGetExtended = (_XInputGetExtended)GetProcAddress(hMod, "XInputGetExtended");
|
||||||
pXInputSetState = (_XInputSetState) GetProcAddress(hMod, "XInputSetState");
|
pXInputSetState = (_XInputSetState) GetProcAddress(hMod, "XInputSetState");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue