Parcourir la source

SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS defaults to true, to match Steam's default behavior

Sam Lantinga il y a 6 ans
Parent
commit
9a76bebfbc
2 fichiers modifiés avec 2 ajouts et 2 suppressions
  1. 1 1
      include/SDL_hints.h
  2. 1 1
      src/joystick/hidapi/SDL_hidapi_switch.c

+ 1 - 1
include/SDL_hints.h

@@ -507,7 +507,7 @@ extern "C" {
  *    "0"       - Report the face buttons by position, as though they were on an Xbox controller.
  *    "0"       - Report the face buttons by position, as though they were on an Xbox controller.
  *    "1"       - Report the face buttons by label instead of position
  *    "1"       - Report the face buttons by label instead of position
  *
  *
- *  The default value is "0".  This hint may be set at any time.
+ *  The default value is "1".  This hint may be set at any time.
  */
  */
 #define SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS "SDL_GAMECONTROLLER_USE_BUTTON_LABELS"
 #define SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS "SDL_GAMECONTROLLER_USE_BUTTON_LABELS"
 
 

+ 1 - 1
src/joystick/hidapi/SDL_hidapi_switch.c

@@ -591,7 +591,7 @@ static Sint16 ApplyStickCalibration(SDL_DriverSwitch_Context *ctx, int nStick, i
 static void SDLCALL SDL_GameControllerButtonReportingHintChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
 static void SDLCALL SDL_GameControllerButtonReportingHintChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
 {
 {
     SDL_DriverSwitch_Context *ctx = (SDL_DriverSwitch_Context *)userdata;
     SDL_DriverSwitch_Context *ctx = (SDL_DriverSwitch_Context *)userdata;
-    ctx->m_bUseButtonLabels = (hint && *hint != '0' && SDL_strcasecmp(hint, "false") != 0);
+    ctx->m_bUseButtonLabels = (!hint || !*hint || ((*hint != '0') && (SDL_strcasecmp(hint, "false") != 0)));
 }
 }
 
 
 static Uint8 RemapButton(SDL_DriverSwitch_Context *ctx, Uint8 button)
 static Uint8 RemapButton(SDL_DriverSwitch_Context *ctx, Uint8 button)