#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)
Change History (14)
comment:1 by , 14 years ago
Keywords: | review added |
---|
follow-up: 3 comment:2 by , 14 years ago
I tested the patch, it does fix this issue, but does not fix #532.
comment:3 by , 14 years ago
comment:4 by , 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 , 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 , 14 years ago
Summary: | → Fall back to windowed mode if fullscreen fails |
---|
Firefox messed up
comment:7 by , 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 , 14 years ago
Added a new patch that should compile with wsdl as well. (Will test later today when i get home.)
comment:9 by , 14 years ago
Apparently not, as SDL_SetVideoMode returns an int in windows. Which means some more changes are needed.
by , 14 years ago
Attachment: | windowed_fallback2.patch added |
---|
Windowed fallback patch (tested with wsdl)
comment:10 by , 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 , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
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.