Permalink
Browse files

Merge pull request #7405 from zackhow/touch-profiles

Android: Portrait Emulation Enhancements
  • Loading branch information...
Helios747 committed Sep 21, 2018
2 parents 85961f9 + 67902a7 commit 8bb6cf2cc4f99a6a96519b1ddc59fd6532accfde
@@ -94,7 +94,8 @@
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 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 @@
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 void handleMenuAction(@MenuAction int menuAction)
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 @@ private void chooseController()
}
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)
{
@@ -218,6 +218,11 @@ public void refreshInputOverlay()
mInputOverlay.refreshControls();
}
public void resetInputOverlay()
{
mInputOverlay.resetButtonPlacement();
}
@Override
public void surfaceCreated(SurfaceHolder holder)
{

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,47 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:keepScreenOn="true"
tools:context="org.dolphinemu.dolphinemu.fragments.EmulationFragment">
<!-- Places the emulation surface to the top half of the screen -->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:baselineAligned="false">
<!-- This is what everything is rendered to during emulation -->
<SurfaceView
android:id="@+id/surface_emulation"
android:layout_height="0dp"
android:layout_width="wrap_content"
android:layout_weight="1"
android:focusable="false"
android:focusableInTouchMode="false"/>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"/>
</LinearLayout>
<!-- This is the onscreen input overlay -->
<org.dolphinemu.dolphinemu.overlay.InputOverlay
android:id="@+id/surface_input_overlay"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:focusable="true"
android:focusableInTouchMode="true"/>
<Button
android:id="@+id/done_control_config"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="@dimen/spacing_small"
android:background="@color/dolphin_blue"
android:textColor="@color/lb_tv_white"
android:text="@string/emulation_done"
android:visibility="gone"/>
</FrameLayout>
@@ -102,6 +102,10 @@
android:id="@+id/menu_emulation_rumble"
android:checkable="true"
android:title="@string/emulation_control_rumble"/>
<item
android:id="@+id/menu_emulation_reset_overlay"
android:title="@string/emulation_touch_overlay_reset"/>
</menu>
</item>
@@ -108,6 +108,9 @@
android:id="@+id/menu_emulation_choose_controller"
android:title="@string/emulation_choose_controller"/>
<item
android:id="@+id/menu_emulation_reset_overlay"
android:title="@string/emulation_touch_overlay_reset"/>
</menu>
</item>
@@ -26,6 +26,30 @@
<integer name="STICK_MAIN_X">17</integer>
<integer name="STICK_MAIN_Y">620</integer>
<!-- Default GameCube portrait layout -->
<integer name="BUTTON_A_PORTRAIT_X">638</integer>
<integer name="BUTTON_A_PORTRAIT_Y">534</integer>
<integer name="BUTTON_B_PORTRAIT_X">560</integer>
<integer name="BUTTON_B_PORTRAIT_Y">648</integer>
<integer name="BUTTON_X_PORTRAIT_X">795</integer>
<integer name="BUTTON_X_PORTRAIT_Y">519</integer>
<integer name="BUTTON_Y_PORTRAIT_X">594</integer>
<integer name="BUTTON_Y_PORTRAIT_Y">463</integer>
<integer name="BUTTON_Z_PORTRAIT_X">357</integer>
<integer name="BUTTON_Z_PORTRAIT_Y">560</integer>
<integer name="BUTTON_UP_PORTRAIT_X">44</integer>
<integer name="BUTTON_UP_PORTRAIT_Y">448</integer>
<integer name="TRIGGER_L_PORTRAIT_X">76</integer>
<integer name="TRIGGER_L_PORTRAIT_Y">582</integer>
<integer name="TRIGGER_R_PORTRAIT_X">739</integer>
<integer name="TRIGGER_R_PORTRAIT_Y">629</integer>
<integer name="BUTTON_START_PORTRAIT_X">472</integer>
<integer name="BUTTON_START_PORTRAIT_Y">789</integer>
<integer name="STICK_C_PORTRAIT_X">622</integer>
<integer name="STICK_C_PORTRAIT_Y">715</integer>
<integer name="STICK_MAIN_PORTRAIT_X">134</integer>
<integer name="STICK_MAIN_PORTRAIT_Y">687</integer>
<!-- Default Wii landscape layout -->
<integer name="WIIMOTE_BUTTON_A_X">858</integer>
<integer name="WIIMOTE_BUTTON_A_Y">772</integer>
@@ -53,6 +77,34 @@
<integer name="WIIMOTE_RIGHT_X">100</integer>
<integer name="WIIMOTE_RIGHT_Y">683</integer>
<!-- Default Wii portrait layout -->
<integer name="WIIMOTE_BUTTON_A_PORTRAIT_X">769</integer>
<integer name="WIIMOTE_BUTTON_A_PORTRAIT_Y">584</integer>
<integer name="WIIMOTE_BUTTON_B_PORTRAIT_X">553</integer>
<integer name="WIIMOTE_BUTTON_B_PORTRAIT_Y">621</integer>
<integer name="WIIMOTE_BUTTON_1_PORTRAIT_X">707</integer>
<integer name="WIIMOTE_BUTTON_1_PORTRAIT_Y">742</integer>
<integer name="WIIMOTE_BUTTON_2_PORTRAIT_X">846</integer>
<integer name="WIIMOTE_BUTTON_2_PORTRAIT_Y">692</integer>
<integer name="NUNCHUK_BUTTON_Z_PORTRAIT_X">526</integer>
<integer name="NUNCHUK_BUTTON_Z_PORTRAIT_Y">483</integer>
<integer name="NUNCHUK_BUTTON_C_PORTRAIT_X">786</integer>
<integer name="NUNCHUK_BUTTON_C_PORTRAIT_Y">455</integer>
<integer name="WIIMOTE_BUTTON_MINUS_PORTRAIT_X">100</integer>
<integer name="WIIMOTE_BUTTON_MINUS_PORTRAIT_Y">420</integer>
<integer name="WIIMOTE_BUTTON_PLUS_PORTRAIT_X">400</integer>
<integer name="WIIMOTE_BUTTON_PLUS_PORTRAIT_Y">420</integer>
<integer name="WIIMOTE_UP_PORTRAIT_X">260</integer>
<integer name="WIIMOTE_UP_PORTRAIT_Y">773</integer>
<integer name="WIIMOTE_BUTTON_HOME_PORTRAIT_X">250</integer>
<integer name="WIIMOTE_BUTTON_HOME_PORTRAIT_Y">420</integer>
<integer name="NUNCHUK_STICK_PORTRAIT_X">68</integer>
<integer name="NUNCHUK_STICK_PORTRAIT_Y">602</integer>
<integer name="WIIMOTE_RIGHT_PORTRAIT_X">68</integer>
<integer name="WIIMOTE_RIGHT_PORTRAIT_Y">602</integer>
<!-- Default Wii classic landscape layout -->
<integer name="CLASSIC_BUTTON_A_X">860</integer>
<integer name="CLASSIC_BUTTON_A_Y">688</integer>
<integer name="CLASSIC_BUTTON_B_X">787</integer>
@@ -81,4 +133,34 @@
<integer name="CLASSIC_TRIGGER_L_Y">429</integer>
<integer name="CLASSIC_TRIGGER_R_X">737</integer>
<integer name="CLASSIC_TRIGGER_R_Y">311</integer>
<!-- Default Wii classic portrait layout -->
<integer name="CLASSIC_BUTTON_A_PORTRAIT_X">820</integer>
<integer name="CLASSIC_BUTTON_A_PORTRAIT_Y">481</integer>
<integer name="CLASSIC_BUTTON_B_PORTRAIT_X">763</integer>
<integer name="CLASSIC_BUTTON_B_PORTRAIT_Y">562</integer>
<integer name="CLASSIC_BUTTON_X_PORTRAIT_X">665</integer>
<integer name="CLASSIC_BUTTON_X_PORTRAIT_Y">476</integer>
<integer name="CLASSIC_BUTTON_Y_PORTRAIT_X">601</integer>
<integer name="CLASSIC_BUTTON_Y_PORTRAIT_Y">552</integer>
<integer name="CLASSIC_BUTTON_MINUS_PORTRAIT_X">100</integer>
<integer name="CLASSIC_BUTTON_MINUS_PORTRAIT_Y">420</integer>
<integer name="CLASSIC_BUTTON_PLUS_PORTRAIT_X">400</integer>
<integer name="CLASSIC_BUTTON_PLUS_PORTRAIT_Y">420</integer>
<integer name="CLASSIC_BUTTON_HOME_PORTRAIT_X">250</integer>
<integer name="CLASSIC_BUTTON_HOME_PORTRAIT_Y">420</integer>
<integer name="CLASSIC_BUTTON_ZL_PORTRAIT_X">301</integer>
<integer name="CLASSIC_BUTTON_ZL_PORTRAIT_Y">613</integer>
<integer name="CLASSIC_BUTTON_ZR_PORTRAIT_X">445</integer>
<integer name="CLASSIC_BUTTON_ZR_PORTRAIT_Y">734</integer>
<integer name="CLASSIC_DPAD_UP_PORTRAIT_X">101</integer>
<integer name="CLASSIC_DPAD_UP_PORTRAIT_Y">752</integer>
<integer name="CLASSIC_STICK_LEFT_PORTRAIT_X">46</integer>
<integer name="CLASSIC_STICK_LEFT_PORTRAIT_Y">533</integer>
<integer name="CLASSIC_STICK_RIGHT_PORTRAIT_X">706</integer>
<integer name="CLASSIC_STICK_RIGHT_PORTRAIT_Y">671</integer>
<integer name="CLASSIC_TRIGGER_L_PORTRAIT_X">342</integer>
<integer name="CLASSIC_TRIGGER_L_PORTRAIT_Y">458</integer>
<integer name="CLASSIC_TRIGGER_R_PORTRAIT_X">650</integer>
<integer name="CLASSIC_TRIGGER_R_PORTRAIT_Y">360</integer>
</resources>
@@ -275,6 +275,7 @@
<string name="emulation_choose_controller">Choose Controller</string>
<string name="emulation_controller_changed">You may have to reload the game after changing extensions.</string>
<string name="emulation_touch_button_help">To change the button layout, open the menu -> Configure Controls -> Edit Layout</string>
<string name="emulation_touch_overlay_reset">Reset Overlay</string>
<!-- GC Adapter Menu-->
<string name="gc_adapter_rumble">Enable Vibration</string>

0 comments on commit 8bb6cf2

Please sign in to comment.