mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
[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.
This commit is contained in:
@ -12,14 +12,14 @@ Main Stick/Left = `Axis 13`
|
||||
Main Stick/Right = `Axis 14`
|
||||
Main Stick/Modifier = Shift_L
|
||||
Main Stick/Modifier/Range = 50.000000
|
||||
C-Stick/Up = `Axis 15`
|
||||
C-Stick/Down = `Axis 16`
|
||||
C-Stick/Left = `Axis 17`
|
||||
C-Stick/Right = `Axis 18`
|
||||
C-Stick/Up = `Axis 16`
|
||||
C-Stick/Down = `Axis 17`
|
||||
C-Stick/Left = `Axis 18`
|
||||
C-Stick/Right = `Axis 19`
|
||||
C-Stick/Modifier = Control_L
|
||||
C-Stick/Modifier/Range = 50.000000
|
||||
Triggers/L = `Button 18`
|
||||
Triggers/R = `Button 19`
|
||||
Triggers/L = `Axis 20`
|
||||
Triggers/R = `Axis 21`
|
||||
D-Pad/Up = `Button 6`
|
||||
D-Pad/Down = `Button 7`
|
||||
D-Pad/Left = `Button 8`
|
||||
@ -38,14 +38,14 @@ Main Stick/Left = `Axis 13`
|
||||
Main Stick/Right = `Axis 14`
|
||||
Main Stick/Modifier = Shift_L
|
||||
Main Stick/Modifier/Range = 50.000000
|
||||
C-Stick/Up = `Axis 15`
|
||||
C-Stick/Down = `Axis 16`
|
||||
C-Stick/Left = `Axis 17`
|
||||
C-Stick/Right = `Axis 18`
|
||||
C-Stick/Up = `Axis 16`
|
||||
C-Stick/Down = `Axis 17`
|
||||
C-Stick/Left = `Axis 18`
|
||||
C-Stick/Right = `Axis 19`
|
||||
C-Stick/Modifier = Control_L
|
||||
C-Stick/Modifier/Range = 50.000000
|
||||
Triggers/L = `Axis 18`
|
||||
Triggers/R = `Axis 19`
|
||||
Triggers/L = `Axis 20`
|
||||
Triggers/R = `Axis 21`
|
||||
D-Pad/Up = `Button 6`
|
||||
D-Pad/Down = `Button 7`
|
||||
D-Pad/Left = `Button 8`
|
||||
@ -64,14 +64,14 @@ Main Stick/Left = `Axis 13`
|
||||
Main Stick/Right = `Axis 14`
|
||||
Main Stick/Modifier = Shift_L
|
||||
Main Stick/Modifier/Range = 50.000000
|
||||
C-Stick/Up = `Axis 15`
|
||||
C-Stick/Down = `Axis 16`
|
||||
C-Stick/Left = `Axis 17`
|
||||
C-Stick/Right = `Axis 18`
|
||||
C-Stick/Up = `Axis 16`
|
||||
C-Stick/Down = `Axis 17`
|
||||
C-Stick/Left = `Axis 18`
|
||||
C-Stick/Right = `Axis 19`
|
||||
C-Stick/Modifier = Control_L
|
||||
C-Stick/Modifier/Range = 50.000000
|
||||
Triggers/L = `Axis 18`
|
||||
Triggers/R = `Axis 19`
|
||||
Triggers/L = `Axis 20`
|
||||
Triggers/R = `Axis 21`
|
||||
D-Pad/Up = `Button 6`
|
||||
D-Pad/Down = `Button 7`
|
||||
D-Pad/Left = `Button 8`
|
||||
@ -90,14 +90,14 @@ Main Stick/Left = `Axis 13`
|
||||
Main Stick/Right = `Axis 14`
|
||||
Main Stick/Modifier = Shift_L
|
||||
Main Stick/Modifier/Range = 50.000000
|
||||
C-Stick/Up = `Axis 15`
|
||||
C-Stick/Down = `Axis 16`
|
||||
C-Stick/Left = `Axis 17`
|
||||
C-Stick/Right = `Axis 18`
|
||||
C-Stick/Up = `Axis 16`
|
||||
C-Stick/Down = `Axis 17`
|
||||
C-Stick/Left = `Axis 18`
|
||||
C-Stick/Right = `Axis 19`
|
||||
C-Stick/Modifier = Control_L
|
||||
C-Stick/Modifier/Range = 50.000000
|
||||
Triggers/L = `Axis 18`
|
||||
Triggers/R = `Axis 19`
|
||||
Triggers/L = `Axis 20`
|
||||
Triggers/R = `Axis 21`
|
||||
D-Pad/Up = `Button 6`
|
||||
D-Pad/Down = `Button 7`
|
||||
D-Pad/Left = `Button 8`
|
||||
|
@ -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);
|
||||
|
@ -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.
|
||||
* Default touchscreen device
|
||||
*/
|
||||
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).
|
||||
*/
|
||||
public static native void onTouchAxisEvent(int padID, int Axis, float force);
|
||||
public static final String TouchScreenDevice = "Touchscreen";
|
||||
|
||||
/**
|
||||
* Handles button press events for a gamepad.
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user