Index: backends/sdl/sdl-common.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl-common.cpp,v
retrieving revision 1.32
diff -u -r1.32 sdl-common.cpp
--- backends/sdl/sdl-common.cpp	28 Jan 2003 06:06:47 -0000	1.32
+++ backends/sdl/sdl-common.cpp	2 Feb 2003 13:30:50 -0000
@@ -423,7 +423,8 @@
 
 void OSystem_SDL_Common::warp_mouse(int x, int y) {
 	if (_mouseCurState.x != x || _mouseCurState.y != y)
-		SDL_WarpMouse(x * _scaleFactor, y * _scaleFactor);
+		SDL_WarpMouse(x * _scaleFactor_hmul / _scaleFactor_hdiv,
+			y * _scaleFactor_vmul / _scaleFactor_vdiv);
 }
 	
 void OSystem_SDL_Common::set_mouse_cursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y) {
@@ -624,8 +625,10 @@
 			km.x = event->mouse.x = ev.motion.x;
 			km.y = event->mouse.y = ev.motion.y;
 
-			event->mouse.x /= _scaleFactor;
-			event->mouse.y /= _scaleFactor;
+			event->mouse.x *= _scaleFactor_hdiv;
+			event->mouse.x /= _scaleFactor_hmul;
+			event->mouse.y *= _scaleFactor_vdiv;
+			event->mouse.y /= _scaleFactor_vmul;
 
 			return true;
 
@@ -644,8 +647,10 @@
 				break;
 			km.x = event->mouse.x = ev.motion.x;
 			km.y = event->mouse.y = ev.motion.y;
-			event->mouse.x /= _scaleFactor;
-			event->mouse.y /= _scaleFactor;
+			event->mouse.x *= _scaleFactor_hdiv;
+			event->mouse.x /= _scaleFactor_hmul;
+			event->mouse.y *= _scaleFactor_vdiv;
+			event->mouse.y /= _scaleFactor_vmul;
 
 			return true;
 
@@ -658,8 +663,10 @@
 				break;
 			event->mouse.x = ev.button.x;
 			event->mouse.y = ev.button.y;
-			event->mouse.x /= _scaleFactor;
-			event->mouse.y /= _scaleFactor;
+			event->mouse.x *= _scaleFactor_hdiv;
+			event->mouse.x /= _scaleFactor_hmul;
+			event->mouse.y *= _scaleFactor_vdiv;
+			event->mouse.y /= _scaleFactor_vmul;
 			return true;
 
 		case SDL_JOYBUTTONDOWN:
Index: backends/sdl/sdl-common.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl-common.h,v
retrieving revision 1.15
diff -u -r1.15 sdl-common.h
--- backends/sdl/sdl-common.h	20 Jan 2003 16:29:26 -0000	1.15
+++ backends/sdl/sdl-common.h	2 Feb 2003 13:30:50 -0000
@@ -125,7 +125,7 @@
 
 protected:
 	typedef void ScalerProc(uint8 *srcPtr, uint32 srcPitch, uint8 *deltaPtr,
-								uint8 *dstPtr, uint32 dstPitch, int width, int height);
+								uint8 *dstPtr, uint32 dstPitch, int x, int y, int width, int height);
 
 	OSystem_SDL_Common();
 	virtual ~OSystem_SDL_Common();
@@ -150,7 +150,10 @@
 	};
 
 	bool _forceFull; // Force full redraw on next update_screen
-	int _scaleFactor;
+	int _scaleFactor_hmul;
+	int _scaleFactor_hdiv;
+	int _scaleFactor_vmul;
+	int _scaleFactor_vdiv;
 	int _mode;
 	bool _full_screen;
 	uint32 _mode_flags;
