From a862c33fc420ce4945dc91b8e6abba342961e03f Mon Sep 17 00:00:00 2001 From: german77 Date: Sat, 25 Mar 2023 13:04:36 -0600 Subject: [PATCH] android: Fix fps counter not showing up --- .../yuzu/yuzu_emu/fragments/EmulationFragment.kt | 5 +++-- .../yuzu/yuzu_emu/utils/EmulationMenuSettings.kt | 2 +- .../src/main/res/layout/fragment_emulation.xml | 16 ++++++++-------- src/android/app/src/main/res/values/strings.xml | 1 + 4 files changed, 13 insertions(+), 11 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 18517bdf8..3f6f39dff 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 @@ -33,6 +33,7 @@ import org.yuzu.yuzu_emu.model.Game import org.yuzu.yuzu_emu.utils.DirectoryInitialization 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 @@ -221,8 +222,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback, Choreographer.Fram } private fun updateShowFpsOverlay() { - // TODO: Create a setting so that this actually works... - if (true) { + if (EmulationMenuSettings.showFps) { val SYSTEM_FPS = 0 val FPS = 1 val FRAMETIME = 2 @@ -238,6 +238,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback, Choreographer.Fram } } perfStatsUpdateHandler.post(perfStatsUpdater!!) + binding.showFpsText.text = resources.getString(R.string.emulation_game_loading) binding.showFpsText.visibility = View.VISIBLE } else { if (perfStatsUpdater != null) { 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 46690bee2..937f13fea 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 @@ -46,7 +46,7 @@ object EmulationMenuSettings { .apply() } var showFps: Boolean - get() = preferences.getBoolean(Settings.PREF_MENU_SETTINGS_SHOW_FPS, false) + get() = preferences.getBoolean(Settings.PREF_MENU_SETTINGS_SHOW_FPS, true) set(value) { preferences.edit() .putBoolean(Settings.PREF_MENU_SETTINGS_SHOW_FPS, value) diff --git a/src/android/app/src/main/res/layout/fragment_emulation.xml b/src/android/app/src/main/res/layout/fragment_emulation.xml index b99c2e9c3..68eedffe1 100644 --- a/src/android/app/src/main/res/layout/fragment_emulation.xml +++ b/src/android/app/src/main/res/layout/fragment_emulation.xml @@ -20,6 +20,14 @@ android:focusable="false" android:focusableInTouchMode="false" /> + + + - - -