diff --git a/input/drivers/dinput.c b/input/drivers/dinput.c index 9605efa9e3..b2c4f667ef 100644 --- a/input/drivers/dinput.c +++ b/input/drivers/dinput.c @@ -328,10 +328,19 @@ static bool dinput_is_pressed(struct dinput_input *di, if (binds && binds[id].valid) { - if (dinput_mouse_button_pressed(di, port, bind->mbutton)) - return true; - if (input_joypad_pressed(di->joypad, joypad_info, port, binds, id)) - return true; + /* Auto-binds are per joypad, not per user. */ + const uint16_t joykey = (binds[id].joykey != NO_BTN) + ? binds[id].joykey : joypad_info.auto_binds[id].joykey; + const uint32_t joyaxis = (binds[id].joyaxis != AXIS_NONE) + ? binds[id].joyaxis : joypad_info.auto_binds[id].joyaxis; + + if (dinput_mouse_button_pressed(di, port, binds[id].mbutton)) + return true; + if (joykey != NO_BTN + && di->joypad->button(joypad_info.joy_idx, joykey)) + return true; + if (((float)abs(di->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) + return true; } return false;