Try to dynamically create a default Android game controller mapping based on the buttons and axes on the controller.

Include the controller USB VID/PID in the GUID where possible, as we do on other platforms.
This commit is contained in:
Sam Lantinga
2018-03-06 14:51:50 -08:00
parent 2419d26724
commit 9e651b6915
8 changed files with 404 additions and 81 deletions

View File

@@ -32,7 +32,7 @@ extern int Android_OnPadDown(int device_id, int keycode);
extern int Android_OnPadUp(int device_id, int keycode);
extern int Android_OnJoy(int device_id, int axisnum, float value);
extern int Android_OnHat(int device_id, int hat_id, int x, int y);
extern int Android_AddJoystick(int device_id, const char *name, const char *desc, SDL_bool is_accelerometer, int nbuttons, int naxes, int nhats, int nballs);
extern int Android_AddJoystick(int device_id, const char *name, const char *desc, int vendor_id, int product_id, SDL_bool is_accelerometer, int button_mask, int naxes, int nhats, int nballs);
extern int Android_RemoveJoystick(int device_id);
/* A linked list of available joysticks */
@@ -45,6 +45,7 @@ typedef struct SDL_joylist_item
SDL_bool is_accelerometer;
SDL_Joystick *joystick;
int nbuttons, naxes, nhats, nballs;
int dpad_state;
/* Steam Controller support */
SDL_bool m_bSteamController;