src/joystick/SDL_gamecontroller.c
changeset 11983 3a50eb90e4b2
parent 11935 331397505b6c
child 11996 77c368583942
equal deleted inserted replaced
11982:7babfecee045 11983:3a50eb90e4b2
    38 #include "SDL_system.h"
    38 #include "SDL_system.h"
    39 #endif
    39 #endif
    40 
    40 
    41 
    41 
    42 /* Many controllers turn the center button into an instantaneous button press */
    42 /* Many controllers turn the center button into an instantaneous button press */
    43 #define SDL_MINIMUM_GUIDE_BUTTON_DELAY_MS   100
    43 #define SDL_MINIMUM_GUIDE_BUTTON_DELAY_MS   250
    44 
    44 
    45 #define SDL_CONTROLLER_PLATFORM_FIELD "platform:"
    45 #define SDL_CONTROLLER_PLATFORM_FIELD "platform:"
    46 
    46 
    47 /* a list of currently opened game controllers */
    47 /* a list of currently opened game controllers */
    48 static SDL_GameController *SDL_gamecontrollers = NULL;
    48 static SDL_GameController *SDL_gamecontrollers = NULL;
   927         SDL_strlcat(mapping_string, "y:b3,", sizeof(mapping_string));
   927         SDL_strlcat(mapping_string, "y:b3,", sizeof(mapping_string));
   928     }
   928     }
   929     if (button_mask & (1 << SDL_CONTROLLER_BUTTON_BACK)) {
   929     if (button_mask & (1 << SDL_CONTROLLER_BUTTON_BACK)) {
   930         SDL_strlcat(mapping_string, "back:b4,", sizeof(mapping_string));
   930         SDL_strlcat(mapping_string, "back:b4,", sizeof(mapping_string));
   931     }
   931     }
       
   932 #if 0 /* The guide button generally isn't functional (or acts as a home button) on most Android controllers */
   932     if (button_mask & (1 << SDL_CONTROLLER_BUTTON_GUIDE)) {
   933     if (button_mask & (1 << SDL_CONTROLLER_BUTTON_GUIDE)) {
   933         SDL_strlcat(mapping_string, "guide:b5,", sizeof(mapping_string));
   934         SDL_strlcat(mapping_string, "guide:b5,", sizeof(mapping_string));
   934 #if 0 /* Actually this will be done in Steam */
   935 #if 0 /* Actually this will be done in Steam */
   935     } else if (button_mask & (1 << SDL_CONTROLLER_BUTTON_START)) {
   936     } else if (button_mask & (1 << SDL_CONTROLLER_BUTTON_START)) {
   936         /* The guide button doesn't exist, use the start button instead,
   937         /* The guide button doesn't exist, use the start button instead,
   938          */
   939          */
   939         SDL_strlcat(mapping_string, "guide:b6,", sizeof(mapping_string));
   940         SDL_strlcat(mapping_string, "guide:b6,", sizeof(mapping_string));
   940         button_mask &= ~(1 << SDL_CONTROLLER_BUTTON_START);
   941         button_mask &= ~(1 << SDL_CONTROLLER_BUTTON_START);
   941 #endif
   942 #endif
   942     }
   943     }
       
   944 #endif
   943     if (button_mask & (1 << SDL_CONTROLLER_BUTTON_START)) {
   945     if (button_mask & (1 << SDL_CONTROLLER_BUTTON_START)) {
   944         SDL_strlcat(mapping_string, "start:b6,", sizeof(mapping_string));
   946         SDL_strlcat(mapping_string, "start:b6,", sizeof(mapping_string));
   945     }
   947     }
   946     if (button_mask & (1 << SDL_CONTROLLER_BUTTON_LEFTSTICK)) {
   948     if (button_mask & (1 << SDL_CONTROLLER_BUTTON_LEFTSTICK)) {
   947         SDL_strlcat(mapping_string, "leftstick:b7,", sizeof(mapping_string));
   949         SDL_strlcat(mapping_string, "leftstick:b7,", sizeof(mapping_string));