Index: backends/sdl/sdl.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl.cpp,v
retrieving revision 1.21
diff -u -r1.21 sdl.cpp
--- backends/sdl/sdl.cpp	15 Jan 2003 02:11:36 -0000	1.21
+++ backends/sdl/sdl.cpp	2 Feb 2003 13:30:51 -0000
@@ -84,28 +84,42 @@
 	
 	switch(_mode) {
 	case GFX_2XSAI:
-		_scaleFactor = 2;
+		_scaleFactor_hmul = _scaleFactor_vmul = 2;
+		_scaleFactor_hdiv = _scaleFactor_vdiv = 1;
 		_scaler_proc = _2xSaI;
 		break;
 	case GFX_SUPER2XSAI:
-		_scaleFactor = 2;
+		_scaleFactor_hmul = _scaleFactor_vmul = 2;
+		_scaleFactor_hdiv = _scaleFactor_vdiv = 1;
 		_scaler_proc = Super2xSaI;
 		break;
 	case GFX_SUPEREAGLE:
-		_scaleFactor = 2;
+		_scaleFactor_hmul = _scaleFactor_vmul = 2;
+		_scaleFactor_hdiv = _scaleFactor_vdiv = 1;
 		_scaler_proc = SuperEagle;
 		break;
 	case GFX_ADVMAME2X:
-		_scaleFactor = 2;
+		_scaleFactor_hmul = _scaleFactor_vmul = 2;
+		_scaleFactor_hdiv = _scaleFactor_vdiv = 1;
 		_scaler_proc = AdvMame2x;
 		break;
 	case GFX_TV2X:
-		_scaleFactor = 2;
+		_scaleFactor_hmul = _scaleFactor_vmul = 2;
+		_scaleFactor_hdiv = _scaleFactor_vdiv = 1;
 		_scaler_proc = TV2x;
 		break;
 
+	case GFX_RATIO800:
+		_scaleFactor_hmul = 5;
+		_scaleFactor_hdiv = 2;
+		_scaleFactor_vmul = 3;
+		_scaleFactor_vdiv = 1;
+		_scaler_proc = Ratio800;
+		break;
+
 	case GFX_DOUBLESIZE:
-		_scaleFactor = 2;
+		_scaleFactor_hmul = _scaleFactor_vmul = 2;
+		_scaleFactor_hdiv = _scaleFactor_vdiv = 1;
 		_scaler_proc = Normal2x;
 		break;
 
@@ -114,18 +128,21 @@
 			warning("full screen in useless in triplesize mode, reverting to normal mode");
 			goto normal_mode;
 		}
-		_scaleFactor = 3;
+		_scaleFactor_hmul = _scaleFactor_vmul = 3;
+		_scaleFactor_hdiv = _scaleFactor_vdiv = 1;
 		_scaler_proc = Normal3x;
 		break;
 
 	case GFX_NORMAL:
 normal_mode:;
-		_scaleFactor = 1;
+		_scaleFactor_hmul = _scaleFactor_vmul = 1;
+		_scaleFactor_hdiv = _scaleFactor_vdiv = 1;
 		_scaler_proc = Normal1x;
 		break;
 	default:
 		error("unknown gfx mode");
-		_scaleFactor = 1;
+		_scaleFactor_hmul = _scaleFactor_vmul = 1;
+		_scaleFactor_hdiv = _scaleFactor_vdiv = 1;
 		_scaler_proc = NULL;
 	}
 
@@ -140,7 +157,7 @@
 	//
 	// Create the surface that contains the scaled graphics in 16 bit mode
 	//
