Here it is, the unofficial patch for big screens.
Code: Select all
diff -urN backends/platform/sdl/graphics.cpp backends/platform/sdl/graphics.cpp
--- backends/platform/sdl/graphics.cpp 2009-11-07 01:09:32.000000000 +0100
+++ backends/platform/sdl/graphics.cpp 2009-11-17 19:17:19.423331167 +0100
@@ -35,11 +35,13 @@
{"1x", "Normal (no scaling)", GFX_NORMAL},
{"2x", "2x", GFX_DOUBLESIZE},
{"3x", "3x", GFX_TRIPLESIZE},
+ {"4x", "4x", GFX_QUADSIZE},
{"2xsai", "2xSAI", GFX_2XSAI},
{"super2xsai", "Super2xSAI", GFX_SUPER2XSAI},
{"supereagle", "SuperEagle", GFX_SUPEREAGLE},
{"advmame2x", "AdvMAME2x", GFX_ADVMAME2X},
{"advmame3x", "AdvMAME3x", GFX_ADVMAME3X},
+ {"advmame4x", "AdvMAME4x", GFX_ADVMAME4X},
#ifndef DISABLE_HQ_SCALERS
{"hq2x", "HQ2x", GFX_HQ2X},
{"hq3x", "HQ3x", GFX_HQ3X},
@@ -51,27 +53,29 @@
// Table of relative scalers magnitudes
// [definedScale - 1][scaleFactor - 1]
-static ScalerProc *scalersMagn[3][3] = {
+static ScalerProc *scalersMagn[4][4] = {
#ifndef DISABLE_SCALERS
- { Normal1x, AdvMame2x, AdvMame3x },
- { Normal1x, Normal1x, Normal1o5x },
- { Normal1x, Normal1x, Normal1x }
+ { Normal1x, AdvMame2x, AdvMame3x, AdvMame4x },
+ { Normal1x, Normal1x, Normal1o5x, AdvMame2x },
+ { Normal1x, Normal1x, Normal1x, Normal1x },
+ { Normal1x, Normal1x, Normal1x, Normal1x }
#else // remove dependencies on other scalers
- { Normal1x, Normal1x, Normal1x },
- { Normal1x, Normal1x, Normal1x },
- { Normal1x, Normal1x, Normal1x }
+ { Normal1x, Normal1x, Normal1x, Normal1x },
+ { Normal1x, Normal1x, Normal1x, Normal1x },
+ { Normal1x, Normal1x, Normal1x, Normal1x },
+ { Normal1x, Normal1x, Normal1x, Normal1x }
#endif
};
-static const int s_gfxModeSwitchTable[][4] = {
- { GFX_NORMAL, GFX_DOUBLESIZE, GFX_TRIPLESIZE, -1 },
- { GFX_NORMAL, GFX_ADVMAME2X, GFX_ADVMAME3X, -1 },
- { GFX_NORMAL, GFX_HQ2X, GFX_HQ3X, -1 },
- { GFX_NORMAL, GFX_2XSAI, -1, -1 },
- { GFX_NORMAL, GFX_SUPER2XSAI, -1, -1 },
- { GFX_NORMAL, GFX_SUPEREAGLE, -1, -1 },
- { GFX_NORMAL, GFX_TV2X, -1, -1 },
- { GFX_NORMAL, GFX_DOTMATRIX, -1, -1 }
+static const int s_gfxModeSwitchTable[][5] = {
+ { GFX_NORMAL, GFX_DOUBLESIZE, GFX_TRIPLESIZE, GFX_QUADSIZE, -1 },
+ { GFX_NORMAL, GFX_ADVMAME2X, GFX_ADVMAME3X, GFX_ADVMAME4X, -1 },
+ { GFX_NORMAL, GFX_HQ2X, GFX_HQ3X, -1, -1 },
+ { GFX_NORMAL, GFX_2XSAI, -1, -1, -1 },
+ { GFX_NORMAL, GFX_SUPER2XSAI, -1, -1, -1 },
+ { GFX_NORMAL, GFX_SUPEREAGLE, -1, -1, -1 },
+ { GFX_NORMAL, GFX_TV2X, -1, -1, -1 },
+ { GFX_NORMAL, GFX_DOTMATRIX, -1, -1, -1 },
};
#ifndef DISABLE_SCALERS
@@ -213,7 +217,10 @@
case GFX_TRIPLESIZE:
newScaleFactor = 3;
break;
-
+ case GFX_QUADSIZE:
+ newScaleFactor = 4;
+ break;
+
case GFX_2XSAI:
newScaleFactor = 2;
break;
@@ -229,6 +236,9 @@
case GFX_ADVMAME3X:
newScaleFactor = 3;
break;
+ case GFX_ADVMAME4X:
+ newScaleFactor = 4;
+ break;
#ifndef DISABLE_HQ_SCALERS
case GFX_HQ2X:
newScaleFactor = 2;
@@ -277,7 +287,10 @@
case GFX_TRIPLESIZE:
newScalerProc = Normal3x;
break;
-
+ case GFX_QUADSIZE:
+ newScalerProc = Normal4x;
+ break;
+
case GFX_2XSAI:
newScalerProc = _2xSaI;
break;
@@ -293,6 +306,9 @@
case GFX_ADVMAME3X:
newScalerProc = AdvMame3x;
break;
+ case GFX_ADVMAME4X:
+ newScalerProc = AdvMame4x;
+ break;
#ifndef DISABLE_HQ_SCALERS
case GFX_HQ2X:
newScalerProc = HQ2x;
@@ -412,7 +428,9 @@
//
// Need some extra bytes around when using 2xSaI
- _tmpscreen = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.screenWidth + 3, _videoMode.screenHeight + 3,
+ _tmpscreen = SDL_CreateRGBSurface(SDL_SWSURFACE,
+ _videoMode.screenWidth + 2 * MAX_SCALER_REACH,
+ _videoMode.screenHeight + 2 * MAX_SCALER_REACH,
16,
_hwscreen->format->Rmask,
_hwscreen->format->Gmask,
@@ -444,7 +462,9 @@
_overlayFormat.bShift = _overlayscreen->format->Bshift;
_overlayFormat.aShift = _overlayscreen->format->Ashift;
- _tmpscreen2 = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.overlayWidth + 3, _videoMode.overlayHeight + 3,
+ _tmpscreen2 = SDL_CreateRGBSurface(SDL_SWSURFACE,
+ _videoMode.overlayWidth + 2 * MAX_SCALER_REACH,
+ _videoMode.overlayHeight + 2 * MAX_SCALER_REACH,
16,
_hwscreen->format->Rmask,
_hwscreen->format->Gmask,
@@ -675,8 +695,8 @@
for (r = _dirtyRectList; r != lastRect; ++r) {
dst = *r;
- dst.x++; // Shift rect by one since 2xSai needs to access the data around
- dst.y++; // any pixel to scale it, and we want to avoid mem access crashes.
+ dst.x += MAX_SCALER_REACH; // Shift rect by one since 2xSai needs to access the data around
+ dst.y += MAX_SCALER_REACH; // any pixel to scale it, and we want to avoid mem access crashes.
if (SDL_BlitSurface(origSurf, r, srcSurf, &dst) != 0)
error("SDL_BlitSurface failed: %s", SDL_GetError());
@@ -706,7 +726,7 @@
dst_y = real2Aspect(dst_y);
assert(scalerProc != NULL);
- scalerProc((byte *)srcSurf->pixels + (r->x * 2 + 2) + (r->y + 1) * srcPitch, srcPitch,
+ scalerProc((byte *)srcSurf->pixels + (r->x * 2 + 2 * MAX_SCALER_REACH) + (r->y + MAX_SCALER_REACH) * srcPitch, srcPitch,
(byte *)_hwscreen->pixels + rx1 * 2 + dst_y * dstPitch, dstPitch, r->w, dst_h);
}
@@ -1331,8 +1351,8 @@
// Allocate bigger surface because AdvMame2x adds black pixel at [0,0]
_mouseOrigSurface = SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_RLEACCEL | SDL_SRCCOLORKEY | SDL_SRCALPHA,
- _mouseCurState.w + 2,
- _mouseCurState.h + 2,
+ _mouseCurState.w + 2 * MAX_SCALER_REACH,
+ _mouseCurState.h + 2 * MAX_SCALER_REACH,
16,
_hwscreen->format->Rmask,
_hwscreen->format->Gmask,
@@ -1368,16 +1388,16 @@
SDL_LockSurface(_mouseOrigSurface);
// Make whole surface transparent
- for (i = 0; i < h + 2; i++) {
+ for (i = 0; i < h + 2 * MAX_SCALER_REACH; i++) {
dstPtr = (byte *)_mouseOrigSurface->pixels + _mouseOrigSurface->pitch * i;
- for (j = 0; j < w + 2; j++) {
+ for (j = 0; j < w + 2 * MAX_SCALER_REACH; j++) {
*(uint16 *)dstPtr = kMouseColorKey;
dstPtr += 2;
}
}
// Draw from [1,1] since AdvMame2x adds artefact at 0,0
- dstPtr = (byte *)_mouseOrigSurface->pixels + _mouseOrigSurface->pitch + 2;
+ dstPtr = (byte *)_mouseOrigSurface->pixels + (_mouseOrigSurface->pitch + 2) * MAX_SCALER_REACH;
SDL_Color *palette;
@@ -1479,12 +1499,12 @@
// the game. This only works well with the non-blurring scalers so we
// actually only use the 1x, 1.5x, 2x and AdvMame scalers.
- if (_cursorTargetScale == 1 && (_videoMode.mode == GFX_DOUBLESIZE || _videoMode.mode == GFX_TRIPLESIZE))
+ if (_cursorTargetScale == 1 && (_videoMode.mode == GFX_DOUBLESIZE || _videoMode.mode == GFX_TRIPLESIZE || _videoMode.mode == GFX_QUADSIZE))
scalerProc = _scalerProc;
else
scalerProc = scalersMagn[_cursorTargetScale - 1][_videoMode.scaleFactor - 1];
- scalerProc((byte *)_mouseOrigSurface->pixels + _mouseOrigSurface->pitch + 2,
+ scalerProc((byte *)_mouseOrigSurface->pixels + (_mouseOrigSurface->pitch + 2) * MAX_SCALER_REACH,
_mouseOrigSurface->pitch, (byte *)_mouseSurface->pixels, _mouseSurface->pitch,
_mouseCurState.w, _mouseCurState.h);
diff -urN backends/platform/sdl/sdl.h backends/platform/sdl/sdl.h
--- backends/platform/sdl/sdl.h 2009-11-07 01:09:32.000000000 +0100
+++ backends/platform/sdl/sdl.h 2009-11-17 19:17:19.423331167 +0100
@@ -59,15 +59,17 @@
GFX_NORMAL = 0,
GFX_DOUBLESIZE = 1,
GFX_TRIPLESIZE = 2,
- GFX_2XSAI = 3,
- GFX_SUPER2XSAI = 4,
- GFX_SUPEREAGLE = 5,
- GFX_ADVMAME2X = 6,
- GFX_ADVMAME3X = 7,
- GFX_HQ2X = 8,
- GFX_HQ3X = 9,
- GFX_TV2X = 10,
- GFX_DOTMATRIX = 11
+ GFX_QUADSIZE = 3,
+ GFX_2XSAI = 4,
+ GFX_SUPER2XSAI = 5,
+ GFX_SUPEREAGLE = 6,
+ GFX_ADVMAME2X = 7,
+ GFX_ADVMAME3X = 8,
+ GFX_ADVMAME4X = 9,
+ GFX_HQ2X = 10,
+ GFX_HQ3X = 11,
+ GFX_TV2X = 12,
+ GFX_DOTMATRIX = 13
};
@@ -297,7 +299,7 @@
enum {
NUM_DIRTY_RECT = 100,
- MAX_SCALING = 3
+ MAX_SCALING = 4
};
// Dirty rect management
diff -urN base/commandLine.cpp base/commandLine.cpp
--- base/commandLine.cpp 2009-11-07 01:09:23.000000000 +0100
+++ base/commandLine.cpp 2009-11-17 19:17:19.424331140 +0100
@@ -68,9 +68,9 @@
" -x, --save-slot[=NUM] Save game slot to load (default: autosave)\n"
" -f, --fullscreen Force full-screen mode\n"
" -F, --no-fullscreen Force windowed mode\n"
- " -g, --gfx-mode=MODE Select graphics scaler (1x,2x,3x,2xsai,super2xsai,\n"
- " supereagle,advmame2x,advmame3x,hq2x,hq3x,tv2x,\n"
- " dotmatrix)\n"
+ " -g, --gfx-mode=MODE Select graphics scaler (1x,2x,3x,4x,2xsai,super2xsai,\n"
+ " supereagle,advmame2x,advmame3x,advmame4x,hq2x,hq3x,\n"
+ " tv2x,dotmatrix)\n"
" --gui-theme=THEME Select GUI theme\n"
" --themepath=PATH Path to where GUI themes are stored\n"
" --list-themes Display list of all usable GUI themes\n"
diff -urN graphics/scaler/scalebit.cpp graphics/scaler/scalebit.cpp
--- graphics/scaler/scalebit.cpp 2009-11-07 01:09:21.000000000 +0100
+++ graphics/scaler/scalebit.cpp 2009-11-17 19:17:19.424331140 +0100
@@ -196,8 +196,6 @@
unsigned count;
unsigned char* mid[6];
- assert(height >= 4);
-
count = height;
/* set the 6 buffer pointers */
@@ -208,11 +206,14 @@
mid[4] = mid[3] + mid_slice;
mid[5] = mid[4] + mid_slice;
+ stage_scale2x(SCMID(0), SCMID(1), SCSRC(0) - pixel, SCSRC(1) - pixel, SCSRC(2) - pixel, pixel, width + 2);
+ stage_scale2x(SCMID(2), SCMID(3), SCSRC(1) - pixel, SCSRC(2) - pixel, SCSRC(3) - pixel, pixel, width + 2);
+
while (count) {
unsigned char* tmp;
- stage_scale2x(SCMID(4), SCMID(5), SCSRC(2), SCSRC(3), SCSRC(4), pixel, width);
- stage_scale4x(SCDST(0), SCDST(1), SCDST(2), SCDST(3), SCMID(1), SCMID(2), SCMID(3), SCMID(4), pixel, width);
+ stage_scale2x(SCMID(4), SCMID(5), SCSRC(2) - pixel, SCSRC(3) - pixel, SCSRC(4) - pixel, pixel, width + 2);
+ stage_scale4x(SCDST(0), SCDST(1), SCDST(2), SCDST(3), SCMID(1) + 2 * pixel, SCMID(2) + 2 * pixel, SCMID(3) + 2 * pixel, SCMID(4) + 2 * pixel, pixel, width);
dst = SCDST(4);
src = SCSRC(1);
@@ -255,7 +256,7 @@
unsigned mid_slice;
void* mid;
- mid_slice = 2 * pixel * width; /* required space for 1 row buffer */
+ mid_slice = 2 * pixel * (width + 2); /* required space for 1 row buffer */
mid_slice = (mid_slice + 0x7) & ~0x7; /* align to 8 bytes */
diff -urN graphics/scaler.cpp graphics/scaler.cpp
--- graphics/scaler.cpp 2009-11-07 01:09:21.000000000 +0100
+++ graphics/scaler.cpp 2009-11-17 19:17:19.424331140 +0100
@@ -297,6 +297,41 @@
}
}
+ void Normal4x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
+ int width, int height) {
+ uint8 *r;
+ const uint32 dstPitch2 = dstPitch * 2;
+ const uint32 dstPitch3 = dstPitch * 3;
+ const uint32 dstPitch4 = dstPitch * 4;
+
+ assert(IS_ALIGNED(dstPtr, 2));
+ while (height--) {
+ r = dstPtr;
+ for (int i = 0; i < width; ++i, r += 8) {
+ uint16 color = *(((const uint16 *)srcPtr) + i);
+
+ *(uint16 *)(r + 0) = color;
+ *(uint16 *)(r + 2) = color;
+ *(uint16 *)(r + 4) = color;
+ *(uint16 *)(r + 6) = color;
+ *(uint16 *)(r + 0 + dstPitch) = color;
+ *(uint16 *)(r + 2 + dstPitch) = color;
+ *(uint16 *)(r + 4 + dstPitch) = color;
+ *(uint16 *)(r + 6 + dstPitch) = color;
+ *(uint16 *)(r + 0 + dstPitch2) = color;
+ *(uint16 *)(r + 2 + dstPitch2) = color;
+ *(uint16 *)(r + 4 + dstPitch2) = color;
+ *(uint16 *)(r + 6 + dstPitch2) = color;
+ *(uint16 *)(r + 0 + dstPitch3) = color;
+ *(uint16 *)(r + 2 + dstPitch3) = color;
+ *(uint16 *)(r + 4 + dstPitch3) = color;
+ *(uint16 *)(r + 6 + dstPitch3) = color;
+ }
+ srcPtr += srcPitch;
+ dstPtr += dstPitch4;
+ }
+ }
+
#define interpolate_1_1 interpolate16_1_1<Graphics::ColorMasks<bitFormat> >
#define interpolate_1_1_1_1 interpolate16_1_1_1_1<Graphics::ColorMasks<bitFormat> >
@@ -355,6 +390,11 @@
scale(3, dstPtr, dstPitch, srcPtr - srcPitch, srcPitch, 2, width, height);
}
+void AdvMame4x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
+ int width, int height) {
+ scale(4, dstPtr, dstPitch, srcPtr - 2 * srcPitch, srcPitch, 2, width, height);
+}
+
template<int bitFormat>
void TV2xTemplate(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
int width, int height) {
diff -urN graphics/scaler.h graphics/scaler.h
--- graphics/scaler.h 2009-11-07 01:09:21.000000000 +0100
+++ graphics/scaler.h 2009-11-17 19:17:19.424331140 +0100
@@ -43,12 +43,14 @@
DECLARE_SCALER(SuperEagle);
DECLARE_SCALER(AdvMame2x);
DECLARE_SCALER(AdvMame3x);
+DECLARE_SCALER(AdvMame4x);
DECLARE_SCALER(Normal1x);
DECLARE_SCALER(Normal2x);
#ifdef USE_ARM_SCALER_ASM
DECLARE_SCALER(Normal2xAspect);
#endif
DECLARE_SCALER(Normal3x);
+DECLARE_SCALER(Normal4x);
DECLARE_SCALER(Normal1o5x);
DECLARE_SCALER(TV2x);
DECLARE_SCALER(DotMatrix);
@@ -58,6 +60,8 @@
DECLARE_SCALER(HQ3x);
#endif
+#define MAX_SCALER_REACH 2
+
FORCEINLINE int real2Aspect(int y) {
return y + (y + 1) / 5;
}