Sdl 2.0.10 released!

Thanks to all the people who contributed code and feedback, SDL 2.0.10 is now available!
http://www.libsdl.org/download-2.0.php

In addition to lots of bug fixes and build improvements, here are the major changes in this release:

General:

  • The SDL_RW* macros have been turned into functions that are available only in 2.0.10 and onward
  • Added SDL_SIMDGetAlignment(), SDL_SIMDAlloc(), and SDL_SIMDFree(), to allocate memory aligned for SIMD operations for the current CPU
  • Added SDL_RenderDrawPointF(), SDL_RenderDrawPointsF(), SDL_RenderDrawLineF(), SDL_RenderDrawLinesF(), SDL_RenderDrawRectF(), SDL_RenderDrawRectsF(), SDL_RenderFillRectF(), SDL_RenderFillRectsF(), SDL_RenderCopyF(), SDL_RenderCopyExF(), to allow floating point precision in the SDL rendering API.
  • Added SDL_GetTouchDeviceType() to get the type of a touch device, which can be a touch screen or a trackpad in relative or absolute coordinate mode.
  • The SDL rendering API now uses batched rendering by default, for improved performance
  • Added SDL_RenderFlush() to force batched render commands to execute, if you’re going to mix SDL rendering with native rendering
  • Added the hint SDL_HINT_RENDER_BATCHING to control whether batching should be used for the rendering API. This defaults to “1” if you don’t specify what rendering driver to use when creating the renderer.
  • Added the hint SDL_HINT_EVENT_LOGGING to enable logging of SDL events for debugging purposes
  • Added the hint SDL_HINT_GAMECONTROLLERCONFIG_FILE to specify a file that will be loaded at joystick initialization with game controller bindings
  • Added the hint SDL_HINT_MOUSE_TOUCH_EVENTS to control whether SDL will synthesize touch events from mouse events
  • Improved handling of malformed WAVE and BMP files, fixing potential security exploits

Linux:

  • Removed the Mir video driver in favor of Wayland

iOS / tvOS:

  • Added support for Xbox and PS4 wireless controllers in iOS 13 and tvOS 13
  • Added support for text input using Bluetooth keyboards

Android:

  • Added low latency audio using OpenSL ES
  • Removed SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH (replaced by SDL_HINT_MOUSE_TOUCH_EVENTS and SDL_HINT_TOUCH_MOUSE_EVENTS)
    SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH=1, should be replaced by setting both previous hints to 0.
    SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH=0, should be replaced by setting both previous hints to 1.
  • Added the hint SDL_HINT_ANDROID_BLOCK_ON_PAUSE to set whether the event loop will block itself when the app is paused.
12 Likes

:metal::partying_face:

2 Likes

Nice, thanks. Is OpenSL ES the default now? I did notice some latency in audio on Android in previous versions. Wonder if forcing OpenSL ES (if it’s not default) would be safe if targeting Android 6.0+?

Yes, OpenSL ES is the default.

2 Likes

I can’t to compile new downloaded version of SDL-2.0.10-12951via CMake on Android, previous version (2.0.9) compiled fine.
I don’t even know why it compiled hidapi PS4 and Xbox for Android gradle project, seems to it was added in macro(CheckHIDAPI)

  C:/gdev/SDL2/src/joystick/hidapi/SDL_hidapi_ps4.c:389: error: undefined reference to 'hid_write'
  C:/gdev/SDL2/src/joystick/hidapi/SDL_hidapi_ps4.c:518: error: undefined reference to 'hid_read_timeout'
  C:/gdev/SDL2/src/joystick/hidapi/SDL_hidapi_ps4.c:241: error: undefined reference to 'hid_get_feature_report'
  C:/gdev/SDL2/src/joystick/hidapi/SDL_hidapi_switch.c:235: error: undefined reference to 'hid_write'
  C:/gdev/SDL2/src/joystick/hidapi/SDL_hidapi_switch.c:230: error: undefined reference to 'hid_read_timeout'
  C:/gdev/SDL2/src/joystick/hidapi/SDL_hidapi_xbox360.c:372: error: undefined reference to 'hid_write'
  C:/gdev/SDL2/src/joystick/hidapi/SDL_hidapi_xbox360.c:718: error: undefined reference to 'hid_read_timeout'
  C:/gdev/SDL2/src/joystick/hidapi/SDL_hidapi_xbox360.c:277: error: undefined reference to 'hid_write'
  C:/gdev/SDL2/src/joystick/hidapi/SDL_hidapi_xboxone.c:276: error: undefined reference to 'hid_read_timeout'
  C:/gdev/SDL2/src/joystick/hidapi/SDL_hidapijoystick.c:872: error: undefined reference to 'hid_enumerate'

