From 6311885824167b8dbc841a8aec14343f27af0796 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 20 Jan 2018 19:48:29 +0100 Subject: [PATCH] (XDK1) Change D-pad to hat controls - make gamepad D-pad and analog stick work properly --- input/drivers_joypad/xdk_joypad.c | 6 +----- input/input_autodetect_builtin.c | 8 ++++---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/input/drivers_joypad/xdk_joypad.c b/input/drivers_joypad/xdk_joypad.c index dbdcd3a3d2..19ea6254c6 100644 --- a/input/drivers_joypad/xdk_joypad.c +++ b/input/drivers_joypad/xdk_joypad.c @@ -101,7 +101,6 @@ static bool xdk_joypad_button(unsigned port_num, uint16_t joykey) btn_word = g_xinput_states[port_num].xstate.Gamepad.wButtons; hat_dir = GET_HAT_DIR(joykey); -#if 0 if (hat_dir) { switch (hat_dir) @@ -119,6 +118,7 @@ static bool xdk_joypad_button(unsigned port_num, uint16_t joykey) return false; /* hat requested and no hat button down. */ } +#if 0 if (joykey < num_buttons) return btn_word & button_index_to_bitmap_code[joykey]; #else @@ -282,10 +282,6 @@ static void xdk_joypad_poll(void) state_cur = &pad_state[port]; *state_cur = 0; - *state_cur |= ((g_xinput_states[port].xstate.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_LEFT) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_LEFT) : 0); - *state_cur |= ((g_xinput_states[port].xstate.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_RIGHT) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_RIGHT) : 0); - *state_cur |= ((g_xinput_states[port].xstate.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_UP) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_UP) : 0); - *state_cur |= ((g_xinput_states[port].xstate.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_DOWN) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_DOWN) : 0); *state_cur |= ((g_xinput_states[port].xstate.Gamepad.wButtons & XINPUT_GAMEPAD_START) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_START) : 0); *state_cur |= ((g_xinput_states[port].xstate.Gamepad.wButtons & XINPUT_GAMEPAD_BACK) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_SELECT) : 0); diff --git a/input/input_autodetect_builtin.c b/input/input_autodetect_builtin.c index a7f12dda43..0e76b04f4e 100644 --- a/input/input_autodetect_builtin.c +++ b/input/input_autodetect_builtin.c @@ -483,10 +483,10 @@ DECL_BTN(x, 9) \ DECL_BTN(y, 1) \ DECL_BTN(start, 3) \ DECL_BTN(select, 2) \ -DECL_BTN(up, 4) \ -DECL_BTN(down, 5) \ -DECL_BTN(left, 6) \ -DECL_BTN(right, 7) \ +DECL_BTN(up, h0up) \ +DECL_BTN(down, h0down) \ +DECL_BTN(left, h0left) \ +DECL_BTN(right, h0right) \ DECL_BTN(l, 10) \ DECL_BTN(r, 11) \ DECL_BTN(l3, 14) \