diff --git a/Quake/in_sdl.c b/Quake/in_sdl.c index 69f4f2d6c..60fc37d8f 100644 --- a/Quake/in_sdl.c +++ b/Quake/in_sdl.c @@ -597,6 +597,8 @@ IN_KeyForControllerButton */ static int IN_KeyForControllerButton(SDL_GameControllerButton button) { + qboolean remap_dpad = (key_dest != key_game && !M_KeyBinding ()); + switch (button) { case SDL_CONTROLLER_BUTTON_A: return K_ABUTTON; @@ -609,10 +611,10 @@ static int IN_KeyForControllerButton(SDL_GameControllerButton button) case SDL_CONTROLLER_BUTTON_RIGHTSTICK: return K_RTHUMB; case SDL_CONTROLLER_BUTTON_LEFTSHOULDER: return K_LSHOULDER; case SDL_CONTROLLER_BUTTON_RIGHTSHOULDER: return K_RSHOULDER; - case SDL_CONTROLLER_BUTTON_DPAD_UP: return K_UPARROW; - case SDL_CONTROLLER_BUTTON_DPAD_DOWN: return K_DOWNARROW; - case SDL_CONTROLLER_BUTTON_DPAD_LEFT: return K_LEFTARROW; - case SDL_CONTROLLER_BUTTON_DPAD_RIGHT: return K_RIGHTARROW; + case SDL_CONTROLLER_BUTTON_DPAD_UP: return remap_dpad ? K_UPARROW : K_DPAD_UP; + case SDL_CONTROLLER_BUTTON_DPAD_DOWN: return remap_dpad ? K_DOWNARROW : K_DPAD_DOWN; + case SDL_CONTROLLER_BUTTON_DPAD_LEFT: return remap_dpad ? K_LEFTARROW : K_DPAD_LEFT; + case SDL_CONTROLLER_BUTTON_DPAD_RIGHT: return remap_dpad ? K_RIGHTARROW : K_DPAD_RIGHT; case SDL_CONTROLLER_BUTTON_MISC1: return K_MISC1; case SDL_CONTROLLER_BUTTON_PADDLE1: return K_PADDLE1; case SDL_CONTROLLER_BUTTON_PADDLE2: return K_PADDLE2; diff --git a/Quake/keys.c b/Quake/keys.c index bbb7b826d..a317799ed 100644 --- a/Quake/keys.c +++ b/Quake/keys.c @@ -134,6 +134,10 @@ static const keyname_t keynames[] = {"RTHUMB", K_RTHUMB}, {"LSHOULDER", K_LSHOULDER}, {"RSHOULDER", K_RSHOULDER}, + {"DPAD_UP", K_DPAD_UP}, + {"DPAD_DOWN", K_DPAD_DOWN}, + {"DPAD_LEFT", K_DPAD_LEFT}, + {"DPAD_RIGHT", K_DPAD_RIGHT}, {"ABUTTON", K_ABUTTON}, {"BBUTTON", K_BBUTTON}, {"XBUTTON", K_XBUTTON}, diff --git a/Quake/keys.h b/Quake/keys.h index 3637a6c84..09851cc1a 100644 --- a/Quake/keys.h +++ b/Quake/keys.h @@ -107,6 +107,10 @@ typedef enum keycode_t K_RTHUMB, K_LSHOULDER, K_RSHOULDER, + K_DPAD_UP, + K_DPAD_DOWN, + K_DPAD_LEFT, + K_DPAD_RIGHT, K_ABUTTON, K_BBUTTON, K_XBUTTON,