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:
parent
4bf2e0a7aa
commit
6abaee94a6
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue