diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java
index 7eb8430935..bfb891bc8d 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java
@@ -94,7 +94,8 @@ public final class EmulationActivity extends AppCompatActivity
MENU_ACTION_SAVE_SLOT3, MENU_ACTION_SAVE_SLOT4, MENU_ACTION_SAVE_SLOT5,
MENU_ACTION_SAVE_SLOT6, MENU_ACTION_LOAD_SLOT1, MENU_ACTION_LOAD_SLOT2,
MENU_ACTION_LOAD_SLOT3, MENU_ACTION_LOAD_SLOT4, MENU_ACTION_LOAD_SLOT5,
- MENU_ACTION_LOAD_SLOT6, MENU_ACTION_EXIT, MENU_ACTION_CHANGE_DISC})
+ MENU_ACTION_LOAD_SLOT6, MENU_ACTION_EXIT, MENU_ACTION_CHANGE_DISC,
+ MENU_ACTION_RESET_OVERLAY})
public @interface MenuAction
{
}
@@ -125,6 +126,7 @@ public final class EmulationActivity extends AppCompatActivity
public static final int MENU_ACTION_CHANGE_DISC = 23;
public static final int MENU_ACTION_JOYSTICK_REL_CENTER = 24;
public static final int MENU_ACTION_RUMBLE = 25;
+ public static final int MENU_ACTION_RESET_OVERLAY = 26;
private static SparseIntArray buttonsActionsMap = new SparseIntArray();
@@ -165,6 +167,8 @@ public final class EmulationActivity extends AppCompatActivity
buttonsActionsMap.append(R.id.menu_emulation_joystick_rel_center,
EmulationActivity.MENU_ACTION_JOYSTICK_REL_CENTER);
buttonsActionsMap.append(R.id.menu_emulation_rumble, EmulationActivity.MENU_ACTION_RUMBLE);
+ buttonsActionsMap
+ .append(R.id.menu_emulation_reset_overlay, EmulationActivity.MENU_ACTION_RESET_OVERLAY);
}
public static void launch(FragmentActivity activity, GameFile gameFile, int position,
@@ -525,6 +529,11 @@ public final class EmulationActivity extends AppCompatActivity
editControlsPlacement();
break;
+ // Reset overlay placement
+ case MENU_ACTION_RESET_OVERLAY:
+ resetOverlay();
+ break;
+
// Enable/Disable specific buttons or the entire input overlay.
case MENU_ACTION_TOGGLE_CONTROLS:
toggleControls();
@@ -833,6 +842,21 @@ public final class EmulationActivity extends AppCompatActivity
}
+ private void resetOverlay()
+ {
+ new AlertDialog.Builder(this)
+ .setTitle(getString(R.string.emulation_touch_overlay_reset))
+ .setPositiveButton(R.string.yes, (dialogInterface, i) ->
+ {
+ mEmulationFragment.resetInputOverlay();
+ })
+ .setNegativeButton(R.string.cancel, (dialogInterface, i) ->
+ {
+ })
+ .create()
+ .show();
+ }
+
@Override
public boolean dispatchGenericMotionEvent(MotionEvent event)
{
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/EmulationFragment.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/EmulationFragment.java
index 68d0939da7..147b2d693e 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/EmulationFragment.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/EmulationFragment.java
@@ -218,6 +218,11 @@ public final class EmulationFragment extends Fragment implements SurfaceHolder.C
mInputOverlay.refreshControls();
}
+ public void resetInputOverlay()
+ {
+ mInputOverlay.resetButtonPlacement();
+ }
+
@Override
public void surfaceCreated(SurfaceHolder holder)
{
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.java
index 60d8044190..de29e00ed5 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.java
@@ -638,6 +638,36 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
invalidate();
}
+ public void resetButtonPlacement()
+ {
+ boolean isLandscape =
+ getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
+
+ // Values for these come from R.array.controllersEntries
+ if (EmulationActivity.isGameCubeGame() || mPreferences.getInt("wiiController", 3) == 0)
+ {
+ if (isLandscape)
+ gcDefaultOverlay();
+ else
+ gcPortraitDefaultOverlay();
+ }
+ else if (mPreferences.getInt("wiiController", 3) == 4)
+ {
+ if (isLandscape)
+ wiiClassicDefaultOverlay();
+ else
+ wiiClassicPortraitDefaultOverlay();
+ }
+ else
+ {
+ if (isLandscape)
+ wiiDefaultOverlay();
+ else
+ wiiPortraitDefaultOverlay();
+ }
+ refreshControls();
+ }
+
private void saveControlPosition(int sharedPrefsId, int x, int y, String orientation)
{
final SharedPreferences sPrefs = PreferenceManager.getDefaultSharedPreferences(getContext());
diff --git a/Source/Android/app/src/main/res/menu/menu_emulation.xml b/Source/Android/app/src/main/res/menu/menu_emulation.xml
index 0a9ccfd25d..2a1418dd83 100644
--- a/Source/Android/app/src/main/res/menu/menu_emulation.xml
+++ b/Source/Android/app/src/main/res/menu/menu_emulation.xml
@@ -102,6 +102,10 @@
android:id="@+id/menu_emulation_rumble"
android:checkable="true"
android:title="@string/emulation_control_rumble"/>
+
+
diff --git a/Source/Android/app/src/main/res/menu/menu_emulation_wii.xml b/Source/Android/app/src/main/res/menu/menu_emulation_wii.xml
index f0cbc6024a..20d1b7a0a3 100644
--- a/Source/Android/app/src/main/res/menu/menu_emulation_wii.xml
+++ b/Source/Android/app/src/main/res/menu/menu_emulation_wii.xml
@@ -108,6 +108,9 @@
android:id="@+id/menu_emulation_choose_controller"
android:title="@string/emulation_choose_controller"/>
+
diff --git a/Source/Android/app/src/main/res/values/strings.xml b/Source/Android/app/src/main/res/values/strings.xml
index c1bf44b837..7527bfb97a 100644
--- a/Source/Android/app/src/main/res/values/strings.xml
+++ b/Source/Android/app/src/main/res/values/strings.xml
@@ -275,6 +275,7 @@
Choose Controller
You may have to reload the game after changing extensions.
To change the button layout, open the menu -> Configure Controls -> Edit Layout
+ Reset Overlay
Enable Vibration