Basically I don’t need SDL_JOYSTICK so I would like to disable it but with
set(SDL_JOYSTICK OFF CACHE BOOL “” FORCE)
set(HIDAPI OFF CACHE BOOL “” FORCE)
set(SDL_HAPTIC OFF CACHE BOOL “” FORCE)

I also receive a lot of compiler errors. How can I disable hidapi library without too many modifications in code ?

C:/gdev/SDL2/src/dynapi/SDL_dynapi_procs.h:0: error: undefined reference to ‘SDL_GameControllerClose_REAL’
C:/gdev/SDL2/src/dynapi/SDL_dynapi_procs.h:0: error: undefined reference to ‘SDL_HapticName_REAL’
C:/gdev/SDL2/src/dynapi/SDL_dynapi_procs.h:0: error: undefined reference to ‘SDL_JoystickOpen_REAL’

Finally I found a solution but I had to link all libraries as static:

file(GLOB MY_HIDAPI_SOURCES ${SDL2_SOURCE_DIR}/src/hidapi/android/hid.cpp)
set(SOURCE_FILES ${SOURCE_FILES} ${MY_HIDAPI_SOURCES})

Than link all together in one big SDL-static library

set(SDL_STATIC_ENABLED_BY_DEFAULT ON CACHE BOOL “” FORCE)
set(SDL_STATIC_PIC ON CACHE BOOL “” FORCE) # It’s due to ERROR libSDL2.a(hid.cpp.o): requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC

To note, this: tvOS Menu button with GameController API is still a problem on tvOS with 2.0.10. Just me experiencing this?

There is also a bug report here: https://bugzilla.libsdl.org/show_bug.cgi?id=4531

I’ll try and find what caused it sometime soonish.

EDIT: I’ve fixed most of the problems using some hints and by ignoring remotes with only a few buttons (not opening them.) For Menu to return to the OS from the toplevel of the game, I needed this patch:

diff -ur SDL2-2.0.10/src/video/uikit/SDL_uikitview.m SDL2-2.0.10-goob/src/video/uikit/SDL_uikitview.m
--- SDL2-2.0.10/src/video/uikit/SDL_uikitview.m	2019-07-28 20:26:20.000000000 -0600
+++ SDL2-2.0.10-goob/src/video/uikit/SDL_uikitview.m	2019-07-28 20:25:34.000000000 -0600
@@ -261,7 +261,7 @@
         return SDL_SCANCODE_RETURN;
     case UIPressTypeMenu:
         /* HIG says: "returns to previous screen" */
-        return SDL_SCANCODE_ESCAPE;
+        return SDL_SCANCODE_MENU;
     case UIPressTypePlayPause:
         /* HIG says: "secondary button behavior" */
         return SDL_SCANCODE_PAUSE;

For some reason Menu was changed to Escape which makes it impossible to exit to the OS which I believe is part of Apple’s requirements of tvOS apps. For the record, I use this code in my event filter to handle the Menu button properly (I set pass_menu_to_os on the title screen to true.)

case SDL_APP_DIDENTERFOREGROUND:
    SDL_SetHint(SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS, "0");
    return 0;
case SDL_KEYDOWN:
case SDL_KEYUP:
    if (event->key.keysym.sym == SDLK_MENU && pass_menu_to_os) {
	    SDL_SetHint(SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS, "1");
    }
return 1;

Removed SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH

I’m surprised this was done in a minor version increase, as it’s an API breaking change. I thought SDL was pretty keen on backwards compatibility? As I read, that’s why SDL_ShowCursor is global instead of per window.

We do occasionally change the API, especially around hints, which are not guaranteed functionality. We don’t ever intentionally break the ABI in minor versions.

Excuse my ignorance, but isn’t this this breaking the ABI? If I would swap out SDL2 for a newer version without recompiling anything it would suddenly start generating mouse events for touch events on android.

Also, https://wiki.libsdl.org/CategoryHints still needs to be updated, not sure who does that.

1 Like