diff options
Diffstat (limited to 'Source/Android/app/src/main/java')
3 files changed, 60 insertions, 1 deletions
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()); |
