[Scummvm-cvs-logs] CVS: scummvm/backends/sdl sdl-common.cpp,1.45.2.1,1.45.2.2 sdl-common.h,1.20,1.20.2.1 sdl.cpp,1.28,1.28.2.1 sdl_gl.cpp,1.25,1.25.2.1

Max Horn fingolfin at users.sourceforge.net
Sun May 25 05:13:02 CEST 2003


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

Modified Files:
      Tag: branch-0-4-0
	sdl-common.cpp sdl-common.h sdl.cpp sdl_gl.cpp 
Log Message:
synced scalers, sdl & GP32 backend with trunk

Index: sdl-common.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl-common.cpp,v
retrieving revision 1.45.2.1
retrieving revision 1.45.2.2
diff -u -d -r1.45.2.1 -r1.45.2.2
--- sdl-common.cpp	18 May 2003 19:34:06 -0000	1.45.2.1
+++ sdl-common.cpp	25 May 2003 12:12:32 -0000	1.45.2.2
@@ -52,14 +52,24 @@
 }
 
 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;
+	OSystem_SDL_Common *syst = OSystem_SDL_Common::create_intern();
+
+	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)) {
@@ -95,7 +103,10 @@
 	_cdrom(0), _dirty_checksums(0),
 	_mouseVisible(false), _mouseDrawn(false), _mouseData(0),
 	_mouseHotspotX(0), _mouseHotspotY(0),
-	_currentShakePos(0), _newShakePos(0) {
+	_currentShakePos(0), _newShakePos(0),
+	_paletteDirtyStart(0), _paletteDirtyEnd(0),
+	_mutex(0) {
+
 	// allocate palette storage
 	_currentPalette = (SDL_Color *)calloc(sizeof(SDL_Color), 256);
 
@@ -104,8 +115,6 @@
 
 	// reset mouse state
 	memset(&km, 0, sizeof(km));
-	
-	_mutex = SDL_CreateMutex();
 }
 
 OSystem_SDL_Common::~OSystem_SDL_Common() {
@@ -286,7 +295,7 @@
 }
 
 #define ROL(a,n) a = (a << (n)) | (a >> (32 - (n)))
-#define DOLINE(x) a ^= ((uint32*)buf)[0 + (x) * (_screenWidth / 4)]; b ^= ((uint32 *)buf)[1 + (x) * (_screenWidth / 4)]
+#define DOLINE(x) a ^= ((const uint32*)buf)[0 + (x) * (_screenWidth / 4)]; b ^= ((const uint32 *)buf)[1 + (x) * (_screenWidth / 4)]
 
 void OSystem_SDL_Common::mk_checksums(const byte *buf) {
 	uint32 *sums = _dirty_checksums;
@@ -462,15 +471,15 @@
 }
 	
 void OSystem_SDL_Common::set_mouse_cursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y) {
-	assert(0 <= w && w <= MAX_MOUSE_W);
-	assert(0 <= h && h <= MAX_MOUSE_H);
+	assert(w <= MAX_MOUSE_W);
+	assert(h <= MAX_MOUSE_H);
 	_mouseCurState.w = w;
 	_mouseCurState.h = h;
 
 	_mouseHotspotX = hotspot_x;
 	_mouseHotspotY = hotspot_y;
 
-	_mouseData = (byte *)buf;
+	_mouseData = buf;
 
 	undraw_mouse();
 }
@@ -546,13 +555,19 @@
 				break;
 			}
 #endif
-			// Ctr-Alt-1 till Ctrl-Alt-9 will change the GFX mode
-			if (b == (KBD_CTRL|KBD_ALT) && 
-				(ev.key.keysym.sym>='1') && (ev.key.keysym.sym<='9')) {
-				Property prop;
-				prop.gfx_mode = ev.key.keysym.sym - '1';
-				property(PROP_SET_GFX_MODE, &prop);
-				break;
+			// Ctr-Alt-<key> will change the GFX mode
+			if (b == (KBD_CTRL|KBD_ALT)) {
+				char keys[] = "1234567890";
+				char *ptr;
+
+				ptr = strchr(keys, ev.key.keysym.sym);
+				if (ptr != NULL) {
+					Property prop;
+
+					prop.gfx_mode = ptr - keys;
+					property(PROP_SET_GFX_MODE, &prop);
+					break;
+				}
 			}
 
 #ifdef QTOPIA
@@ -812,7 +827,7 @@
 	return false;
 }
 
