aboutsummaryrefslogtreecommitdiff
path: root/backends/sdl
diff options
context:
space:
mode:
authorLars Persson2005-06-21 20:39:09 +0000
committerLars Persson2005-06-21 20:39:09 +0000
commit0047a768f2a03191c63c487d01d602a7e0939949 (patch)
treef400e717ca8275c8474ee82cb0e3af4c69be310d /backends/sdl
parent7bded41f194331f309388afa5a30035927655f5d (diff)
downloadscummvm-rg350-0047a768f2a03191c63c487d01d602a7e0939949.tar.gz
scummvm-rg350-0047a768f2a03191c63c487d01d602a7e0939949.tar.bz2
scummvm-rg350-0047a768f2a03191c63c487d01d602a7e0939949.zip
This is the SDL changes needed by the Symbian build to work properly.
Also there is a bugfix for using the joystick handling for SDL. (See events.cpp history) svn-id: r18428
Diffstat (limited to 'backends/sdl')
-rw-r--r--backends/sdl/events.cpp10
-rw-r--r--backends/sdl/graphics.cpp18
-rw-r--r--backends/sdl/sdl-common.h2
-rw-r--r--backends/sdl/sdl.cpp10
4 files changed, 32 insertions, 8 deletions
diff --git a/backends/sdl/events.cpp b/backends/sdl/events.cpp
index 4185fcef37..cdc803409c 100644
--- a/backends/sdl/events.cpp
+++ b/backends/sdl/events.cpp
@@ -26,7 +26,11 @@
// FIXME move joystick defines out and replace with confile file options
// we should really allow users to map any key to a joystick button
#define JOY_DEADZONE 3200
-#define JOY_ANALOG
+
+#ifndef __SYMBIAN32__ // Symbian wants dialog joystick i.e cursor for movement/selection
+ #define JOY_ANALOG
+#endif
+
// #define JOY_INVERT_Y
#define JOY_XAXIS 0
#define JOY_YAXIS 1
@@ -451,8 +455,10 @@ bool OSystem_SDL::pollEvent(Event &event) {
case SDL_JOYBUTTONDOWN:
if (ev.jbutton.button == JOY_BUT_LMOUSE) {
event.type = EVENT_LBUTTONDOWN;
+ fillMouseEvent(event, _km.x, _km.y);
} else if (ev.jbutton.button == JOY_BUT_RMOUSE) {
event.type = EVENT_RBUTTONDOWN;
+ fillMouseEvent(event, _km.x, _km.y);
} else {
event.type = EVENT_KEYDOWN;
switch (ev.jbutton.button) {
@@ -479,8 +485,10 @@ bool OSystem_SDL::pollEvent(Event &event) {
case SDL_JOYBUTTONUP:
if (ev.jbutton.button == JOY_BUT_LMOUSE) {
event.type = EVENT_LBUTTONUP;
+ fillMouseEvent(event, _km.x, _km.y);
} else if (ev.jbutton.button == JOY_BUT_RMOUSE) {
event.type = EVENT_RBUTTONUP;
+ fillMouseEvent(event, _km.x, _km.y);
} else {
event.type = EVENT_KEYUP;
switch (ev.jbutton.button) {
diff --git a/backends/sdl/graphics.cpp b/backends/sdl/graphics.cpp
index 9b8de045dd..f1f84e63ec 100644
--- a/backends/sdl/graphics.cpp
+++ b/backends/sdl/graphics.cpp
@@ -48,9 +48,15 @@ static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
// Table of relative scalers magnitudes
// [definedScale - 1][_scaleFactor - 1]
static ScalerProc *scalersMagn[3][3] = {
+#ifndef __SYMBIAN32__
{ Normal1x, AdvMame2x, AdvMame3x },
{ Normal1x, Normal1x, Normal1o5x },
{ Normal1x, Normal1x, Normal1x }
+#else // remove dependencies on other scalers
+ { Normal1x, Normal1x, Normal1x },
+ { Normal1x, Normal1x, Normal1x },
+ { Normal1x, Normal1x, Normal1x }
+#endif
};
static int cursorStretch200To240(uint8 *buf, uint32 pitch, int width, int height, int srcX, int srcY, int origSrcY);
@@ -134,6 +140,7 @@ bool OSystem_SDL::setGraphicsMode(int mode) {
newScaleFactor = 1;
newScalerProc = Normal1x;
break;
+#ifndef __SYMBIAN32__ // remove dependencies on other scalers
case GFX_DOUBLESIZE:
newScaleFactor = 2;
newScalerProc = Normal2x;
@@ -181,6 +188,7 @@ bool OSystem_SDL::setGraphicsMode(int mode) {
newScaleFactor = 2;
newScalerProc = DotMatrix;
break;
+#endif // __SYMBIAN32__
default:
warning("unknown gfx mode %d", mode);
@@ -189,6 +197,7 @@ bool OSystem_SDL::setGraphicsMode(int mode) {
_transactionDetails.normal1xScaler = (mode == GFX_NORMAL);
+#ifndef __SYMBIAN32__ // this code introduces a dependency on Normal2x()
// Do not let switch to lesser than overlay size resolutions
if (_screenWidth * newScaleFactor < _overlayWidth) {
if (_scaleFactor == 1) { // Force 2x mode
@@ -199,6 +208,7 @@ bool OSystem_SDL::setGraphicsMode(int mode) {
} else
return false;
}
+#endif
_mode = mode;
_scalerProc = newScalerProc;
@@ -503,7 +513,10 @@ void OSystem_SDL::internUpdateScreen() {
ScalerProc *scalerProc;
int scale1, scale2;
+#ifdef DEBUG // definitions not available for non-DEBUG here. (needed this to compile in SYMBIAN32 & linux?)
assert(_hwscreen != NULL);
+ assert(_hwscreen->map->sw_data != NULL);
+#endif
// If the shake position changed, fill the dirty area with blackness
if (_currentShakePos != _newShakePos) {
@@ -635,6 +648,7 @@ void OSystem_SDL::internUpdateScreen() {
dst_y -= dst_y % 3;
}
+ assert(scalerProc != NULL);
scalerProc((byte *)srcSurf->pixels + (r->x * 2 + 2) + (r->y + 1) * srcPitch, srcPitch,
(byte *)_hwscreen->pixels + rx1 * 2 + dst_y * dstPitch, dstPitch, r->w, dst_h);
}
@@ -644,8 +658,10 @@ void OSystem_SDL::internUpdateScreen() {
r->w = r->w * scale1 / scale2;
r->h = dst_h * scale1 / scale2;
+#ifndef __SYMBIAN32__ // don't want to introduce dep on aspect.cpp
if (_adjustAspectRatio && orig_dst_y < height)
r->h = stretch200To240((uint8 *) _hwscreen->pixels, dstPitch, r->w, r->h, r->x, r->y, orig_dst_y * scale1 / scale2);
+#endif
}
SDL_UnlockSurface(srcSurf);
SDL_UnlockSurface(_hwscreen);
@@ -903,6 +919,7 @@ void OSystem_SDL::addDirtyRect(int x, int y, int w, int h, bool mouseRect) {
h = height - y;
}
+#ifndef __SYMBIAN32__ // don't want to introduce dep on aspect.cpp
if (_adjustAspectRatio) {
makeRectStretchable(x, y, w, h);
if (_scaleFactor == 3 && _overlayScale == 2 && _overlayVisible) {
@@ -910,6 +927,7 @@ void OSystem_SDL::addDirtyRect(int x, int y, int w, int h, bool mouseRect) {
y++;
}
}
+#endif
r->x = x;
r->y = y;
diff --git a/backends/sdl/sdl-common.h b/backends/sdl/sdl-common.h
index a4265c6f31..036a63fd05 100644
--- a/backends/sdl/sdl-common.h
+++ b/backends/sdl/sdl-common.h
@@ -31,7 +31,7 @@
#include <SDL.h>
-#ifndef _WIN32_WCE
+#if !defined(_WIN32_WCE) && !defined(__SYMBIAN32__)
// Uncomment this to enable the 'on screen display' code.
#define USE_OSD 1
#endif
diff --git a/backends/sdl/sdl.cpp b/backends/sdl/sdl.cpp
index 117736d0ad..2fdd120187 100644
--- a/backends/sdl/sdl.cpp
+++ b/backends/sdl/sdl.cpp
@@ -63,13 +63,13 @@ void OSystem_SDL::initBackend() {
SDL_EnableUNICODE(1);
_cksumValid = false;
-#ifndef _WIN32_WCE
+#if !defined(_WIN32_WCE) && !defined(__SYMBIAN32__)
_mode = GFX_DOUBLESIZE;
_scaleFactor = 2;
_scalerProc = Normal2x;
_fullscreen = ConfMan.getBool("fullscreen");
_adjustAspectRatio = ConfMan.getBool("aspect_ratio");
-#else
+#else // for small screen platforms
_mode = GFX_NORMAL;
_scaleFactor = 1;
_scalerProc = Normal1x;
@@ -79,10 +79,8 @@ void OSystem_SDL::initBackend() {
_scalerType = 0;
_modeFlags = 0;
-
-#ifndef MACOSX // Don't set icon on OS X, as we use a nicer external icon there
- // Setup the icon
- setupIcon();
+#if !defined(MACOSX) && !defined(__SYMBIAN32__) // Don't set icon on OS X, as we use a nicer external icon there
+ setupIcon(); // Don't for Symbian: it uses the EScummVM.aif file for the icon
#endif
// enable joystick