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
This commit is contained in:
Lars Persson 2005-06-21 20:39:09 +00:00
parent 7bded41f19
commit 0047a768f2
4 changed files with 32 additions and 8 deletions

View file

@ -26,7 +26,11 @@
// FIXME move joystick defines out and replace with confile file options // FIXME move joystick defines out and replace with confile file options
// we should really allow users to map any key to a joystick button // we should really allow users to map any key to a joystick button
#define JOY_DEADZONE 3200 #define JOY_DEADZONE 3200
#ifndef __SYMBIAN32__ // Symbian wants dialog joystick i.e cursor for movement/selection
#define JOY_ANALOG #define JOY_ANALOG
#endif
// #define JOY_INVERT_Y // #define JOY_INVERT_Y
#define JOY_XAXIS 0 #define JOY_XAXIS 0
#define JOY_YAXIS 1 #define JOY_YAXIS 1
@ -451,8 +455,10 @@ bool OSystem_SDL::pollEvent(Event &event) {
case SDL_JOYBUTTONDOWN: case SDL_JOYBUTTONDOWN:
if (ev.jbutton.button == JOY_BUT_LMOUSE) { if (ev.jbutton.button == JOY_BUT_LMOUSE) {
event.type = EVENT_LBUTTONDOWN; event.type = EVENT_LBUTTONDOWN;
fillMouseEvent(event, _km.x, _km.y);
} else if (ev.jbutton.button == JOY_BUT_RMOUSE) { } else if (ev.jbutton.button == JOY_BUT_RMOUSE) {
event.type = EVENT_RBUTTONDOWN; event.type = EVENT_RBUTTONDOWN;
fillMouseEvent(event, _km.x, _km.y);
} else { } else {
event.type = EVENT_KEYDOWN; event.type = EVENT_KEYDOWN;
switch (ev.jbutton.button) { switch (ev.jbutton.button) {
@ -479,8 +485,10 @@ bool OSystem_SDL::pollEvent(Event &event) {
case SDL_JOYBUTTONUP: case SDL_JOYBUTTONUP:
if (ev.jbutton.button == JOY_BUT_LMOUSE) { if (ev.jbutton.button == JOY_BUT_LMOUSE) {
event.type = EVENT_LBUTTONUP; event.type = EVENT_LBUTTONUP;
fillMouseEvent(event, _km.x, _km.y);
} else if (ev.jbutton.button == JOY_BUT_RMOUSE) { } else if (ev.jbutton.button == JOY_BUT_RMOUSE) {
event.type = EVENT_RBUTTONUP; event.type = EVENT_RBUTTONUP;
fillMouseEvent(event, _km.x, _km.y);
} else { } else {
event.type = EVENT_KEYUP; event.type = EVENT_KEYUP;
switch (ev.jbutton.button) { switch (ev.jbutton.button) {

View file

@ -48,9 +48,15 @@ static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
// Table of relative scalers magnitudes // Table of relative scalers magnitudes
// [definedScale - 1][_scaleFactor - 1] // [definedScale - 1][_scaleFactor - 1]
static ScalerProc *scalersMagn[3][3] = { static ScalerProc *scalersMagn[3][3] = {
#ifndef __SYMBIAN32__
{ Normal1x, AdvMame2x, AdvMame3x }, { Normal1x, AdvMame2x, AdvMame3x },
{ Normal1x, Normal1x, Normal1o5x }, { Normal1x, Normal1x, Normal1o5x },
{ Normal1x, Normal1x, Normal1x } { 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); 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; newScaleFactor = 1;
newScalerProc = Normal1x; newScalerProc = Normal1x;
break; break;
#ifndef __SYMBIAN32__ // remove dependencies on other scalers
case GFX_DOUBLESIZE: case GFX_DOUBLESIZE:
newScaleFactor = 2; newScaleFactor = 2;
newScalerProc = Normal2x; newScalerProc = Normal2x;
@ -181,6 +188,7 @@ bool OSystem_SDL::setGraphicsMode(int mode) {
newScaleFactor = 2; newScaleFactor = 2;
newScalerProc = DotMatrix; newScalerProc = DotMatrix;
break; break;
#endif // __SYMBIAN32__
default: default:
warning("unknown gfx mode %d", mode); warning("unknown gfx mode %d", mode);
@ -189,6 +197,7 @@ bool OSystem_SDL::setGraphicsMode(int mode) {
_transactionDetails.normal1xScaler = (mode == GFX_NORMAL); _transactionDetails.normal1xScaler = (mode == GFX_NORMAL);
#ifndef __SYMBIAN32__ // this code introduces a dependency on Normal2x()
// Do not let switch to lesser than overlay size resolutions // Do not let switch to lesser than overlay size resolutions
if (_screenWidth * newScaleFactor < _overlayWidth) { if (_screenWidth * newScaleFactor < _overlayWidth) {
if (_scaleFactor == 1) { // Force 2x mode if (_scaleFactor == 1) { // Force 2x mode
@ -199,6 +208,7 @@ bool OSystem_SDL::setGraphicsMode(int mode) {
} else } else
return false; return false;
} }
#endif
_mode = mode; _mode = mode;
_scalerProc = newScalerProc; _scalerProc = newScalerProc;
@ -503,7 +513,10 @@ void OSystem_SDL::internUpdateScreen() {
ScalerProc *scalerProc; ScalerProc *scalerProc;
int scale1, scale2; int scale1, scale2;
#ifdef DEBUG // definitions not available for non-DEBUG here. (needed this to compile in SYMBIAN32 & linux?)
assert(_hwscreen != NULL); assert(_hwscreen != NULL);
assert(_hwscreen->map->sw_data != NULL);
#endif
// If the shake position changed, fill the dirty area with blackness // If the shake position changed, fill the dirty area with blackness
if (_currentShakePos != _newShakePos) { if (_currentShakePos != _newShakePos) {
@ -635,6 +648,7 @@ void OSystem_SDL::internUpdateScreen() {
dst_y -= dst_y % 3; dst_y -= dst_y % 3;
} }
assert(scalerProc != NULL);
scalerProc((byte *)srcSurf->pixels + (r->x * 2 + 2) + (r->y + 1) * srcPitch, srcPitch, 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); (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->w = r->w * scale1 / scale2;
r->h = dst_h * 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) 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); 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(srcSurf);
SDL_UnlockSurface(_hwscreen); SDL_UnlockSurface(_hwscreen);
@ -903,6 +919,7 @@ void OSystem_SDL::addDirtyRect(int x, int y, int w, int h, bool mouseRect) {
h = height - y; h = height - y;
} }
#ifndef __SYMBIAN32__ // don't want to introduce dep on aspect.cpp
if (_adjustAspectRatio) { if (_adjustAspectRatio) {
makeRectStretchable(x, y, w, h); makeRectStretchable(x, y, w, h);
if (_scaleFactor == 3 && _overlayScale == 2 && _overlayVisible) { 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++; y++;
} }
} }
#endif
r->x = x; r->x = x;
r->y = y; r->y = y;

View file

@ -31,7 +31,7 @@
#include <SDL.h> #include <SDL.h>
#ifndef _WIN32_WCE #if !defined(_WIN32_WCE) && !defined(__SYMBIAN32__)
// Uncomment this to enable the 'on screen display' code. // Uncomment this to enable the 'on screen display' code.
#define USE_OSD 1 #define USE_OSD 1
#endif #endif

View file

@ -63,13 +63,13 @@ void OSystem_SDL::initBackend() {
SDL_EnableUNICODE(1); SDL_EnableUNICODE(1);
_cksumValid = false; _cksumValid = false;
#ifndef _WIN32_WCE #if !defined(_WIN32_WCE) && !defined(__SYMBIAN32__)
_mode = GFX_DOUBLESIZE; _mode = GFX_DOUBLESIZE;
_scaleFactor = 2; _scaleFactor = 2;
_scalerProc = Normal2x; _scalerProc = Normal2x;
_fullscreen = ConfMan.getBool("fullscreen"); _fullscreen = ConfMan.getBool("fullscreen");
_adjustAspectRatio = ConfMan.getBool("aspect_ratio"); _adjustAspectRatio = ConfMan.getBool("aspect_ratio");
#else #else // for small screen platforms
_mode = GFX_NORMAL; _mode = GFX_NORMAL;
_scaleFactor = 1; _scaleFactor = 1;
_scalerProc = Normal1x; _scalerProc = Normal1x;
@ -79,10 +79,8 @@ void OSystem_SDL::initBackend() {
_scalerType = 0; _scalerType = 0;
_modeFlags = 0; _modeFlags = 0;
#if !defined(MACOSX) && !defined(__SYMBIAN32__) // Don't set icon on OS X, as we use a nicer external icon there
#ifndef MACOSX // 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
// Setup the icon
setupIcon();
#endif #endif
// enable joystick // enable joystick