Skip to content

Commit aa170a3

Browse files
authored
Merge pull request #178 from OpenBrickProtocolFoundation/update_sdl_2_30_6
update sdl2 to 2.30.6
2 parents bb12fc2 + 4e14124 commit aa170a3

File tree

16 files changed

+66
-56
lines changed

16 files changed

+66
-56
lines changed

.github/workflows/android.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646

4747
- name: Setup NDK
4848
run: |
49-
sdkmanager --install "ndk;27.0.12077973"
49+
sdkmanager --install "ndk;27.1.12297006"
5050
5151
5252
- name: Build native libraries

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ jobs:
9797
uses: TheMrMilchmann/setup-msvc-dev@v3
9898
with:
9999
arch: x64
100-
toolset: "14.40"
100+
toolset: "14.41"
101101

102102

103103
- name: Setup MYSYS2 (Windows)

.github/workflows/installer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
uses: TheMrMilchmann/setup-msvc-dev@v3
3737
with:
3838
arch: x64
39-
toolset: "14.40"
39+
toolset: "14.41"
4040

4141
- name: Setup meson
4242
if: matrix.config.os != 'macos'

platforms/android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ android {
248248
}
249249

250250
compileSdkVersion 34
251-
ndkVersion "27.0.12077973"
251+
ndkVersion "27.1.12297006"
252252
defaultConfig {
253253
if (buildAsApplication) {
254254
applicationId "com.github.oopetris"

platforms/android/app/jni/Android.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ SUBPROJECTS_PATH :=$(BUILD_PATH)/subprojects
44

55
include $(CLEAR_VARS)
66
LOCAL_MODULE := SDL2
7-
LOCAL_SRC_FILES := $(shell find "${SUBPROJECTS_PATH}" -name libsdl2.so)
7+
LOCAL_SRC_FILES := $(shell find "${SUBPROJECTS_PATH}" -name libSDL2.so)
88
include $(PREBUILT_SHARED_LIBRARY)
99

1010

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

platforms/build-android.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ set -e
44

55
mkdir -p toolchains
66

7-
export NDK_VER_DOWNLOAD="r27"
8-
export NDK_VER_DESC="r27"
7+
export NDK_VER_DOWNLOAD="r27b"
8+
export NDK_VER_DESC="r27b"
99

1010
export BASE_PATH="$PWD/toolchains/android-ndk-$NDK_VER_DESC"
1111
export ANDROID_NDK_HOME="$BASE_PATH"

0 commit comments

Comments
 (0)