From 843be847eb31d8f0bea4e552b87c20f6d3002406 Mon Sep 17 00:00:00 2001 From: gerstrong Date: Sun, 9 Aug 2009 13:52:35 +0000 Subject: [PATCH] Improved resolution detection system git-svn-id: https://clonekeenplus.svn.sourceforge.net/svnroot/clonekeenplus/cgenius/trunk@218 4df4b0f3-56ce-47cb-b001-ed939b7d65a6 --- data/resolutions.cfg | 2 +- readme.txt | 35 +++++++++++++++++------------------ src/CLogFile.h | 2 +- src/sdl/CVideoDriver.cpp | 29 ++++++++++++++++++++++++++++- 4 files changed, 47 insertions(+), 21 deletions(-) diff --git a/data/resolutions.cfg b/data/resolutions.cfg index 8b88ca8c2..54ed2a268 100644 --- a/data/resolutions.cfg +++ b/data/resolutions.cfg @@ -4,6 +4,6 @@ 800x600x32 1024x768x32 1280x1024x32 -1600x1200x32 1680x1050x32 +1600x1200x32 1920x1200x32 diff --git a/readme.txt b/readme.txt index 3bbe8c964..a98164775 100644 --- a/readme.txt +++ b/readme.txt @@ -1,18 +1,18 @@ -************************************* -* * -* Commander Genius * -* (CloneKeenPlus) * -* * -* (c)2008-2009 Gerstrong * -* (c)2009 Pickle * -* (c)2009 Tulip * -* (c)2009 DaVince -* (c)2003-2005 Caitlin Shaw * -* Released under GNU/GPL * -* * -* Prerelease v0.3 * -* * -************************************* +********************************************** +* * +* Commander Genius * +* (CloneKeenPlus) * +* * +* (c)2008-2009 Gerstrong * +* (c)2009 Pickle * +* (c)2009 Tulip * +* (c)2009 DaVince * +* (c)2003-2005 and 2009 Caitlin Shaw * +* Released under GNU/GPL * +* * +* Release v0.3 * +* * +********************************************** Welcome to Commander Genius (aka CloneKeenPlus) @@ -22,9 +22,8 @@ Vorticons by ID Software. Commander Genius requires the original game data files to work. You can play all three episodes of the game and some fanmade mods. -Commander Genius currently runs under Linux/X11 and Windows with SDL. -In Mac OS X it also runs, but we are still looking for a distributor. -Check our website to get CG running on MacOs X Systems. +Commander Genius currently runs under Linux/X11, Windows +and MacOS X with SDL. Also portable systems are supported (Wiz) Commander Genius tries to mostly replicate the original game, however there are also a number of improvements like: diff --git a/src/CLogFile.h b/src/CLogFile.h index 82cebc6aa..d2be309c2 100644 --- a/src/CLogFile.h +++ b/src/CLogFile.h @@ -8,7 +8,7 @@ #ifndef CLOGFILE_H_ #define CLOGFILE_H_ -#define REVISION "Commander Genius Prerelease v0.3 Pre9" +#define REVISION "Commander Genius Release v0.3" #include "CSingleton.h" #define g_pLogFile CLogFile::Get() diff --git a/src/sdl/CVideoDriver.cpp b/src/sdl/CVideoDriver.cpp index dc571caa6..b1b118126 100644 --- a/src/sdl/CVideoDriver.cpp +++ b/src/sdl/CVideoDriver.cpp @@ -111,15 +111,42 @@ void CVideoDriver::initResolutionList() } else { + // Init SDL in order to check, if the resolutions are really supported + if(SDL_Init(SDL_INIT_VIDEO) < 0) + { + g_pLogFile->textOut(RED,"Could not initialize SDL for mode detection: %s
", SDL_GetError()); + return; + } + else + g_pLogFile->textOut(GREEN,"SDL-Video was successfully initialized for mode detections!
"); + + + std::list :: iterator i; while(!ResolutionFile.eof()) { ResolutionFile.getline(buf,256); if(sscanf(buf,"%hdx%hdx%hd", &resolution.width, &resolution.height, &resolution.depth) == 3) - m_Resolutionlist.push_back(resolution); + // Now check if it's possible to use this resolution + resolution.depth = SDL_VideoModeOK(resolution.width, resolution.height, + resolution.depth, SDL_FULLSCREEN); + if(resolution.depth) + { + for( i = m_Resolutionlist.begin() ; i != m_Resolutionlist.end() ; i++ ) + if(i->width == resolution.width && + i->height == resolution.height && + i->depth == resolution.depth) break; + + if(i == m_Resolutionlist.end()) + m_Resolutionlist.push_back(resolution); + } } ResolutionFile.close(); + + SDL_Quit(); + + // shutdown SDL, so the game can initialize it correctly } if(m_Resolutionlist.empty()) {