summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCharles Lombardo <clombardo169@gmail.com>2023-04-01 06:16:01 +0200
committerbunnei <bunneidev@gmail.com>2023-06-03 09:05:48 +0200
commit1ea84854bd72a4a76eb3193d0f22fd8bd7010c19 (patch)
tree3330ff3bbb40eb88b1513b76481ff3328e9a3ef1 /src
parentandroid: Do not update FPS text on null view (diff)
downloadyuzu-1ea84854bd72a4a76eb3193d0f22fd8bd7010c19.tar
yuzu-1ea84854bd72a4a76eb3193d0f22fd8bd7010c19.tar.gz
yuzu-1ea84854bd72a4a76eb3193d0f22fd8bd7010c19.tar.bz2
yuzu-1ea84854bd72a4a76eb3193d0f22fd8bd7010c19.tar.lz
yuzu-1ea84854bd72a4a76eb3193d0f22fd8bd7010c19.tar.xz
yuzu-1ea84854bd72a4a76eb3193d0f22fd8bd7010c19.tar.zst
yuzu-1ea84854bd72a4a76eb3193d0f22fd8bd7010c19.zip
Diffstat (limited to 'src')
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt36
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/EmulationMenuSettings.kt2
-rw-r--r--src/android/app/src/main/res/menu/menu_overlay_options.xml4
-rw-r--r--src/android/app/src/main/res/values/arrays.xml18
-rw-r--r--src/android/app/src/main/res/values/strings.xml8
5 files changed, 62 insertions, 6 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt
index edc1a19ff..703d4623b 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt
@@ -21,6 +21,7 @@ import androidx.core.view.WindowInsetsCompat
import androidx.fragment.app.Fragment
import androidx.localbroadcastmanager.content.LocalBroadcastManager
import androidx.preference.PreferenceManager
+import com.google.android.material.dialog.MaterialAlertDialogBuilder
import org.yuzu.yuzu_emu.NativeLibrary
import org.yuzu.yuzu_emu.R
import org.yuzu.yuzu_emu.YuzuApplication
@@ -30,12 +31,8 @@ import org.yuzu.yuzu_emu.features.settings.model.Settings
import org.yuzu.yuzu_emu.features.settings.ui.SettingsActivity
import org.yuzu.yuzu_emu.features.settings.utils.SettingsFile
import org.yuzu.yuzu_emu.model.Game
-import org.yuzu.yuzu_emu.utils.DirectoryInitialization
+import org.yuzu.yuzu_emu.utils.*
import org.yuzu.yuzu_emu.utils.DirectoryInitialization.DirectoryInitializationState
-import org.yuzu.yuzu_emu.utils.DirectoryStateReceiver
-import org.yuzu.yuzu_emu.utils.EmulationMenuSettings
-import org.yuzu.yuzu_emu.utils.InsetsHelper
-import org.yuzu.yuzu_emu.utils.Log
import org.yuzu.yuzu_emu.utils.SerializableHelper.parcelable
class EmulationFragment : Fragment(), SurfaceHolder.Callback, Choreographer.FrameCallback {
@@ -281,6 +278,35 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback, Choreographer.Fram
startConfiguringControls()
true
}
+ R.id.menu_toggle_controls -> {
+ val preferences =
+ PreferenceManager.getDefaultSharedPreferences(YuzuApplication.appContext)
+ val optionsArray = BooleanArray(15)
+ for (i in 0..14) {
+ optionsArray[i] = preferences.getBoolean("buttonToggle$i", i < 13)
+ }
+
+ MaterialAlertDialogBuilder(requireContext())
+ .setTitle(R.string.emulation_toggle_controls)
+ .setMultiChoiceItems(
+ R.array.gamepadButtons,
+ optionsArray
+ ) { _, indexSelected, isChecked ->
+ preferences.edit()
+ .putBoolean("buttonToggle$indexSelected", isChecked)
+ .commit()
+ }
+ .setPositiveButton(android.R.string.ok) { _, _ ->
+ refreshInputOverlay()
+ }
+ .setNeutralButton(R.string.emulation_toggle_all) { _, _ ->
+ EmulationMenuSettings.showOverlay = !EmulationMenuSettings.showOverlay
+ refreshInputOverlay()
+ }
+ .show()
+
+ true
+ }
R.id.menu_reset_overlay -> {
binding.drawerLayout.close()
resetInputOverlay()
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/EmulationMenuSettings.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/EmulationMenuSettings.kt
index 937f13fea..e51ac1cc1 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/EmulationMenuSettings.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/EmulationMenuSettings.kt
@@ -57,6 +57,6 @@ object EmulationMenuSettings {
set(value) {
preferences.edit()
.putBoolean(Settings.PREF_MENU_SETTINGS_SHOW_OVERLAY, value)
- .apply()
+ .commit()
}
}
diff --git a/src/android/app/src/main/res/menu/menu_overlay_options.xml b/src/android/app/src/main/res/menu/menu_overlay_options.xml
index 75c84cdf3..b9341c508 100644
--- a/src/android/app/src/main/res/menu/menu_overlay_options.xml
+++ b/src/android/app/src/main/res/menu/menu_overlay_options.xml
@@ -6,6 +6,10 @@
android:title="@string/emulation_touch_overlay_edit" />
<item
+ android:id="@+id/menu_toggle_controls"
+ android:title="@string/emulation_toggle_controls" />
+
+ <item
android:id="@+id/menu_reset_overlay"
android:title="@string/emulation_touch_overlay_reset" />
diff --git a/src/android/app/src/main/res/values/arrays.xml b/src/android/app/src/main/res/values/arrays.xml
index 7e25f12b8..6d909ddae 100644
--- a/src/android/app/src/main/res/values/arrays.xml
+++ b/src/android/app/src/main/res/values/arrays.xml
@@ -135,4 +135,22 @@
<item>3</item>
</integer-array>
+ <string-array name="gamepadButtons">
+ <item>A</item>
+ <item>B</item>
+ <item>X</item>
+ <item>Y</item>
+ <item>L</item>
+ <item>R</item>
+ <item>ZL</item>
+ <item>ZR</item>
+ <item>+</item>
+ <item>-</item>
+ <item>@string/gamepad_d_pad</item>
+ <item>@string/gamepad_left_stick</item>
+ <item>@string/gamepad_right_stick</item>
+ <item>@string/gamepad_home</item>
+ <item>@string/gamepad_screenshot</item>
+ </string-array>
+
</resources>
diff --git a/src/android/app/src/main/res/values/strings.xml b/src/android/app/src/main/res/values/strings.xml
index 5c31fb322..ea9290df5 100644
--- a/src/android/app/src/main/res/values/strings.xml
+++ b/src/android/app/src/main/res/values/strings.xml
@@ -85,6 +85,7 @@
<string name="emulation_exit">Exit Emulation</string>
<string name="emulation_done">Done</string>
<string name="emulation_toggle_controls">Toggle Controls</string>
+ <string name="emulation_toggle_all">Toggle All</string>
<string name="emulation_control_scale">Adjust Scale</string>
<string name="emulation_touch_overlay_reset">Reset Overlay</string>
<string name="emulation_touch_overlay_edit">Edit Overlay</string>
@@ -173,4 +174,11 @@
<string name="cpu_accuracy_unsafe">Unsafe</string>
<string name="cpu_accuracy_paranoid">Paranoid (Slow)</string>
+ <!-- Gamepad Buttons -->
+ <string name="gamepad_d_pad">D-Pad</string>
+ <string name="gamepad_left_stick">Left Stick</string>
+ <string name="gamepad_right_stick">Right Stick</string>
+ <string name="gamepad_home">Home</string>
+ <string name="gamepad_screenshot">Screenshot</string>
+
</resources>