From 0150f521f740fc3b1a00d49b432edd0ed32e31d1 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sat, 14 Aug 2021 15:03:54 +0200 Subject: ControllerInterface/Android: Rip out ButtonManager ButtonManager is very different from how a normal input backend works, and is making it hard for us to improve controller support on Android. The following commits will add a new input backend in its place. --- .../org/dolphinemu/dolphinemu/NativeLibrary.java | 2 +- .../dolphinemu/activities/EmulationActivity.java | 49 ++-------------------- 2 files changed, 5 insertions(+), 46 deletions(-) (limited to 'Source/Android/app/src/main/java/org') diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java index d6fc236771..abd5e8cc2c 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java @@ -44,7 +44,7 @@ public final class NativeLibrary } /** - * Button type for use in onTouchEvent + * Button type, for legacy use only */ public static final class ButtonType { diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java index 808adbff26..fb839ed41a 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java @@ -894,21 +894,8 @@ public final class EmulationActivity extends AppCompatActivity implements ThemeP return super.dispatchKeyEvent(event); } - int action; - - switch (event.getAction()) - { - case KeyEvent.ACTION_DOWN: - action = NativeLibrary.ButtonState.PRESSED; - break; - case KeyEvent.ACTION_UP: - action = NativeLibrary.ButtonState.RELEASED; - break; - default: - return false; - } - InputDevice input = event.getDevice(); - return NativeLibrary.onGamePadEvent(input.getDescriptor(), event.getKeyCode(), action); + // TODO + return false; } private void toggleControls() @@ -1271,36 +1258,8 @@ public final class EmulationActivity extends AppCompatActivity implements ThemeP return false; } - if (((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) == 0)) - { - return super.dispatchGenericMotionEvent(event); - } - - // Don't attempt to do anything if we are disconnecting a device. - if (event.getActionMasked() == MotionEvent.ACTION_CANCEL) - return true; - - InputDevice input = event.getDevice(); - List motions = input.getMotionRanges(); - - for (InputDevice.MotionRange range : motions) - { - int axis = range.getAxis(); - float origValue = event.getAxisValue(axis); - float value = ControllerMappingHelper.scaleAxis(input, axis, origValue); - // If the input is still in the "flat" area, that means it's really zero. - // This is used to compensate for imprecision in joysticks. - if (Math.abs(value) > range.getFlat()) - { - NativeLibrary.onGamePadMoveEvent(input.getDescriptor(), axis, value); - } - else - { - NativeLibrary.onGamePadMoveEvent(input.getDescriptor(), axis, 0.0f); - } - } - - return true; + // TODO + return false; } private void showSubMenu(SaveLoadStateFragment.SaveOrLoad saveOrLoad) -- cgit v1.2.3