mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-12-25 17:29:19 +00:00
SDL_ListModes() sometimes does not return a sorted list from largest to
smallest screen dimensions (e.g. on windows)
This commit is contained in:
parent
7fcb230d67
commit
ae6555fd46
@ -959,8 +959,16 @@ bool VideoInit(bool classic)
|
||||
int max_width = 640, max_height = 480;
|
||||
SDL_Rect **modes = SDL_ListModes(NULL, SDL_FULLSCREEN | SDL_HWSURFACE);
|
||||
if (modes && modes != (SDL_Rect **)-1) {
|
||||
max_width = modes[0]->w;
|
||||
max_height = modes[0]->h;
|
||||
// It turns out that on some implementations, and contrary to the documentation,
|
||||
// the returned list is not sorted from largest to smallest (e.g. Windows)
|
||||
for (int i = 0; modes[i] != NULL; i++) {
|
||||
const int w = modes[i]->w;
|
||||
const int h = modes[i]->h;
|
||||
if (w > max_width && h > max_height) {
|
||||
max_width = w;
|
||||
max_height = h;
|
||||
}
|
||||
}
|
||||
if (default_width > max_width)
|
||||
default_width = max_width;
|
||||
if (default_height > max_height)
|
||||
|
Loading…
Reference in New Issue
Block a user