diff options
author | ludwig <ludwig@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2008-04-13 08:30:51 +0000 |
---|---|---|
committer | ludwig <ludwig@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2008-04-13 08:30:51 +0000 |
commit | ca4c2b82b665d04219cf478048b2cd0fb369aba8 (patch) | |
tree | 7518013d88e2556ac7dd7b2e23dd052918c3657e /code/q3_ui | |
parent | 26cc9629c9968cd0ae215f6ad136abd4e9671840 (diff) | |
download | ioquake3-aero-ca4c2b82b665d04219cf478048b2cd0fb369aba8.tar.gz ioquake3-aero-ca4c2b82b665d04219cf478048b2cd0fb369aba8.zip |
better handling of illegal mode values
git-svn-id: svn://svn.icculus.org/quake3/trunk@1320 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/q3_ui')
-rw-r--r-- | code/q3_ui/ui_video.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/code/q3_ui/ui_video.c b/code/q3_ui/ui_video.c index 8f5de7c..98d61ab 100644 --- a/code/q3_ui/ui_video.c +++ b/code/q3_ui/ui_video.c @@ -423,7 +423,7 @@ static void GraphicsOptions_CheckConfig( void ) continue; if ( s_ivo_templates[i].driver != s_graphicsoptions.driver.curvalue ) continue; - if ( s_ivo_templates[i].mode != s_graphicsoptions.mode.curvalue ) + if ( GraphicsOptions_FindDetectedResolution(s_ivo_templates[i].mode) != s_graphicsoptions.mode.curvalue ) continue; if ( s_ivo_templates[i].fullscreen != s_graphicsoptions.fs.curvalue ) continue; @@ -555,7 +555,12 @@ static void GraphicsOptions_ApplyChanges( void *unused, int notification ) if( resolutionsDetected ) { // search for builtin mode that matches the detected mode - int mode = GraphicsOptions_FindBuiltinResolution( s_graphicsoptions.mode.curvalue ); + int mode; + if ( s_graphicsoptions.mode.curvalue == -1 + || s_graphicsoptions.mode.curvalue >= sizeof(detectedResolutions)/sizeof(detectedResolutions[0]) ) + s_graphicsoptions.mode.curvalue = 0; + + mode = GraphicsOptions_FindBuiltinResolution( s_graphicsoptions.mode.curvalue ); if( mode == -1 ) { char w[ 16 ], h[ 16 ]; @@ -633,7 +638,7 @@ static void GraphicsOptions_Event( void* ptr, int event ) { case ID_LIST: ivo = &s_ivo_templates[s_graphicsoptions.list.curvalue]; - s_graphicsoptions.mode.curvalue = ivo->mode; + s_graphicsoptions.mode.curvalue = GraphicsOptions_FindDetectedResolution(ivo->mode); s_graphicsoptions.tq.curvalue = ivo->tq; s_graphicsoptions.lighting.curvalue = ivo->lighting; s_graphicsoptions.colordepth.curvalue = ivo->colordepth; |