mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
[Android-overlay] Support multiple gamepads with touch screen controls.
This commit is contained in:
@ -25,5 +25,80 @@ D-Pad/Down = `Button 7`
|
||||
D-Pad/Left = `Button 8`
|
||||
D-Pad/Right = `Button 9`
|
||||
[GCPad2]
|
||||
Device = Android/1/Touchscreen
|
||||
Buttons/A = `Button 0`
|
||||
Buttons/B = `Button 1`
|
||||
Buttons/X = `Button 3`
|
||||
Buttons/Y = `Button 4`
|
||||
Buttons/Z = `Button 5`
|
||||
Buttons/Start = `Button 2`
|
||||
Main Stick/Up = `Axis 11`
|
||||
Main Stick/Down = `Axis 12`
|
||||
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/Modifier = Control_L
|
||||
C-Stick/Modifier/Range = 50.000000
|
||||
Triggers/L = `Axis 18`
|
||||
Triggers/R = `Axis 19`
|
||||
D-Pad/Up = `Button 6`
|
||||
D-Pad/Down = `Button 7`
|
||||
D-Pad/Left = `Button 8`
|
||||
D-Pad/Right = `Button 9`
|
||||
[GCPad3]
|
||||
Device = Android/2/Touchscreen
|
||||
Buttons/A = `Button 0`
|
||||
Buttons/B = `Button 1`
|
||||
Buttons/X = `Button 3`
|
||||
Buttons/Y = `Button 4`
|
||||
Buttons/Z = `Button 5`
|
||||
Buttons/Start = `Button 2`
|
||||
Main Stick/Up = `Axis 11`
|
||||
Main Stick/Down = `Axis 12`
|
||||
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/Modifier = Control_L
|
||||
C-Stick/Modifier/Range = 50.000000
|
||||
Triggers/L = `Axis 18`
|
||||
Triggers/R = `Axis 19`
|
||||
D-Pad/Up = `Button 6`
|
||||
D-Pad/Down = `Button 7`
|
||||
D-Pad/Left = `Button 8`
|
||||
D-Pad/Right = `Button 9`
|
||||
[GCPad4]
|
||||
Device = Android/3/Touchscreen
|
||||
Buttons/A = `Button 0`
|
||||
Buttons/B = `Button 1`
|
||||
Buttons/X = `Button 3`
|
||||
Buttons/Y = `Button 4`
|
||||
Buttons/Z = `Button 5`
|
||||
Buttons/Start = `Button 2`
|
||||
Main Stick/Up = `Axis 11`
|
||||
Main Stick/Down = `Axis 12`
|
||||
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/Modifier = Control_L
|
||||
C-Stick/Modifier/Range = 50.000000
|
||||
Triggers/L = `Axis 18`
|
||||
Triggers/R = `Axis 19`
|
||||
D-Pad/Up = `Button 6`
|
||||
D-Pad/Down = `Button 7`
|
||||
D-Pad/Left = `Button 8`
|
||||
D-Pad/Right = `Button 9`
|
||||
|
@ -56,19 +56,21 @@ public final class NativeLibrary
|
||||
/**
|
||||
* Handles touch events.
|
||||
*
|
||||
* @param Button Key code identifying which button was pressed.
|
||||
* @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 Button, int Action);
|
||||
public static native void onTouchEvent(int padID, int Button, int Action);
|
||||
|
||||
/**
|
||||
* Handles axis-related touch events.
|
||||
*
|
||||
* @param Axis Axis ID for the type of axis being altered. (Example: Main stick up, down, left, right, etc).
|
||||
* @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 Axis, float force);
|
||||
public static native void onTouchAxisEvent(int padID, int Axis, float force);
|
||||
|
||||
/**
|
||||
* Handles button press events for a gamepad.
|
||||
|
@ -96,15 +96,15 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
switch (button.getId())
|
||||
{
|
||||
case ButtonType.BUTTON_A:
|
||||
NativeLibrary.onTouchEvent(ButtonType.BUTTON_A, buttonState);
|
||||
NativeLibrary.onTouchEvent(0, ButtonType.BUTTON_A, buttonState);
|
||||
break;
|
||||
|
||||
case ButtonType.BUTTON_B:
|
||||
NativeLibrary.onTouchEvent(ButtonType.BUTTON_B, buttonState);
|
||||
NativeLibrary.onTouchEvent(0, ButtonType.BUTTON_B, buttonState);
|
||||
break;
|
||||
|
||||
case ButtonType.BUTTON_START:
|
||||
NativeLibrary.onTouchEvent(ButtonType.BUTTON_START, buttonState);
|
||||
NativeLibrary.onTouchEvent(0, ButtonType.BUTTON_START, buttonState);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -121,7 +121,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
|
||||
for (int a = 0; a < 4; ++a)
|
||||
{
|
||||
NativeLibrary.onTouchAxisEvent(axisIDs[a], axises[a]);
|
||||
NativeLibrary.onTouchAxisEvent(0, axisIDs[a], axises[a]);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user