summaryrefslogtreecommitdiff
path: root/Source/Android/src
diff options
context:
space:
mode:
authorRyan Houdek <Sonicadvance1@gmail.com>2014-04-23 03:49:25 -0500
committerRyan Houdek <Sonicadvance1@gmail.com>2014-04-24 08:51:44 -0500
commite1bbda1e1884665ff52d5250458e40b7227a53bc (patch)
treef6f208a31916a9032fd0c525b062f801b22d296a /Source/Android/src
parent9f12d023284419a08ae89717fd65b0550bd0b5e6 (diff)
[Android] Fix a bunch of input bugs.
Looking at the old code for the ButtonManager was a brainfsck. This fixes a ton of bugs I kept uncovering as I was moving along. Fixes the gamepad configuration file being incorrect. No longer treats touchscreen in a special way. Ends up as a regular device with a "Touchscreen" device name. Was incorrectly converting a index from integer to ButtonType. Wouldn't work due to the addition of some unused(in JNI) enumerators in ButtonType. Fixes an issue where a map had a key as an axis which was causing its binding to be overwritten for every axis that was used twice (eg main stick left and right); Fixes Triggers not working at all. Fixes DPad not working at all. Fixes C-Stick only half working. Removes touch screen specific nativelibrary types onTouchAxisEvent and onTouchEvent. Adds a configuration version configuration option. Allows easy configuration overwriting if the options need to be changed during updating. Supersedes github PR #291.
Diffstat (limited to 'Source/Android/src')
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java5
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java18
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/emulation/EmulationActivity.java4
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/emulation/overlay/InputOverlay.java6
4 files changed, 11 insertions, 22 deletions
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java b/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java
index b28d476e23..22e482349f 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java
@@ -69,7 +69,6 @@ public final class DolphinEmulator extends Activity
if(!file.exists())
{
NativeLibrary.CreateUserFolders();
- CopyAsset("GCPadNew.ini", ConfigDir + File.separator + "GCPadNew.ini");
CopyAsset("Dolphin.ini", ConfigDir + File.separator + "Dolphin.ini");
CopyAsset("dsp_coef.bin", GCDir + File.separator + "dsp_coef.bin");
CopyAsset("dsp_rom.bin", GCDir + File.separator + "dsp_rom.bin");
@@ -77,6 +76,10 @@ public final class DolphinEmulator extends Activity
CopyAsset("font_sjis.bin", GCDir + File.separator + "font_sjis.bin");
}
+ // Always copy over the GCPad config in case of change or corruption.
+ // Not a user configurable file.
+ CopyAsset("GCPadNew.ini", ConfigDir + File.separator + "GCPadNew.ini");
+
// Load the configuration keys set in the Dolphin ini and gfx ini files
// into the application's shared preferences.
UserPreferences.LoadIniToPrefs(this);
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java b/Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java
index 6b5cca1448..b66aa0a84f 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java
@@ -54,23 +54,9 @@ public final class NativeLibrary
}
/**
- * Handles touch events.
- *
- * @param padID Identifier for which GCpad 0-3,
- * @param Button Key code identifying which button was pressed,
- * @param Action Mask for the action being performed.
- */
- public static native void onTouchEvent(int padID, int Button, int Action);
-
- /**
- * Handles axis-related touch events.
- *
- * @param padID Identifier for which GCpad 0-3,
- * @param Axis Axis ID for the type of axis being altered. (Example: Main stick up, down, left, right, etc),
- * @param force How 'far down' the joystick is pushed down. 0.0f indicates center (or no force),
- * 1.0f indicates max force (or joystick pushed all the way down in any arbitrary direction).
+ * Default touchscreen device
*/
- public static native void onTouchAxisEvent(int padID, int Axis, float force);
+ public static final String TouchScreenDevice = "Touchscreen";
/**
* Handles button press events for a gamepad.
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/emulation/EmulationActivity.java b/Source/Android/src/org/dolphinemu/dolphinemu/emulation/EmulationActivity.java
index cb13b9e2d6..b28653e03b 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/emulation/EmulationActivity.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/emulation/EmulationActivity.java
@@ -290,10 +290,10 @@ public final class EmulationActivity extends Activity
}
// Normal key events.
- action = 0;
+ action = NativeLibrary.ButtonState.PRESSED;
break;
case KeyEvent.ACTION_UP:
- action = 1;
+ action = NativeLibrary.ButtonState.RELEASED;
break;
default:
return false;
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/emulation/overlay/InputOverlay.java b/Source/Android/src/org/dolphinemu/dolphinemu/emulation/overlay/InputOverlay.java
index 5df8841814..0d5a8580da 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/emulation/overlay/InputOverlay.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/emulation/overlay/InputOverlay.java
@@ -123,14 +123,14 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
{
if (button.getBounds().contains((int)event.getX(), (int)event.getY()))
{
- NativeLibrary.onTouchEvent(0, button.getId(), buttonState);
+ NativeLibrary.onGamePadEvent(NativeLibrary.TouchScreenDevice, button.getId(), buttonState);
}
else
{
// Because the above code only changes the state for the button that is being touched, sliding off the
// button does not allow for it to be released. Release the button as soon as the touch coordinates leave
// the button bounds.
- NativeLibrary.onTouchEvent(0, button.getId(), ButtonState.RELEASED);
+ NativeLibrary.onGamePadEvent(NativeLibrary.TouchScreenDevice, button.getId(), ButtonState.RELEASED);
}
}
@@ -142,7 +142,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
float[] axises = joystick.getAxisValues();
for (int i = 0; i < 4; i++)
- NativeLibrary.onTouchAxisEvent(0, axisIDs[i], axises[i]);
+ NativeLibrary.onGamePadMoveEvent(NativeLibrary.TouchScreenDevice, axisIDs[i], axises[i]);
}
return true;