Patch #735294: AdvMame3x scaler

svn-id: r7409
This commit is contained in:
Max Horn 2003-05-09 22:44:16 +00:00
parent 54a9ad3204
commit 37724d9297
7 changed files with 64 additions and 12 deletions

3
README
View file

@ -346,7 +346,7 @@ simon games.
Ctrl-z OR Alt-x - quit Ctrl-z OR Alt-x - quit
Keyboard Arrow Keys - simulate mouse movement Keyboard Arrow Keys - simulate mouse movement
Ctrl-f - runs in fast mode. Ctrl-f - runs in fast mode.
Ctrl-Alt 1-9 - Switch between graphics filters Ctrl-Alt 0-9 - Switch between graphics filters
Ctrl-Alt 1 - Switch beetwen bilinear and non-linear filtering [OpenGL backend] Ctrl-Alt 1 - Switch beetwen bilinear and non-linear filtering [OpenGL backend]
Ctrl-Alt 2 - Don't fit the game in the whole screen (black borders) [OpenGL backend] Ctrl-Alt 2 - Don't fit the game in the whole screen (black borders) [OpenGL backend]
Ctrl-Alt 3 - Fit the game in the whole screen (no black borders) [OpenGL backend] Ctrl-Alt 3 - Fit the game in the whole screen (no black borders) [OpenGL backend]
@ -408,6 +408,7 @@ They are:
super2xsai - Enhanced 2xsai filtering. 640x400 screen/window size super2xsai - Enhanced 2xsai filtering. 640x400 screen/window size
supereagle - Less blurry than 2xsai, but slower. Also 640x400 supereagle - Less blurry than 2xsai, but slower. Also 640x400
advmame2x - 640x400 scaling. Doesn't rely on blurring like 2xSAI. advmame2x - 640x400 scaling. Doesn't rely on blurring like 2xSAI.
advmame3x - 960x600 scaling. Doesn't rely on blurring like 2xSAI.
tv2x - 640x400 scaling. Horizontal scanlines. tv2x - 640x400 scaling. Horizontal scanlines.
dotmatrix - 640x400 scaling. Dot matrix effect. dotmatrix - 640x400 scaling. Dot matrix effect.

View file

@ -544,13 +544,19 @@ bool OSystem_SDL_Common::poll_event(Event *event) {
break; break;
} }
#endif #endif
// Ctr-Alt-1 till Ctrl-Alt-9 will change the GFX mode // Ctr-Alt-<key> will change the GFX mode
if (b == (KBD_CTRL|KBD_ALT) && if (b == (KBD_CTRL|KBD_ALT)) {
(ev.key.keysym.sym>='1') && (ev.key.keysym.sym<='9')) { char keys[] = "1234567890";
Property prop; char *ptr;
prop.gfx_mode = ev.key.keysym.sym - '1';
property(PROP_SET_GFX_MODE, &prop); ptr = strchr(keys, ev.key.keysym.sym);
break; if (ptr != NULL) {
Property prop;
prop.gfx_mode = ptr - keys;
property(PROP_SET_GFX_MODE, &prop);
break;
}
} }
#ifdef QTOPIA #ifdef QTOPIA

View file

