Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDL upgrade to version 2.30.11 #2650

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ private boolean isXboxOneController(UsbDevice usbDevice, UsbInterface usbInterfa
0x044f, // Thrustmaster
0x045e, // Microsoft
0x0738, // Mad Catz
0x0b05, // ASUS
0x0e6f, // PDP
0x0f0d, // Hori
0x10f5, // Turtle Beach
Expand Down Expand Up @@ -590,7 +591,13 @@ public boolean openDevice(int deviceID) {
} else {
flags = 0;
}
mUsbManager.requestPermission(usbDevice, PendingIntent.getBroadcast(mContext, 0, new Intent(HIDDeviceManager.ACTION_USB_PERMISSION), flags));
if (Build.VERSION.SDK_INT >= 33 /* Android 14.0 (U) */) {
Intent intent = new Intent(HIDDeviceManager.ACTION_USB_PERMISSION);
intent.setPackage(mContext.getPackageName());
mUsbManager.requestPermission(usbDevice, PendingIntent.getBroadcast(mContext, 0, intent, flags));
} else {
mUsbManager.requestPermission(usbDevice, PendingIntent.getBroadcast(mContext, 0, new Intent(HIDDeviceManager.ACTION_USB_PERMISSION), flags));
}
} catch (Exception e) {
Log.v(TAG, "Couldn't request permission for USB device " + usbDevice);
HIDDeviceOpenResult(deviceID, false);
Expand Down
14 changes: 9 additions & 5 deletions Android/library/runtime/src/main/java/org/libsdl/app/SDL.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ public static Context getContext() {
}

public static void loadLibrary(String libraryName) throws UnsatisfiedLinkError, SecurityException, NullPointerException {
loadLibrary(libraryName, mContext);
}

public static void loadLibrary(String libraryName, Context context) throws UnsatisfiedLinkError, SecurityException, NullPointerException {

if (libraryName == null) {
throw new NullPointerException("No library name provided.");
Expand All @@ -53,10 +57,10 @@ public static void loadLibrary(String libraryName) throws UnsatisfiedLinkError,
// To use ReLinker, just add it as a dependency. For more information, see
// https://github.com/KeepSafe/ReLinker for ReLinker's repository.
//
Class<?> relinkClass = mContext.getClassLoader().loadClass("com.getkeepsafe.relinker.ReLinker");
Class<?> relinkListenerClass = mContext.getClassLoader().loadClass("com.getkeepsafe.relinker.ReLinker$LoadListener");
Class<?> contextClass = mContext.getClassLoader().loadClass("android.content.Context");
Class<?> stringClass = mContext.getClassLoader().loadClass("java.lang.String");
Class<?> relinkClass = context.getClassLoader().loadClass("com.getkeepsafe.relinker.ReLinker");
Class<?> relinkListenerClass = context.getClassLoader().loadClass("com.getkeepsafe.relinker.ReLinker$LoadListener");
Class<?> contextClass = context.getClassLoader().loadClass("android.content.Context");
Class<?> stringClass = context.getClassLoader().loadClass("java.lang.String");

// Get a 'force' instance of the ReLinker, so we can ensure libraries are reinstalled if
// they've changed during updates.
Expand All @@ -66,7 +70,7 @@ public static void loadLibrary(String libraryName) throws UnsatisfiedLinkError,

// Actually load the library!
Method loadMethod = relinkInstanceClass.getDeclaredMethod("loadLibrary", contextClass, stringClass, stringClass, relinkListenerClass);
loadMethod.invoke(relinkInstance, mContext, libraryName, null, null);
loadMethod.invoke(relinkInstance, context, libraryName, null, null);
}
catch (final Throwable e) {
// Fall back
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
public class SDLActivity extends Activity implements View.OnSystemUiVisibilityChangeListener {
private static final String TAG = "SDL";
private static final int SDL_MAJOR_VERSION = 2;
private static final int SDL_MINOR_VERSION = 28;
private static final int SDL_MICRO_VERSION = 5;
private static final int SDL_MINOR_VERSION = 30;
private static final int SDL_MICRO_VERSION = 11;
/*
// Display InputType.SOURCE/CLASS of events and devices
//
Expand Down Expand Up @@ -89,7 +89,7 @@ public static void debugSource(int sources, String prefix) {
| InputDevice.SOURCE_CLASS_POSITION
| InputDevice.SOURCE_CLASS_TRACKBALL);

if (s2 != 0) cls += "Some_Unkown";
if (s2 != 0) cls += "Some_Unknown";

s2 = s_copy & InputDevice.SOURCE_ANY; // keep source only, no class;

Expand Down Expand Up @@ -163,7 +163,7 @@ public static void debugSource(int sources, String prefix) {
if (s == FLAG_TAINTED) src += " FLAG_TAINTED";
s2 &= ~FLAG_TAINTED;

if (s2 != 0) src += " Some_Unkown";
if (s2 != 0) src += " Some_Unknown";

Log.v(TAG, prefix + "int=" + s_copy + " CLASS={" + cls + " } source(s):" + src);
}
Expand Down Expand Up @@ -281,7 +281,7 @@ protected String[] getLibraries() {
// Load the .so
public void loadLibraries() {
for (String lib : getLibraries()) {
SDL.loadLibrary(lib);
SDL.loadLibrary(lib, this);
}
}

Expand Down Expand Up @@ -995,8 +995,8 @@ public void setOrientationBis(int w, int h, boolean resizable, String hint)
/* No valid hint, nothing is explicitly allowed */
if (!is_portrait_allowed && !is_landscape_allowed) {
if (resizable) {
/* All orientations are allowed */
req = ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR;
/* All orientations are allowed, respecting user orientation lock setting */
req = ActivityInfo.SCREEN_ORIENTATION_FULL_USER;
} else {
/* Fixed window and nothing specified. Get orientation from w/h of created window */
req = (w > h ? ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE : ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
Expand All @@ -1005,8 +1005,8 @@ public void setOrientationBis(int w, int h, boolean resizable, String hint)
/* At least one orientation is allowed */
if (resizable) {
if (is_portrait_allowed && is_landscape_allowed) {
/* hint allows both landscape and portrait, promote to full sensor */
req = ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR;
/* hint allows both landscape and portrait, promote to full user */
req = ActivityInfo.SCREEN_ORIENTATION_FULL_USER;
} else {
/* Use the only one allowed "orientation" */
req = (is_landscape_allowed ? orientation_landscape : orientation_portrait);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -546,13 +546,15 @@ public void pollHapticDevices() {
if (haptic == null) {
InputDevice device = InputDevice.getDevice(deviceIds[i]);
Vibrator vib = device.getVibrator();
if (vib.hasVibrator()) {
haptic = new SDLHaptic();
haptic.device_id = deviceIds[i];
haptic.name = device.getName();
haptic.vib = vib;
mHaptics.add(haptic);
SDLControllerManager.nativeAddHaptic(haptic.device_id, haptic.name);
if (vib != null) {
if (vib.hasVibrator()) {
haptic = new SDLHaptic();
haptic.device_id = deviceIds[i];
haptic.name = device.getName();
haptic.vib = vib;
mHaptics.add(haptic);
SDLControllerManager.nativeAddHaptic(haptic.device_id, haptic.name);
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions CMake/FetchSDL2.cmake
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FetchContent_Declare(
sdl2_content
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
URL https://github.com/libsdl-org/SDL/archive/refs/tags/release-2.28.5.tar.gz
URL_HASH SHA1=9dba2b579b7bfbd24cb302e4f4b27563cc8f1070
URL https://github.com/libsdl-org/SDL/archive/refs/tags/release-2.30.11.tar.gz
URL_HASH SHA1=db4ae1d7a477854d44a468f19661794b59721267
)

FetchContent_GetProperties(sdl2_content)
Expand Down
2 changes: 1 addition & 1 deletion ci/linux/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ RUN curl -fLsS "https://github.com/xiph/vorbis/releases/download/v${LIBVORBIS_VE
rm /tmp/libvorbis-${LIBVORBIS_VERSION}.tar.gz

# Build and install SDL2
ARG SDL_VERSION=release-2.28.5
ARG SDL_VERSION=release-2.30.11
RUN curl -fLsS "https://github.com/libsdl-org/SDL/archive/refs/tags/${SDL_VERSION}.tar.gz" | tar -f - -xvzC /tmp && \
cd /tmp/SDL-${SDL_VERSION} && \
./configure --enable-shared --enable-loadso --enable-pulseaudio-shared --enable-sndio-shared --enable-x11-shared --enable-oss=no --enable-libsamplerate-shared --enable-video-wayland=no --enable-directfb-shared --enable-rpath=no && \
Expand Down
4 changes: 2 additions & 2 deletions ci/windows/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ RUN mkdir Redist && \
curl -fLOJ https://download.microsoft.com/download/6/A/A/6AA4EDFF-645B-48C5-81CC-ED5963AEAD48/vc_redist.x86.exe && \
curl -fLOJ https://download.microsoft.com/download/6/A/A/6AA4EDFF-645B-48C5-81CC-ED5963AEAD48/vc_redist.x64.exe

ARG SDL_VERSION=release-2.28.5
ARG SDL_VERSION_NUMBER=2.28.5
ARG SDL_VERSION=release-2.30.11
ARG SDL_VERSION_NUMBER=2.30.11
RUN mkdir Lib\SDL2 && \
curl -fLOJ "https://github.com/libsdl-org/SDL/releases/download/%SDL_VERSION%/SDL2-devel-%SDL_VERSION_NUMBER%-VC.zip" && \
tar -f SDL2-devel-%SDL_VERSION_NUMBER%-VC.zip -xvzC Lib\SDL2\ --strip-components 1 && \
Expand Down
4 changes: 2 additions & 2 deletions libsrc/download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ get https://github.com/xiph/theora/archive/${LIBTHEORA_VERSION}.tar.gz theora.ta
SDLSOUND_VERSION=474dbf755a1b67ebe7a55467b4f65e033f268aff
get https://github.com/icculus/SDL_sound/archive/${SDLSOUND_VERSION}.tar.gz SDL_sound.tar.gz

SDL_VERSION=release-2.28.5
SDL_VERSION_NUMBER=2.28.5
SDL_VERSION=release-2.30.11
SDL_VERSION_NUMBER=2.30.11
# Framework for macOS
get https://github.com/libsdl-org/SDL/releases/download/${SDL_VERSION}/SDL2-${SDL_VERSION_NUMBER}.dmg SDL2-Framework.dmg
# Full code for iOS
Expand Down
2 changes: 1 addition & 1 deletion libsrc/sha1sums
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
9dba2b579b7bfbd24cb302e4f4b27563cc8f1070 SDL.tar.gz
db4ae1d7a477854d44a468f19661794b59721267 SDL.tar.gz
7f6b977a7ebae4cdecd4ac9b9404760a9e9a6b77 SDL_sound.tar.gz
8085a94164c1eb6cfab245c5b4306c2d3ec847cd ogg.tar.gz
beaeae25bc7ace77007f42c33e0b0fa74acf4992 theora.tar.gz
Expand Down
4 changes: 2 additions & 2 deletions version.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"urlHash": "7f6b977a7ebae4cdecd4ac9b9404760a9e9a6b77"
},
"sdl": {
"revision": "2.28.5",
"revision": "2.30.11",
"release_type": "release",
"urlHash": "9dba2b579b7bfbd24cb302e4f4b27563cc8f1070"
"urlHash": "db4ae1d7a477854d44a468f19661794b59721267"
}
}
}
Loading