-	_hwscreen = SDL_SetVideoMode(_screenWidth * _scaleFactor, _screenHeight * _scaleFactor, 16, 
+	_hwscreen = SDL_SetVideoMode(_screenWidth * _scaleFactor_hmul / _scaleFactor_hdiv, _screenHeight * _scaleFactor_vmul / _scaleFactor_vdiv, 16, 
 		_full_screen ? (SDL_FULLSCREEN|SDL_SWSURFACE) : SDL_SWSURFACE
 	);
 	if (_hwscreen == NULL)
@@ -169,8 +186,8 @@
 		error("_tmpscreen failed");
 	
 	// keyboard cursor control, some other better place for it?
-	km.x_max = _screenWidth * _scaleFactor - 1;
-	km.y_max = _screenHeight * _scaleFactor - 1;
+	km.x_max = _screenWidth * _scaleFactor_hmul / _scaleFactor_hdiv - 1;
+	km.y_max = _screenHeight * _scaleFactor_vmul / _scaleFactor_vdiv - 1;
 	km.delay_time = 25;
 	km.last_time = 0;
 
@@ -231,7 +248,8 @@
 
 	// If the shake position changed, fill the dirty area with blackness
 	if (_currentShakePos != _newShakePos) {
-		SDL_Rect blackrect = {0, 0, _screenWidth*_scaleFactor, _newShakePos*_scaleFactor};
+		/* ratio: FIXME */
+		SDL_Rect blackrect = {0, 0, _screenWidth*_scaleFactor_hmul / _scaleFactor_hdiv, _newShakePos*_scaleFactor_vmul / _scaleFactor_vdiv};
 		SDL_FillRect(_hwscreen, &blackrect, 0);
 
 		_currentShakePos = _newShakePos;
@@ -297,16 +315,20 @@
 				if (dst_h > _screenHeight - dst_y)
 					dst_h = _screenHeight - dst_y;
 				
-				dst_y *= _scaleFactor;
+				dst_y *= _scaleFactor_vmul;
+				dst_y /= _scaleFactor_vdiv;
 				
 				_scaler_proc((byte*)_tmpscreen->pixels + (r->x*2+2) + (r->y+1)*srcPitch, srcPitch, NULL, 
-					(byte*)_hwscreen->pixels + r->x*2*_scaleFactor + dst_y*dstPitch, dstPitch, r->w, dst_h);
+					(byte*)_hwscreen->pixels + (r->x*_scaleFactor_hmul / _scaleFactor_hdiv) * 2 + dst_y*dstPitch, dstPitch, r->x, r->y, r->w, dst_h);
 			}
 			
-			r->x *= _scaleFactor;
+			r->w = (r->x + r->w) * _scaleFactor_hmul / _scaleFactor_hdiv;
+			r->x *= _scaleFactor_hmul;
+			r->x /= _scaleFactor_hdiv;
+			r->w -= r->x;
+			r->h = (r->y + r->h) * _scaleFactor_vmul / _scaleFactor_vdiv;
 			r->y = dst_y;
-			r->w *= _scaleFactor;
-			r->h = dst_h * _scaleFactor;
+			r->h -= r->y;
 		}
 		
 		SDL_UnlockSurface(_tmpscreen);
@@ -316,7 +338,7 @@
 		// This is necessary if shaking is active.
 		if (_forceFull) {
 			_dirty_rect_list[0].y = 0;
-			_dirty_rect_list[0].h = _screenHeight * _scaleFactor;
+			_dirty_rect_list[0].h = _screenHeight * _scaleFactor_vmul / _scaleFactor_vdiv;
 		}
 
 		// Finally, blit all our changes to the screen
Index: common/gameDetector.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/gameDetector.cpp,v
retrieving revision 1.66
diff -u -r1.66 gameDetector.cpp
--- common/gameDetector.cpp	2 Feb 2003 13:16:12 -0000	1.66
+++ common/gameDetector.cpp	2 Feb 2003 13:30:53 -0000
@@ -47,7 +47,7 @@
 	"\t-p<path>   - look for game in <path>\n"
 	"\t-x[<num>]  - load this savegame (default: 0 - autosave)\n"
 	"\t-f         - fullscreen mode\n"
-	"\t-g<mode>   - graphics mode (normal,2x,3x,2xsai,super2xsai,supereagle,advmame2x,tv2x)\n"
+	"\t-g<mode>   - graphics mode (normal,2x,3x,2xsai,super2xsai,supereagle,advmame2x,tv2x,ratio800)\n"
 	"\t-e<mode>   - set music engine (see README for details)\n"
 	"\t-a         - specify game is amiga version\n"
 	"\t-q<lang>   - specify language (en,de,fr,it,pt,es,ja,zh,ko,hb)\n"
@@ -184,6 +184,7 @@
 	{"supereagle", "SuperEagle", GFX_SUPEREAGLE},
 	{"advmame2x", "AdvMAME2x", GFX_ADVMAME2X},
 	{"tv2x", "TV2x", GFX_TV2X},
+	{"ratio800", "Ratio800", GFX_RATIO800},
 	{0, 0}
 };
 
