mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-27 08:05:41 +00:00
Android: Add quick load/save touchscreen buttons
This commit is contained in:
parent
20afc1c4a1
commit
81da9be2d1
|
@ -19,6 +19,8 @@ public final class TouchscreenControllerButtonView extends View {
|
||||||
FAST_FORWARD,
|
FAST_FORWARD,
|
||||||
ANALOG_TOGGLE,
|
ANALOG_TOGGLE,
|
||||||
OPEN_PAUSE_MENU,
|
OPEN_PAUSE_MENU,
|
||||||
|
QUICK_LOAD,
|
||||||
|
QUICK_SAVE
|
||||||
}
|
}
|
||||||
|
|
||||||
private Drawable mUnpressedDrawable;
|
private Drawable mUnpressedDrawable;
|
||||||
|
@ -149,8 +151,9 @@ public final class TouchscreenControllerButtonView extends View {
|
||||||
|
|
||||||
switch (mHotkey)
|
switch (mHotkey)
|
||||||
{
|
{
|
||||||
case FAST_FORWARD:
|
case FAST_FORWARD: {
|
||||||
hi.setFastForwardEnabled(mPressed);
|
hi.setFastForwardEnabled(mPressed);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ANALOG_TOGGLE: {
|
case ANALOG_TOGGLE: {
|
||||||
|
@ -165,6 +168,18 @@ public final class TouchscreenControllerButtonView extends View {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case QUICK_LOAD: {
|
||||||
|
if (!mPressed)
|
||||||
|
hi.loadState(false, 0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case QUICK_SAVE: {
|
||||||
|
if (!mPressed)
|
||||||
|
hi.saveState(false, 0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case NONE:
|
case NONE:
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -328,6 +328,10 @@ public class TouchscreenControllerView extends FrameLayout {
|
||||||
TouchscreenControllerButtonView.Hotkey.ANALOG_TOGGLE, false);
|
TouchscreenControllerButtonView.Hotkey.ANALOG_TOGGLE, false);
|
||||||
linkHotkeyButton(mMainView, R.id.controller_button_pause, "OpenPauseMenu",
|
linkHotkeyButton(mMainView, R.id.controller_button_pause, "OpenPauseMenu",
|
||||||
TouchscreenControllerButtonView.Hotkey.OPEN_PAUSE_MENU, true);
|
TouchscreenControllerButtonView.Hotkey.OPEN_PAUSE_MENU, true);
|
||||||
|
linkHotkeyButton(mMainView, R.id.controller_button_quick_load, "QuickLoad",
|
||||||
|
TouchscreenControllerButtonView.Hotkey.QUICK_LOAD, false);
|
||||||
|
linkHotkeyButton(mMainView, R.id.controller_button_quick_save, "QuickSave",
|
||||||
|
TouchscreenControllerButtonView.Hotkey.QUICK_SAVE, false);
|
||||||
|
|
||||||
reloadButtonSettings();
|
reloadButtonSettings();
|
||||||
updateOpacity();
|
updateOpacity();
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:fillColor="#4d4d4d"
|
||||||
|
android:pathData="M14,12c0,-1.1 -0.9,-2 -2,-2s-2,0.9 -2,2 0.9,2 2,2 2,-0.9 2,-2zM12,3c-4.97,0 -9,4.03 -9,9L0,12l4,4 4,-4L5,12c0,-3.87 3.13,-7 7,-7s7,3.13 7,7 -3.13,7 -7,7c-1.51,0 -2.91,-0.49 -4.06,-1.3l-1.42,1.44C8.04,20.3 9.94,21 12,21c4.97,0 9,-4.03 9,-9s-4.03,-9 -9,-9z"/>
|
||||||
|
</vector>
|
|
@ -0,0 +1,9 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:fillColor="#4d4d4d"
|
||||||
|
android:pathData="M17,3L5,3c-1.11,0 -2,0.9 -2,2v14c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2L21,7l-4,-4zM12,19c-1.66,0 -3,-1.34 -3,-3s1.34,-3 3,-3 3,1.34 3,3 -1.34,3 -3,3zM15,9L5,9L5,5h10v4z"/>
|
||||||
|
</vector>
|
|
@ -179,6 +179,28 @@
|
||||||
app:pressedDrawable="@drawable/ic_controller_pause_button"
|
app:pressedDrawable="@drawable/ic_controller_pause_button"
|
||||||
app:unpressedDrawable="@drawable/ic_controller_pause_button" />
|
app:unpressedDrawable="@drawable/ic_controller_pause_button" />
|
||||||
|
|
||||||
|
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
||||||
|
android:id="@+id/controller_button_quick_load"
|
||||||
|
android:layout_width="35dp"
|
||||||
|
android:layout_height="35dp"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:pressedDrawable="@drawable/ic_controller_quick_load_button"
|
||||||
|
app:unpressedDrawable="@drawable/ic_controller_quick_load_button" />
|
||||||
|
|
||||||
|
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
||||||
|
android:id="@+id/controller_button_quick_save"
|
||||||
|
android:layout_width="35dp"
|
||||||
|
android:layout_height="35dp"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_marginLeft="75dp"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:pressedDrawable="@drawable/ic_controller_quick_save_button"
|
||||||
|
app:unpressedDrawable="@drawable/ic_controller_quick_save_button" />
|
||||||
|
|
||||||
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
||||||
android:id="@+id/controller_button_autofire_1"
|
android:id="@+id/controller_button_autofire_1"
|
||||||
android:layout_width="35dp"
|
android:layout_width="35dp"
|
||||||
|
|
|
@ -201,6 +201,28 @@
|
||||||
app:pressedDrawable="@drawable/ic_controller_pause_button"
|
app:pressedDrawable="@drawable/ic_controller_pause_button"
|
||||||
app:unpressedDrawable="@drawable/ic_controller_pause_button" />
|
app:unpressedDrawable="@drawable/ic_controller_pause_button" />
|
||||||
|
|
||||||
|
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
||||||
|
android:id="@+id/controller_button_quick_load"
|
||||||
|
android:layout_width="35dp"
|
||||||
|
android:layout_height="35dp"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:pressedDrawable="@drawable/ic_controller_quick_load_button"
|
||||||
|
app:unpressedDrawable="@drawable/ic_controller_quick_load_button" />
|
||||||
|
|
||||||
|
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
||||||
|
android:id="@+id/controller_button_quick_save"
|
||||||
|
android:layout_width="35dp"
|
||||||
|
android:layout_height="35dp"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_marginLeft="75dp"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:pressedDrawable="@drawable/ic_controller_quick_save_button"
|
||||||
|
app:unpressedDrawable="@drawable/ic_controller_quick_save_button" />
|
||||||
|
|
||||||
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
||||||
android:id="@+id/controller_button_autofire_1"
|
android:id="@+id/controller_button_autofire_1"
|
||||||
android:layout_width="35dp"
|
android:layout_width="35dp"
|
||||||
|
|
|
@ -163,6 +163,28 @@
|
||||||
app:pressedDrawable="@drawable/ic_controller_pause_button"
|
app:pressedDrawable="@drawable/ic_controller_pause_button"
|
||||||
app:unpressedDrawable="@drawable/ic_controller_pause_button" />
|
app:unpressedDrawable="@drawable/ic_controller_pause_button" />
|
||||||
|
|
||||||
|
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
||||||
|
android:id="@+id/controller_button_quick_load"
|
||||||
|
android:layout_width="35dp"
|
||||||
|
android:layout_height="35dp"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:pressedDrawable="@drawable/ic_controller_quick_load_button"
|
||||||
|
app:unpressedDrawable="@drawable/ic_controller_quick_load_button" />
|
||||||
|
|
||||||
|
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
||||||
|
android:id="@+id/controller_button_quick_save"
|
||||||
|
android:layout_width="35dp"
|
||||||
|
android:layout_height="35dp"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_marginLeft="75dp"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:pressedDrawable="@drawable/ic_controller_quick_save_button"
|
||||||
|
app:unpressedDrawable="@drawable/ic_controller_quick_save_button" />
|
||||||
|
|
||||||
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
||||||
android:id="@+id/controller_button_autofire_1"
|
android:id="@+id/controller_button_autofire_1"
|
||||||
android:layout_width="35dp"
|
android:layout_width="35dp"
|
||||||
|
|
|
@ -62,6 +62,28 @@
|
||||||
app:pressedDrawable="@drawable/ic_controller_pause_button"
|
app:pressedDrawable="@drawable/ic_controller_pause_button"
|
||||||
app:unpressedDrawable="@drawable/ic_controller_pause_button" />
|
app:unpressedDrawable="@drawable/ic_controller_pause_button" />
|
||||||
|
|
||||||
|
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
||||||
|
android:id="@+id/controller_button_quick_load"
|
||||||
|
android:layout_width="35dp"
|
||||||
|
android:layout_height="35dp"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:pressedDrawable="@drawable/ic_controller_quick_load_button"
|
||||||
|
app:unpressedDrawable="@drawable/ic_controller_quick_load_button" />
|
||||||
|
|
||||||
|
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
||||||
|
android:id="@+id/controller_button_quick_save"
|
||||||
|
android:layout_width="35dp"
|
||||||
|
android:layout_height="35dp"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_marginLeft="75dp"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:pressedDrawable="@drawable/ic_controller_quick_save_button"
|
||||||
|
app:unpressedDrawable="@drawable/ic_controller_quick_save_button" />
|
||||||
|
|
||||||
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
<com.github.stenzek.duckstation.TouchscreenControllerButtonView
|
||||||
android:id="@+id/controller_button_autofire_1"
|
android:id="@+id/controller_button_autofire_1"
|
||||||
android:layout_width="35dp"
|
android:layout_width="35dp"
|
||||||
|
|
Loading…
Reference in a new issue