mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-10-24 05:22:35 +00:00
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>
This commit is contained in:
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user