Skip to content

Commit 1926c8a

Browse files
committed
update sdl2 to 2.30.6
1 parent bb12fc2 commit 1926c8a

File tree

6 files changed

+37
-27
lines changed

6 files changed

+37
-27
lines changed

platforms/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);

platforms/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

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

Lines changed: 6 additions & 7 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
//
@@ -282,7 +282,7 @@ protected String[] getLibraries() {
282282
// Load the .so
283283
public void loadLibraries() {
284284
for (String lib : getLibraries()) {
285-
SDL.loadLibrary(lib);
285+
SDL.loadLibrary(lib, this);
286286
}
287287
}
288288

@@ -777,7 +777,6 @@ public void handleMessage(Message msg) {
777777
int flags = View.SYSTEM_UI_FLAG_FULLSCREEN |
778778
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
779779
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY |
780-
781780
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
782781
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
783782
View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.INVISIBLE;
@@ -997,8 +996,8 @@ public void setOrientationBis(int w, int h, boolean resizable, String hint)
997996
/* No valid hint, nothing is explicitly allowed */
998997
if (!is_portrait_allowed && !is_landscape_allowed) {
999998
if (resizable) {
1000-
/* All orientations are allowed */
1001-
req = ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR;
999+
/* All orientations are allowed, respecting user orientation lock setting */
1000+
req = ActivityInfo.SCREEN_ORIENTATION_FULL_USER;
10021001
} else {
10031002
/* Fixed window and nothing specified. Get orientation from w/h of created window */
10041003
req = (w > h ? ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE : ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
@@ -1007,8 +1006,8 @@ public void setOrientationBis(int w, int h, boolean resizable, String hint)
10071006
/* At least one orientation is allowed */
10081007
if (resizable) {
10091008
if (is_portrait_allowed && is_landscape_allowed) {
1010-
/* hint allows both landscape and portrait, promote to full sensor */
1011-
req = ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR;
1009+
/* hint allows both landscape and portrait, promote to full user */
1010+
req = ActivityInfo.SCREEN_ORIENTATION_FULL_USER;
10121011
} else {
10131012
/* Use the only one allowed "orientation" */
10141013
req = (is_landscape_allowed ? orientation_landscape : orientation_portrait);

platforms/build-3ds.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,13 @@ mkdir -p "$SDL_ROOT_DIR"
130130

131131
# build sdl2
132132

133-
export SDL2_SRC_DIR="SDL2-2.30.3"
133+
export SDL2_SRC_DIR="SDL2-2.30.6"
134134

135135
if [ ! -d "$SDL2_SRC_DIR" ]; then
136136

137-
wget "https://github.com/libsdl-org/SDL/releases/download/release-2.30.3/SDL2-2.30.3.tar.gz"
138-
tar xzf SDL2-2.30.3.tar.gz
139-
rm -rf SDL2-2.30.3.tar.gz
137+
wget "https://github.com/libsdl-org/SDL/releases/download/release-2.30.6/SDL2-2.30.6.tar.gz"
138+
tar xzf SDL2-2.30.6.tar.gz
139+
rm -rf SDL2-2.30.6.tar.gz
140140

141141
cd $SDL2_SRC_DIR
142142

subprojects/sdl2.wrap

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
[wrap-file]
2-
directory = SDL2-2.30.3
3-
source_url = https://github.com/libsdl-org/SDL/releases/download/release-2.30.3/SDL2-2.30.3.tar.gz
4-
source_filename = SDL2-2.30.3.tar.gz
5-
source_hash = 820440072f8f5b50188c1dae104f2ad25984de268785be40c41a099a510f0aec
6-
patch_filename = sdl2_2.30.3-3_patch.zip
7-
patch_url = https://wrapdb.mesonbuild.com/v2/sdl2_2.30.3-3/get_patch
8-
patch_hash = 58db4d525787a2f0585cc5256b3cf3ef1150ff7a100bd2e8995b478c7ee55e5f
9-
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/sdl2_2.30.3-3/SDL2-2.30.3.tar.gz
10-
wrapdb_version = 2.30.3-3
11-
diff_files = SDL2-2.30.3_android.diff
2+
directory = SDL2-2.30.6
3+
source_url = https://github.com/libsdl-org/SDL/releases/download/release-2.30.6/SDL2-2.30.6.tar.gz
4+
source_filename = SDL2-2.30.6.tar.gz
5+
source_hash = c6ef64ca18a19d13df6eb22df9aff19fb0db65610a74cc81dae33a82235cacd4
6+
patch_filename = sdl2_2.30.6-1_patch.zip
7+
patch_url = https://wrapdb.mesonbuild.com/v2/sdl2_2.30.6-1/get_patch
8+
patch_hash = 9c143c81d02ac33fe4d50b320ee2860e59552a30e087630de298af44a16ed015
9+
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/sdl2_2.30.6-1/SDL2-2.30.6.tar.gz
10+
wrapdb_version = 2.30.6-1
11+
diff_files = SDL2-2.30.6_android.diff
1212

1313
[provide]
1414
sdl2 = sdl2_dep

0 commit comments

Comments
 (0)