From 6abaee94a61b1cc07cf1eab6cc838b908d6c0a5b Mon Sep 17 00:00:00 2001 From: xbzk Date: Tue, 4 Nov 2025 16:59:06 +0100 Subject: [PATCH] fix for the rotate -> unpause bug (#2938) Some lore: On Android, whenever you pause emulation, next you will a lot likely move your phone, and then proly cause a rotation. Unpause upon rotation makes me unpause my games accidentally very often. I acknowledge that as a bug, and believe most will agree. Co-authored-by: Allison Cunha Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2938 Reviewed-by: Lizzie Reviewed-by: Caio Oliveira Co-authored-by: xbzk Co-committed-by: xbzk --- .../org/yuzu/yuzu_emu/fragments/EmulationFragment.kt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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 4ee68df3ff..2c30f94bc7 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 @@ -1511,7 +1511,9 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback { emulationState.newSurface(holder.surface) } else { - emulationState.newSurface(holder.surface) + // Surface changed due to rotation/config change + // Only update surface reference, don't trigger state changes + emulationState.updateSurfaceReference(holder.surface) } } @@ -1842,6 +1844,14 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback { } } + @Synchronized + fun updateSurfaceReference(surface: Surface?) { + this.surface = surface + if (this.surface != null && state == State.RUNNING) { + NativeLibrary.surfaceChanged(this.surface) + } + } + @Synchronized fun clearSurface() { if (surface == null) {