diff options
Diffstat (limited to 'backends')
-rw-r--r-- | backends/platform/gp2x/events.cpp | 2 | ||||
-rw-r--r-- | backends/platform/gp2x/gp2x-common.h | 26 | ||||
-rw-r--r-- | backends/platform/gp2x/gp2x-hw.cpp | 2 | ||||
-rw-r--r-- | backends/platform/gp2x/gp2x-mem.cpp | 2 | ||||
-rw-r--r-- | backends/platform/gp2x/gp2x-mem.h | 1 | ||||
-rw-r--r-- | backends/platform/gp2x/gp2x.cpp | 45 | ||||
-rw-r--r-- | backends/platform/gp2x/graphics.cpp | 225 | ||||
-rw-r--r-- | backends/platform/gp2x/module.mk | 2 | ||||
-rw-r--r-- | backends/platform/sdl/graphics.cpp | 60 | ||||
-rw-r--r-- | backends/platform/sdl/sdl.cpp | 26 | ||||
-rw-r--r-- | backends/platform/sdl/sdl.h | 14 | ||||
-rw-r--r-- | backends/platform/wii/osystem_events.cpp | 22 | ||||
-rw-r--r-- | backends/platform/wince/Makefile | 4 | ||||
-rw-r--r-- | backends/platform/wince/README-WinCE.txt | 14 | ||||
-rw-r--r-- | backends/platform/wince/missing/missing.cpp | 19 | ||||
-rw-r--r-- | backends/platform/wince/wince-sdl.cpp | 25 | ||||
-rw-r--r-- | backends/platform/wince/wince-sdl.h | 1 |
17 files changed, 246 insertions, 244 deletions
diff --git a/backends/platform/gp2x/events.cpp b/backends/platform/gp2x/events.cpp index 8cd034d2d5..bc9a4ff26c 100644 --- a/backends/platform/gp2x/events.cpp +++ b/backends/platform/gp2x/events.cpp @@ -93,7 +93,7 @@ void OSystem_GP2X::fillMouseEvent(Common::Event &event, int x, int y) { if (!_overlayVisible) { event.mouse.x /= _videoMode.scaleFactor; event.mouse.y /= _videoMode.scaleFactor; - if (_videoMode.aspectRatio) + if (_videoMode.aspectRatioCorrection) event.mouse.y = aspect2Real(event.mouse.y); } } diff --git a/backends/platform/gp2x/gp2x-common.h b/backends/platform/gp2x/gp2x-common.h index 7341b0646f..4e6421f353 100644 --- a/backends/platform/gp2x/gp2x-common.h +++ b/backends/platform/gp2x/gp2x-common.h @@ -42,18 +42,7 @@ namespace Audio { } enum { - 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_NORMAL = 0 }; @@ -248,7 +237,7 @@ protected: bool setup; bool fullscreen; - bool aspectRatio; + bool aspectRatioCorrection; int mode; int scaleFactor; @@ -274,16 +263,11 @@ protected: bool _modeChanged; int _screenChangeCount; - /** True if aspect ratio correction is enabled. */ - bool _adjustAspectRatio; - - /** True if zoom on mouse is enabled. (only set by > 240 high games) */ + /* True if zoom on mouse is enabled. (only set by > 240 high games) */ bool _adjustZoomOnMouse; - //_adjustZoomOnMouse = false; enum { NUM_DIRTY_RECT = 100, - MAX_MOUSE_W = 80, MAX_MOUSE_H = 80, MAX_SCALING = 3 @@ -332,7 +316,7 @@ protected: // mouse KbdMouse _km; bool _mouseVisible; - bool _mouseDrawn; + bool _mouseNeedsRedraw; byte *_mouseData; SDL_Rect _mouseBackup; MousePos _mouseCurState; @@ -419,7 +403,7 @@ protected: bool saveScreenshot(const char *filename); int effectiveScreenHeight() const { - return (_videoMode.aspectRatio ? real2Aspect(_videoMode.screenHeight) : _videoMode.screenHeight) + return (_videoMode.aspectRatioCorrection ? real2Aspect(_videoMode.screenHeight) : _videoMode.screenHeight) * _videoMode.scaleFactor; } diff --git a/backends/platform/gp2x/gp2x-hw.cpp b/backends/platform/gp2x/gp2x-hw.cpp index 38799ea7ad..2dc5b4f579 100644 --- a/backends/platform/gp2x/gp2x-hw.cpp +++ b/backends/platform/gp2x/gp2x-hw.cpp @@ -56,7 +56,7 @@ enum { VOLUME_UP = 2, VOLUME_CHANGE_RATE = 8, VOLUME_MIN = 0, - VOLUME_INITIAL = 70, + VOLUME_INITIAL = 60, VOLUME_MAX = 100 }; diff --git a/backends/platform/gp2x/gp2x-mem.cpp b/backends/platform/gp2x/gp2x-mem.cpp index ec73922bf7..97a34ffb6a 100644 --- a/backends/platform/gp2x/gp2x-mem.cpp +++ b/backends/platform/gp2x/gp2x-mem.cpp @@ -37,7 +37,7 @@ #include <unistd.h> #include <string.h> -#include "gp2x-mem.h" +#include "backends/platform/gp2x/gp2x-mem.h" void SetClock (unsigned c) { diff --git a/backends/platform/gp2x/gp2x-mem.h b/backends/platform/gp2x/gp2x-mem.h index 2b64cdb802..24b2a3f569 100644 --- a/backends/platform/gp2x/gp2x-mem.h +++ b/backends/platform/gp2x/gp2x-mem.h @@ -35,7 +35,6 @@ extern "C" { #endif - // Use Squidge's MMU patch rather then myown (his is neater). // The effect if not that great but cacheing the upper RAM is no bad thing (tm) ;). diff --git a/backends/platform/gp2x/gp2x.cpp b/backends/platform/gp2x/gp2x.cpp index 3d416f8415..21a047b345 100644 --- a/backends/platform/gp2x/gp2x.cpp +++ b/backends/platform/gp2x/gp2x.cpp @@ -131,8 +131,6 @@ void OSystem_GP2X::initBackend() { ConfMan.registerDefault("savepath", savePath); - _savefile = new DefaultSaveFileManager(savePath); - #ifdef DUMP_STDOUT // The GP2X has a serial console but most users do not use this so we // output all our STDOUT and STDERR to files for debug purposes. @@ -186,9 +184,9 @@ void OSystem_GP2X::initBackend() { ConfMan.registerDefault("aspect_ratio", true); /* Up default volume values as we use a seperate system level volume anyway. */ - ConfMan.registerDefault("music_volume", 220); - ConfMan.registerDefault("sfx_volume", 220); - ConfMan.registerDefault("speech_volume", 220); + ConfMan.registerDefault("music_volume", 192); + ConfMan.registerDefault("sfx_volume", 192); + ConfMan.registerDefault("speech_volume", 192); ConfMan.registerDefault("autosave_period", 3 * 60); // Trigger autosave every 3 minutes - On low batts 4 mins is about your warning time. memset(&_oldVideoMode, 0, sizeof(_oldVideoMode)); @@ -199,7 +197,7 @@ void OSystem_GP2X::initBackend() { _videoMode.mode = GFX_NORMAL; _videoMode.scaleFactor = 1; _scalerProc = Normal1x; - _videoMode.aspectRatio = ConfMan.getBool("aspect_ratio"); + _videoMode.aspectRatioCorrection = ConfMan.getBool("aspect_ratio"); _scalerType = 0; _modeFlags = 0; _adjustZoomOnMouse = false; @@ -210,17 +208,13 @@ void OSystem_GP2X::initBackend() { _joystick = SDL_JoystickOpen(joystick_num); } + _savefile = new DefaultSaveFileManager(); // Create and hook up the mixer, if none exists yet (we check for this to // allow subclasses to provide their own). if (_mixer == 0) { setupMixer(); } - // Setup the keymapper with backend's set of keys - // NOTE: must be done before creating TimerManager - // to avoid race conditions in creating EventManager - setupKeymapper(); - // Create and hook up the timer manager, if none exists yet (we check for // this to allow subclasses to provide their own). if (_timer == 0) { @@ -241,27 +235,6 @@ void OSystem_GP2X::initBackend() { /* Set Default hardware mixer volume to a preset level (VOLUME_INITIAL). This is done to 'reset' volume level if set by other apps. */ GP2X_HW::mixerMoveVolume(0); - // Set Default hardware mixer volume to a plesent level. - // This is done to 'reset' volume level if set by other apps. - - //if (SDL_GP2X_MouseType() == 0) { - // // No mouse, F100 default state. - // _gp2xInputType = 0; - // displayMessageOnOSD("F100 GP2X Found"); - //} - - //if (SDL_GP2X_MouseType() == 1) { - // // USB mouse found. - // _gp2xInputType = 1; - // displayMessageOnOSD("USB Mouse Found"); - //} - - //if (SDL_GP2X_MouseType() == 2) { - // // F200 touch screen found. - F200 default state. - // _gp2xInputType = 2; - // displayMessageOnOSD("Touch Screen Found"); - //} - OSystem::initBackend(); _inited = true; @@ -275,7 +248,7 @@ OSystem_GP2X::OSystem_GP2X() _overlayscreen(0), _tmpscreen2(0), _samplesPerSec(0), _cdrom(0), _scalerProc(0), _modeChanged(false), _screenChangeCount(0), _dirtyChecksums(0), - _mouseVisible(false), _mouseDrawn(false), _mouseData(0), _mouseSurface(0), + _mouseVisible(false), _mouseNeedsRedraw(false), _mouseData(0), _mouseSurface(0), _mouseOrigSurface(0), _cursorTargetScale(1), _cursorPaletteDisabled(true), _joystick(0), _currentShakePos(0), _newShakePos(0), @@ -434,7 +407,7 @@ bool OSystem_GP2X::getFeatureState(Feature f) { case kFeatureFullscreenMode: return false; case kFeatureAspectRatioCorrection: - return _videoMode.aspectRatio; + return _videoMode.aspectRatioCorrection; case kFeatureAutoComputeDirtyRects: return _modeFlags & DF_WANT_RECT_OPTIM; default: @@ -458,12 +431,12 @@ void OSystem_GP2X::quit() { free(_cursorPalette); free(_mouseData); - delete _savefile; delete _timer; SDL_ShowCursor(SDL_ENABLE); SDL_Quit(); delete getEventManager(); + delete _savefile; #ifdef DUMP_STDOUT printf("%s\n", "Debug: STDOUT and STDERR text files closed."); @@ -610,7 +583,7 @@ void OSystem_GP2X::setupMixer() { _samplesPerSec = SAMPLES_PER_SEC; //Quick EVIL Hack - DJWillis - _samplesPerSec = 11025; +// _samplesPerSec = 11025; // Determine the sample buffer size. We want it to store enough data for // about 1/16th of a second. Note that it must be a power of two. diff --git a/backends/platform/gp2x/graphics.cpp b/backends/platform/gp2x/graphics.cpp index a77afd88b7..229f840d11 100644 --- a/backends/platform/gp2x/graphics.cpp +++ b/backends/platform/gp2x/graphics.cpp @@ -37,7 +37,7 @@ #include "graphics/surface.h" static const OSystem::GraphicsMode s_supportedGraphicsModes[] = { - {"GP2X Graphics Mode", "1x", GFX_NORMAL}, + {"Fullscreen", "1x", GFX_NORMAL}, {0, 0, 0} }; @@ -50,14 +50,7 @@ static ScalerProc *scalersMagn[3][3] = { }; 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 } + { GFX_NORMAL } }; static int cursorStretch200To240(uint8 *buf, uint32 pitch, int width, int height, int srcX, int srcY, int origSrcY); @@ -95,10 +88,10 @@ OSystem::TransactionError OSystem_GP2X::endGFXTransaction(void) { errors |= kTransactionFullscreenFailed; _videoMode.fullscreen = _oldVideoMode.fullscreen; - } else if (_videoMode.aspectRatio != _oldVideoMode.aspectRatio) { + } else if (_videoMode.aspectRatioCorrection != _oldVideoMode.aspectRatioCorrection) { errors |= kTransactionAspectRatioFailed; - _videoMode.aspectRatio = _oldVideoMode.aspectRatio; + _videoMode.aspectRatioCorrection = _oldVideoMode.aspectRatioCorrection; } else if (_videoMode.mode != _oldVideoMode.mode) { errors |= kTransactionModeSwitchFailed; @@ -114,7 +107,7 @@ OSystem::TransactionError OSystem_GP2X::endGFXTransaction(void) { } if (_videoMode.fullscreen == _oldVideoMode.fullscreen && - _videoMode.aspectRatio == _oldVideoMode.aspectRatio && + _videoMode.aspectRatioCorrection == _oldVideoMode.aspectRatioCorrection && _videoMode.mode == _oldVideoMode.mode && _videoMode.screenWidth == _oldVideoMode.screenWidth && _videoMode.screenHeight == _oldVideoMode.screenHeight) { @@ -190,45 +183,6 @@ bool OSystem_GP2X::setGraphicsMode(int mode) { case GFX_NORMAL: newScaleFactor = 1; break; -#ifndef DISABLE_SCALERS - case GFX_DOUBLESIZE: - newScaleFactor = 2; - break; - case GFX_TRIPLESIZE: - newScaleFactor = 3; - break; - - case GFX_2XSAI: - newScaleFactor = 2; - break; - case GFX_SUPER2XSAI: - newScaleFactor = 2; - break; - case GFX_SUPEREAGLE: - newScaleFactor = 2; - break; - case GFX_ADVMAME2X: - newScaleFactor = 2; - break; - case GFX_ADVMAME3X: - newScaleFactor = 3; - break; -#ifndef DISABLE_HQ_SCALERS - case GFX_HQ2X: - newScaleFactor = 2; - break; - case GFX_HQ3X: - newScaleFactor = 3; - break; -#endif - case GFX_TV2X: - newScaleFactor = 2; - break; - case GFX_DOTMATRIX: - newScaleFactor = 2; - break; -#endif // DISABLE_SCALERS - default: warning("unknown gfx mode %d", mode); return false; @@ -246,7 +200,6 @@ bool OSystem_GP2X::setGraphicsMode(int mode) { return true; } - void OSystem_GP2X::setGraphicsModeIntern() { Common::StackLock lock(_graphicsMutex); ScalerProc *newScalerProc = 0; @@ -255,44 +208,6 @@ void OSystem_GP2X::setGraphicsModeIntern() { case GFX_NORMAL: newScalerProc = Normal1x; break; -#ifndef DISABLE_SCALERS - case GFX_DOUBLESIZE: - newScalerProc = Normal2x; - break; - case GFX_TRIPLESIZE: - newScalerProc = Normal3x; - break; - - case GFX_2XSAI: - newScalerProc = _2xSaI; - break; - case GFX_SUPER2XSAI: - newScalerProc = Super2xSaI; - break; - case GFX_SUPEREAGLE: - newScalerProc = SuperEagle; - break; - case GFX_ADVMAME2X: - newScalerProc = AdvMame2x; - break; - case GFX_ADVMAME3X: - newScalerProc = AdvMame3x; - break; -#ifndef DISABLE_HQ_SCALERS - case GFX_HQ2X: - newScalerProc = HQ2x; - break; - case GFX_HQ3X: - newScalerProc = HQ3x; - break; -#endif - case GFX_TV2X: - newScalerProc = TV2x; - break; - case GFX_DOTMATRIX: - newScalerProc = DotMatrix; - break; -#endif // DISABLE_SCALERS default: error("Unknown gfx mode %d", _videoMode.mode); @@ -353,18 +268,28 @@ bool OSystem_GP2X::loadGFXMode() { _videoMode.overlayHeight = _videoMode.screenHeight * _videoMode.scaleFactor; if (_videoMode.screenHeight != 200 && _videoMode.screenHeight != 400) - _videoMode.aspectRatio = false; + _videoMode.aspectRatioCorrection = false; - if (_videoMode.aspectRatio) + if (_videoMode.aspectRatioCorrection) _videoMode.overlayHeight = real2Aspect(_videoMode.overlayHeight); hwW = _videoMode.screenWidth * _videoMode.scaleFactor; - hwH = effectiveScreenHeight(); + + if (_videoMode.screenHeight == 200) { + hwH = 240; + } else if (_videoMode.screenHeight == 400) { + hwH = 480; + } else { + hwH = _videoMode.screenHeight; + } + + printf ("Game Screen Height: %d\n", hwH); // - // Create the surface that contains the 8 bit game data + // Create the surface that contains the game data // - _screen = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.screenWidth, _videoMode.screenHeight, 8, 0, 0, 0, 0); + + _screen = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.screenWidth, hwH, 8, 0, 0, 0, 0); if (_screen == NULL) error("allocating _screen failed"); @@ -372,9 +297,7 @@ bool OSystem_GP2X::loadGFXMode() { // Create the surface that contains the scaled graphics in 16 bit mode // - _hwscreen = SDL_SetVideoMode(hwW, hwH, 16, - _videoMode.fullscreen ? (SDL_FULLSCREEN|SDL_SWSURFACE) : SDL_SWSURFACE - ); + _hwscreen = SDL_SetVideoMode(hwW, hwH, 16, SDL_SWSURFACE | SDL_NOFRAME | SDL_FULLSCREEN); if (_hwscreen == NULL) { // DON'T use error(), as this tries to bring up the debug // console, which WON'T WORK now that _hwscreen is hosed. @@ -395,12 +318,6 @@ bool OSystem_GP2X::loadGFXMode() { // Create the surface used for the graphics in 16 bit before scaling, and also the overlay // - // Distinguish 555 and 565 mode - if (_hwscreen->format->Rmask == 0x7C00) - InitScalers(555); - else - InitScalers(565); - // Need some extra bytes around when using 2xSaI _tmpscreen = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.screenWidth + 3, _videoMode.screenHeight + 3, 16, @@ -462,6 +379,12 @@ bool OSystem_GP2X::loadGFXMode() { _km.delay_time = 25; _km.last_time = 0; + // Distinguish 555 and 565 mode + if (_hwscreen->format->Rmask == 0x7C00) + InitScalers(555); + else + InitScalers(565); + return true; } @@ -571,7 +494,7 @@ void OSystem_GP2X::internUpdateScreen() { if (_currentShakePos != _newShakePos) { SDL_Rect blackrect = {0, 0, _videoMode.screenWidth * _videoMode.scaleFactor, _newShakePos * _videoMode.scaleFactor}; - if (_videoMode.aspectRatio && !_overlayVisible) + if (_videoMode.aspectRatioCorrection && !_overlayVisible) blackrect.h = real2Aspect(blackrect.h - 1) + 1; SDL_FillRect(_hwscreen, &blackrect, 0); @@ -627,6 +550,11 @@ void OSystem_GP2X::internUpdateScreen() { scale1 = 1; } + // Add the area covered by the mouse cursor to the list of dirty rects if + // we have to redraw the mouse. + if (_mouseNeedsRedraw) + undrawMouse(); + // Force a full redraw if requested if (_forceFull) { _numDirtyRects = 1; @@ -634,12 +562,10 @@ void OSystem_GP2X::internUpdateScreen() { _dirtyRectList[0].y = 0; _dirtyRectList[0].w = width; _dirtyRectList[0].h = height; - } else - undrawMouse(); + } // Only draw anything if necessary - if (_numDirtyRects > 0) { - + if (_numDirtyRects > 0 || _mouseNeedsRedraw) { SDL_Rect *r; SDL_Rect dst; uint32 srcPitch, dstPitch; @@ -647,7 +573,7 @@ void OSystem_GP2X::internUpdateScreen() { for (r = _dirtyRectList; r != lastRect; ++r) { dst = *r; - dst.x++; // Shift rect by one since 2xSai needs to acces the data around + 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. if (SDL_BlitSurface(origSurf, r, srcSurf, &dst) != 0) @@ -674,7 +600,7 @@ void OSystem_GP2X::internUpdateScreen() { orig_dst_y = dst_y; dst_y = dst_y * scale1; - if (_videoMode.aspectRatio && !_overlayVisible) + if (_videoMode.aspectRatioCorrection && !_overlayVisible) dst_y = real2Aspect(dst_y); assert(scalerProc != NULL); @@ -687,10 +613,8 @@ void OSystem_GP2X::internUpdateScreen() { r->w = r->w * scale1; r->h = dst_h * scale1; -#ifndef DISABLE_SCALERS - if (_videoMode.aspectRatio && orig_dst_y < height && !_overlayVisible) + if (_videoMode.aspectRatioCorrection && orig_dst_y < height && !_overlayVisible) r->h = stretch200To240((uint8 *) _hwscreen->pixels, dstPitch, r->w, r->h, r->x, r->y, orig_dst_y * scale1); -#endif } SDL_UnlockSurface(srcSurf); SDL_UnlockSurface(_hwscreen); @@ -710,14 +634,11 @@ void OSystem_GP2X::internUpdateScreen() { // Finally, blit all our changes to the screen SDL_UpdateRects(_hwscreen, _numDirtyRects, _dirtyRectList); - } else { - drawMouse(); - if (_numDirtyRects) - SDL_UpdateRects(_hwscreen, _numDirtyRects, _dirtyRectList); } _numDirtyRects = 0; _forceFull = false; + _mouseNeedsRedraw = false; } bool OSystem_GP2X::saveScreenshot(const char *filename) { @@ -740,18 +661,14 @@ void OSystem_GP2X::setFullscreenMode(bool enable) { } void OSystem_GP2X::setAspectRatioCorrection(bool enable) { - if ((_videoMode.screenHeight == 200 && _videoMode.aspectRatio != enable) || - _transactionMode == kTransactionActive) { - - Common::StackLock lock(_graphicsMutex); + Common::StackLock lock(_graphicsMutex); - if (_oldVideoMode.setup && _oldVideoMode.aspectRatio == enable) - return; + if (_oldVideoMode.setup && _oldVideoMode.aspectRatioCorrection == enable) + return; - if (_transactionMode == kTransactionActive) { - _videoMode.aspectRatio = enable; - _transactionDetails.needHotswap = true; - } + if (_transactionMode == kTransactionActive) { + _videoMode.aspectRatioCorrection = enable; + _transactionDetails.needHotswap = true; } } @@ -776,12 +693,12 @@ void OSystem_GP2X::copyRectToScreen(const byte *src, int pitch, int x, int y, in Common::StackLock lock(_graphicsMutex); // Lock the mutex until this function ends -// assert(x >= 0 && x < _screenWidth); -// assert(y >= 0 && y < _screenHeight); -// assert(h > 0 && y + h <= _screenHeight); -// assert(w > 0 && x + w <= _screenWidth); + assert(x >= 0 && x < _videoMode.screenWidth); + assert(y >= 0 && y < _videoMode.screenHeight); + assert(h > 0 && y + h <= _videoMode.screenHeight); + assert(w > 0 && x + w <= _videoMode.screenWidth); - if (((long)src & 3) == 0 && pitch == _videoMode.screenWidth && x == 0 && y == 0 && + if (IS_ALIGNED(src, 4) && pitch == _videoMode.screenWidth && x == 0 && y == 0 && w == _videoMode.screenWidth && h == _videoMode.screenHeight && _modeFlags & DF_WANT_RECT_OPTIM) { /* Special, optimized case for full screen updates. * It tries to determine what areas were actually changed, @@ -923,7 +840,7 @@ void OSystem_GP2X::addDirtyRect(int x, int y, int w, int h, bool realCoordinates h = height - y; } - if (_videoMode.aspectRatio && !_overlayVisible && !realCoordinates) { + if (_videoMode.aspectRatioCorrection && !_overlayVisible && !realCoordinates) { makeRectStretchable(x, y, w, h); } @@ -982,7 +899,7 @@ void OSystem_GP2X::makeChecksums(const byte *buf) { void OSystem_GP2X::addDirtyRgnAuto(const byte *buf) { assert(buf); - assert(((long)buf & 3) == 0); + assert(IS_ALIGNED(buf, 4)); /* generate a table of the checksums */ makeChecksums(buf); @@ -1115,7 +1032,7 @@ void OSystem_GP2X::showOverlay() { // Since resolution could change, put mouse to adjusted position // Fixes bug #1349059 x = _mouseCurState.x * _videoMode.scaleFactor; - if (_videoMode.aspectRatio) + if (_videoMode.aspectRatioCorrection) y = real2Aspect(_mouseCurState.y) * _videoMode.scaleFactor; else y = _mouseCurState.y * _videoMode.scaleFactor; @@ -1139,7 +1056,7 @@ void OSystem_GP2X::hideOverlay() { // Fixes bug #1349059 x = _mouseCurState.x / _videoMode.scaleFactor; y = _mouseCurState.y / _videoMode.scaleFactor; - if (_videoMode.aspectRatio) + if (_videoMode.aspectRatioCorrection) y = aspect2Real(y); warpMouse(x, y); @@ -1172,7 +1089,7 @@ void OSystem_GP2X::clearOverlay() { (byte *)_overlayscreen->pixels, _overlayscreen->pitch, _videoMode.screenWidth, _videoMode.screenHeight); #ifndef DISABLE_SCALERS - if (_videoMode.aspectRatio) + if (_videoMode.aspectRatioCorrection) stretch200To240((uint8 *)_overlayscreen->pixels, _overlayscreen->pitch, _videoMode.overlayWidth, _videoMode.screenHeight * _videoMode.scaleFactor, 0, 0, 0); #endif @@ -1259,12 +1176,14 @@ bool OSystem_GP2X::showMouse(bool visible) { bool last = _mouseVisible; _mouseVisible = visible; + _mouseNeedsRedraw = true; return last; } void OSystem_GP2X::setMousePos(int x, int y) { if (x != _mouseCurState.x || y != _mouseCurState.y) { + _mouseNeedsRedraw = true; _mouseCurState.x = x; _mouseCurState.y = y; } @@ -1273,7 +1192,7 @@ void OSystem_GP2X::setMousePos(int x, int y) { void OSystem_GP2X::warpMouse(int x, int y) { int y1 = y; - if (_adjustAspectRatio && !_overlayVisible) + if (_videoMode.aspectRatioCorrection && !_overlayVisible) y1 = real2Aspect(y); if (_mouseCurState.x != x || _mouseCurState.y != y) { @@ -1342,6 +1261,8 @@ void OSystem_GP2X::blitCursor() { if (!_mouseOrigSurface || !_mouseData) return; + _mouseNeedsRedraw = true; + w = _mouseCurState.w; h = _mouseCurState.h; @@ -1422,7 +1343,7 @@ void OSystem_GP2X::blitCursor() { int rH1 = rH; // store original to pass to aspect-correction function later - if (_videoMode.aspectRatio && _cursorTargetScale == 1) { + if (_videoMode.aspectRatioCorrection && _cursorTargetScale == 1) { rH = real2Aspect(rH - 1) + 1; _mouseCurState.rHotY = real2Aspect(_mouseCurState.rHotY); } @@ -1453,20 +1374,17 @@ void OSystem_GP2X::blitCursor() { ScalerProc *scalerProc; - // If possible, use the same scaler for the cursor as for the rest of - // 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)) - scalerProc = _scalerProc; - else + if (_cursorTargetScale == 1 && _videoMode.screenWidth > 320) { + scalerProc = scalersMagn[_cursorTargetScale + 1][_videoMode.scaleFactor + 1]; + } else { scalerProc = scalersMagn[_cursorTargetScale - 1][_videoMode.scaleFactor - 1]; + } scalerProc((byte *)_mouseOrigSurface->pixels + _mouseOrigSurface->pitch + 2, _mouseOrigSurface->pitch, (byte *)_mouseSurface->pixels, _mouseSurface->pitch, _mouseCurState.w, _mouseCurState.h); - if (_videoMode.aspectRatio && _cursorTargetScale == 1) + if (_videoMode.aspectRatioCorrection && _cursorTargetScale == 1) cursorStretch200To240((uint8 *)_mouseSurface->pixels, _mouseSurface->pitch, rW, rH1, 0, 0, 0); SDL_UnlockSurface(_mouseSurface); @@ -1506,9 +1424,8 @@ void OSystem_GP2X::undrawMouse() { // When we switch bigger overlay off mouse jumps. Argh! // This is intended to prevent undrawing offscreen mouse - if (!_overlayVisible && (x >= _videoMode.screenWidth || y >= _videoMode.screenHeight)) { + if (!_overlayVisible && (x >= _videoMode.screenWidth || y >= _videoMode.screenHeight)) return; - } if (_mouseBackup.w != 0 && _mouseBackup.h != 0) addDirtyRect(x, y, _mouseBackup.w, _mouseBackup.h); @@ -1575,7 +1492,7 @@ void OSystem_GP2X::drawMouse() { dst.y += _currentShakePos; } - if (_videoMode.aspectRatio && !_overlayVisible) + if (_videoMode.aspectRatioCorrection && !_overlayVisible) dst.y = real2Aspect(dst.y); dst.x = scale * dst.x - _mouseCurState.rHotX; @@ -1584,7 +1501,6 @@ void OSystem_GP2X::drawMouse() { dst.h = _mouseCurState.rH; // Hacking about with the zoom around mouse pointer stuff. - if (_adjustZoomOnMouse == true){ zoomdst.w = (tmpScreenWidth / 2); @@ -1623,7 +1539,6 @@ void OSystem_GP2X::drawMouse() { SDL_GP2X_Display(&zoomdst); }; - // Note that SDL_BlitSurface() and addDirtyRect() will both perform any // clipping necessary @@ -1730,10 +1645,10 @@ void OSystem_GP2X::handleScalerHotkeys(const SDL_KeyboardEvent &key) { // Ctrl-Alt-a toggles aspect ratio correction if (key.keysym.sym == 'a') { beginGFXTransaction(); - setFeatureState(kFeatureAspectRatioCorrection, !_videoMode.aspectRatio); + setFeatureState(kFeatureAspectRatioCorrection, !_videoMode.aspectRatioCorrection); endGFXTransaction(); char buffer[128]; - if (_videoMode.aspectRatio) + if (_videoMode.aspectRatioCorrection) sprintf(buffer, "Enabled aspect ratio correction\n%d x %d -> %d x %d", _videoMode.screenWidth, _videoMode.screenHeight, _hwscreen->w, _hwscreen->h diff --git a/backends/platform/gp2x/module.mk b/backends/platform/gp2x/module.mk index 58dfd24ee6..50a771219a 100644 --- a/backends/platform/gp2x/module.mk +++ b/backends/platform/gp2x/module.mk @@ -6,8 +6,6 @@ MODULE_OBJS := \ events.o \ graphics.o \ gp2x.o \ -# gp2x-options.o \ -# overload_help.o \ MODULE_DIRS += \ backends/platform/gp2x/ diff --git a/backends/platform/sdl/graphics.cpp b/backends/platform/sdl/graphics.cpp index 8768dd90d4..efcade834d 100644 --- a/backends/platform/sdl/graphics.cpp +++ b/backends/platform/sdl/graphics.cpp @@ -475,12 +475,54 @@ void OSystem_SDL::initSize(uint w, uint h, const Graphics::PixelFormat *format) _dirtyChecksums = (uint32 *)calloc(_cksumNum * 2, sizeof(uint32)); } + +static void fixupResolutionForAspectRatio(AspectRatio desiredAspectRatio, int &width, int &height) { + assert(&width != &height); + + if (desiredAspectRatio.isAuto()) + return; + + int kw = desiredAspectRatio.kw(); + int kh = desiredAspectRatio.kh(); + + const int w = width; + const int h = height; + + SDL_Rect const* const*availableModes = SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_SWSURFACE); //TODO : Maybe specify a pixel format + assert(availableModes); + + const SDL_Rect *bestMode = NULL; + uint bestMetric = (uint)-1; // Metric is wasted space + while (const SDL_Rect *mode = *availableModes++) { + if (mode->w < w) + continue; + if (mode->h < h) + continue; + if (mode->h * kw != mode->w * kh) + continue; + //printf("%d %d\n", mode->w, mode->h); + + uint metric = mode->w * mode->h - w * h; + if (metric > bestMetric) + continue; + + bestMetric = metric; + bestMode = mode; + } + + if (!bestMode) { + warning("Unable to enforce the desired aspect ratio!"); + return; + } + //printf("%d %d\n", bestMode->w, bestMode->h); + width = bestMode->w; + height = bestMode->h; +} + bool OSystem_SDL::loadGFXMode() { assert(_inited); _forceFull = true; - int hwW, hwH; - #if !defined(__MAEMO__) && !defined(GP2XWIZ) _videoMode.overlayWidth = _videoMode.screenWidth * _videoMode.scaleFactor; _videoMode.overlayHeight = _videoMode.screenHeight * _videoMode.scaleFactor; @@ -491,11 +533,11 @@ bool OSystem_SDL::loadGFXMode() { if (_videoMode.aspectRatioCorrection) _videoMode.overlayHeight = real2Aspect(_videoMode.overlayHeight); - hwW = _videoMode.screenWidth * _videoMode.scaleFactor; - hwH = effectiveScreenHeight(); + _videoMode.hardwareWidth = _videoMode.screenWidth * _videoMode.scaleFactor; + _videoMode.hardwareHeight = effectiveScreenHeight(); #else - hwW = _videoMode.overlayWidth; - hwH = _videoMode.overlayHeight; + _videoMode.hardwareWidth = _videoMode.overlayWidth; + _videoMode.hardwareHeight = _videoMode.overlayHeight; #endif // @@ -521,7 +563,11 @@ bool OSystem_SDL::loadGFXMode() { // Create the surface that contains the scaled graphics in 16 bit mode // - _hwscreen = SDL_SetVideoMode(hwW, hwH, 16, + if(_videoMode.fullscreen) { + fixupResolutionForAspectRatio(_videoMode.desiredAspectRatio, _videoMode.hardwareWidth, _videoMode.hardwareHeight); + } + + _hwscreen = SDL_SetVideoMode(_videoMode.hardwareWidth, _videoMode.hardwareHeight, 16, _videoMode.fullscreen ? (SDL_FULLSCREEN|SDL_SWSURFACE) : SDL_SWSURFACE ); if (_hwscreen == NULL) { diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index 5abeff3902..b6b46af9d7 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -85,6 +85,31 @@ static Uint32 timer_handler(Uint32 interval, void *param) { return interval; } +AspectRatio::AspectRatio(int w, int h) { + // TODO : Validation and so on... + // Currently, we just ensure the program don't instantiate non-supported aspect ratios + _kw = w; + _kh = h; +} + +static const size_t AR_COUNT = 4; +static const char* desiredAspectRatioAsStrings[AR_COUNT] = { "auto", "4/3", "16/9", "16/10" }; +static const AspectRatio desiredAspectRatios[AR_COUNT] = { AspectRatio(0, 0), AspectRatio(4,3), AspectRatio(16,9), AspectRatio(16,10) }; +static AspectRatio getDesiredAspectRatio() { + //TODO : We could parse an arbitrary string, if we code enough proper validation + Common::String desiredAspectRatio = ConfMan.get("desired_screen_aspect_ratio"); + + for (size_t i = 0; i < AR_COUNT; i++) { + assert(desiredAspectRatioAsStrings[i] != NULL); + + if (!scumm_stricmp(desiredAspectRatio.c_str(), desiredAspectRatioAsStrings[i])) { + return desiredAspectRatios[i]; + } + } + // TODO : Report a warning + return AspectRatio(0, 0); +} + void OSystem_SDL::initBackend() { assert(!_inited); @@ -124,6 +149,7 @@ void OSystem_SDL::initBackend() { _videoMode.mode = GFX_DOUBLESIZE; _videoMode.scaleFactor = 2; _videoMode.aspectRatioCorrection = ConfMan.getBool("aspect_ratio"); + _videoMode.desiredAspectRatio = getDesiredAspectRatio(); _scalerProc = Normal2x; #else // for small screen platforms _videoMode.mode = GFX_NORMAL; diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h index 3e074a884a..6c8a721701 100644 --- a/backends/platform/sdl/sdl.h +++ b/backends/platform/sdl/sdl.h @@ -70,6 +70,18 @@ enum { GFX_DOTMATRIX = 11 }; +class AspectRatio { + int _kw, _kh; +public: + AspectRatio() { _kw = _kh = 0; } + AspectRatio(int w, int h); + + bool isAuto() const { return (_kw | _kh) == 0; } + + int kw() const { return _kw; } + int kh() const { return _kh; } +}; + class OSystem_SDL : public BaseBackend { public: @@ -284,6 +296,7 @@ protected: bool fullscreen; bool aspectRatioCorrection; + AspectRatio desiredAspectRatio; int mode; int scaleFactor; @@ -293,6 +306,7 @@ protected: #ifdef ENABLE_RGB_COLOR Graphics::PixelFormat format; #endif + int hardwareWidth, hardwareHeight; }; VideoState _videoMode, _oldVideoMode; diff --git a/backends/platform/wii/osystem_events.cpp b/backends/platform/wii/osystem_events.cpp index f28e5b547b..0967db1625 100644 --- a/backends/platform/wii/osystem_events.cpp +++ b/backends/platform/wii/osystem_events.cpp @@ -316,13 +316,13 @@ bool OSystem_Wii::pollEvent(Common::Event &event) { #endif if (bd || bu) { - PAD_EVENT(PADS_Z, Common::KEYCODE_RETURN, Common::ASCII_RETURN, 0); - PAD_EVENT(PADS_X, Common::KEYCODE_ESCAPE, Common::ASCII_ESCAPE, 0); - PAD_EVENT(PADS_Y, Common::KEYCODE_PERIOD, '.', 0); - PAD_EVENT(PADS_START, Common::KEYCODE_F5, Common::ASCII_F5, 0); - PAD_EVENT(PADS_UP, Common::KEYCODE_F5, Common::ASCII_F5, Common::KBD_CTRL); - PAD_EVENT(PADS_DOWN, Common::KEYCODE_F7, Common::ASCII_F7, 0); - //PAD_EVENT(PADS_LEFT, Common::KEYCODE_F8, Common::ASCII_F8, 0); + byte flags = 0; + + if (bh & PADS_UP) { + PAD_EVENT(PADS_START, Common::KEYCODE_F5, Common::ASCII_F5, Common::KBD_CTRL); + + flags = Common::KBD_SHIFT; + } if (bd & PADS_RIGHT) { event.type = Common::EVENT_PREDICTIVE_DIALOG; @@ -330,6 +330,14 @@ bool OSystem_Wii::pollEvent(Common::Event &event) { return true; } + PAD_EVENT(PADS_Z, Common::KEYCODE_RETURN, Common::ASCII_RETURN, flags); + PAD_EVENT(PADS_X, Common::KEYCODE_ESCAPE, Common::ASCII_ESCAPE, flags); + PAD_EVENT(PADS_Y, Common::KEYCODE_PERIOD, '.', flags); + PAD_EVENT(PADS_START, Common::KEYCODE_F5, Common::ASCII_F5, flags); + PAD_EVENT(PADS_UP, Common::KEYCODE_LSHIFT, 0, flags); + PAD_EVENT(PADS_DOWN, Common::KEYCODE_F7, Common::ASCII_F7, flags); + //PAD_EVENT(PADS_LEFT, Common::KEYCODE_F8, Common::ASCII_F8, 0); + if ((bd | bu) & (PADS_A | PADS_B)) { if (bd & PADS_A) event.type = Common::EVENT_LBUTTONDOWN; diff --git a/backends/platform/wince/Makefile b/backends/platform/wince/Makefile index acade8ac9a..49101dcb27 100644 --- a/backends/platform/wince/Makefile +++ b/backends/platform/wince/Makefile @@ -50,10 +50,10 @@ ENABLE_MADE = STATIC_PLUGIN ## Pick which libraries you want to use here USE_MAD = 1 -USE_MPEG2 = 1 +#USE_MPEG2 = 1 #USE_TREMOR = 1 USE_TREMOLO = 1 -USE_FLAC = 1 +#USE_FLAC = 1 USE_ZLIB = 1 ######################################################################## diff --git a/backends/platform/wince/README-WinCE.txt b/backends/platform/wince/README-WinCE.txt index 5b3215e34e..21c62fb47f 100644 --- a/backends/platform/wince/README-WinCE.txt +++ b/backends/platform/wince/README-WinCE.txt @@ -1,6 +1,6 @@ ScummVM Windows CE FAQ Last updated: $Date$ -Release version: 0.13.0 +Release version: 1.0.0rc1 ------------------------------------------------------------------------ New in this version @@ -20,6 +20,18 @@ Be aware that Discworld 2 tries to allocate a big chunk of memory (10 MB) and this will fail on many devices (file under the not enough memory category). +From this version on, we're dropping support for FLAC and MPEG-2. The first +is a pain to maintain, while the second has been gradually phased out in +scummvm. Be sure to update your add-on packs and/or recompress your sound. + +This is still a 2-binary distribution. Here's what engines are compiled in +the two executables: +scummvm1.exe: + - scumm, sword1, sword2, queen, sky, lure, agi, touche, tinsel, cruise +scummvm2.exe: + - gob, cine, saga, kyra, agos, parallaction, drascula, groovie, tucker, made + + ------------------------------------------------------------------------ This document is intended to give common answers to specific ScummVM diff --git a/backends/platform/wince/missing/missing.cpp b/backends/platform/wince/missing/missing.cpp index ac93e8f714..2d9765b0f2 100644 --- a/backends/platform/wince/missing/missing.cpp +++ b/backends/platform/wince/missing/missing.cpp @@ -42,6 +42,7 @@ #endif #include "time.h" #include "dirent.h" +#include "common/debug.h" char *strdup(const char *strSource); @@ -182,11 +183,19 @@ int _access(const char *path, int mode) { HANDLE h = FindFirstFile(fname, &ffd); FindClose(h); - if (h == INVALID_HANDLE_VALUE) - return -1; //Can't find file + if (h == INVALID_HANDLE_VALUE) { + // WORKAROUND: WinCE 3.0 doesn't find paths ending in '\' + if (path[strlen(path)-1] == '\\') { + char p2[MAX_PATH]; + strncpy(p2, path, strlen(path)-1); + p2[strlen(path) - 1]= '\0'; + return _access(p2, mode); + } else + return -1; //Can't find file + } - if (ffd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) { - // WORKAROUND: WinCE (or the emulator) sometimes returns bogus direcotry + if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { + // WORKAROUND: WinCE (or the emulator) sometimes returns bogus directory // hits for files that don't exist. TRIPLE checking for the same fname // seems to weed out those false positives. // Exhibited in kyra engine. @@ -206,7 +215,7 @@ int _access(const char *path, int mode) { return 0; case 06: //Check Read & Write permission case 02: //Check Write permission - return ffd.dwFileAttributes&FILE_ATTRIBUTE_READONLY?-1:0; + return ffd.dwFileAttributes & FILE_ATTRIBUTE_READONLY ? -1 : 0; case 04: //Check Read permission return 0; //Assume always have read permission } diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp index 5d75b76805..65082014da 100644 --- a/backends/platform/wince/wince-sdl.cpp +++ b/backends/platform/wince/wince-sdl.cpp @@ -1934,8 +1934,7 @@ void OSystem_WINCE3::setMouseCursor(const byte *buf, uint w, uint h, int hotspot _mouseData = (byte *) malloc(w * h); memcpy(_mouseData, buf, w * h); - if (w > _mouseBackupDim || h > _mouseBackupDim) - { + if (w > _mouseBackupDim || h > _mouseBackupDim) { // mouse has been undrawn, adjust sprite backup area free(_mouseBackupOld); free(_mouseBackupToolbar); @@ -2050,7 +2049,6 @@ void OSystem_WINCE3::undrawMouse() { if (_mouseNeedsRedraw) return; - _mouseNeedsRedraw = true; int old_mouse_x = _mouseCurState.x - _mouseHotspotX; int old_mouse_y = _mouseCurState.y - _mouseHotspotY; @@ -2101,6 +2099,22 @@ void OSystem_WINCE3::undrawMouse() { addDirtyRect(old_mouse_x, old_mouse_y, old_mouse_w, old_mouse_h); SDL_UnlockSurface(_overlayVisible ? _overlayscreen : _screen); + + _mouseNeedsRedraw = true; +} + +bool OSystem_WINCE3::showMouse(bool visible) { + if (_mouseVisible == visible) + return visible; + + if (visible == false) + undrawMouse(); + + bool last = _mouseVisible; + _mouseVisible = visible; + _mouseNeedsRedraw = true; + + return last; } void OSystem_WINCE3::drawToolbarMouse(SDL_Surface *surf, bool draw) { @@ -2457,9 +2471,12 @@ bool OSystem_WINCE3::pollEvent(Common::Event &event) { } if (_toolbarHandler.action(event.mouse.x, event.mouse.y, false)) { - if (!_toolbarHandler.drawn()) + if (!_toolbarHandler.drawn()) { _toolbarHighDrawn = false; internUpdateScreen(); + } + return false; + } return true; diff --git a/backends/platform/wince/wince-sdl.h b/backends/platform/wince/wince-sdl.h index cc2948f93d..deafde6d80 100644 --- a/backends/platform/wince/wince-sdl.h +++ b/backends/platform/wince/wince-sdl.h @@ -94,6 +94,7 @@ public: void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, byte keycolor, int cursorTargetScale); // overloaded by CE backend void undrawMouse(); void blitCursor(); + bool showMouse(bool visible); void setMousePos(int x, int y); void copyRectToScreen(const byte *src, int pitch, int x, int y, int w, int h); // overloaded by CE backend (FIXME) void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h); |