mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2026-04-18 08:36:56 -04:00
SDL: Add back proper checks for GLFW/SDL switch
This commit is contained in:
@@ -112,7 +112,7 @@ public class MainActivity extends BaseActivity implements ControlButtonMenuListe
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (true) {
|
||||
if (LauncherPreferences.PREF_GAMEPAD_SDL_PASSTHRU) {
|
||||
// TODO: Use lower level HID capture that needs a dialogue box from the user for the
|
||||
// app to fully take focus of the input devices. Might cause issues with older android
|
||||
// versions so we don't use that right now. Needs testing.
|
||||
|
||||
@@ -220,11 +220,11 @@ public class MinecraftGLSurface extends View implements GrabListener, DirectGame
|
||||
}
|
||||
|
||||
private void createGamepad(View contextView, InputDevice inputDevice) {
|
||||
if(CallbackBridge.sGamepadDirectInput) {
|
||||
if(CallbackBridge.sGamepadDirectInput && !LauncherPreferences.PREF_GAMEPAD_SDL_PASSTHRU) {
|
||||
mGamepadHandler = new DirectGamepad();
|
||||
}else {
|
||||
}else if(!LauncherPreferences.PREF_GAMEPAD_SDL_PASSTHRU) {
|
||||
mGamepadHandler = new Gamepad(contextView, inputDevice, DefaultDataProvider.INSTANCE, true);
|
||||
}
|
||||
}else mGamepadHandler = (code, value) -> {}; // Ensure it isn't null while also not processing the events.
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -310,7 +310,8 @@ public class MinecraftGLSurface extends View implements GrabListener, DirectGame
|
||||
}
|
||||
// Android bundles in garbage KeyEvents for compatibility with old apps
|
||||
// that don't have controller code so we are, checking for em.
|
||||
if (eventKeycode >= KeyEvent.KEYCODE_BUTTON_A &&
|
||||
if (LauncherPreferences.PREF_GAMEPAD_SDL_PASSTHRU &&
|
||||
eventKeycode >= KeyEvent.KEYCODE_BUTTON_A &&
|
||||
eventKeycode <= KeyEvent.KEYCODE_BUTTON_MODE) {
|
||||
try {
|
||||
SDLActivity.handleKeyEvent(this, eventKeycode, event, null);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
</Preference>
|
||||
|
||||
<androidx.preference.SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:defaultValue="true"
|
||||
android:icon="@drawable/ic_menu_custom_controls"
|
||||
android:key="gamepadPassthru"
|
||||
android:summary="@string/mcl_gamepad_SDL_subtitle"
|
||||
|
||||
Reference in New Issue
Block a user