diff options
Diffstat (limited to 'backends/platform/gp2xwiz')
-rw-r--r-- | backends/platform/gp2xwiz/build/README-GP2XWIZ | 41 | ||||
-rwxr-xr-x | backends/platform/gp2xwiz/build/bundle.sh | 9 | ||||
-rwxr-xr-x | backends/platform/gp2xwiz/build/scummvm.gpe | 4 | ||||
-rw-r--r-- | backends/platform/gp2xwiz/gp2xwiz-events.cpp | 11 | ||||
-rw-r--r-- | backends/platform/gp2xwiz/gp2xwiz-graphics.cpp | 425 | ||||
-rw-r--r-- | backends/platform/gp2xwiz/gp2xwiz-hw.cpp | 2 | ||||
-rw-r--r-- | backends/platform/gp2xwiz/gp2xwiz-main.cpp | 6 | ||||
-rw-r--r-- | backends/platform/gp2xwiz/gp2xwiz-scaler.cpp | 40 | ||||
-rw-r--r-- | backends/platform/gp2xwiz/gp2xwiz-scaler.h | 42 | ||||
-rw-r--r-- | backends/platform/gp2xwiz/gp2xwiz-sdl.h | 15 | ||||
-rw-r--r-- | backends/platform/gp2xwiz/module.mk | 2 |
11 files changed, 567 insertions, 30 deletions
diff --git a/backends/platform/gp2xwiz/build/README-GP2XWIZ b/backends/platform/gp2xwiz/build/README-GP2XWIZ index 95ac844a2c..ec8142a6f3 100644 --- a/backends/platform/gp2xwiz/build/README-GP2XWIZ +++ b/backends/platform/gp2xwiz/build/README-GP2XWIZ @@ -11,19 +11,27 @@ Contents: * Recent changes <#Recent_changes> * How to save <#How_to_save> * Controller mappings <#Controller_mappings> - * Know issues <#Know_issues> - * Major TODO's <#Major_TODOs> + * Known issues <#Knonw_issues> * Additional resources/links <#Additional_resourceslinks> * Credits <#Credits> +------------------------------------------------------------------------ + +Please refer to the: + +GP2X/GP2XWiz ScummVM Forum: <http://forums.scummvm.org/viewforum.php?f=14> +WiKi: <http://wiki.scummvm.org/index.php/GP2XWiz> + +for the most current information on the port and any updates to this +documentation. ------------------------------------------------------------------------ About the backend/port -This is the readme for the offficial GP2X WIZ ScummVM backend (also known as -the GP2X WIZ port). +This is the readme for the official GP2XWiz ScummVM backend (also known as +the GP2XWiz port). -This is an SVN test release of ScummVM for the GP2X WIZ, it would be +This is an SVN test release of ScummVM for the GP2XWiz, it would be appreciated if this SVN test distribution was not mirrored and that people be directed to http://scummvm.distant-earth.com/ instead for updated SVN builds. @@ -35,19 +43,12 @@ downloads page <http://www.scummvm.org/downloads.php>. This build is in an active state of development and as such no "expected" behavior can be guaranteed ;). -SVN builds are quickly tested with firmware 1.0.0 for reference. - -Please refer to the GP2X/GP2X WIZ ScummVM forum -<http://forums.scummvm.org/viewforum.php?f=14> and WiKi -<http://wiki.scummvm.org/index.php/GP2X> for the latest information on -the port. - ------------------------------------------------------------------------ Game compatibility For information on the compatability of a specific game please refer to -the GP2X compatability section of the ScummVM WiKi -<http://wiki.scummvm.org/index.php/GP2X#Compatibility_List>. +the GP2XWiz compatability section of the ScummVM WiKi +<http://wiki.scummvm.org/index.php/GP2XWiz#Compatibility_List>. Please note the version and date of the ScummVM build you are running when reviewing the above list. @@ -105,22 +106,20 @@ Right Trigger: Return Select: Escape Y: Space Bar (Pause) Menu: Game Menu (Save, Load, Quit etc.) -Volume Buttons: Increase and Decrease volume (5% per press) +Volume Buttons: Increase and Decrease volume Fancy button combos: NOTE: To use button combos press and hold the Left Trigger then... -Right Trigger: 0 (For skipping the copy protection in Monkey Island 2) +Right Trigger: Display Virtual Keyboard Menu: Bring up the Global main menu for ScummVM Select: Exit ScummVM completely (and gracefully) ------------------------------------------------------------------------ -Know issues +Known issues -Possible random crash (well SegFault). I have had this happen twice and -have not tracked down the cause. -It happens very infrequently, both times it was in the DOTT CD intro. +No major known issues ------------------------------------------------------------------------ Additional resources/links @@ -128,7 +127,7 @@ Additional resources/links * ScummVM WiKi GP2X page <http://wiki.scummvm.org/index.php/GP2X> * ScummVM forums GP2X forum <http://forums.scummvm.org/viewforum.php?f=14> - * My own ScummVM page <http://www.distant-earth.com/scummvm> (for + * My own ScummVM page <http://scummvm.distant-earth.com/> (for SVN/test builds) * Main ScummVM site <http://www.scummvm.org> (for official supported release builds) diff --git a/backends/platform/gp2xwiz/build/bundle.sh b/backends/platform/gp2xwiz/build/bundle.sh index 506dfcb742..492ba9e1c6 100755 --- a/backends/platform/gp2xwiz/build/bundle.sh +++ b/backends/platform/gp2xwiz/build/bundle.sh @@ -8,6 +8,8 @@ mkdir "scummvm-wiz-`date '+%Y-%m-%d'`/scummvm" mkdir "scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/saves" mkdir "scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/plugins" mkdir "scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/engine-data" +mkdir "scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/lib" + echo "Please put your save games in this dir" >> "scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/saves/PUT_SAVES_IN_THIS_DIR" @@ -27,6 +29,13 @@ cp ../../../../dists/pred.dic ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ cp ../../../../dists/engine-data/* ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/engine-data cp ../../../../plugins/* ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/plugins +# Copy over dynamic libs needed by the app (as the ones in the default filesystem are broken). +f=`which arm-open2x-linux-g++` +loc=`dirname "$f"` +cp $loc/../lib/libz.so.1.2.3 ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/lib/libz.so.1 +cp $loc/../lib/libvorbisidec.so.1.0.2 ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/lib/libvorbisidec.so.1 + + echo Making Stripped exe. arm-open2x-linux-strip ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/scummvm.wiz diff --git a/backends/platform/gp2xwiz/build/scummvm.gpe b/backends/platform/gp2xwiz/build/scummvm.gpe index 037b81d937..42cc00a22a 100755 --- a/backends/platform/gp2xwiz/build/scummvm.gpe +++ b/backends/platform/gp2xwiz/build/scummvm.gpe @@ -1,5 +1,9 @@ #!/bin/sh +# Export the location of any libs ScummVM depends on +# (to avoid installing to the NAND and overwriting the broken ones there). +export LD_LIBRARY_PATH=`pwd`/lib:$LD_LIBRARY_PATH + # Run ScummVM, important this bit. ./scummvm.wiz --fullscreen --gfx-mode=1x --config=$(pwd)/.scummvmrc diff --git a/backends/platform/gp2xwiz/gp2xwiz-events.cpp b/backends/platform/gp2xwiz/gp2xwiz-events.cpp index dfb36742dc..48c9af00ff 100644 --- a/backends/platform/gp2xwiz/gp2xwiz-events.cpp +++ b/backends/platform/gp2xwiz/gp2xwiz-events.cpp @@ -81,8 +81,13 @@ static int mapKey(SDLKey key, SDLMod mod, Uint16 unicode) { } void OSystem_GP2XWIZ::fillMouseEvent(Common::Event &event, int x, int y) { - event.mouse.x = x; - event.mouse.y = y; + if(_videoMode.mode == GFX_HALF && !_overlayVisible){ + event.mouse.x = x*2; + event.mouse.y = y*2; + } else { + event.mouse.x = x; + event.mouse.y = y; + } // Update the "keyboard mouse" coords _km.x = x; @@ -203,7 +208,7 @@ bool OSystem_GP2XWIZ::pollEvent(Common::Event &event) { Combos: - GP2X_BUTTON_VOLUP & GP2X_BUTTON_VOLDOWN 0 (For Monkey 2 CP) + GP2X_BUTTON_VOLUP & GP2X_BUTTON_VOLDOWN 0 (For Monkey 2 CP) or Virtual Keyboard if enabled GP2X_BUTTON_L & GP2X_BUTTON_SELECT Common::EVENT_QUIT (Calls Sync() to make sure SD is flushed) GP2X_BUTTON_L & GP2X_BUTTON_MENU Common::EVENT_MAINMENU (ScummVM Global Main Menu) GP2X_BUTTON_L & GP2X_BUTTON_A Common::EVENT_PREDICTIVE_DIALOG for predictive text entry box (AGI games) diff --git a/backends/platform/gp2xwiz/gp2xwiz-graphics.cpp b/backends/platform/gp2xwiz/gp2xwiz-graphics.cpp index 2482051286..90f2c821aa 100644 --- a/backends/platform/gp2xwiz/gp2xwiz-graphics.cpp +++ b/backends/platform/gp2xwiz/gp2xwiz-graphics.cpp @@ -24,10 +24,433 @@ */ #include "backends/platform/gp2xwiz/gp2xwiz-sdl.h" +#include "backends/platform/gp2xwiz/gp2xwiz-scaler.h" // TODO: Make GFX_HALF/HalfScale generic. +#include "common/mutex.h" +#include "graphics/font.h" +#include "graphics/fontman.h" +#include "graphics/scaler.h" +#include "graphics/scaler/intern.h" +#include "graphics/surface.h" -/* TODO: Add code to ensure that overlay is always 320*240 and maybe invoke some custom scale code. */ +static const OSystem::GraphicsMode s_supportedGraphicsModes[] = { + {"1x", "Fullscreen", GFX_NORMAL}, +// {"½x", "Downscale", GFX_HALF}, + {0, 0, 0} +}; + + +const OSystem::GraphicsMode *OSystem_GP2XWIZ::getSupportedGraphicsModes() const { + return s_supportedGraphicsModes; +} + +int OSystem_GP2XWIZ::getDefaultGraphicsMode() const { + return GFX_NORMAL; +} + +bool OSystem_GP2XWIZ::setGraphicsMode(int mode) { + Common::StackLock lock(_graphicsMutex); + + assert(_transactionMode == kTransactionActive); + + if (_oldVideoMode.setup && _oldVideoMode.mode == mode) + return true; + + int newScaleFactor = 1; + + switch(mode) { + case GFX_NORMAL: + newScaleFactor = 1; + break; + case GFX_HALF: + newScaleFactor = 1; + break; + default: + warning("unknown gfx mode %d", mode); + return false; + } + + _transactionDetails.normal1xScaler = (mode == GFX_NORMAL); + if (_oldVideoMode.setup && _oldVideoMode.scaleFactor != newScaleFactor) + _transactionDetails.needHotswap = true; + + _transactionDetails.needUpdatescreen = true; + + _videoMode.mode = mode; + _videoMode.scaleFactor = newScaleFactor; + + return true; +} + +void OSystem_GP2XWIZ::setGraphicsModeIntern() { + Common::StackLock lock(_graphicsMutex); + ScalerProc *newScalerProc = 0; + + switch (_videoMode.mode) { + case GFX_NORMAL: + newScalerProc = Normal1x; + break; + case GFX_HALF: + newScalerProc = HalfScale; + break; + + default: + error("Unknown gfx mode %d", _videoMode.mode); + } + + _scalerProc = newScalerProc; + + if (!_screen || !_hwscreen) + return; + + // Blit everything to the screen + _forceFull = true; + + // Even if the old and new scale factors are the same, we may have a + // different scaler for the cursor now. + blitCursor(); +} + + +void OSystem_GP2XWIZ::initSize(uint w, uint h) { + assert(_transactionMode == kTransactionActive); + + // Avoid redundant res changes + if ((int)w == _videoMode.screenWidth && (int)h == _videoMode.screenHeight) + return; + + _videoMode.screenWidth = w; + _videoMode.screenHeight = h; + if(w > 320 || h > 240){ + setGraphicsMode(GFX_HALF); + setGraphicsModeIntern(); + toggleMouseGrab(); + } + + _cksumNum = (w * h / (8 * 8)); + + _transactionDetails.sizeChanged = true; + + free(_dirtyChecksums); + _dirtyChecksums = (uint32 *)calloc(_cksumNum * 2, sizeof(uint32)); +} bool OSystem_GP2XWIZ::loadGFXMode() { + _videoMode.overlayWidth = 320; + _videoMode.overlayHeight = 240; + _videoMode.fullscreen = true; + + if (_videoMode.screenHeight != 200 && _videoMode.screenHeight != 400) + _videoMode.aspectRatioCorrection = false; + OSystem_SDL::loadGFXMode(); } + +void OSystem_GP2XWIZ::drawMouse() { + if (!_mouseVisible || !_mouseSurface) { + _mouseBackup.x = _mouseBackup.y = _mouseBackup.w = _mouseBackup.h = 0; + return; + } + + SDL_Rect dst; + int scale; + int width, height; + int hotX, hotY; + + if(_videoMode.mode == GFX_HALF && !_overlayVisible){ + dst.x = _mouseCurState.x/2; + dst.y = _mouseCurState.y/2; + } else { + dst.x = _mouseCurState.x; + dst.y = _mouseCurState.y; + } + + if (!_overlayVisible) { + scale = _videoMode.scaleFactor; + width = _videoMode.screenWidth; + height = _videoMode.screenHeight; + dst.w = _mouseCurState.vW; + dst.h = _mouseCurState.vH; + hotX = _mouseCurState.vHotX; + hotY = _mouseCurState.vHotY; + } else { + scale = 1; + width = _videoMode.overlayWidth; + height = _videoMode.overlayHeight; + dst.w = _mouseCurState.rW; + dst.h = _mouseCurState.rH; + hotX = _mouseCurState.rHotX; + hotY = _mouseCurState.rHotY; + } + + // The mouse is undrawn using virtual coordinates, i.e. they may be + // scaled and aspect-ratio corrected. + + _mouseBackup.x = dst.x - hotX; + _mouseBackup.y = dst.y - hotY; + _mouseBackup.w = dst.w; + _mouseBackup.h = dst.h; + + // We draw the pre-scaled cursor image, so now we need to adjust for + // scaling, shake position and aspect ratio correction manually. + + if (!_overlayVisible) { + dst.y += _currentShakePos; + } + + if (_videoMode.aspectRatioCorrection && !_overlayVisible) + dst.y = real2Aspect(dst.y); + + dst.x = scale * dst.x - _mouseCurState.rHotX; + dst.y = scale * dst.y - _mouseCurState.rHotY; + dst.w = _mouseCurState.rW; + dst.h = _mouseCurState.rH; + + // Note that SDL_BlitSurface() and addDirtyRect() will both perform any + // clipping necessary + + if (SDL_BlitSurface(_mouseSurface, NULL, _hwscreen, &dst) != 0) + error("SDL_BlitSurface failed: %s", SDL_GetError()); + + // The screen will be updated using real surface coordinates, i.e. + // they will not be scaled or aspect-ratio corrected. + addDirtyRect(dst.x, dst.y, dst.w, dst.h, true); +} + +void OSystem_GP2XWIZ::undrawMouse() { + const int x = _mouseBackup.x; + const int y = _mouseBackup.y; + + // 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)) + return; + + if (_mouseBackup.w != 0 && _mouseBackup.h != 0){ + if(_videoMode.mode == GFX_HALF && !_overlayVisible){ + addDirtyRect(x*2, y*2, _mouseBackup.w*2, _mouseBackup.h*2); + } else { + addDirtyRect(x, y, _mouseBackup.w, _mouseBackup.h); + } + } +} + +void OSystem_GP2XWIZ::internUpdateScreen() { + SDL_Surface *srcSurf, *origSurf; + int height, width; + ScalerProc *scalerProc; + int scale1; + +#if defined (DEBUG) && ! defined(_WIN32_WCE) // 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) { + SDL_Rect blackrect = {0, 0, _videoMode.screenWidth * _videoMode.scaleFactor, _newShakePos * _videoMode.scaleFactor}; + + if (_videoMode.aspectRatioCorrection && !_overlayVisible) + blackrect.h = real2Aspect(blackrect.h - 1) + 1; + + SDL_FillRect(_hwscreen, &blackrect, 0); + + _currentShakePos = _newShakePos; + + _forceFull = true; + } + + // Check whether the palette was changed in the meantime and update the + // screen surface accordingly. + if (_screen && _paletteDirtyEnd != 0) { + SDL_SetColors(_screen, _currentPalette + _paletteDirtyStart, + _paletteDirtyStart, + _paletteDirtyEnd - _paletteDirtyStart); + + _paletteDirtyEnd = 0; + + _forceFull = true; + } + +#ifdef USE_OSD + // OSD visible (i.e. non-transparent)? + if (_osdAlpha != SDL_ALPHA_TRANSPARENT) { + // Updated alpha value + const int diff = SDL_GetTicks() - _osdFadeStartTime; + if (diff > 0) { + if (diff >= kOSDFadeOutDuration) { + // Back to full transparency + _osdAlpha = SDL_ALPHA_TRANSPARENT; + } else { + // Do a linear fade out... + const int startAlpha = SDL_ALPHA_TRANSPARENT + kOSDInitialAlpha * (SDL_ALPHA_OPAQUE - SDL_ALPHA_TRANSPARENT) / 100; + _osdAlpha = startAlpha + diff * (SDL_ALPHA_TRANSPARENT - startAlpha) / kOSDFadeOutDuration; + } + SDL_SetAlpha(_osdSurface, SDL_RLEACCEL | SDL_SRCCOLORKEY | SDL_SRCALPHA, _osdAlpha); + _forceFull = true; + } + } +#endif + + if (!_overlayVisible) { + origSurf = _screen; + srcSurf = _tmpscreen; + width = _videoMode.screenWidth; + height = _videoMode.screenHeight; + scalerProc = _scalerProc; + scale1 = _videoMode.scaleFactor; + } else { + origSurf = _overlayscreen; + srcSurf = _tmpscreen2; + width = _videoMode.overlayWidth; + height = _videoMode.overlayHeight; + scalerProc = Normal1x; + + 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; + _dirtyRectList[0].x = 0; + _dirtyRectList[0].y = 0; + _dirtyRectList[0].w = width; + _dirtyRectList[0].h = height; + } + + // Only draw anything if necessary + if (_numDirtyRects > 0 || _mouseNeedsRedraw) { + SDL_Rect *r; + SDL_Rect dst; + uint32 srcPitch, dstPitch; + SDL_Rect *lastRect = _dirtyRectList + _numDirtyRects; + + 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. + + if (SDL_BlitSurface(origSurf, r, srcSurf, &dst) != 0) + error("SDL_BlitSurface failed: %s", SDL_GetError()); + } + + SDL_LockSurface(srcSurf); + SDL_LockSurface(_hwscreen); + + srcPitch = srcSurf->pitch; + dstPitch = _hwscreen->pitch; + + for (r = _dirtyRectList; r != lastRect; ++r) { + register int dst_y = r->y + _currentShakePos; + register int dst_h = 0; + register int dst_w = r->w; + register int orig_dst_y = 0; + register int dst_x = r->x; + register int src_y; + register int src_x; + + if (dst_y < height) { + dst_h = r->h; + if (dst_h > height - dst_y) + dst_h = height - dst_y; + + orig_dst_y = dst_y; + src_x = dst_x; + src_y = dst_y; + + if (_videoMode.aspectRatioCorrection && !_overlayVisible) + dst_y = real2Aspect(dst_y); + + assert(scalerProc != NULL); + + if(_videoMode.mode == GFX_HALF && scalerProc == HalfScale){ + if(dst_x%2==1){ + dst_x--; + dst_w++; + } + if(dst_y%2==1){ + dst_y--; + dst_h++; + } + src_x = dst_x; + src_y = dst_y; + dst_x = dst_x / 2; + dst_y = dst_y / 2; + } + scalerProc((byte *)srcSurf->pixels + (src_x * 2 + 2) + (src_y + 1) * srcPitch, srcPitch, + (byte *)_hwscreen->pixels + dst_x * 2 + dst_y * dstPitch, dstPitch, dst_w, dst_h); + } + + if(_videoMode.mode == GFX_HALF && scalerProc == HalfScale){ + r->w = r->w / 2; + r->h = dst_h / 2; + } else { + r->w = r->w; + r->h = dst_h; + } + + r->x = dst_x; + r->y = dst_y; + + +#ifndef DISABLE_SCALERS + 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); + + // Readjust the dirty rect list in case we are doing a full update. + // This is necessary if shaking is active. + if (_forceFull) { + _dirtyRectList[0].y = 0; + _dirtyRectList[0].h = (_videoMode.mode == GFX_HALF) ? effectiveScreenHeight()/2 : effectiveScreenHeight(); + } + + drawMouse(); + +#ifdef USE_OSD + if (_osdAlpha != SDL_ALPHA_TRANSPARENT) { + SDL_BlitSurface(_osdSurface, 0, _hwscreen, 0); + } +#endif + // Finally, blit all our changes to the screen + SDL_UpdateRects(_hwscreen, _numDirtyRects, _dirtyRectList); + } + + _numDirtyRects = 0; + _forceFull = false; + _mouseNeedsRedraw = false; +} + +void OSystem_GP2XWIZ::showOverlay() { + if(_videoMode.mode == GFX_HALF){ + _mouseCurState.x = _mouseCurState.x / 2; + _mouseCurState.y = _mouseCurState.y / 2; + } + OSystem_SDL::showOverlay(); +} + +void OSystem_GP2XWIZ::hideOverlay() { + if(_videoMode.mode == GFX_HALF){ + _mouseCurState.x = _mouseCurState.x * 2; + _mouseCurState.y = _mouseCurState.y * 2; + } + OSystem_SDL::hideOverlay(); +} + +void OSystem_GP2XWIZ::warpMouse(int x, int y) { + if (_mouseCurState.x != x || _mouseCurState.y != y) { + if(_videoMode.mode == GFX_HALF && !_overlayVisible){ + x = x / 2; + y = y / 2; + } + } + OSystem_SDL::warpMouse(x, y); +} diff --git a/backends/platform/gp2xwiz/gp2xwiz-hw.cpp b/backends/platform/gp2xwiz/gp2xwiz-hw.cpp index 4d69915e27..4a86443aa7 100644 --- a/backends/platform/gp2xwiz/gp2xwiz-hw.cpp +++ b/backends/platform/gp2xwiz/gp2xwiz-hw.cpp @@ -48,7 +48,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/gp2xwiz/gp2xwiz-main.cpp b/backends/platform/gp2xwiz/gp2xwiz-main.cpp index 4bd3f98211..394c3090c3 100644 --- a/backends/platform/gp2xwiz/gp2xwiz-main.cpp +++ b/backends/platform/gp2xwiz/gp2xwiz-main.cpp @@ -148,9 +148,9 @@ void OSystem_GP2XWIZ::initBackend() { WIZ_HW::mixerMoveVolume(0); /* 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); /* Trigger autosave every 4 minutes - On low batts 5 mins is about your warning time. */ ConfMan.registerDefault("autosave_period", 4 * 60); diff --git a/backends/platform/gp2xwiz/gp2xwiz-scaler.cpp b/backends/platform/gp2xwiz/gp2xwiz-scaler.cpp new file mode 100644 index 0000000000..3a95280eab --- /dev/null +++ b/backends/platform/gp2xwiz/gp2xwiz-scaler.cpp @@ -0,0 +1,40 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ +#include "graphics/scaler/intern.h" +#include "backends/platform/gp2xwiz/gp2xwiz-sdl.h" + +SDL_PixelFormat *screenPixelFormat; + +extern "C" { + void PocketPCHalfARM(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height, int mask, int round); + // Rounding constants and masks used for different pixel formats + int roundingconstants[] = { 0x00200802, 0x00201002 }; + int redbluegreenMasks[] = { 0x03E07C1F, 0x07E0F81F }; +} + +void HalfScale(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) { + int maskUsed = (gBitFormat == 565); + PocketPCHalfARM(srcPtr, srcPitch, dstPtr, dstPitch, width, height, redbluegreenMasks[maskUsed],roundingconstants[maskUsed]); +} diff --git a/backends/platform/gp2xwiz/gp2xwiz-scaler.h b/backends/platform/gp2xwiz/gp2xwiz-scaler.h new file mode 100644 index 0000000000..5867693dfb --- /dev/null +++ b/backends/platform/gp2xwiz/gp2xwiz-scaler.h @@ -0,0 +1,42 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#ifndef GP2XWIZ_SCALER_H +#define GP2XWIZ_SCALER_H + +#include "common/scummsys.h" +#include "common/system.h" +#include "graphics/scaler.h" +#include "graphics/scaler/intern.h" + +// FIXME: For now keep hacks in this header to save polluting the SDL backend. +enum { + GFX_HALF = 12 +}; + +// TODO/FIXME: Move this platform specific scaler into /graphics/scaler and properly merge with the WinCE PocketPCHalf that it is based on. +DECLARE_SCALER(HalfScale); + +#endif diff --git a/backends/platform/gp2xwiz/gp2xwiz-sdl.h b/backends/platform/gp2xwiz/gp2xwiz-sdl.h index 8811f86edf..1f67624d5c 100644 --- a/backends/platform/gp2xwiz/gp2xwiz-sdl.h +++ b/backends/platform/gp2xwiz/gp2xwiz-sdl.h @@ -27,6 +27,7 @@ #define GP2XWIZ_SDL_H #include "backends/platform/sdl/sdl.h" +#include "backends/platform/gp2xwiz/gp2xwiz-scaler.h" #include <SDL.h> @@ -42,12 +43,24 @@ public: OSystem_GP2XWIZ() {} /* Graphics */ - bool loadGFXMode(); + void initSize(uint w, uint h); + void setGraphicsModeIntern(); + bool setGraphicsMode(int mode); + void internUpdateScreen(); + const OSystem::GraphicsMode *getSupportedGraphicsModes() const; + bool setGraphicsMode(const char *name); + int getDefaultGraphicsMode() const; + bool loadGFXMode(); + void drawMouse(); + void undrawMouse(); + void showOverlay(); + void hideOverlay(); /* Event Stuff */ bool pollEvent(Common::Event &event); void moveStick(); void fillMouseEvent(Common::Event&, int, int); + void warpMouse(int, int); bool remapKey(SDL_Event&, Common::Event&); /* Platform Setup Stuff */ diff --git a/backends/platform/gp2xwiz/module.mk b/backends/platform/gp2xwiz/module.mk index 03241f7b60..f2e27a7cce 100644 --- a/backends/platform/gp2xwiz/module.mk +++ b/backends/platform/gp2xwiz/module.mk @@ -1,6 +1,8 @@ MODULE := backends/platform/gp2xwiz MODULE_OBJS := \ + gp2xwiz-scaler.o \ + ../wince/ARMscaler.o \ gp2xwiz-graphics.o \ gp2xwiz-events.o \ gp2xwiz-hw.o \ |