From 8fab363237083a8130a7b2a023cd9c5dd83f8f4f Mon Sep 17 00:00:00 2001 From: GPUCode Date: Sat, 18 Nov 2023 16:10:39 +0200 Subject: android: Add cpu bakend gui toggle --- .../org/yuzu/yuzu_emu/features/settings/model/IntSetting.kt | 1 + .../yuzu/yuzu_emu/features/settings/model/view/SettingsItem.kt | 9 +++++++++ .../yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt | 1 + src/android/app/src/main/res/values/arrays.xml | 10 ++++++++++ src/android/app/src/main/res/values/strings.xml | 5 +++++ 5 files changed, 26 insertions(+) (limited to 'src/android') diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/IntSetting.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/IntSetting.kt index 151362124..ef10b209f 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/IntSetting.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/IntSetting.kt @@ -10,6 +10,7 @@ enum class IntSetting( override val category: Settings.Category, override val androidDefault: Int? = null ) : AbstractIntSetting { + CPU_BACKEND("cpu_backend", Settings.Category.Cpu), CPU_ACCURACY("cpu_accuracy", Settings.Category.Cpu), REGION_INDEX("region_index", Settings.Category.System), LANGUAGE_INDEX("language_index", Settings.Category.System), diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SettingsItem.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SettingsItem.kt index 6aba69dbe..1f090424b 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SettingsItem.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SettingsItem.kt @@ -77,6 +77,15 @@ abstract class SettingsItem( "%" ) ) + put( + SingleChoiceSetting( + IntSetting.CPU_BACKEND, + R.string.cpu_backend, + 0, + R.array.cpuBackendNames, + R.array.cpuBackendValues + ) + ) put( SingleChoiceSetting( IntSetting.CPU_ACCURACY, diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt index 8b71e32f3..7425728c6 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt @@ -269,6 +269,7 @@ class SettingsFragmentPresenter( add(BooleanSetting.RENDERER_DEBUG.key) add(HeaderSetting(R.string.cpu)) + add(IntSetting.CPU_BACKEND.key) add(IntSetting.CPU_ACCURACY.key) add(BooleanSetting.CPU_DEBUG_MODE.key) add(SettingsItem.FASTMEM_COMBINED) diff --git a/src/android/app/src/main/res/values/arrays.xml b/src/android/app/src/main/res/values/arrays.xml index 51bcc49a3..2756e5cc9 100644 --- a/src/android/app/src/main/res/values/arrays.xml +++ b/src/android/app/src/main/res/values/arrays.xml @@ -175,6 +175,16 @@ 2 + + @string/cpu_backend_dynarmic + @string/cpu_backend_nce + + + + 0 + 1 + + @string/auto @string/cpu_accuracy_accurate diff --git a/src/android/app/src/main/res/values/strings.xml b/src/android/app/src/main/res/values/strings.xml index 471af8795..f07121f6a 100644 --- a/src/android/app/src/main/res/values/strings.xml +++ b/src/android/app/src/main/res/values/strings.xml @@ -185,6 +185,7 @@ Limits emulation speed to a specified percentage of normal speed. Limit speed percent Specifies the percentage to limit emulation speed. 100% is the normal speed. Values higher or lower will increase or decrease the speed limit. + CPU Backend CPU accuracy %1$s%2$s @@ -416,6 +417,10 @@ Force 16:10 Stretch to window + + Dynarmic (Slow) + Native code execution (NCE) + Accurate Unsafe -- cgit v1.2.3 From 20de0ddf1f3afce420beebdf69ec675f0dee2b9f Mon Sep 17 00:00:00 2001 From: Liam Date: Mon, 20 Nov 2023 12:12:24 -0500 Subject: android: show current backend in fps overlay --- src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt | 5 +++++ .../main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt | 4 +++- src/android/app/src/main/jni/native.cpp | 8 ++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) (limited to 'src/android') diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt index f2ba2504c..e0f01127c 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt @@ -299,6 +299,11 @@ object NativeLibrary { */ external fun getPerfStats(): DoubleArray + /** + * Returns the current CPU backend. + */ + external fun getCpuBackend(): String + /** * Notifies the core emulation that the orientation has changed. */ 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 c32fa0d7e..734c1d5ca 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 @@ -414,8 +414,10 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback { perfStatsUpdater = { if (emulationViewModel.emulationStarted.value) { val perfStats = NativeLibrary.getPerfStats() + val cpuBackend = NativeLibrary.getCpuBackend() if (_binding != null) { - binding.showFpsText.text = String.format("FPS: %.1f", perfStats[FPS]) + binding.showFpsText.text = + String.format("FPS: %.1f\n%s", perfStats[FPS], cpuBackend) } perfStatsUpdateHandler.postDelayed(perfStatsUpdater!!, 800) } diff --git a/src/android/app/src/main/jni/native.cpp b/src/android/app/src/main/jni/native.cpp index 617288ae4..ed5ce6f8a 100644 --- a/src/android/app/src/main/jni/native.cpp +++ b/src/android/app/src/main/jni/native.cpp @@ -694,6 +694,14 @@ jdoubleArray Java_org_yuzu_yuzu_1emu_NativeLibrary_getPerfStats(JNIEnv* env, jcl return j_stats; } +jstring Java_org_yuzu_yuzu_1emu_NativeLibrary_getCpuBackend(JNIEnv* env, jclass clazz) { + if (Settings::IsNceEnabled()) { + return ToJString(env, "NCE"); + } + + return ToJString(env, "JIT"); +} + void Java_org_yuzu_yuzu_1emu_utils_DirectoryInitialization_setSysDirectory(JNIEnv* env, jclass clazz, jstring j_path) {} -- cgit v1.2.3 From 9ff8d0f3e652fee83d9f4374d9f6e0aa1759dd88 Mon Sep 17 00:00:00 2001 From: GPUCode Date: Thu, 23 Nov 2023 11:26:06 +0200 Subject: Address more review comments --- .../yuzu_emu/features/settings/model/view/SettingsItem.kt | 4 ++-- src/android/app/src/main/res/values/arrays.xml | 12 ++++++++++-- src/android/app/src/main/res/values/strings.xml | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) (limited to 'src/android') diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SettingsItem.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SettingsItem.kt index 1f090424b..e198b18a0 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SettingsItem.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SettingsItem.kt @@ -82,8 +82,8 @@ abstract class SettingsItem( IntSetting.CPU_BACKEND, R.string.cpu_backend, 0, - R.array.cpuBackendNames, - R.array.cpuBackendValues + R.array.cpuBackendArm64Names, + R.array.cpuBackendArm64Values ) ) put( diff --git a/src/android/app/src/main/res/values/arrays.xml b/src/android/app/src/main/res/values/arrays.xml index 2756e5cc9..ab435dce9 100644 --- a/src/android/app/src/main/res/values/arrays.xml +++ b/src/android/app/src/main/res/values/arrays.xml @@ -175,16 +175,24 @@ 2 - + @string/cpu_backend_dynarmic @string/cpu_backend_nce - + 0 1 + + @string/cpu_backend_dynarmic + + + + 0 + + @string/auto @string/cpu_accuracy_accurate diff --git a/src/android/app/src/main/res/values/strings.xml b/src/android/app/src/main/res/values/strings.xml index f07121f6a..95b90fd6d 100644 --- a/src/android/app/src/main/res/values/strings.xml +++ b/src/android/app/src/main/res/values/strings.xml @@ -185,7 +185,7 @@ Limits emulation speed to a specified percentage of normal speed. Limit speed percent Specifies the percentage to limit emulation speed. 100% is the normal speed. Values higher or lower will increase or decrease the speed limit. - CPU Backend + CPU backend CPU accuracy %1$s%2$s -- cgit v1.2.3