Merged latest changes from Steam Link app
authorSam Lantinga <slouken@libsdl.org>
Fri, 18 May 2018 13:09:30 -0700
changeset 119833a50eb90e4b2
parent 11982 7babfecee045
child 11984 987c5dc71309
Merged latest changes from Steam Link app
VisualC/SDLmain/SDLmain.vcxproj
src/joystick/SDL_gamecontroller.c
src/joystick/SDL_gamecontrollerdb.h
src/video/SDL_egl.c
src/video/uikit/SDL_uikitmessagebox.m
     1.1 --- a/VisualC/SDLmain/SDLmain.vcxproj	Thu May 17 12:50:46 2018 -0400
     1.2 +++ b/VisualC/SDLmain/SDLmain.vcxproj	Fri May 18 13:09:30 2018 -0700
     1.3 @@ -1,4 +1,4 @@
     1.4 -<?xml version="1.0" encoding="utf-8"?>
     1.5 +<?xml version="1.0" encoding="utf-8"?>
     1.6  <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     1.7    <ItemGroup Label="ProjectConfigurations">
     1.8      <ProjectConfiguration Include="Debug|Win32">
     2.1 --- a/src/joystick/SDL_gamecontroller.c	Thu May 17 12:50:46 2018 -0400
     2.2 +++ b/src/joystick/SDL_gamecontroller.c	Fri May 18 13:09:30 2018 -0700
     2.3 @@ -40,7 +40,7 @@
     2.4  
     2.5  
     2.6  /* Many controllers turn the center button into an instantaneous button press */
     2.7 -#define SDL_MINIMUM_GUIDE_BUTTON_DELAY_MS   100
     2.8 +#define SDL_MINIMUM_GUIDE_BUTTON_DELAY_MS   250
     2.9  
    2.10  #define SDL_CONTROLLER_PLATFORM_FIELD "platform:"
    2.11  
    2.12 @@ -929,6 +929,7 @@
    2.13      if (button_mask & (1 << SDL_CONTROLLER_BUTTON_BACK)) {
    2.14          SDL_strlcat(mapping_string, "back:b4,", sizeof(mapping_string));
    2.15      }
    2.16 +#if 0 /* The guide button generally isn't functional (or acts as a home button) on most Android controllers */
    2.17      if (button_mask & (1 << SDL_CONTROLLER_BUTTON_GUIDE)) {
    2.18          SDL_strlcat(mapping_string, "guide:b5,", sizeof(mapping_string));
    2.19  #if 0 /* Actually this will be done in Steam */
    2.20 @@ -940,6 +941,7 @@
    2.21          button_mask &= ~(1 << SDL_CONTROLLER_BUTTON_START);
    2.22  #endif
    2.23      }
    2.24 +#endif
    2.25      if (button_mask & (1 << SDL_CONTROLLER_BUTTON_START)) {
    2.26          SDL_strlcat(mapping_string, "start:b6,", sizeof(mapping_string));
    2.27      }
     3.1 --- a/src/joystick/SDL_gamecontrollerdb.h	Thu May 17 12:50:46 2018 -0400
     3.2 +++ b/src/joystick/SDL_gamecontrollerdb.h	Fri May 18 13:09:30 2018 -0700
     3.3 @@ -199,7 +199,8 @@
     3.4      "03000000de2800000112000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
     3.5      "05000000de2800000212000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
     3.6      "03000000de2800004211000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
     3.7 -    "03000000de280000fc11000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
     3.8 +    "05000000de2800000611000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
     3.9 +    "03000000de280000fc11000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
    3.10      "03000000de280000ff11000001000000,Steam Virtual Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
    3.11      "xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
    3.12      "050000005e040000e002000003090000,Xbox One Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
    3.13 @@ -213,6 +214,7 @@
    3.14      "050000004c05000068020000dfff3f00,PS3 Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
    3.15      "050000004c050000cc090000fffe3f00,PS4 Controller,a:b1,b:b17,back:b15,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b3,leftstick:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b6,righttrigger:a4,rightx:a2,righty:a5,start:b16,x:b0,y:b2,",
    3.16      "05000000de2800000511000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
    3.17 +    "05000000de2800000611000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
    3.18      "050000005e040000e00200000ffe3f00,Xbox One Wireless Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b3,leftstick:b15,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b16,righttrigger:a5,rightx:a3,righty:a4,start:b10,x:b17,y:b2,",
    3.19      "050000005e040000fd020000ffff3f00,Xbox One Wireless Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
    3.20      "050000005e04000091020000ff073f00,Xbox Wireless Controller,a:b0,b:b1,back:b4,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a3,righty:a4,start:b6,x:b2,y:b3,", /* The DPAD doesn't seem to work on this controller on Android TV? */
    3.21 @@ -222,6 +224,7 @@
    3.22      "05000000ac0500000200000000006d02,*,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,leftshoulder:b4,rightshoulder:b5,x:b2,y:b3,",
    3.23      "05000000ac0500000300000000006d03,Remote,a:b0,b:b2,leftx:a0,lefty:a1,",
    3.24      "05000000de2800000511000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
    3.25 +    "05000000de2800000611000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
    3.26  #endif
    3.27  #if defined(SDL_JOYSTICK_EMSCRIPTEN)
    3.28      "default,Standard Gamepad,a:b0,b:b1,back:b8,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,guide:b16,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
     4.1 --- a/src/video/SDL_egl.c	Thu May 17 12:50:46 2018 -0400
     4.2 +++ b/src/video/SDL_egl.c	Fri May 18 13:09:30 2018 -0700
     4.3 @@ -446,6 +446,64 @@
     4.4      return 0;
     4.5  }
     4.6  
     4.7 +#ifdef DUMP_EGL_CONFIG
     4.8 +
     4.9 +#define ATTRIBUTE(_attr) { _attr, #_attr }
    4.10 +
    4.11 +typedef struct {
    4.12 +    EGLint attribute;
    4.13 +    char const* name;
    4.14 +} Attribute;
    4.15 +
    4.16 +Attribute attributes[] = {
    4.17 +        ATTRIBUTE( EGL_BUFFER_SIZE ),
    4.18 +        ATTRIBUTE( EGL_ALPHA_SIZE ),
    4.19 +        ATTRIBUTE( EGL_BLUE_SIZE ),
    4.20 +        ATTRIBUTE( EGL_GREEN_SIZE ),
    4.21 +        ATTRIBUTE( EGL_RED_SIZE ),
    4.22 +        ATTRIBUTE( EGL_DEPTH_SIZE ),
    4.23 +        ATTRIBUTE( EGL_STENCIL_SIZE ),
    4.24 +        ATTRIBUTE( EGL_CONFIG_CAVEAT ),
    4.25 +        ATTRIBUTE( EGL_CONFIG_ID ),
    4.26 +        ATTRIBUTE( EGL_LEVEL ),
    4.27 +        ATTRIBUTE( EGL_MAX_PBUFFER_HEIGHT ),
    4.28 +        ATTRIBUTE( EGL_MAX_PBUFFER_WIDTH ),
    4.29 +        ATTRIBUTE( EGL_MAX_PBUFFER_PIXELS ),
    4.30 +        ATTRIBUTE( EGL_NATIVE_RENDERABLE ),
    4.31 +        ATTRIBUTE( EGL_NATIVE_VISUAL_ID ),
    4.32 +        ATTRIBUTE( EGL_NATIVE_VISUAL_TYPE ),
    4.33 +        ATTRIBUTE( EGL_SAMPLES ),
    4.34 +        ATTRIBUTE( EGL_SAMPLE_BUFFERS ),
    4.35 +        ATTRIBUTE( EGL_SURFACE_TYPE ),
    4.36 +        ATTRIBUTE( EGL_TRANSPARENT_TYPE ),
    4.37 +        ATTRIBUTE( EGL_TRANSPARENT_BLUE_VALUE ),
    4.38 +        ATTRIBUTE( EGL_TRANSPARENT_GREEN_VALUE ),
    4.39 +        ATTRIBUTE( EGL_TRANSPARENT_RED_VALUE ),
    4.40 +        ATTRIBUTE( EGL_BIND_TO_TEXTURE_RGB ),
    4.41 +        ATTRIBUTE( EGL_BIND_TO_TEXTURE_RGBA ),
    4.42 +        ATTRIBUTE( EGL_MIN_SWAP_INTERVAL ),
    4.43 +        ATTRIBUTE( EGL_MAX_SWAP_INTERVAL ),
    4.44 +        ATTRIBUTE( EGL_LUMINANCE_SIZE ),
    4.45 +        ATTRIBUTE( EGL_ALPHA_MASK_SIZE ),
    4.46 +        ATTRIBUTE( EGL_COLOR_BUFFER_TYPE ),
    4.47 +        ATTRIBUTE( EGL_RENDERABLE_TYPE ),
    4.48 +        ATTRIBUTE( EGL_MATCH_NATIVE_PIXMAP ),
    4.49 +        ATTRIBUTE( EGL_CONFORMANT ),
    4.50 +};
    4.51 +
    4.52 +
    4.53 +static void dumpconfig(_THIS, EGLConfig config)
    4.54 +{
    4.55 +    int attr;
    4.56 +    for (attr = 0 ; attr<sizeof(attributes)/sizeof(Attribute) ; attr++) {
    4.57 +        EGLint value;
    4.58 +        _this->egl_data->eglGetConfigAttrib(_this->egl_data->egl_display, config, attributes[attr].attribute, &value);
    4.59 +        SDL_Log("\t%-32s: %10d (0x%08x)\n", attributes[attr].name, value, value);
    4.60 +    }
    4.61 +}
    4.62 +
    4.63 +#endif /* DUMP_EGL_CONFIG */
    4.64 +
    4.65  int
    4.66  SDL_EGL_ChooseConfig(_THIS) 
    4.67  {
    4.68 @@ -570,6 +628,10 @@
    4.69              break; /* we found an exact match! */
    4.70          }
    4.71      }
    4.72 +
    4.73 +#ifdef DUMP_EGL_CONFIG
    4.74 +    dumpconfig(_this, _this->egl_data->egl_config);
    4.75 +#endif
    4.76      
    4.77      return 0;
    4.78  }
     5.1 --- a/src/video/uikit/SDL_uikitmessagebox.m	Thu May 17 12:50:46 2018 -0400
     5.2 +++ b/src/video/uikit/SDL_uikitmessagebox.m	Fri May 18 13:09:30 2018 -0700
     5.3 @@ -109,6 +109,7 @@
     5.4          alertwindow.hidden = YES;
     5.5      }
     5.6  
     5.7 +#if !TARGET_OS_TV
     5.8      /* Force the main SDL window to re-evaluate home indicator state */
     5.9      SDL_Window *focus = SDL_GetFocusWindow();
    5.10      if (focus) {
    5.11 @@ -120,6 +121,7 @@
    5.12              }
    5.13          }
    5.14      }
    5.15 +#endif /* !TARGET_OS_TV */
    5.16  
    5.17      *buttonid = messageboxdata->buttons[clickedindex].buttonid;
    5.18      return YES;