diff options
author | Chris Apers | 2009-03-01 10:25:33 +0000 |
---|---|---|
committer | Chris Apers | 2009-03-01 10:25:33 +0000 |
commit | 3e56c3a40973d89c0ae6f95d46d2f982becdde1a (patch) | |
tree | 8b9d203bac9216dfd2a528e3b47701caa69629ac | |
parent | fdb9cd9ce2c560486a62d959efdaa8519919e279 (diff) | |
download | scummvm-rg350-3e56c3a40973d89c0ae6f95d46d2f982becdde1a.tar.gz scummvm-rg350-3e56c3a40973d89c0ae6f95d46d2f982becdde1a.tar.bz2 scummvm-rg350-3e56c3a40973d89c0ae6f95d46d2f982becdde1a.zip |
PalmOS Backend updates:
- Removed old clearScreen backend method and keep it for internal use only
- Fixed save path with missing end slash
- Added use of the new audio mixer
- Added new file system factory
- Added missing getOverlayWidth/Height
- Changed color encoding from int16 to uint16 as required by the new ScummVM code
- Fixed ColorMasks use with missing namespace
svn-id: r39028
-rw-r--r-- | backends/platform/PalmOS/Src/base_gfx.cpp | 6 | ||||
-rw-r--r-- | backends/platform/PalmOS/Src/be_base.cpp | 15 | ||||
-rw-r--r-- | backends/platform/PalmOS/Src/be_base.h | 15 | ||||
-rw-r--r-- | backends/platform/PalmOS/Src/be_os5.cpp | 2 | ||||
-rw-r--r-- | backends/platform/PalmOS/Src/be_os5.h | 6 | ||||
-rw-r--r-- | backends/platform/PalmOS/Src/be_zodiac.cpp | 2 | ||||
-rw-r--r-- | backends/platform/PalmOS/Src/os5_gfx.cpp | 14 | ||||
-rw-r--r-- | backends/platform/PalmOS/Src/os5_mouse.cpp | 10 | ||||
-rw-r--r-- | backends/platform/PalmOS/Src/os5_overlay.cpp | 2 | ||||
-rw-r--r-- | backends/platform/PalmOS/Src/os5_renderer.cpp | 14 | ||||
-rw-r--r-- | backends/platform/PalmOS/Src/os5_sound.cpp | 9 | ||||
-rw-r--r-- | backends/platform/PalmOS/Src/os5ex_sound.cpp | 7 | ||||
-rw-r--r-- | backends/platform/PalmOS/Src/zodiac_gfx.cpp | 8 | ||||
-rw-r--r-- | backends/platform/PalmOS/Src/zodiac_mouse.cpp | 6 |
14 files changed, 68 insertions, 48 deletions
diff --git a/backends/platform/PalmOS/Src/base_gfx.cpp b/backends/platform/PalmOS/Src/base_gfx.cpp index cb40bb55e5..73a98909d6 100644 --- a/backends/platform/PalmOS/Src/base_gfx.cpp +++ b/backends/platform/PalmOS/Src/base_gfx.cpp @@ -150,12 +150,6 @@ void OSystem_PalmBase::updateScreen() { } -void OSystem_PalmBase::clearScreen() { - WinSetDrawWindow(WinGetDisplayWindow()); - WinSetBackColor(Graphics::RGBToColor<ColorMasks<565> >(0,0,0)); - WinEraseWindow(); -} - void OSystem_PalmBase::draw_osd(UInt16 id, Int32 x, Int32 y, Boolean show, UInt8 color) { //return; diff --git a/backends/platform/PalmOS/Src/be_base.cpp b/backends/platform/PalmOS/Src/be_base.cpp index 424c70566c..0355f28501 100644 --- a/backends/platform/PalmOS/Src/be_base.cpp +++ b/backends/platform/PalmOS/Src/be_base.cpp @@ -28,9 +28,10 @@ #include "common/config-manager.h" #include "backends/saves/default/default-saves.h" #include "backends/timer/default/default-timer.h" -#include "sound/mixer.h" +#include "backends/fs/palmos/palmos-fs-factory.h" +#include "sound/mixer_intern.h" -#define DEFAULT_SAVE_PATH "/PALM/Programs/ScummVM/Saved" +#define DEFAULT_SAVE_PATH "/PALM/Programs/ScummVM/Saved/" OSystem_PalmBase::OSystem_PalmBase() { @@ -109,8 +110,9 @@ void OSystem_PalmBase::initBackend() { // Create and hook up the mixer, if none exists yet (we check for this to // allow subclasses to provide their own). if (_mixerMgr == 0) { - _mixerMgr = new Audio::Mixer(); - setSoundCallback(Audio::Mixer::mixCallback, _mixerMgr); + _mixerMgr = new Audio::MixerImpl(this); + setSoundCallback(0, _mixerMgr); +// setSoundCallback(Audio::Mixer::mixCallback, _mixerMgr); } // Create and hook up the timer manager, if none exists yet (we check for @@ -179,6 +181,11 @@ Common::TimerManager *OSystem_PalmBase::getTimerManager() { return _timerMgr; } +FilesystemFactory *OSystem_PalmBase::getFilesystemFactory() { + return &PalmOSFilesystemFactory::instance(); +} + + #define PALMOS_CONFIG_FILE "/PALM/Programs/ScummVM/scummvm.ini" Common::SeekableReadStream *OSystem_PalmBase::createConfigReadStream() { diff --git a/backends/platform/PalmOS/Src/be_base.h b/backends/platform/PalmOS/Src/be_base.h index 333b633f05..83b2ec2cbd 100644 --- a/backends/platform/PalmOS/Src/be_base.h +++ b/backends/platform/PalmOS/Src/be_base.h @@ -32,11 +32,13 @@ #include "globals.h" #include "backends/base-backend.h" +#include "common/scummsys.h" #include "common/events.h" #include "graphics/surface.h" +#include "graphics/colormasks.h" namespace Audio { - class Mixer; + class MixerImpl; } namespace Common { @@ -73,7 +75,8 @@ enum { #define computeMsecs(x) ((SysTicksPerSecond() * x) / 1000) -typedef void (*SoundProc)(void *param, byte *buf, int len); +//typedef void (*SoundProc)(void *param, byte *buf, int len); +typedef void (*SoundProc)(byte *buf, uint len); typedef int (*TimerProc)(int interval); typedef struct { @@ -121,6 +124,7 @@ protected: OSystem_PalmBase(); virtual void draw_osd(UInt16 id, Int32 x, Int32 y, Boolean show, UInt8 color = 0); + virtual void clear_screen() = 0; struct MousePos { int16 x,y,w,h; @@ -130,7 +134,7 @@ protected: SoundType _sound; Common::SaveFileManager *_saveMgr; - Audio::Mixer *_mixerMgr; + Audio::MixerImpl *_mixerMgr; Common::TimerManager *_timerMgr; RGBColorType _currentPalette[256]; @@ -215,7 +219,6 @@ public: void setShakePos(int shakeOffset); virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) = 0; virtual void updateScreen(); - virtual void clearScreen(); bool showMouse(bool visible); void warpMouse(int x, int y); @@ -227,6 +230,9 @@ public: virtual void grabOverlay(OverlayColor *buf, int pitch) = 0; virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) = 0; + int16 getOverlayWidth() { return getWidth(); } + int16 getOverlayHeight() { return getHeight(); } + void setPalette(const byte *colors, uint start, uint num); void grabPalette(byte *colors, uint start, uint num); virtual Graphics::PixelFormat getOverlayFormat() const { return Graphics::createPixelFormat<565>(); } @@ -252,6 +258,7 @@ public: Common::SaveFileManager *getSavefileManager(); Common::TimerManager *getTimerManager(); + FilesystemFactory *getFilesystemFactory(); virtual Common::SeekableReadStream *createConfigReadStream(); virtual Common::WriteStream *createConfigWriteStream(); diff --git a/backends/platform/PalmOS/Src/be_os5.cpp b/backends/platform/PalmOS/Src/be_os5.cpp index 1fc61cffbf..aa578dad9c 100644 --- a/backends/platform/PalmOS/Src/be_os5.cpp +++ b/backends/platform/PalmOS/Src/be_os5.cpp @@ -108,7 +108,7 @@ void OSystem_PalmOS5::setFeatureState(Feature f, bool enable) { //calc_rect(true); hotswap_gfx_mode(_mode); // TwGfxSetClip(_palmScreenP, &_dstRect); - clearScreen(); + clear_screen(); } break; } diff --git a/backends/platform/PalmOS/Src/be_os5.h b/backends/platform/PalmOS/Src/be_os5.h index c56688b98f..692e304007 100644 --- a/backends/platform/PalmOS/Src/be_os5.h +++ b/backends/platform/PalmOS/Src/be_os5.h @@ -101,7 +101,7 @@ extern SoundExType _soundEx; class OSystem_PalmOS5 : public OSystem_PalmBase { protected: - int16 _nativePal[256], _mousePal[256]; + uint16 _nativePal[256], _mousePal[256]; private: uint16 _scaleTableX[512]; @@ -114,7 +114,7 @@ private: OverlayColor *_overlayP; WinHandle _overlayH, _workScreenH; - int16 *_workScreenP; + uint16 *_workScreenP; Boolean _isSwitchable, _wasRotated; @@ -160,6 +160,7 @@ protected: void calc_rect(Boolean fullscreen); void get_coordinates(EventPtr ev, Coord &x, Coord &y); + void clear_screen(); public: OSystem_PalmOS5(); @@ -169,7 +170,6 @@ public: void setFeatureState(Feature f, bool enable); void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h); - void clearScreen(); virtual Graphics::Surface *lockScreen(); virtual void unlockScreen(); diff --git a/backends/platform/PalmOS/Src/be_zodiac.cpp b/backends/platform/PalmOS/Src/be_zodiac.cpp index bb78030290..d6e7e2c292 100644 --- a/backends/platform/PalmOS/Src/be_zodiac.cpp +++ b/backends/platform/PalmOS/Src/be_zodiac.cpp @@ -67,7 +67,7 @@ void OSystem_PalmZodiac::setFeatureState(Feature f, bool enable) { _ratio.adjustAspect = (_ratio.adjustAspect + 1) % 3; calc_rect(true); TwGfxSetClip(_palmScreenP, &_dstRect); - clearScreen(); + clear_screen(); } break; } diff --git a/backends/platform/PalmOS/Src/os5_gfx.cpp b/backends/platform/PalmOS/Src/os5_gfx.cpp index c02e1f7db4..6a7b21e100 100644 --- a/backends/platform/PalmOS/Src/os5_gfx.cpp +++ b/backends/platform/PalmOS/Src/os5_gfx.cpp @@ -67,7 +67,7 @@ void OSystem_PalmOS5::load_gfx_mode() { UInt32 depth = 16; WinScreenMode(winScreenModeSet, NULL, NULL, &depth, NULL); - clearScreen(); + clear_screen(); if (OPTIONS_TST(kOptModeRotatable)) { _sysOldOrientation = __68K(SysGetOrientation()); @@ -77,8 +77,8 @@ void OSystem_PalmOS5::load_gfx_mode() { __68K(PINSetInputTriggerState(pinInputTriggerDisabled)); } - gVars->indicator.on = Graphics::RGBToColor<ColorMasks<565> >(0,255,0); - gVars->indicator.off = Graphics::RGBToColor<ColorMasks<565> >(0,0,0); + gVars->indicator.on = Graphics::RGBToColor<Graphics::ColorMasks<565> >(0,255,0); + gVars->indicator.off = Graphics::RGBToColor<Graphics::ColorMasks<565> >(0,0,0); _overlayH = alloc_screen(_screenWidth, _screenHeight); _overlayP = (OverlayColor *)(BmpGetBits(WinGetBitmap(_overlayH))); @@ -153,11 +153,11 @@ void OSystem_PalmOS5::hotswap_gfx_mode(int mode) { } _workScreenH = alloc_screen(_screenDest.w, _screenDest.h); - _workScreenP = (int16 *)(BmpGetBits(WinGetBitmap(_workScreenH))); + _workScreenP = (uint16 *)(BmpGetBits(WinGetBitmap(_workScreenH))); MemSet(_workScreenP, _screenDest.w * _screenDest.h * 2, 0); _mode = mode; - clearScreen(); + clear_screen(); } void OSystem_PalmOS5::unload_gfx_mode() { @@ -178,7 +178,7 @@ void OSystem_PalmOS5::unload_gfx_mode() { UInt32 depth = 8; WinScreenMode(winScreenModeSet, NULL, NULL, &depth, NULL); - clearScreen(); + clear_screen(); if (OPTIONS_TST(kOptModeRotatable)) { __68K(PINSetInputTriggerState(_sysOldTriggerState)); @@ -251,7 +251,7 @@ void OSystem_PalmOS5::int_updateScreen() { undraw_mouse(); } -void OSystem_PalmOS5::clearScreen() { +void OSystem_PalmOS5::clear_screen() { RGBColorType rgb = { 0,0,0,0 }; WinSetDrawWindow(WinGetDisplayWindow()); WinSetBackColorRGB(&rgb, 0); diff --git a/backends/platform/PalmOS/Src/os5_mouse.cpp b/backends/platform/PalmOS/Src/os5_mouse.cpp index 0be9d3da46..c019e1607d 100644 --- a/backends/platform/PalmOS/Src/os5_mouse.cpp +++ b/backends/platform/PalmOS/Src/os5_mouse.cpp @@ -81,9 +81,9 @@ void OSystem_PalmOS5::draw_mouse() { int ww; if (_overlayVisible) { - int16 *bak = (int16 *)_mouseBackupP; - int16 *pal = _cursorPaletteDisabled ? _nativePal : _mousePal; - int16 *dst = _overlayP + y * _screenWidth + x; + uint16 *bak = (uint16 *)_mouseBackupP; + uint16 *pal = _cursorPaletteDisabled ? _nativePal : _mousePal; + uint16 *dst = _overlayP + y * _screenWidth + x; do { ww = w; @@ -133,8 +133,8 @@ void OSystem_PalmOS5::undraw_mouse() { // no need to do clipping here, since draw_mouse() did that already if (_overlayVisible) { - int16 *dst = _overlayP + _mouseOldState.y * _screenWidth + _mouseOldState.x; - int16 *bak = (int16 *)_mouseBackupP; + uint16 *dst = _overlayP + _mouseOldState.y * _screenWidth + _mouseOldState.x; + uint16 *bak = (uint16 *)_mouseBackupP; do { MemMove(dst, bak, _mouseOldState.w * 2); diff --git a/backends/platform/PalmOS/Src/os5_overlay.cpp b/backends/platform/PalmOS/Src/os5_overlay.cpp index 2ffc082547..7e16a6b7b9 100644 --- a/backends/platform/PalmOS/Src/os5_overlay.cpp +++ b/backends/platform/PalmOS/Src/os5_overlay.cpp @@ -46,7 +46,7 @@ void OSystem_PalmOS5::clearOverlay() { return; byte *src = _offScreenP; - int16 *dst = _overlayP; + uint16 *dst = _overlayP; int cnt = _screenWidth * _screenHeight; do { *dst++ = _nativePal[*src++]; diff --git a/backends/platform/PalmOS/Src/os5_renderer.cpp b/backends/platform/PalmOS/Src/os5_renderer.cpp index 2c1c122a7d..fea3ec28d7 100644 --- a/backends/platform/PalmOS/Src/os5_renderer.cpp +++ b/backends/platform/PalmOS/Src/os5_renderer.cpp @@ -29,13 +29,13 @@ void OSystem_PalmOS5::render_1x(RectangleType &r, PointType &p) { Coord o = 0; if (_overlayVisible) { - int16 *src = _overlayP; - int16 *dst = _workScreenP; + uint16 *src = _overlayP; + uint16 *dst = _workScreenP; MemMove(dst, src, _screenWidth * _screenHeight * 2); } else { byte *src = _offScreenP; - int16 *dst = _workScreenP; + uint16 *dst = _workScreenP; int cnt = _screenWidth * _screenHeight; o = _current_shake_pos; @@ -51,11 +51,11 @@ void OSystem_PalmOS5::render_1x(RectangleType &r, PointType &p) { void OSystem_PalmOS5::render_landscapeAny(RectangleType &r, PointType &p) { Coord x, y, o = 0; - int16 *dst = _workScreenP; + uint16 *dst = _workScreenP; if (_overlayVisible) { for (y = 0; y < _screenDest.h; y++) { - int16 *src = _overlayP + *(_scaleTableY + y); + uint16 *src = _overlayP + *(_scaleTableY + y); for (x = 0; x < _screenDest.w; x++) { *dst++ = *(src + *(_scaleTableX + x)); } @@ -79,10 +79,10 @@ void OSystem_PalmOS5::render_landscapeAny(RectangleType &r, PointType &p) { void OSystem_PalmOS5::render_landscape15x(RectangleType &r, PointType &p) { Coord x, y, o = 0; - int16 *dst = _workScreenP; + uint16 *dst = _workScreenP; if (_overlayVisible) { - int16 *src = _overlayP; + uint16 *src = _overlayP; for (y = 0; y < 100; y++) { // draw 2 lines diff --git a/backends/platform/PalmOS/Src/os5_sound.cpp b/backends/platform/PalmOS/Src/os5_sound.cpp index 608b8af543..7553f032a9 100644 --- a/backends/platform/PalmOS/Src/os5_sound.cpp +++ b/backends/platform/PalmOS/Src/os5_sound.cpp @@ -25,6 +25,8 @@ #include "be_os5.h" #include "common/config-manager.h" +#include "sound/mixer_intern.h" + #ifdef PALMOS_ARM # ifdef COMPILE_ZODIAC @@ -63,7 +65,8 @@ void OSystem_PalmOS5::sound_handler() { if (!_soundEx.dataP) _soundEx.dataP = MemPtrNew(_soundEx.size); - ((SoundProc)_sound.proc)(_sound.param, (byte *)_soundEx.dataP, _soundEx.size); + _mixerMgr->mixCallback((byte *)_soundEx.dataP, _soundEx.size); +// ((SoundProc)_sound.proc)(_sound.param, (byte *)_soundEx.dataP, _soundEx.size); _soundEx.set = true; } }// TODO : no Sound API case @@ -128,6 +131,10 @@ bool OSystem_PalmOS5::setSoundCallback(SoundProc proc, void *param) { } } // if not true some scenes (indy3 256,...) may freeze (ESC to skip) + + _mixerMgr->setOutputRate(_samplesPerSec); + _mixerMgr->setReady(true); + return true; } diff --git a/backends/platform/PalmOS/Src/os5ex_sound.cpp b/backends/platform/PalmOS/Src/os5ex_sound.cpp index 77569e2548..f27f5a202d 100644 --- a/backends/platform/PalmOS/Src/os5ex_sound.cpp +++ b/backends/platform/PalmOS/Src/os5ex_sound.cpp @@ -24,11 +24,16 @@ */ #include "be_os5ex.h" +#include "sound/mixer_intern.h" static SYSTEM_CALLBACK Err sndCallbackEx(void* UserDataP, SndStreamRef stream, void* bufferP, UInt32 *bufferSizeP) { CALLBACK_PROLOGUE SoundType *_sound = ((SoundExType *)UserDataP)->sound; - ((SoundProc)_sound->proc)(_sound->param, (byte *)bufferP, *bufferSizeP); +// ((SoundProc)_sound->proc)(_sound->param, (byte *)bufferP, *bufferSizeP); + + Audio::MixerImpl *_mixerMgr = ( Audio::MixerImpl *)_sound->param; + _mixerMgr->mixCallback((byte *)bufferP, *bufferSizeP); + CALLBACK_EPILOGUE return errNone; } diff --git a/backends/platform/PalmOS/Src/zodiac_gfx.cpp b/backends/platform/PalmOS/Src/zodiac_gfx.cpp index 866ee086f7..98c563e101 100644 --- a/backends/platform/PalmOS/Src/zodiac_gfx.cpp +++ b/backends/platform/PalmOS/Src/zodiac_gfx.cpp @@ -71,8 +71,8 @@ void OSystem_PalmZodiac::load_gfx_mode() { SysSetOrientationTriggerState(sysOrientationTriggerDisabled); PINSetInputTriggerState(pinInputTriggerDisabled); - gVars->indicator.on = Graphics::RGBToColor<ColorMasks<565> >(0,255,0); - gVars->indicator.off = Graphics::RGBToColor<ColorMasks<565> >(0,0,0); + gVars->indicator.on = Graphics::RGBToColor<Graphics::ColorMasks<565> >(0,255,0); + gVars->indicator.off = Graphics::RGBToColor<Graphics::ColorMasks<565> >(0,0,0); _screenH = WinGetDisplayWindow(); _screenP = (byte *)BmpGetBits(WinGetBitmap(_screenH)); @@ -167,7 +167,7 @@ void OSystem_PalmZodiac::hotswap_gfx_mode(int mode) { _mode = mode; _srcPos.x = _screenOffset.x; _srcPos.y = _screenOffset.y; - clearScreen(); + clear_screen(); // updateScreen(); } @@ -188,7 +188,7 @@ void OSystem_PalmZodiac::unload_gfx_mode() { UInt32 depth = 8; WinScreenMode(winScreenModeSet, NULL, NULL, &depth, NULL); - clearScreen(); + clear_screen(); MemPtrFree(_offScreenP); diff --git a/backends/platform/PalmOS/Src/zodiac_mouse.cpp b/backends/platform/PalmOS/Src/zodiac_mouse.cpp index 6fa19d090b..39a789aaa1 100644 --- a/backends/platform/PalmOS/Src/zodiac_mouse.cpp +++ b/backends/platform/PalmOS/Src/zodiac_mouse.cpp @@ -67,9 +67,9 @@ void OSystem_PalmZodiac::draw_mouse() { int ww; if (_overlayVisible) { - int16 *bak = (int16 *)_mouseBackupP; - int16 *pal = _cursorPaletteDisabled ? _nativePal : _mousePal; - int16 *dst; + uint16 *bak = (uint16 *)_mouseBackupP; + uint16 *pal = _cursorPaletteDisabled ? _nativePal : _mousePal; + uint16 *dst; TwGfxLockSurface(_overlayP, (void **)&dst); dst += y * _screenWidth + x; |