AGS: Engine: abort in case failed both to switch and restore gfx mode

This may be a temporary solution, but it's necessary, because otherwise
engine will fail later, with a seemingly unrelated error, which will
be harder to diagnose.
From upstream 902568c4eba9dba4eb762882890c6e8a308683aa
This commit is contained in:
Walter Agazzi 2023-03-02 13:46:21 +01:00 committed by Thierry Crozat
parent f0887a3b9f
commit 711ca20dd1

View File

@ -1244,16 +1244,15 @@ bool engine_try_switch_windowed_gfxmode() {
// If failed, try switching back to previous gfx mode
res = graphics_mode_set_dm(old_dm) &&
graphics_mode_set_render_frame(old_frame);
if (!res)
quitprintf("Failed to restore graphics mode.");
}
if (res) {
// If succeeded (with any case), update engine objects that rely on
// active display mode.
if (!_G(gfxDriver)->GetDisplayMode().IsRealFullscreen())
init_desktop = get_desktop_size();
engine_post_gfxmode_setup(init_desktop);
}
// If succeeded (with any case), update engine objects that rely on
// active display mode.
if (!_G(gfxDriver)->GetDisplayMode().IsRealFullscreen())
init_desktop = get_desktop_size();
engine_post_gfxmode_setup(init_desktop);
// Make sure that we don't receive window events queued during init
sys_flush_events();
return res;