From 42d3ff8d1d90b6f8b23f8d5af065565525d2b429 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Mon, 27 Aug 2012 14:52:41 +0000 Subject: [PATCH] Added r_mode -2, uses desktop resolution. Bug #5408. Patch by Andrei Drexler and myself. --- README | 2 ++ code/sdl/sdl_glimp.c | 20 +++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/README b/README index c19e28d7..4b4260c1 100644 --- a/README +++ b/README @@ -273,6 +273,8 @@ New cvars captured using screenshotJPEG r_aviMotionJpegQuality - Controls quality of video capture when cl_aviMotionJpeg is enabled + r_mode -2 - This new video mode automatically uses the + desktop resolution. New commands video [filename] - start video capture (use with demo command) diff --git a/code/sdl/sdl_glimp.c b/code/sdl/sdl_glimp.c index 9921e587..1d4af0b3 100644 --- a/code/sdl/sdl_glimp.c +++ b/code/sdl/sdl_glimp.c @@ -250,7 +250,25 @@ static int GLimp_SetMode(int mode, qboolean fullscreen, qboolean noborder) ri.Printf (PRINT_ALL, "...setting mode %d:", mode ); - if ( !R_GetModeInfo( &glConfig.vidWidth, &glConfig.vidHeight, &glConfig.windowAspect, mode ) ) + if (mode == -2) + { + // use desktop video resolution + if( videoInfo->current_h > 0 ) + { + glConfig.vidWidth = videoInfo->current_w; + glConfig.vidHeight = videoInfo->current_h; + } + else + { + glConfig.vidWidth = 480; + glConfig.vidHeight = 640; + ri.Printf( PRINT_ALL, + "Cannot determine display resolution, assuming 640x480\n" ); + } + + glConfig.windowAspect = (float)glConfig.vidWidth / (float)glConfig.vidHeight; + } + else if ( !R_GetModeInfo( &glConfig.vidWidth, &glConfig.vidHeight, &glConfig.windowAspect, mode ) ) { ri.Printf( PRINT_ALL, " invalid mode\n" ); return RSERR_INVALID_MODE;