diff --git a/Source/Android/assets/GCPadNew.ini b/Source/Android/assets/GCPadNew.ini index 42144db1ce..7e770f60d3 100644 --- a/Source/Android/assets/GCPadNew.ini +++ b/Source/Android/assets/GCPadNew.ini @@ -6,16 +6,16 @@ Buttons/X = `Button 3` Buttons/Y = `Button 4` Buttons/Z = `Button 5` Buttons/Start = `Button 2` -Main Stick/Up = `Axis 10` -Main Stick/Down = `Axis 11` -Main Stick/Left = `Axis 12` -Main Stick/Right = `Axis 13` +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 14` -C-Stick/Down = `Axis 15` -C-Stick/Left = `Axis 16` -C-Stick/Right = `Axis 17` +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` diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java b/Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java index 07bea528ba..7745deadba 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java @@ -30,16 +30,18 @@ public final class NativeLibrary public static final int BUTTON_DOWN = 7; public static final int BUTTON_LEFT = 8; public static final int BUTTON_RIGHT = 9; - public static final int STICK_MAIN_UP = 10; - public static final int STICK_MAIN_DOWN = 11; - public static final int STICK_MAIN_LEFT = 12; - public static final int STICK_MAIN_RIGHT = 13; - public static final int STICK_C_UP = 14; - public static final int STICK_C_DOWN = 15; - public static final int STICK_C_LEFT = 16; - public static final int STICK_C_RIGHT = 17; - public static final int TRIGGER_L = 18; - public static final int TRIGGER_R = 19; + public static final int STICK_MAIN = 10; + public static final int STICK_MAIN_UP = 11; + public static final int STICK_MAIN_DOWN = 12; + public static final int STICK_MAIN_LEFT = 13; + public static final int STICK_MAIN_RIGHT = 14; + public static final int STICK_C = 15; + public static final int STICK_C_UP = 16; + public static final int STICK_C_DOWN = 17; + public static final int STICK_C_LEFT = 18; + public static final int STICK_C_RIGHT = 19; + public static final int TRIGGER_L = 20; + public static final int TRIGGER_R = 21; } /** 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 359f25f17e..26f628ed46 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/emulation/overlay/InputOverlay.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/emulation/overlay/InputOverlay.java @@ -50,8 +50,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener overlayButtons.add(initializeOverlayButton(context, R.drawable.button_start, ButtonType.BUTTON_START)); overlayJoysticks.add(initializeOverlayJoystick(context, R.drawable.joy_outer, R.drawable.joy_inner, - ButtonType.STICK_MAIN_UP, ButtonType.STICK_MAIN_DOWN, - ButtonType.STICK_MAIN_LEFT, ButtonType.STICK_MAIN_RIGHT)); + ButtonType.STICK_MAIN)); // Set the on touch listener. setOnTouchListener(this); @@ -200,14 +199,11 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener * @param context The current {@link Context} * @param resOuter Resource ID for the outer image of the joystick (the static image that shows the circular bounds). * @param resInner Resource ID for the inner image of the joystick (the one you actually move around). - * @param axisUp Identifier for this type of axis. - * @param axisDown Identifier for this type of axis. - * @param axisLeft Identifier for this type of axis. - * @param axisRight Identifier for this type of axis. + * @param joystick Identifier for which joystick this is. * * @return the initialized {@link InputOverlayDrawableJoystick}. */ - private static InputOverlayDrawableJoystick initializeOverlayJoystick(Context context, int resOuter, int resInner, int axisUp, int axisDown, int axisLeft, int axisRight) + private static InputOverlayDrawableJoystick initializeOverlayJoystick(Context context, int resOuter, int resInner, int joystick) { // Resources handle for fetching the initial Drawable resource. final Resources res = context.getResources(); @@ -219,22 +215,26 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener final Bitmap bitmapOuter = BitmapFactory.decodeResource(res, resOuter); final Bitmap bitmapInner = BitmapFactory.decodeResource(res, resInner); - // TODO: Load coordinates for the drawable from the SharedPreference keys - // made from the overlay configuration window in the settings. + // String ID of the Drawable. This is what is passed into SharedPreferences + // to check whether or not a value has been set. + final String drawableId = res.getResourceEntryName(resOuter); + + // The X and Y coordinates of the InputOverlayDrawableButton on the InputOverlay. + // These were set in the input overlay configuration menu. + int drawableX = (int) sPrefs.getFloat(drawableId+"-X", 0f); + int drawableY = (int) sPrefs.getFloat(drawableId+"-Y", 0f); // Now set the bounds for the InputOverlayDrawableJoystick. // This will dictate where on the screen (and the what the size) the InputOverlayDrawableJoystick will be. int outerSize = bitmapOuter.getWidth() + 256; - int X = 0; - int Y = 0; - Rect outerRect = new Rect(X, Y, X + outerSize, Y + outerSize); + Rect outerRect = new Rect(drawableX, drawableY, drawableX + outerSize, drawableY + outerSize); Rect innerRect = new Rect(0, 0, outerSize / 4, outerSize / 4); final InputOverlayDrawableJoystick overlayDrawable = new InputOverlayDrawableJoystick(res, bitmapOuter, bitmapInner, outerRect, innerRect, - axisUp, axisDown, axisLeft, axisRight); + joystick); return overlayDrawable; diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/emulation/overlay/InputOverlayDrawableJoystick.java b/Source/Android/src/org/dolphinemu/dolphinemu/emulation/overlay/InputOverlayDrawableJoystick.java index a115305fa2..9b5dd6b860 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/emulation/overlay/InputOverlayDrawableJoystick.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/emulation/overlay/InputOverlayDrawableJoystick.java @@ -29,15 +29,12 @@ public final class InputOverlayDrawableJoystick extends BitmapDrawable * * @param res {@link Resources} instance. * @param bitmapOuter {@link Bitmap} to use with this Drawable. - * @param axisUp Identifier for this type of axis. - * @param axisDown Identifier for this type of axis. - * @param axisLeft Identifier for this type of axis. - * @param axisRight Identifier for this type of axis. + * @param joystick Identifier for which joystick this is. */ public InputOverlayDrawableJoystick(Resources res, Bitmap bitmapOuter, Bitmap bitmapInner, Rect rectOuter, Rect rectInner, - int axisUp, int axisDown, int axisLeft, int axisRight) + int joystick) { super(res, bitmapOuter); this.setBounds(rectOuter); @@ -45,10 +42,10 @@ public final class InputOverlayDrawableJoystick extends BitmapDrawable this.ringInner = new BitmapDrawable(res, bitmapInner); this.ringInner.setBounds(rectInner); SetInnerBounds(); - this.axisIDs[0] = axisUp; - this.axisIDs[1] = axisDown; - this.axisIDs[2] = axisLeft; - this.axisIDs[3] = axisRight; + this.axisIDs[0] = joystick + 1; + this.axisIDs[1] = joystick + 2; + this.axisIDs[2] = joystick + 3; + this.axisIDs[3] = joystick + 4; } @Override @@ -142,5 +139,6 @@ public final class InputOverlayDrawableJoystick extends BitmapDrawable int height = this.ringInner.getBounds().height() / 2; this.ringInner.setBounds(X - width, Y - height, X + width, Y + height); + } } diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListActivity.java b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListActivity.java index 96f1783310..c24d21a74b 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListActivity.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListActivity.java @@ -16,13 +16,12 @@ import android.content.res.Configuration; import android.os.Bundle; import android.support.v4.app.ActionBarDrawerToggle; import android.support.v4.widget.DrawerLayout; -import android.view.*; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.view.View; import android.widget.AdapterView; import android.widget.ListView; - -import java.util.ArrayList; -import java.util.List; - import org.dolphinemu.dolphinemu.AboutFragment; import org.dolphinemu.dolphinemu.NativeLibrary; import org.dolphinemu.dolphinemu.R; @@ -31,6 +30,9 @@ import org.dolphinemu.dolphinemu.settings.PrefsActivity; import org.dolphinemu.dolphinemu.sidemenu.SideMenuAdapter; import org.dolphinemu.dolphinemu.sidemenu.SideMenuItem; +import java.util.ArrayList; +import java.util.List; + /** * The activity that implements all of the functions * for the game list. diff --git a/Source/Core/DolphinWX/Src/Android/ButtonManager.h b/Source/Core/DolphinWX/Src/Android/ButtonManager.h index 5a99bb092f..383e52f445 100644 --- a/Source/Core/DolphinWX/Src/Android/ButtonManager.h +++ b/Source/Core/DolphinWX/Src/Android/ButtonManager.h @@ -28,25 +28,27 @@ namespace ButtonManager enum ButtonType { BUTTON_A = 0, - BUTTON_B, - BUTTON_START, - BUTTON_X, - BUTTON_Y, - BUTTON_Z, - BUTTON_UP, - BUTTON_DOWN, - BUTTON_LEFT, - BUTTON_RIGHT, - STICK_MAIN_UP, - STICK_MAIN_DOWN, - STICK_MAIN_LEFT, - STICK_MAIN_RIGHT, - STICK_C_UP, - STICK_C_DOWN, - STICK_C_LEFT, - STICK_C_RIGHT, - TRIGGER_L, - TRIGGER_R + BUTTON_B = 1, + BUTTON_START = 2, + BUTTON_X = 3, + BUTTON_Y = 4, + BUTTON_Z = 5, + BUTTON_UP = 6, + BUTTON_DOWN = 7, + BUTTON_LEFT = 8, + BUTTON_RIGHT = 9, + STICK_MAIN = 10, /* Used on Java Side */ + STICK_MAIN_UP = 11, + STICK_MAIN_DOWN = 12, + STICK_MAIN_LEFT = 13, + STICK_MAIN_RIGHT = 14, + STICK_C = 15, /* Used on Java Side */ + STICK_C_UP = 16, + STICK_C_DOWN = 17, + STICK_C_LEFT = 18, + STICK_C_RIGHT = 19, + TRIGGER_L = 20, + TRIGGER_R = 21, }; enum ButtonState {