-bool OSystem_SDL_Common::set_sound_proc(void *param, SoundProc *proc, byte format) {
+bool OSystem_SDL_Common::set_sound_proc(void *param, SoundProc *proc, byte /* format */) {
 	SDL_AudioSpec desired;
 
 	memset(&desired, 0, sizeof(desired));
@@ -882,7 +897,7 @@
 	int w = _mouseCurState.w;
 	int h = _mouseCurState.h;
 	byte color;
-	byte *src = _mouseData;		// Image representing the mouse
+	const byte *src = _mouseData;		// Image representing the mouse
 
 	// clip the mouse rect, and addjust the src pointer accordingly
 	if (x < 0) {
@@ -1112,8 +1127,8 @@
 	for (h = 0; h < 32; h++) {
 		char *line = scummvm_icon[1 + ncols + h];
 		for (w = 0; w < 32; w++) {
-			icon[w + 32 * h] = rgba[line[w]];
-			if (rgba[line[w]] & 0xFF000000) {
+			icon[w + 32 * h] = rgba[(int)line[w]];
+			if (rgba[(int)line[w]] & 0xFF000000) {
 				mask[h][w >> 3] |= 1 << (7 - (w & 0x07));
 			}
 		}

Index: sdl-common.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl-common.h,v
retrieving revision 1.20
retrieving revision 1.20.2.1
diff -u -d -r1.20 -r1.20.2.1
--- sdl-common.h	30 Apr 2003 19:11:33 -0000	1.20
+++ sdl-common.h	25 May 2003 12:12:32 -0000	1.20.2.1
@@ -124,12 +124,13 @@
 	static OSystem *create(int gfx_mode, bool full_screen);
 
 protected:
-	typedef void ScalerProc(uint8 *srcPtr, uint32 srcPitch,
-								uint8 *dstPtr, uint32 dstPitch, int width, int height);
-
 	OSystem_SDL_Common();
 	virtual ~OSystem_SDL_Common();
 
+	static OSystem_SDL_Common *create_intern();
+
+	void init_intern(int gfx_mode, bool full_screen);
+
 	// unseen game screen
 	SDL_Surface *_screen;
 	int _screenWidth, _screenHeight;
@@ -186,7 +187,7 @@
 
 	bool _mouseVisible;
 	bool _mouseDrawn;
-	byte *_mouseData;
+	const byte *_mouseData;
 	byte *_mouseBackup;
 	MousePos _mouseCurState;
 	MousePos _mouseOldState;
@@ -222,8 +223,6 @@
 	void setup_icon();
 	void kbd_mouse();
 	void init_joystick() { _joystick = SDL_JoystickOpen(0); }
-
-	static OSystem_SDL_Common *create();
 };
 
 // Auxillary class to (un)lock a mutex on the stack

Index: sdl.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl.cpp,v
retrieving revision 1.28
retrieving revision 1.28.2.1
diff -u -d -r1.28 -r1.28.2.1
--- sdl.cpp	30 Apr 2003 19:11:33 -0000	1.28
+++ sdl.cpp	25 May 2003 12:12:32 -0000	1.28.2.1
@@ -48,7 +48,7 @@
 	void hotswap_gfx_mode();
 };
 
-OSystem_SDL_Common *OSystem_SDL_Common::create() {
+OSystem_SDL_Common *OSystem_SDL_Common::create_intern() {
 	return new OSystem_SDL();
 }
 
@@ -99,6 +99,10 @@
 		_scaleFactor = 2;
 		_scaler_proc = AdvMame2x;
 		break;
+	case GFX_ADVMAME3X:
+		_scaleFactor = 3;
+		_scaler_proc = AdvMame3x;
+		break;
 	case GFX_TV2X:
 		_scaleFactor = 2;
 		_scaler_proc = TV2x;
@@ -360,7 +364,7 @@
 #endif
 		return 1;
 	} else if (param == PROP_SET_GFX_MODE) {
-		if (value->gfx_mode >= 9)
+		if (value->gfx_mode >= 10)
 			return 0;
 
 		_mode = value->gfx_mode;

Index: sdl_gl.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl_gl.cpp,v
retrieving revision 1.25
retrieving revision 1.25.2.1
diff -u -d -r1.25 -r1.25.2.1
--- sdl_gl.cpp	25 Apr 2003 20:02:59 -0000	1.25
+++ sdl_gl.cpp	25 May 2003 12:12:32 -0000	1.25.2.1
@@ -69,7 +69,7 @@
 	void hotswap_gfx_mode();
 };
 
-OSystem_SDL_Common *OSystem_SDL_Common::create() {
+OSystem_SDL_Common *OSystem_SDL_Common::create_intern() {
 	return new OSystem_SDL_OpenGL();
 }
 
@@ -135,6 +135,10 @@
 		_scaleFactor = 2;
 		_scaler_proc = AdvMame2x;
 		break;
+	case GFX_ADVMAME3X:
+		_scaleFactor = 3;
+		_scaler_proc = AdvMame3x;
+		break;
 	case GFX_TV2X:
 		_scaleFactor = 2;
 		_scaler_proc = TV2x;
@@ -570,7 +574,7 @@
 				_glScreenStart = 0;
 				break;
 			default: // SDL backend
-				if (value->gfx_mode >= 9)
+				if (value->gfx_mode >= 10)
 				  return 0;
 
 				_mode = value->gfx_mode;





More information about the Scummvm-git-logs mailing list