Browse Source

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 <allisonbzk@gmail.com>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2938
Reviewed-by: Lizzie <lizzie@eden-emu.dev>
Reviewed-by: Caio Oliveira <caiooliveirafarias0@gmail.com>
Co-authored-by: xbzk <xbzk@eden-emu.dev>
Co-committed-by: xbzk <xbzk@eden-emu.dev>
pull/2964/head
xbzk 2 months ago
committed by crueter
parent
commit
6abaee94a6
No known key found for this signature in database GPG Key ID: 425ACD2D4830EBC6
  1. 12
      src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt

12
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) emulationState.newSurface(holder.surface)
} else { } 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 @Synchronized
fun clearSurface() { fun clearSurface() {
if (surface == null) { if (surface == null) {

Loading…
Cancel
Save