Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#544 closed task (fixed)

Fall back to windowed mode if fullscreen fails

Reported by: Philip Taylor Owned by:
Priority: Nice to Have Milestone:
Component: Core engine Keywords: simple
Cc: Patch:

Description

Someone reports startup errors:

ERROR: SetVideoMode failed: 2960x1050:24 1 ("No video mode large enough for 2960x1050")
ERROR: SetVideoMode failed: 2960x1050:24 1 ("No video mode large enough for 2960x1050")
terminate called after throwing an instance of 'PSERROR_System_VmodeFailed'
  what():  System_VmodeFailed

Probably CVideoMode should determine when fullscreen mode fails, then try windowed mode instead of giving up entirely.

Attachments (2)

windowed_fallback.patch (1.6 KB ) - added by Øyvind L N 14 years ago.
Fallback to windowed mode patch
windowed_fallback2.patch (3.1 KB ) - added by Øyvind L N 14 years ago.
Windowed fallback patch (tested with wsdl)

Download all attachments as: .zip

Change History (14)

comment:1 by Øyvind L N, 14 years ago

Keywords: review added

Attached a simple fix. This may also fix #532, though the window didn't auto-resize on ubuntu, so i haven't been able to test.

comment:2 by Quentin Pradet, 14 years ago

I tested the patch, it does fix this issue, but does not fix #532.

in reply to:  2 comment:3 by Quentin Pradet, 14 years ago

Replying to Cygal:

I tested the patch, it does fix this issue, but does not fix #532.

In fact maybe it does; I misunderstood issue #532, sorry about that.

comment:4 by Philip Taylor, 14 years ago

Keywords: review removed

Thanks for the patch, but it looks like this will fail to compile on Windows: we have a custom implementation of a subset of the SDL API (see source/lib/sysdep/os/win/wsdl.h) which doesn't provide SDL_VideoModeOK.

I think we need to either just use SDL_SetVideoMode/SDL_GetVideoInfo (no new API functions) and retry if it fails; or reimplement SDL_VideoModeOK on Windows (I have no idea how hard that is); or switch to using real SDL instead of wsdl on Windows (that might be quite tricky, and I think there were plausible reasons why we used wsdl in the first place (though I forget exactly what they were)).

comment:5 by Øyvind L N, 14 years ago

Summary: Fall back to windowed mode if fullscreen fails

I see, wasn't aware that you used a custom implementation on windows. Should be simple to change the function to not use SDL_VideoModeOK. I'll have a look at this and the custom implementation tomorrow. I suppose this is the reason for having the part of the code in CVideoMode that reattempts with a lower BPP as well? (I could be wrong, but plain SDL should just revert to a lower BPP on it's own.) Looking at lib/config2.h i can see there are plausible reasons for using the emulated SDL. Though, using a custom SDL implementation could possibly cause more issues later, e.g with implementing resolution switching in the options menu which i was planning on doing some work on. I suppose i will have a look at this as well, if it would be possible to switch to the actualy SDL library on windows as well, that would be helpful for future upkeep.

comment:6 by Øyvind L N, 14 years ago

Summary: Fall back to windowed mode if fullscreen fails

Firefox messed up

comment:7 by Philip Taylor, 14 years ago

The fallback code in CVideoMode for 16-bit depth buffers was needed for Linux (in VMware with no hardware accelerated graphics) - SDL didn't do that fallback itself.

Ah, I wasn't aware lib/config2.h had relevant comments. wsdl was much simpler when we started, since we didn't need much from it, and since then it's been easier to incrementally add features rather than switch everything over to standard SDL and debug and fix any problems it introduces. I don't know what'll be better in the long term. If someone had a patch that made standard SDL work without any functionality/performance regressions then I'd prefer to switch, but I probably don't want to spend any significant effort on that myself.

comment:8 by Øyvind L N, 14 years ago

Added a new patch that should compile with wsdl as well. (Will test later today when i get home.)

by Øyvind L N, 14 years ago

Attachment: windowed_fallback.patch added

Fallback to windowed mode patch

comment:9 by Øyvind L N, 14 years ago

Apparently not, as SDL_SetVideoMode returns an int in windows. Which means some more changes are needed.

by Øyvind L N, 14 years ago

Attachment: windowed_fallback2.patch added

Windowed fallback patch (tested with wsdl)

comment:10 by Philip Taylor, 14 years ago

Looks good, thanks! I haven't tested it on Windows myself but I'll believe it works there. Just made a few stylistic alterations to better match the surrounding code.

Is anyone able to reproduce the bug in #532 before this patch, and confirm whether the patch does or doesn't fix it? (I forgot what platform I found that bug on :-( )

comment:11 by philip, 14 years ago

Resolution: fixed
Status: newclosed

(In [8072]) Fix #544 (Fall back to windowed mode if fullscreen fails), based on patch from oln

comment:12 by (none), 14 years ago

Milestone: Unclassified

Milestone Unclassified deleted

Note: See TracTickets for help on using tickets.