@ -99,6 +99,10 @@ void OSystem_SDL::load_gfx_mode() {
_scaleFactor = 2; _scaleFactor = 2;
_scaler_proc = AdvMame2x; _scaler_proc = AdvMame2x;
break; break;
case GFX_ADVMAME3X:
_scaleFactor = 3;
_scaler_proc = AdvMame3x;
break;
case GFX_TV2X: case GFX_TV2X:
_scaleFactor = 2; _scaleFactor = 2;
_scaler_proc = TV2x; _scaler_proc = TV2x;
@ -360,7 +364,7 @@ uint32 OSystem_SDL::property(int param, Property *value) {
#endif #endif
return 1; return 1;
} else if (param == PROP_SET_GFX_MODE) { } else if (param == PROP_SET_GFX_MODE) {
if (value->gfx_mode >= 9) if (value->gfx_mode >= 10)
return 0; return 0;
_mode = value->gfx_mode; _mode = value->gfx_mode;

View file

@ -570,7 +570,7 @@ uint32 OSystem_SDL_OpenGL::property(int param, Property *value) {
_glScreenStart = 0; _glScreenStart = 0;
break; break;
default: // SDL backend default: // SDL backend
if (value->gfx_mode >= 9) if (value->gfx_mode >= 10)
return 0; return 0;
_mode = value->gfx_mode; _mode = value->gfx_mode;

View file

@ -90,6 +90,7 @@ static const struct GraphicsMode gfx_modes[] = {
{"super2xsai", "Super2xSAI", GFX_SUPER2XSAI}, {"super2xsai", "Super2xSAI", GFX_SUPER2XSAI},
{"supereagle", "SuperEagle", GFX_SUPEREAGLE}, {"supereagle", "SuperEagle", GFX_SUPEREAGLE},
{"advmame2x", "AdvMAME2x", GFX_ADVMAME2X}, {"advmame2x", "AdvMAME2x", GFX_ADVMAME2X},
{"advmame3x", "AdvMAME3x", GFX_ADVMAME3X},
{"tv2x", "TV2x", GFX_TV2X}, {"tv2x", "TV2x", GFX_TV2X},
{"dotmatrix", "DotMatrix", GFX_DOTMATRIX}, {"dotmatrix", "DotMatrix", GFX_DOTMATRIX},
#else #else

View file

@ -746,6 +746,44 @@ void AdvMame2x(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
} }
} }
void AdvMame3x(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
int width, int height) {
unsigned int nextlineSrc = srcPitch / sizeof(uint16);
uint16 *p = (uint16 *)srcPtr;
unsigned int nextlineDst = dstPitch / sizeof(uint16);
uint16 *q = (uint16 *)dstPtr;
uint16 A, B, C;
uint16 D, E, F;
uint16 G, H, I;
while (height--) {
B = C = *(p - nextlineSrc);
E = F = *(p);
H = I = *(p + nextlineSrc);
for (int i = 0; i < width; ++i) {
p++;
A = B; B = C; C = *(p - nextlineSrc);
D = E; E = F; F = *(p);
G = H; H = I; I = *(p + nextlineSrc);
*(q) = D == B && B != F && D != H ? D : E;
*(q + 1) = E;
*(q + 2) = B == F && B != D && F != H ? F : E;
*(q + nextlineDst) = E;
*(q + nextlineDst + 1) = E;
*(q + nextlineDst + 2) = E;
*(q + 2 * nextlineDst) = D == H && D != B && H != F ? D : E;
*(q + 2 * nextlineDst + 1) = E;
*(q + 2 * nextlineDst + 2) = H == F && D != H && B != F ? F : E;
q += 3;
}
p += nextlineSrc - width;
q += (nextlineDst - width) * 3;
}
}
void Normal1x(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, void Normal1x(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
int width, int height) { int width, int height) {
while (height--) { while (height--) {

View file

@ -31,6 +31,7 @@ DECLARE_SCALER(_2xSaI);
DECLARE_SCALER(Super2xSaI); DECLARE_SCALER(Super2xSaI);
DECLARE_SCALER(SuperEagle); DECLARE_SCALER(SuperEagle);
DECLARE_SCALER(AdvMame2x); DECLARE_SCALER(AdvMame2x);
DECLARE_SCALER(AdvMame3x);
DECLARE_SCALER(Normal1x); DECLARE_SCALER(Normal1x);
DECLARE_SCALER(Normal2x); DECLARE_SCALER(Normal2x);
DECLARE_SCALER(Normal3x); DECLARE_SCALER(Normal3x);
@ -46,8 +47,9 @@ enum {
GFX_SUPER2XSAI = 4, GFX_SUPER2XSAI = 4,
GFX_SUPEREAGLE = 5, GFX_SUPEREAGLE = 5,
GFX_ADVMAME2X = 6, GFX_ADVMAME2X = 6,
GFX_TV2X = 7, GFX_ADVMAME3X = 7,
GFX_DOTMATRIX = 8, GFX_TV2X = 8,
GFX_DOTMATRIX = 9,
GFX_FLIPPING = 100, // Palmos GFX_FLIPPING = 100, // Palmos
GFX_DOUBLEBUFFER = 101 // Palmos GFX_DOUBLEBUFFER = 101 // Palmos