mrimer wrote:
StuartK wrote:
Before you release the patch, did you see this one? I've now seen crashes (freezes) and black screens when changing resolution, colour depth, and refresh rate.
So far Erik's in charge of releasing the patches, so for good or for bad, probably nothing's gonna get released until he's back from hiatus. So we can work on this stuff in the meantime. Regarding this one, I'm not sure what to do about it. If a genius like Matt or a graphics-savvy guy like Gerry happen to know how to fix it, make sure they let me know!
It'd be nice with some more information. What OS is this on, does drod.err contain anything, and do other
SDL games behave in the same way ?
I can't try this myself in Windows, but I did try it in Linux/XFree-4.3.0 by changing resolution and refresh rate (can't change bpp) while DROD was running in a window*, but I didn't get any crashes or black screens. So, either this problem is related to changing bpp (which could make sense), or it's Windows-specific (which could also make sense).
I have no idea how Windows handles these things, but a wild guess at what happens (don't treat this as fact!) is that when Windows change the screen attributes, it assigns a new screen surface to the DROD window, and also invalidates the old one. Now, when DROD resumes running after the change, it may still use the old screen, while the window is showing the new one. This could explain black screens and crashes. Another possibility is that DROD (via SDL) does in fact write to the new surface (which may just be the modified old one), but assuming that the bit depth is the same as before, so the data is all wrong and may end up outside the screen. This could explain garbage screens (possibly including black ones) and crashes.
In either case, this could happen while DROD is executing anything. The best way to fix it would be to use a event handler that gets called whenever this happens, no matter what DROD is doing at that moment, to fix the screen surface. The problem is that SDL events doesn't work that way. SDL just queue the events as they appear, for later handling. So, the right place to fix it would be in SDL, not DROD.
But, as I said, I have no idea what I'm talking about here. I hope it was entertaining, at least
*) For those interested, I used XRandR for the resolution/refresh change, not just virtual desktop change.
- Gerry