From c2e2565144e35fb9da630dde4cd2c9a1d18720ad Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 1 Oct 2016 13:02:20 -0700 Subject: [PATCH] Fixed bug 3424 - SDL_GameController: Increase k_nMaxReverseEntries ny00 On Android, the keycodes KEYCODE_BUTTON_1..16 (actual values 188-203) are translated to SDL_Joystick buttons no. 20-35. These are currently ignored in SDL_gamecontroller.c. The attached patch fixes this, by increasing k_nMaxReverseEntries from 20 to another arbitrary bound of 48. Side-note: Maybe some log should be emitted in case of going over any such bound? --- src/joystick/SDL_gamecontroller.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/joystick/SDL_gamecontroller.c b/src/joystick/SDL_gamecontroller.c index a312a86ba..ccecb80d5 100644 --- a/src/joystick/SDL_gamecontroller.c +++ b/src/joystick/SDL_gamecontroller.c @@ -45,7 +45,8 @@ struct _SDL_HatMapping Uint8 mask; }; -#define k_nMaxReverseEntries 20 +/* We need 36 entries for Android (as of SDL v2.0.4) */ +#define k_nMaxReverseEntries 48 /** * We are encoding the "HAT" as 0xhm. where h == hat ID and m == mask