Skip to content

Commit

Permalink
Merge pull request #9624 from JosJuice/input-override
Browse files Browse the repository at this point in the history
Add new "input override" system for TAS input and Android touch controls
  • Loading branch information
JMC47 authored Oct 3, 2022
2 parents cb6d476 + 51ee05c commit 052c739
Show file tree
Hide file tree
Showing 62 changed files with 1,760 additions and 855 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,6 @@ public static void rumble(int padID, double state)
public static native void SetMotionSensorsEnabled(boolean accelerometerEnabled,
boolean gyroscopeEnabled);

// Angle is in radians and should be non-negative
public static native double GetInputRadiusAtAngle(int emu_pad_id, int stick, double angle);

/**
* Gets the Dolphin version string.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// SPDX-License-Identifier: GPL-2.0-or-later

package org.dolphinemu.dolphinemu.features.input.model;

public final class InputOverrider
{
public static final class ControlId
{
public static final int GCPAD_A_BUTTON = 0;
public static final int GCPAD_B_BUTTON = 1;
public static final int GCPAD_X_BUTTON = 2;
public static final int GCPAD_Y_BUTTON = 3;
public static final int GCPAD_Z_BUTTON = 4;
public static final int GCPAD_START_BUTTON = 5;
public static final int GCPAD_DPAD_UP = 6;
public static final int GCPAD_DPAD_DOWN = 7;
public static final int GCPAD_DPAD_LEFT = 8;
public static final int GCPAD_DPAD_RIGHT = 9;
public static final int GCPAD_L_DIGITAL = 10;
public static final int GCPAD_R_DIGITAL = 11;
public static final int GCPAD_L_ANALOG = 12;
public static final int GCPAD_R_ANALOG = 13;
public static final int GCPAD_MAIN_STICK_X = 14;
public static final int GCPAD_MAIN_STICK_Y = 15;
public static final int GCPAD_C_STICK_X = 16;
public static final int GCPAD_C_STICK_Y = 17;

public static final int WIIMOTE_A_BUTTON = 18;
public static final int WIIMOTE_B_BUTTON = 19;
public static final int WIIMOTE_ONE_BUTTON = 20;
public static final int WIIMOTE_TWO_BUTTON = 21;
public static final int WIIMOTE_PLUS_BUTTON = 22;
public static final int WIIMOTE_MINUS_BUTTON = 23;
public static final int WIIMOTE_HOME_BUTTON = 24;
public static final int WIIMOTE_DPAD_UP = 25;
public static final int WIIMOTE_DPAD_DOWN = 26;
public static final int WIIMOTE_DPAD_LEFT = 27;
public static final int WIIMOTE_DPAD_RIGHT = 28;
public static final int WIIMOTE_IR_X = 29;
public static final int WIIMOTE_IR_Y = 30;

public static final int NUNCHUK_C_BUTTON = 31;
public static final int NUNCHUK_Z_BUTTON = 32;
public static final int NUNCHUK_STICK_X = 33;
public static final int NUNCHUK_STICK_Y = 34;

public static final int CLASSIC_A_BUTTON = 35;
public static final int CLASSIC_B_BUTTON = 36;
public static final int CLASSIC_X_BUTTON = 37;
public static final int CLASSIC_Y_BUTTON = 38;
public static final int CLASSIC_ZL_BUTTON = 39;
public static final int CLASSIC_ZR_BUTTON = 40;
public static final int CLASSIC_PLUS_BUTTON = 41;
public static final int CLASSIC_MINUS_BUTTON = 42;
public static final int CLASSIC_HOME_BUTTON = 43;
public static final int CLASSIC_DPAD_UP = 44;
public static final int CLASSIC_DPAD_DOWN = 45;
public static final int CLASSIC_DPAD_LEFT = 46;
public static final int CLASSIC_DPAD_RIGHT = 47;
public static final int CLASSIC_L_DIGITAL = 48;
public static final int CLASSIC_R_DIGITAL = 49;
public static final int CLASSIC_L_ANALOG = 50;
public static final int CLASSIC_R_ANALOG = 51;
public static final int CLASSIC_LEFT_STICK_X = 52;
public static final int CLASSIC_LEFT_STICK_Y = 53;
public static final int CLASSIC_RIGHT_STICK_X = 54;
public static final int CLASSIC_RIGHT_STICK_Y = 55;
}

public static native void registerGameCube(int controllerIndex);

public static native void registerWii(int controllerIndex);

public static native void unregisterGameCube(int controllerIndex);

public static native void unregisterWii(int controllerIndex);

public static native void setControlState(int controllerIndex, int control, double state);

public static native void clearControlState(int controllerIndex, int control);

// Angle is in radians and should be non-negative
public static native double getGateRadiusAtAngle(int emuPadId, int stick, double angle);
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ public enum IntSetting implements AbstractIntSetting
InputOverlayPointer.MODE_FOLLOW),

MAIN_DOUBLE_TAP_BUTTON(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID_OVERLAY_BUTTONS,
"DoubleTapButton",
InputOverlayPointer.DOUBLE_TAP_OPTIONS.get(InputOverlayPointer.DOUBLE_TAP_A)),
"DoubleTapButton", NativeLibrary.ButtonType.WIIMOTE_BUTTON_A),

SYSCONF_LANGUAGE(Settings.FILE_SYSCONF, "IPL", "LNG", 0x01),
SYSCONF_SOUND_MODE(Settings.FILE_SYSCONF, "IPL", "SND", 0x01),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,15 @@ public void onPause()
super.onPause();
}

@Override
public void onDestroy()
{
if (mInputOverlay != null)
mInputOverlay.onDestroy();

super.onDestroy();
}

@Override
public void onDetach()
{
Expand Down
Loading

0 comments on commit 052c739

Please sign in to comment.