[iortcw] 221/497: All: Don't add duplicate resolutions to r_availableModes
Simon McVittie
smcv at debian.org
Fri Sep 8 10:36:55 UTC 2017
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to annotated tag 1.42d
in repository iortcw.
commit d70b24955548857463540c92324b807c63cfb73e
Author: M4N4T4RMS at gmail.com <M4N4T4RMS at gmail.com@e65d2741-a53d-b2dc-ae96-bb75fa5e4c4a>
Date: Mon Sep 22 07:32:00 2014 +0000
All: Don't add duplicate resolutions to r_availableModes
---
MP/code/sdl/sdl_glimp.c | 15 +++++++++++++--
SP/code/sdl/sdl_glimp.c | 15 +++++++++++++--
2 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/MP/code/sdl/sdl_glimp.c b/MP/code/sdl/sdl_glimp.c
index 1d67082..a910d99 100644
--- a/MP/code/sdl/sdl_glimp.c
+++ b/MP/code/sdl/sdl_glimp.c
@@ -143,7 +143,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;
@@ -173,6 +173,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++;
@@ -188,7 +199,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 )
diff --git a/SP/code/sdl/sdl_glimp.c b/SP/code/sdl/sdl_glimp.c
index 1d67082..a910d99 100644
--- a/SP/code/sdl/sdl_glimp.c
+++ b/SP/code/sdl/sdl_glimp.c
@@ -143,7 +143,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;
@@ -173,6 +173,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++;
@@ -188,7 +199,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 )
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git
More information about the Pkg-games-commits
mailing list