Index: common/scaler.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/scaler.cpp,v
retrieving revision 1.6
diff -u -r1.6 scaler.cpp
--- common/scaler.cpp	19 Jan 2003 22:28:36 -0000	1.6
+++ common/scaler.cpp	2 Feb 2003 13:30:56 -0000
@@ -146,7 +146,8 @@
 #define GREEN_MASK555 0x03E003E0
 
 void Super2xSaI(uint8 *srcPtr, uint32 srcPitch,
-								uint8 *deltaPtr, uint8 *dstPtr, uint32 dstPitch, int width, int height)
+								uint8 *deltaPtr, uint8 *dstPtr, uint32 dstPitch,
+            int x, int y, int width, int height)
 {
 	uint16 *bP;
 	uint8 *dP;
@@ -265,7 +266,8 @@
 }
 
 void SuperEagle(uint8 *srcPtr, uint32 srcPitch, uint8 *deltaPtr,
-								uint8 *dstPtr, uint32 dstPitch, int width, int height)
+								uint8 *dstPtr, uint32 dstPitch,
+            int x, int y, int width, int height)
 {
 	uint8 *dP;
 	uint16 *bP;
@@ -385,7 +387,8 @@
 }
 
 void _2xSaI(uint8 *srcPtr, uint32 srcPitch, uint8 *deltaPtr,
-						uint8 *dstPtr, uint32 dstPitch, int width, int height)
+						uint8 *dstPtr, uint32 dstPitch,
+            int x, int y, int width, int height)
 {
 	uint8 *dP;
 	uint16 *bP;
@@ -582,9 +585,11 @@
 	return (result & redblueMask) | ((result >> 16) & greenMask);
 }
 
+/* not used */
 void Scale_2xSaI(uint8 *srcPtr, uint32 srcPitch, uint8 * /* deltaPtr */ ,
 								 uint8 *dstPtr, uint32 dstPitch,
-								 uint32 dstWidth, uint32 dstHeight, int width, int height)
+								 uint32 dstWidth, uint32 dstHeight,
+            int x, int y, int width, int height)
 {
 	uint8 *dP;
 	uint16 *bP;
@@ -716,7 +721,7 @@
 }
 
 void AdvMame2x(uint8 *srcPtr, uint32 srcPitch, uint8 *null, uint8 *dstPtr, uint32 dstPitch,
-							 int width, int height)
+            int x, int y, int width, int height)
 {
 	unsigned int nextlineSrc = srcPitch / sizeof(short);
 	short *p = (short *)srcPtr;
@@ -748,7 +753,7 @@
 
 
 void Normal1x(uint8 *srcPtr, uint32 srcPitch, uint8 *null, uint8 *dstPtr, uint32 dstPitch,
-							int width, int height)
+            int x, int y, int width, int height)
 {
 	while (height--) {
 		memcpy(dstPtr, srcPtr, 2 * width);
@@ -758,7 +763,7 @@
 }
 
 void Normal2x(uint8 *srcPtr, uint32 srcPitch, uint8 *null, uint8 *dstPtr, uint32 dstPitch,
-							int width, int height)
+            int x, int y, int width, int height)
 {
 	uint8 *r;
 
@@ -778,7 +783,7 @@
 }
 
 void Normal3x(uint8 *srcPtr, uint32 srcPitch, uint8 *null, uint8 *dstPtr, uint32 dstPitch,
-							int width, int height)
+            int x, int y, int width, int height)
 {
 	uint8 *r;
 	uint32 dstPitch2 = dstPitch * 2;
@@ -805,7 +810,7 @@
 }
 
 void TV2x(uint8 *srcPtr, uint32 srcPitch, uint8 *null, uint8 *dstPtr, uint32 dstPitch, 
-					int width, int height)
+            int x, int y, int width, int height)
 {
 	unsigned int nextlineSrc = srcPitch / sizeof(uint16);
 	uint16 *p = (uint16 *)srcPtr;
@@ -828,5 +833,38 @@
 		}
 		p += nextlineSrc;
 		q += nextlineDst << 1;
