From c43bff41dffe800a69f077d8f84304586ffce67f Mon Sep 17 00:00:00 2001
From: alexytomi <60690056+alexytomi@users.noreply.github.com>
Date: Wed, 17 Sep 2025 02:03:03 +0800
Subject: [PATCH] SDL: Add force use switch
---
.../net/kdt/pojavlaunch/MainActivity.java | 1 +
.../prefs/LauncherPreferences.java | 2 ++
.../src/main/res/values/strings.xml | 5 +++-
.../src/main/res/xml/pref_control.xml | 24 ++++++++++++-------
4 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/MainActivity.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/MainActivity.java
index 74a1d628f..288812494 100644
--- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/MainActivity.java
+++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/MainActivity.java
@@ -129,6 +129,7 @@ public class MainActivity extends BaseActivity implements ControlButtonMenuListe
motionListener = (View.OnGenericMotionListener)
runMethodbyReflection("org.libsdl.app.SDLActivity",
"getMotionListener");
+ if (LauncherPreferences.PREF_GAMEPAD_FORCEDSDL_PASSTHRU) Tools.SDL.initializeControllerSubsystems();
} catch (UnsatisfiedLinkError ignored) {
// Ignore because if SDL.setupJNI(); fails, SDL wasn't loaded.
} catch (ReflectiveOperationException e) {
diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/prefs/LauncherPreferences.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/prefs/LauncherPreferences.java
index acab148d7..1fe730977 100644
--- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/prefs/LauncherPreferences.java
+++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/prefs/LauncherPreferences.java
@@ -40,6 +40,7 @@ public class LauncherPreferences {
public static boolean PREF_CHECK_LIBRARY_SHA = true;
public static boolean PREF_DISABLE_GESTURES = false;
public static boolean PREF_GAMEPAD_SDL_PASSTHRU = false;
+ public static boolean PREF_GAMEPAD_FORCEDSDL_PASSTHRU = false;
public static boolean PREF_DISABLE_SWAP_HAND = false;
public static float PREF_MOUSESPEED = 1f;
public static int PREF_RAM_ALLOCATION;
@@ -91,6 +92,7 @@ public class LauncherPreferences {
PREF_CHECK_LIBRARY_SHA = DEFAULT_PREF.getBoolean("checkLibraries",true);
PREF_DISABLE_GESTURES = DEFAULT_PREF.getBoolean("disableGestures",false);
PREF_GAMEPAD_SDL_PASSTHRU = DEFAULT_PREF.getBoolean("gamepadPassthru",false);
+ PREF_GAMEPAD_FORCEDSDL_PASSTHRU = DEFAULT_PREF.getBoolean("gamepadPassthruForced",false);
PREF_DISABLE_SWAP_HAND = DEFAULT_PREF.getBoolean("disableDoubleTap", false);
PREF_RAM_ALLOCATION = DEFAULT_PREF.getInt("allocation", findBestRAMAllocation(ctx));
PREF_CUSTOM_JAVA_ARGS = DEFAULT_PREF.getString("javaArgs", "");
diff --git a/app_pojavlauncher/src/main/res/values/strings.xml b/app_pojavlauncher/src/main/res/values/strings.xml
index 8fd87f667..fe3d2cc8c 100644
--- a/app_pojavlauncher/src/main/res/values/strings.xml
+++ b/app_pojavlauncher/src/main/res/values/strings.xml
@@ -166,7 +166,7 @@
Library %s can\'t be checked, have to assume it\'s good
Library %s is fine and usable
Enable SDL controller backend
- Replaces the legacy GLFW controller handling with SDL. Has better mod support.
+ Enables SDL controller backend. Has better mod support. Falls back to GLFW if not used.
Disable gestures
Disables gestures, such as hold to break block, and tap to place a block.
Disable double tap to swap hands
@@ -476,4 +476,7 @@
Vanilla json seems to be corrupt. Please send a bug report on github or discord.
Allow microphone
Click to re-request the notification permission, required for voice chat mods like Simple Voice Chat.
+ Can allow old versions of Legacy4J to use SDL backend
+ Forcibly start SDL controller handling
+ SDL Settings
diff --git a/app_pojavlauncher/src/main/res/xml/pref_control.xml b/app_pojavlauncher/src/main/res/xml/pref_control.xml
index bba8377fb..7747d0c7a 100644
--- a/app_pojavlauncher/src/main/res/xml/pref_control.xml
+++ b/app_pojavlauncher/src/main/res/xml/pref_control.xml
@@ -12,14 +12,6 @@
>
-
-
-
@@ -176,6 +168,22 @@
+
+
+
+
+
+