diff --git a/src/Native/Silk.NET.SDL.Native/runtimes/ios/native/libSDL2.a b/src/Native/Silk.NET.SDL.Native/runtimes/ios/native/libSDL2.a index e3469b70ff..b8e66b76c1 100644 Binary files a/src/Native/Silk.NET.SDL.Native/runtimes/ios/native/libSDL2.a and b/src/Native/Silk.NET.SDL.Native/runtimes/ios/native/libSDL2.a differ diff --git a/src/Native/Silk.NET.SDL.Native/runtimes/iossimulator/native/libSDL2.a b/src/Native/Silk.NET.SDL.Native/runtimes/iossimulator/native/libSDL2.a index efbf09b5d9..b398cce77b 100644 Binary files a/src/Native/Silk.NET.SDL.Native/runtimes/iossimulator/native/libSDL2.a and b/src/Native/Silk.NET.SDL.Native/runtimes/iossimulator/native/libSDL2.a differ diff --git a/src/Native/Silk.NET.SDL.Native/runtimes/linux-arm/native/libSDL2-2.0.so b/src/Native/Silk.NET.SDL.Native/runtimes/linux-arm/native/libSDL2-2.0.so index 20016fa718..69e3f70520 100755 Binary files a/src/Native/Silk.NET.SDL.Native/runtimes/linux-arm/native/libSDL2-2.0.so and b/src/Native/Silk.NET.SDL.Native/runtimes/linux-arm/native/libSDL2-2.0.so differ diff --git a/src/Native/Silk.NET.SDL.Native/runtimes/linux-arm64/native/libSDL2-2.0.so b/src/Native/Silk.NET.SDL.Native/runtimes/linux-arm64/native/libSDL2-2.0.so index 49f77d7c83..d3b36509ac 100755 Binary files a/src/Native/Silk.NET.SDL.Native/runtimes/linux-arm64/native/libSDL2-2.0.so and b/src/Native/Silk.NET.SDL.Native/runtimes/linux-arm64/native/libSDL2-2.0.so differ diff --git a/src/Native/Silk.NET.SDL.Native/runtimes/linux-x64/native/libSDL2-2.0.so b/src/Native/Silk.NET.SDL.Native/runtimes/linux-x64/native/libSDL2-2.0.so index 137fe52542..e537df2df2 100755 Binary files a/src/Native/Silk.NET.SDL.Native/runtimes/linux-x64/native/libSDL2-2.0.so and b/src/Native/Silk.NET.SDL.Native/runtimes/linux-x64/native/libSDL2-2.0.so differ diff --git a/src/Native/Silk.NET.SDL.Native/runtimes/osx/native/libSDL2-2.0.dylib b/src/Native/Silk.NET.SDL.Native/runtimes/osx/native/libSDL2-2.0.dylib index 42c0d24617..61254afd75 100755 Binary files a/src/Native/Silk.NET.SDL.Native/runtimes/osx/native/libSDL2-2.0.dylib and b/src/Native/Silk.NET.SDL.Native/runtimes/osx/native/libSDL2-2.0.dylib differ diff --git a/src/Native/Silk.NET.SDL.Native/runtimes/tvos/native/libSDL2.a b/src/Native/Silk.NET.SDL.Native/runtimes/tvos/native/libSDL2.a index d6605533a1..4e90fc9622 100644 Binary files a/src/Native/Silk.NET.SDL.Native/runtimes/tvos/native/libSDL2.a and b/src/Native/Silk.NET.SDL.Native/runtimes/tvos/native/libSDL2.a differ diff --git a/src/Native/Silk.NET.SDL.Native/runtimes/tvossimulator/native/libSDL2.a b/src/Native/Silk.NET.SDL.Native/runtimes/tvossimulator/native/libSDL2.a index 5d8ea6f5b0..070b75fd2d 100644 Binary files a/src/Native/Silk.NET.SDL.Native/runtimes/tvossimulator/native/libSDL2.a and b/src/Native/Silk.NET.SDL.Native/runtimes/tvossimulator/native/libSDL2.a differ diff --git a/src/Native/Silk.NET.SDL.Native/runtimes/win-arm64/native/SDL2.dll b/src/Native/Silk.NET.SDL.Native/runtimes/win-arm64/native/SDL2.dll index 72787dc5ea..9c1092aca5 100644 Binary files a/src/Native/Silk.NET.SDL.Native/runtimes/win-arm64/native/SDL2.dll and b/src/Native/Silk.NET.SDL.Native/runtimes/win-arm64/native/SDL2.dll differ diff --git a/src/Native/Silk.NET.SDL.Native/runtimes/win-x64/native/SDL2.dll b/src/Native/Silk.NET.SDL.Native/runtimes/win-x64/native/SDL2.dll index fff4b44527..f7f4e69777 100644 Binary files a/src/Native/Silk.NET.SDL.Native/runtimes/win-x64/native/SDL2.dll and b/src/Native/Silk.NET.SDL.Native/runtimes/win-x64/native/SDL2.dll differ diff --git a/src/Native/Silk.NET.SDL.Native/runtimes/win-x86/native/SDL2.dll b/src/Native/Silk.NET.SDL.Native/runtimes/win-x86/native/SDL2.dll index 387fcf304c..00895f6860 100644 Binary files a/src/Native/Silk.NET.SDL.Native/runtimes/win-x86/native/SDL2.dll and b/src/Native/Silk.NET.SDL.Native/runtimes/win-x86/native/SDL2.dll differ diff --git a/src/Windowing/Silk.NET.Windowing.Sdl/Android/app-release.aar b/src/Windowing/Silk.NET.Windowing.Sdl/Android/app-release.aar index 99d2061d8f..91cfd74a34 100644 Binary files a/src/Windowing/Silk.NET.Windowing.Sdl/Android/app-release.aar and b/src/Windowing/Silk.NET.Windowing.Sdl/Android/app-release.aar differ diff --git a/src/Windowing/Silk.NET.Windowing.Sdl/PublicAPI/net6.0-android/PublicAPI.Unshipped.txt b/src/Windowing/Silk.NET.Windowing.Sdl/PublicAPI/net6.0-android/PublicAPI.Unshipped.txt index 6de42df6ee..eb0057b5b2 100644 --- a/src/Windowing/Silk.NET.Windowing.Sdl/PublicAPI/net6.0-android/PublicAPI.Unshipped.txt +++ b/src/Windowing/Silk.NET.Windowing.Sdl/PublicAPI/net6.0-android/PublicAPI.Unshipped.txt @@ -15,6 +15,7 @@ Org.Libsdl.App.SDLSurface.SDLSurface(System.IntPtr javaReference, Android.Runtim override Org.Libsdl.App.SDLSurface.JniPeerMembers.get -> Java.Interop.JniPeerMembers! override Org.Libsdl.App.SDLSurface.ThresholdClass.get -> System.IntPtr override Org.Libsdl.App.SDLSurface.ThresholdType.get -> System.Type! +static Org.Libsdl.App.SDL.LoadLibrary(string? libraryName, Android.Content.Context? context) -> void static Org.Libsdl.App.SDLActivity.DestroyCustomCursor(int cursorID) -> void static Org.Libsdl.App.SDLActivity.HandleKeyEvent(Android.Views.View? v, int keyCode, Android.Views.KeyEvent? e, Android.Views.InputMethods.IInputConnection? ic) -> bool static Org.Libsdl.App.SDLActivity.NativeGetHintBoolean(string? p0, bool p1) -> bool diff --git a/src/Windowing/SilkDroid/app/src/main/java/org/libsdl/app/HIDDeviceManager.java b/src/Windowing/SilkDroid/app/src/main/java/org/libsdl/app/HIDDeviceManager.java index e7281fdf26..21a1c1d18e 100644 --- a/src/Windowing/SilkDroid/app/src/main/java/org/libsdl/app/HIDDeviceManager.java +++ b/src/Windowing/SilkDroid/app/src/main/java/org/libsdl/app/HIDDeviceManager.java @@ -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 @@ -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); diff --git a/src/Windowing/SilkDroid/app/src/main/java/org/libsdl/app/SDL.java b/src/Windowing/SilkDroid/app/src/main/java/org/libsdl/app/SDL.java index 44c21c1c75..139be9d151 100644 --- a/src/Windowing/SilkDroid/app/src/main/java/org/libsdl/app/SDL.java +++ b/src/Windowing/SilkDroid/app/src/main/java/org/libsdl/app/SDL.java @@ -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."); @@ -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. @@ -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 diff --git a/src/Windowing/SilkDroid/app/src/main/java/org/libsdl/app/SDLActivity.java b/src/Windowing/SilkDroid/app/src/main/java/org/libsdl/app/SDLActivity.java index fd5a056e3f..05ed80bdfa 100644 --- a/src/Windowing/SilkDroid/app/src/main/java/org/libsdl/app/SDLActivity.java +++ b/src/Windowing/SilkDroid/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -61,7 +61,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh private static final String TAG = "SDL"; private static final int SDL_MAJOR_VERSION = 2; private static final int SDL_MINOR_VERSION = 30; - private static final int SDL_MICRO_VERSION = 1; + private static final int SDL_MICRO_VERSION = 8; /* // Display InputType.SOURCE/CLASS of events and devices // @@ -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; @@ -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); } @@ -281,7 +281,7 @@ protected String[] getLibraries() { // Load the .so public void loadLibraries() { for (String lib : getLibraries()) { - SDL.loadLibrary(lib); + SDL.loadLibrary(lib, this); } } @@ -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); @@ -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); diff --git a/src/Windowing/SilkDroid/app/src/main/java/org/libsdl/app/SDLControllerManager.java b/src/Windowing/SilkDroid/app/src/main/java/org/libsdl/app/SDLControllerManager.java index d6913f1571..9d8b20b7bb 100644 --- a/src/Windowing/SilkDroid/app/src/main/java/org/libsdl/app/SDLControllerManager.java +++ b/src/Windowing/SilkDroid/app/src/main/java/org/libsdl/app/SDLControllerManager.java @@ -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); + } } } }