Skip to content

Commit 43d8d0b

Browse files
committed
feat: update sdl2 2.30.6
1 parent 0420d89 commit 43d8d0b

File tree

4 files changed

+25
-15
lines changed

4 files changed

+25
-15
lines changed

project/android/app/src/main/java/org/libsdl/app/HIDDeviceManager.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ private boolean isXboxOneController(UsbDevice usbDevice, UsbInterface usbInterfa
277277
0x044f, // Thrustmaster
278278
0x045e, // Microsoft
279279
0x0738, // Mad Catz
280+
0x0b05, // ASUS
280281
0x0e6f, // PDP
281282
0x0f0d, // Hori
282283
0x10f5, // Turtle Beach
@@ -590,7 +591,13 @@ public boolean openDevice(int deviceID) {
590591
} else {
591592
flags = 0;
592593
}
593-
mUsbManager.requestPermission(usbDevice, PendingIntent.getBroadcast(mContext, 0, new Intent(HIDDeviceManager.ACTION_USB_PERMISSION), flags));
594+
if (Build.VERSION.SDK_INT >= 33 /* Android 14.0 (U) */) {
595+
Intent intent = new Intent(HIDDeviceManager.ACTION_USB_PERMISSION);
596+
intent.setPackage(mContext.getPackageName());
597+
mUsbManager.requestPermission(usbDevice, PendingIntent.getBroadcast(mContext, 0, intent, flags));
598+
} else {
599+
mUsbManager.requestPermission(usbDevice, PendingIntent.getBroadcast(mContext, 0, new Intent(HIDDeviceManager.ACTION_USB_PERMISSION), flags));
600+
}
594601
} catch (Exception e) {
595602
Log.v(TAG, "Couldn't request permission for USB device " + usbDevice);
596603
HIDDeviceOpenResult(deviceID, false);

project/android/app/src/main/java/org/libsdl/app/SDL.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ public static Context getContext() {
3838
}
3939

4040
public static void loadLibrary(String libraryName) throws UnsatisfiedLinkError, SecurityException, NullPointerException {
41+
loadLibrary(libraryName, mContext);
42+
}
43+
44+
public static void loadLibrary(String libraryName, Context context) throws UnsatisfiedLinkError, SecurityException, NullPointerException {
4145

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

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

6771
// Actually load the library!
6872
Method loadMethod = relinkInstanceClass.getDeclaredMethod("loadLibrary", contextClass, stringClass, stringClass, relinkListenerClass);
69-
loadMethod.invoke(relinkInstance, mContext, libraryName, null, null);
73+
loadMethod.invoke(relinkInstance, context, libraryName, null, null);
7074
}
7175
catch (final Throwable e) {
7276
// Fall back

project/android/app/src/main/java/org/libsdl/app/SDLActivity.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
6161
private static final String TAG = "SDL";
6262
private static final int SDL_MAJOR_VERSION = 2;
6363
private static final int SDL_MINOR_VERSION = 30;
64-
private static final int SDL_MICRO_VERSION = 3;
64+
private static final int SDL_MICRO_VERSION = 6;
6565
/*
6666
// Display InputType.SOURCE/CLASS of events and devices
6767
//
@@ -281,7 +281,7 @@ protected String[] getLibraries() {
281281
// Load the .so
282282
public void loadLibraries() {
283283
for (String lib : getLibraries()) {
284-
SDL.loadLibrary(lib);
284+
SDL.loadLibrary(lib, this);
285285
}
286286
}
287287

@@ -995,8 +995,8 @@ public void setOrientationBis(int w, int h, boolean resizable, String hint)
995995
/* No valid hint, nothing is explicitly allowed */
996996
if (!is_portrait_allowed && !is_landscape_allowed) {
997997
if (resizable) {
998-
/* All orientations are allowed */
999-
req = ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR;
998+
/* All orientations are allowed, respecting user orientation lock setting */
999+
req = ActivityInfo.SCREEN_ORIENTATION_FULL_USER;
10001000
} else {
10011001
/* Fixed window and nothing specified. Get orientation from w/h of created window */
10021002
req = (w > h ? ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE : ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
@@ -1005,8 +1005,8 @@ public void setOrientationBis(int w, int h, boolean resizable, String hint)
10051005
/* At least one orientation is allowed */
10061006
if (resizable) {
10071007
if (is_portrait_allowed && is_landscape_allowed) {
1008-
/* hint allows both landscape and portrait, promote to full sensor */
1009-
req = ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR;
1008+
/* hint allows both landscape and portrait, promote to full user */
1009+
req = ActivityInfo.SCREEN_ORIENTATION_FULL_USER;
10101010
} else {
10111011
/* Use the only one allowed "orientation" */
10121012
req = (is_landscape_allowed ? orientation_landscape : orientation_portrait);

xmake.lua

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,19 +92,18 @@ end
9292

9393
add_requireconfs("sdl2", {system=false, configs=sdlConfigs})
9494
add_requireconfs("**.sdl2", {system=false, configs=sdlConfigs})
95-
add_requireconfs("**.harfbuzz", {system=false, configs={freetype=true}})
95+
-- add_requireconfs("**.harfbuzz", {system=false, configs={freetype=true}})
9696
add_requireconfs("**.freetype", {system=false})
9797
add_requires("freetype", {
9898
system=false,
9999
configs={
100-
harfbuzz=true,
101100
zlib=true,
102101
bzip2=true,
103102
brotli=true,
104103
png=true
105104
}
106105
})
107-
add_requires("sdl2_ttf", {system=false,configs={harfbuzz=true}})
106+
add_requires("sdl2_ttf", {system=false})
108107
local sdl2_image_config = {
109108
webp=true
110109
}

0 commit comments

Comments
 (0)