+	}
+}
+
+void Ratio800(uint8 *srcPtr, uint32 srcPitch, uint8 *null, uint8 *dstPtr, uint32 dstPitch, 
+            int x, int y, int width, int height)
+{
+	unsigned int nextlineSrc = srcPitch / sizeof(uint16);
+	uint16 *p = (uint16 *)srcPtr;
+
+	unsigned int nextlineDst = dstPitch / sizeof(uint16);
+	uint16 *q0 = (uint16 *)dstPtr;
+	uint16 *q;
+
+	int i, j;
+	uint16 c;
+
+	for(i = 0; i < height; i++) {
+	    q = q0;
+	    for(j = 0; j < width; j++) {
+		c = *p;
+		if((j ^ x) & 1) {
+		    q[0] = q[nextlineDst] = q[nextlineDst * 2] =
+			INTERPOLATE(c, p[-1]);
+		    q++;
+		}
+		p++;
+		q[0] = q[nextlineDst] = q[nextlineDst * 2] =
+		q[1] = q[nextlineDst + 1] = q[nextlineDst * 2 + 1] =
+		    c;
+		q += 2;
+	    }
+	    p += nextlineSrc - width;
+	    q0 += nextlineDst * 3;
 	}
 }
Index: common/scaler.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/scaler.h,v
retrieving revision 1.2
diff -u -r1.2 scaler.h
--- common/scaler.h	15 Jan 2003 02:11:37 -0000	1.2
+++ common/scaler.h	2 Feb 2003 13:30:56 -0000
@@ -23,20 +23,22 @@
 
 extern int Init_2xSaI (uint32 BitFormat);
 extern void _2xSaI(uint8 *srcPtr, uint32 srcPitch, uint8 *deltaPtr, uint8 *dstPtr,
-						uint32 dstPitch, int width, int height);
+						uint32 dstPitch, int x, int y, int width, int height);
 extern void Super2xSaI(uint8 *srcPtr, uint32 srcPitch, uint8 *deltaPtr,
-								uint8 *dstPtr, uint32 dstPitch, int width, int height);
+								uint8 *dstPtr, uint32 dstPitch, int x, int y, int width, int height);
 extern void SuperEagle(uint8 *srcPtr, uint32 srcPitch, uint8 *deltaPtr,
-								uint8 *dstPtr, uint32 dstPitch, int width, int height);
+								uint8 *dstPtr, uint32 dstPitch, int x, int y, int width, int height);
 extern void AdvMame2x(uint8 *srcPtr, uint32 srcPitch, uint8 *null,
-								uint8 *dstPtr, uint32 dstPitch, int width, int height);
+								uint8 *dstPtr, uint32 dstPitch, int x, int y, int width, int height);
 extern void Normal1x(uint8 *srcPtr, uint32 srcPitch, uint8 *null,
-								uint8 *dstPtr, uint32 dstPitch, int width, int height);
+								uint8 *dstPtr, uint32 dstPitch, int x, int y, int width, int height);
 extern void Normal2x(uint8 *srcPtr, uint32 srcPitch, uint8 *null,
-								uint8 *dstPtr, uint32 dstPitch, int width, int height);
+								uint8 *dstPtr, uint32 dstPitch, int x, int y, int width, int height);
 extern void Normal3x(uint8 *srcPtr, uint32 srcPitch, uint8 *null,
-								uint8 *dstPtr, uint32 dstPitch, int width, int height);
+								uint8 *dstPtr, uint32 dstPitch, int x, int y, int width, int height);
 extern void TV2x(uint8 *srcPtr, uint32 srcPitch, uint8 *null,
-								uint8 *dstPtr, uint32 dstPitch, int width, int height);
+								uint8 *dstPtr, uint32 dstPitch, int x, int y, int width, int height);
+extern void Ratio800(uint8 *srcPtr, uint32 srcPitch, uint8 *null,
+								uint8 *dstPtr, uint32 dstPitch, int x, int y, int width, int height);
 
 #endif
Index: common/system.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/system.h,v
retrieving revision 1.19
diff -u -r1.19 system.h
--- common/system.h	29 Jan 2003 21:28:36 -0000	1.19
+++ common/system.h	2 Feb 2003 13:30:57 -0000
@@ -223,7 +223,8 @@
 	GFX_SUPER2XSAI = 4,
 	GFX_SUPEREAGLE = 5,
 	GFX_ADVMAME2X = 6,
-	GFX_TV2X = 7
+	GFX_TV2X = 7,
+	GFX_RATIO800 = 8
 };
 
 
