rpms/CriticalMass/F-13 CriticalMass-1.0.2-res-change-rh566533.patch, NONE, 1.1 CriticalMass.spec, 1.7, 1.8

Hans de Goede jwrdegoede at fedoraproject.org
Mon Jul 12 20:10:51 UTC 2010


Author: jwrdegoede

Update of /cvs/pkgs/rpms/CriticalMass/F-13
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv16578

Modified Files:
	CriticalMass.spec 
Added Files:
	CriticalMass-1.0.2-res-change-rh566533.patch 
Log Message:
* Mon Jul 12 2010 Hans de Goede <hdegoede at redhat.com> 1.0.2-8
- Fix crash when trying to change resolution to a resolution too big for
  the monitor (#566533)
- Fix misdetection of available resolutions (they were all given the width
  of the highest resolution)


CriticalMass-1.0.2-res-change-rh566533.patch:
 Selectable.hpp |    2 +-
 Video.cpp      |   45 +++++++++++++++++++++++++++++++++------------
 Video.hpp      |    2 +-
 3 files changed, 35 insertions(+), 14 deletions(-)

--- NEW FILE CriticalMass-1.0.2-res-change-rh566533.patch ---
--- CriticalMass-1.0.2/game/Selectable.hpp	2005-08-15 03:06:37.000000000 +0200
+++ CriticalMass-1.0.2.foo/game/Selectable.hpp	2010-07-12 15:33:57.229790590 +0200
@@ -139,7 +139,7 @@
 	string text;
 	bool operator==(Resolution &r1)
 	{
-	    return (r1.width=width) && (r1.height==height);
+	    return (r1.width==width) && (r1.height==height);
 	}
 	bool operator!=(Resolution &r1)
 	{
--- CriticalMass-1.0.2/game/Video.cpp	2006-07-16 01:43:57.000000000 +0200
+++ CriticalMass-1.0.2.foo/game/Video.cpp	2010-07-12 16:40:16.377919418 +0200
@@ -124,10 +124,9 @@
 	_fpsStepSize = 1.0f/(float)_maxFPS;
     }
 
-    ConfigS::instance()->getBoolean( "fullscreen", _isFullscreen);
-
     if( !setVideoMode())
     {
+	SDL_QuitSubSystem( SDL_INIT_VIDEO);
 	return false;
     }
 
@@ -247,6 +246,8 @@
 bool Video::setVideoMode( void)
 {
     int videoFlags = SDL_OPENGL;
+
+    ConfigS::instance()->getBoolean( "fullscreen", _isFullscreen);
     if( _isFullscreen)
     {
         LOG_INFO << "Fullscreen request." << endl;
@@ -279,14 +280,12 @@
     if( ! ::init("libGL.so.1"))
     {
 	LOG_ERROR << "SDL Error: " << SDL_GetError() << endl;
-	SDL_QuitSubSystem( SDL_INIT_VIDEO);
 	return false;
     }
 
     if( SDL_SetVideoMode( _width, _height, _bpp, videoFlags ) == NULL )
     {
         LOG_ERROR << "Video Mode: failed #" << SDL_GetError() << endl;
-	SDL_QuitSubSystem( SDL_INIT_VIDEO);
         return false;
     }
     glViewport(0,0, _width, _height);
@@ -304,16 +303,20 @@
     return true;
 }
 
-void  Video::updateSettings( void)
+bool Video::updateSettings( void)
 {
-    bool fullscreen = _isFullscreen;
-    ConfigS::instance()->getBoolean( "fullscreen", _isFullscreen);
+    bool isFullscreen, oldIsFullscreen;
+    int width, height, oldWidth, oldHeight;
+
+    isFullscreen = oldIsFullscreen = _isFullscreen;
+    width  = oldWidth  = _width;
+    height = oldHeight = _height;
 
-    int width = 0;
+    ConfigS::instance()->getBoolean( "fullscreen", isFullscreen);
     ConfigS::instance()->getInteger( "width", width);
-    int height = 0;
     ConfigS::instance()->getInteger( "height", height);
-    if( (fullscreen != _isFullscreen) || (width != _width) || (height != _height))
+
+    if( (isFullscreen != oldIsFullscreen) || (width != oldWidth) || (height != oldHeight))
     {
 #ifdef DYNAMIC_GL
 	SDL_QuitSubSystem( SDL_INIT_VIDEO);
@@ -322,7 +325,22 @@
 	    LOG_ERROR << "Update Video: failed # " << SDL_GetError() << endl;
 	}
 #endif
-	setVideoMode();
+	if (!setVideoMode()) {
+	    // Try again with old settings.
+	    Value *fs = new Value( oldIsFullscreen);
+	    Value *w = new Value( oldWidth);
+	    Value *h = new Value( oldHeight);
+
+	    ConfigS::instance()->updateKeyword( "fullscreen", fs);
+	    ConfigS::instance()->updateKeyword( "width", w);
+	    ConfigS::instance()->updateKeyword( "height", h);
+
+	    if (!setVideoMode()) {
+		SDL_QuitSubSystem(SDL_INIT_VIDEO);
+		GameState::isAlive = false;
+		return false;
+	    }
+	}
 	reload();
 #ifdef DYNAMIC_GL
 	//hide&grab cursor and warp to centre
@@ -345,6 +363,8 @@
 
     ConfigS::instance()->getBoolean( "showStarfield", _showStarfield);
     ConfigS::instance()->getBoolean( "showNebulas", _showNebulas);
+
+    return true;
 }
 
 void Video::updateLogic( void)
@@ -360,7 +380,8 @@
     float thisTime = Timer::getTime();
     if( thisTime > nextTime)
     {
-	updateSettings();
+	if (!updateSettings())
+	    return false;
 	nextTime = thisTime+0.5f;
     }
 
--- CriticalMass-1.0.2/game/Video.hpp	2005-12-31 01:37:26.000000000 +0100
+++ CriticalMass-1.0.2.foo/game/Video.hpp	2010-07-12 16:37:20.560170285 +0200
@@ -52,7 +52,7 @@
     Video &operator=(const Video&);
 
     void reload( void);
-    void updateSettings( void);
+    bool updateSettings( void);
     bool setVideoMode( void);
 
     bool _isFullscreen;


Index: CriticalMass.spec
===================================================================
RCS file: /cvs/pkgs/rpms/CriticalMass/F-13/CriticalMass.spec,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -p -r1.7 -r1.8
--- CriticalMass.spec	24 Jul 2009 15:05:46 -0000	1.7
+++ CriticalMass.spec	12 Jul 2010 20:10:51 -0000	1.8
@@ -1,6 +1,6 @@
 Name:           CriticalMass
 Version:        1.0.2
-Release:        7%{?dist}
+Release:        8%{?dist}
 Summary:        SDL/OpenGL space shoot'em up game also known as critter
 Group:          Amusements/Games
 License:        GPLv2+
@@ -10,6 +10,7 @@ Source1:        %{name}.desktop
 Patch0:         CriticalMass-1.0.2-sys-curl.patch
 Patch1:         CriticalMass-1.0.2-sys-tinyxml.patch
 Patch2:         CriticalMass-1.0.2-gcc43.patch
+Patch3:         CriticalMass-1.0.2-res-change-rh566533.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires:  SDL_image-devel SDL_mixer-devel libpng-devel curl-devel
 BuildRequires:  tinyxml-devel desktop-file-utils
@@ -30,6 +31,7 @@ a tiny spacecraft and sent after them.
 %patch0 -p1
 %patch1 -p1
 %patch2 -p1
+%patch3 -p1
 
 
 %build
@@ -85,6 +87,12 @@ fi
 
 
 %changelog
+* Mon Jul 12 2010 Hans de Goede <hdegoede at redhat.com> 1.0.2-8
+- Fix crash when trying to change resolution to a resolution too big for
+  the monitor (#566533)
+- Fix misdetection of available resolutions (they were all given the width
+  of the highest resolution)
+
 * Fri Jul 24 2009 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.0.2-7
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
 



More information about the scm-commits mailing list