Merge pull request #40927 from 27thLiz/dinput-id

DirectInput: Use correct joypad id
This commit is contained in:
Rémi Verschelde 2020-08-01 10:13:15 +02:00 committed by GitHub
commit ec9302cecc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -146,8 +146,8 @@ bool JoypadWindows::setup_dinput_joypad(const DIDEVICEINSTANCE *instance) {
if (have_device(instance->guidInstance) || num == -1) if (have_device(instance->guidInstance) || num == -1)
return false; return false;
d_joypads[joypad_count] = dinput_gamepad(); d_joypads[num] = dinput_gamepad();
dinput_gamepad *joy = &d_joypads[joypad_count]; dinput_gamepad *joy = &d_joypads[num];
const DWORD devtype = (instance->dwDevType & 0xFF); const DWORD devtype = (instance->dwDevType & 0xFF);
@ -171,7 +171,7 @@ bool JoypadWindows::setup_dinput_joypad(const DIDEVICEINSTANCE *instance) {
WORD version = 0; WORD version = 0;
sprintf_s(uid, "%04x%04x%04x%04x%04x%04x%04x%04x", type, 0, vendor, 0, product, 0, version, 0); sprintf_s(uid, "%04x%04x%04x%04x%04x%04x%04x%04x", type, 0, vendor, 0, product, 0, version, 0);
id_to_change = joypad_count; id_to_change = num;
slider_count = 0; slider_count = 0;
joy->di_joy->SetDataFormat(&c_dfDIJoystick2); joy->di_joy->SetDataFormat(&c_dfDIJoystick2);