diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/sdl/sdl_glimp.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/sdl/sdl_glimp.c b/src/sdl/sdl_glimp.c index 3b619b1b..a88d9173 100644 --- a/src/sdl/sdl_glimp.c +++ b/src/sdl/sdl_glimp.c @@ -133,7 +133,7 @@ GLimp_DetectAvailableModes */ static void GLimp_DetectAvailableModes(void) { - int i; + int i, j; char buf[ MAX_STRING_CHARS ] = { 0 }; SDL_Rect modes[ 128 ]; int numModes = 0; @@ -163,6 +163,17 @@ static void GLimp_DetectAvailableModes(void) if( windowMode.format != mode.format ) continue; + // SDL can give the same resolution with different refresh rates. + // Only list resolution once. + for( j = 0; j < numModes; j++ ) + { + if( mode.w == modes[ j ].w && mode.h == modes[ j ].h ) + break; + } + + if( j != numModes ) + continue; + modes[ numModes ].w = mode.w; modes[ numModes ].h = mode.h; numModes++; @@ -178,7 +189,7 @@ static void GLimp_DetectAvailableModes(void) if( strlen( newModeString ) < (int)sizeof( buf ) - strlen( buf ) ) Q_strcat( buf, sizeof( buf ), newModeString ); else - ri.Printf( PRINT_WARNING, "Skipping mode %ux%x, buffer too small\n", modes[ i ].w, modes[ i ].h ); + ri.Printf( PRINT_WARNING, "Skipping mode %ux%u, buffer too small\n", modes[ i ].w, modes[ i ].h ); } if( *buf ) |