Fix missing slider joystick handling on Windows
(cherry picked from commit aa01b327d6
)
This commit is contained in:
parent
cdbbc75e90
commit
70fb79efa0
|
@ -179,6 +179,7 @@ bool JoypadWindows::setup_dinput_joypad(const DIDEVICEINSTANCE *instance) {
|
|||
sprintf_s(uid, "%04x%04x%04x%04x%04x%04x%04x%04x", type, 0, vendor, 0, product, 0, version, 0);
|
||||
|
||||
id_to_change = joypad_count;
|
||||
slider_count = 0;
|
||||
|
||||
joy->di_joy->SetDataFormat(&c_dfDIJoystick2);
|
||||
joy->di_joy->SetCooperativeLevel(*hWnd, DISCL_FOREGROUND);
|
||||
|
@ -215,9 +216,12 @@ void JoypadWindows::setup_joypad_object(const DIDEVICEOBJECTINSTANCE *ob, int p_
|
|||
ofs = DIJOFS_RY;
|
||||
else if (ob->guidType == GUID_RzAxis)
|
||||
ofs = DIJOFS_RZ;
|
||||
else if (ob->guidType == GUID_Slider)
|
||||
ofs = DIJOFS_SLIDER(0);
|
||||
else
|
||||
else if (ob->guidType == GUID_Slider) {
|
||||
if (slider_count < 2) {
|
||||
ofs = DIJOFS_SLIDER(slider_count);
|
||||
slider_count++;
|
||||
}
|
||||
} else
|
||||
return;
|
||||
prop_range.diph.dwSize = sizeof(DIPROPRANGE);
|
||||
prop_range.diph.dwHeaderSize = sizeof(DIPROPHEADER);
|
||||
|
@ -419,9 +423,9 @@ void JoypadWindows::process_joypads() {
|
|||
}
|
||||
|
||||
// on mingw, these constants are not constants
|
||||
int count = 6;
|
||||
unsigned int axes[] = { DIJOFS_X, DIJOFS_Y, DIJOFS_Z, DIJOFS_RX, DIJOFS_RY, DIJOFS_RZ };
|
||||
int values[] = { js.lX, js.lY, js.lZ, js.lRx, js.lRy, js.lRz };
|
||||
int count = 8;
|
||||
unsigned int axes[] = { DIJOFS_X, DIJOFS_Y, DIJOFS_Z, DIJOFS_RX, DIJOFS_RY, DIJOFS_RZ, DIJOFS_SLIDER(0), DIJOFS_SLIDER(1) };
|
||||
int values[] = { js.lX, js.lY, js.lZ, js.lRx, js.lRy, js.lRz, js.rglSlider[0], js.rglSlider[1] };
|
||||
|
||||
for (int j = 0; j < joy->joy_axis.size(); j++) {
|
||||
|
||||
|
|
|
@ -120,6 +120,7 @@ private:
|
|||
InputDefault *input;
|
||||
|
||||
int id_to_change;
|
||||
int slider_count;
|
||||
int joypad_count;
|
||||
bool attached_joypads[JOYPADS_MAX];
|
||||
dinput_gamepad d_joypads[JOYPADS_MAX];
|
||||
|
|
Loading…
Reference in New Issue