[Scummvm-cvs-logs] CVS: scummvm/backends/sdl sdl-common.cpp,1.46,1.47 sdl-common.h,1.20,1.21 sdl.cpp,1.29,1.30 sdl_gl.cpp,1.27,1.28

Max Horn fingolfin at users.sourceforge.net
Wed May 14 12:45:12 CEST 2003


Update of /cvsroot/scummvm/scummvm/backends/sdl
In directory sc8-pr-cvs1:/tmp/cvs-serv18641

Modified Files:
	sdl-common.cpp sdl-common.h sdl.cpp sdl_gl.cpp 
Log Message:
fixed bug where SDL_CreateMutex was being called before SDL_Init; restructured code a little

Index: sdl-common.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl-common.cpp,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- sdl-common.cpp	9 May 2003 22:44:16 -0000	1.46
+++ sdl-common.cpp	14 May 2003 19:44:41 -0000	1.47
@@ -53,13 +53,23 @@
 
 OSystem *OSystem_SDL_Common::create(int gfx_mode, bool full_screen) {
 	OSystem_SDL_Common *syst = OSystem_SDL_Common::create();
-	syst->_mode = gfx_mode;
-	syst->_full_screen = full_screen;
+
+	syst->init_intern(gfx_mode, full_screen);
+
+	return syst;
+}
+
+void OSystem_SDL_Common::init_intern(int gfx_mode, bool full_screen) {
+
+	_mode = gfx_mode;
+	_full_screen = full_screen;
 
 	if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER | SDL_INIT_JOYSTICK) ==-1) {
 		error("Could not initialize SDL: %s.\n", SDL_GetError());
 	}
 
+	_mutex = SDL_CreateMutex();
+
 	SDL_ShowCursor(SDL_DISABLE);
 	
 	// Enable unicode support if possible
@@ -67,7 +77,7 @@
 
 #ifndef MACOSX		// Don't set icon on OS X, as we use a nicer external icon there
 	// Setup the icon
-	syst->setup_icon();
+	setup_icon();
 #endif
 
 #ifndef MACOSX		// Work around a bug in OS X
@@ -79,10 +89,8 @@
 	// enable joystick
 	if (SDL_NumJoysticks() > 0) {
 		printf("Using joystick: %s\n", SDL_JoystickName(0));
-		syst->init_joystick();
+		init_joystick();
 	}
-
-	return syst;
 }
 
 void OSystem_SDL_Common::set_timer(int timer, int (*callback)(int)) {
@@ -105,7 +113,7 @@
 	// reset mouse state
 	memset(&km, 0, sizeof(km));
 	
-	_mutex = SDL_CreateMutex();
+	_mutex = 0;
 }
 
 OSystem_SDL_Common::~OSystem_SDL_Common() {

Index: sdl-common.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl-common.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- sdl-common.h	30 Apr 2003 19:11:33 -0000	1.20
+++ sdl-common.h	14 May 2003 19:44:41 -0000	1.21
@@ -130,6 +130,10 @@
 	OSystem_SDL_Common();
 	virtual ~OSystem_SDL_Common();
 
+	static OSystem *create_intern();
+
+	void init_intern(int gfx_mode, bool full_screen);
+
 	// unseen game screen
 	SDL_Surface *_screen;
 	int _screenWidth, _screenHeight;

Index: sdl.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- sdl.cpp	9 May 2003 22:44:16 -0000	1.29
+++ sdl.cpp	14 May 2003 19:44:41 -0000	1.30
@@ -48,7 +48,7 @@
 	void hotswap_gfx_mode();
 };
 
-OSystem_SDL_Common *OSystem_SDL_Common::create() {
+OSystem *OSystem_SDL_Common::create_intern() {
 	return new OSystem_SDL();
 }
 

Index: sdl_gl.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl_gl.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- sdl_gl.cpp	13 May 2003 15:58:27 -0000	1.27
+++ sdl_gl.cpp	14 May 2003 19:44:41 -0000	1.28
@@ -69,7 +69,7 @@
 	void hotswap_gfx_mode();
 };
 
-OSystem_SDL_Common *OSystem_SDL_Common::create() {
+OSystem *OSystem_SDL_Common::create_intern() {
 	return new OSystem_SDL_OpenGL();
 }
 





More information about the Scummvm-git-logs mailing list