[Scummvm-cvs-logs] SF.net SVN: scummvm:[39028] scummvm/trunk/backends/platform/PalmOS/Src

chrilith at users.sourceforge.net chrilith at users.sourceforge.net
Sun Mar 1 11:25:33 CET 2009


Revision: 39028
          http://scummvm.svn.sourceforge.net/scummvm/?rev=39028&view=rev
Author:   chrilith
Date:     2009-03-01 10:25:33 +0000 (Sun, 01 Mar 2009)

Log Message:
-----------
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

Modified Paths:
--------------
    scummvm/trunk/backends/platform/PalmOS/Src/base_gfx.cpp
    scummvm/trunk/backends/platform/PalmOS/Src/be_base.cpp
    scummvm/trunk/backends/platform/PalmOS/Src/be_base.h
    scummvm/trunk/backends/platform/PalmOS/Src/be_os5.cpp
    scummvm/trunk/backends/platform/PalmOS/Src/be_os5.h
    scummvm/trunk/backends/platform/PalmOS/Src/be_zodiac.cpp
    scummvm/trunk/backends/platform/PalmOS/Src/os5_gfx.cpp
    scummvm/trunk/backends/platform/PalmOS/Src/os5_mouse.cpp
    scummvm/trunk/backends/platform/PalmOS/Src/os5_overlay.cpp
    scummvm/trunk/backends/platform/PalmOS/Src/os5_renderer.cpp
    scummvm/trunk/backends/platform/PalmOS/Src/os5_sound.cpp
    scummvm/trunk/backends/platform/PalmOS/Src/os5ex_sound.cpp
    scummvm/trunk/backends/platform/PalmOS/Src/zodiac_gfx.cpp
    scummvm/trunk/backends/platform/PalmOS/Src/zodiac_mouse.cpp

Modified: scummvm/trunk/backends/platform/PalmOS/Src/base_gfx.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/base_gfx.cpp	2009-03-01 10:16:28 UTC (rev 39027)
+++ scummvm/trunk/backends/platform/PalmOS/Src/base_gfx.cpp	2009-03-01 10:25:33 UTC (rev 39028)
@@ -150,12 +150,6 @@
 
 }
 
-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;
 

Modified: scummvm/trunk/backends/platform/PalmOS/Src/be_base.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/be_base.cpp	2009-03-01 10:16:28 UTC (rev 39027)
+++ scummvm/trunk/backends/platform/PalmOS/Src/be_base.cpp	2009-03-01 10:25:33 UTC (rev 39028)
@@ -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 @@
 	// 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 @@
 	return _timerMgr;
 }
 
+FilesystemFactory *OSystem_PalmBase::getFilesystemFactory() {
+	return &PalmOSFilesystemFactory::instance();
+}
+
+
 #define PALMOS_CONFIG_FILE "/PALM/Programs/ScummVM/scummvm.ini"
 
 Common::SeekableReadStream *OSystem_PalmBase::createConfigReadStream() {

Modified: scummvm/trunk/backends/platform/PalmOS/Src/be_base.h
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/be_base.h	2009-03-01 10:16:28 UTC (rev 39027)
+++ scummvm/trunk/backends/platform/PalmOS/Src/be_base.h	2009-03-01 10:25:33 UTC (rev 39028)
@@ -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 @@
 #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 @@
 	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 @@
 	SoundType _sound;
 
 	Common::SaveFileManager *_saveMgr;
-	Audio::Mixer *_mixerMgr;
+	Audio::MixerImpl *_mixerMgr;
 	Common::TimerManager *_timerMgr;
 
 	RGBColorType _currentPalette[256];
@@ -215,7 +219,6 @@
 	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 @@
 	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 @@
 
 	Common::SaveFileManager *getSavefileManager();
 	Common::TimerManager *getTimerManager();
+	FilesystemFactory *getFilesystemFactory();
 
 	virtual Common::SeekableReadStream *createConfigReadStream();
 	virtual Common::WriteStream *createConfigWriteStream();

Modified: scummvm/trunk/backends/platform/PalmOS/Src/be_os5.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/be_os5.cpp	2009-03-01 10:16:28 UTC (rev 39027)
+++ scummvm/trunk/backends/platform/PalmOS/Src/be_os5.cpp	2009-03-01 10:25:33 UTC (rev 39028)
@@ -108,7 +108,7 @@
 				//calc_rect(true);
 				hotswap_gfx_mode(_mode);
 //				TwGfxSetClip(_palmScreenP, &_dstRect);
-				clearScreen();
+				clear_screen();
 			}
 			break;
 	}

Modified: scummvm/trunk/backends/platform/PalmOS/Src/be_os5.h
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/be_os5.h	2009-03-01 10:16:28 UTC (rev 39027)
+++ scummvm/trunk/backends/platform/PalmOS/Src/be_os5.h	2009-03-01 10:25:33 UTC (rev 39028)
@@ -101,7 +101,7 @@
 
 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 @@
 
 	OverlayColor *_overlayP;
 	WinHandle _overlayH, _workScreenH;
-	int16 *_workScreenP;
+	uint16 *_workScreenP;
 
 	Boolean _isSwitchable, _wasRotated;
 
@@ -160,6 +160,7 @@
 
 	void calc_rect(Boolean fullscreen);
 	void get_coordinates(EventPtr ev, Coord &x, Coord &y);
+	void clear_screen();
 
 public:
 	OSystem_PalmOS5();
@@ -169,7 +170,6 @@
 	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();
 

Modified: scummvm/trunk/backends/platform/PalmOS/Src/be_zodiac.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/be_zodiac.cpp	2009-03-01 10:16:28 UTC (rev 39027)
+++ scummvm/trunk/backends/platform/PalmOS/Src/be_zodiac.cpp	2009-03-01 10:25:33 UTC (rev 39028)
@@ -67,7 +67,7 @@
 				_ratio.adjustAspect = (_ratio.adjustAspect + 1) % 3;
 				calc_rect(true);
 				TwGfxSetClip(_palmScreenP, &_dstRect);
-				clearScreen();
+				clear_screen();
 			}
 			break;
 	}

Modified: scummvm/trunk/backends/platform/PalmOS/Src/os5_gfx.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/os5_gfx.cpp	2009-03-01 10:16:28 UTC (rev 39027)
+++ scummvm/trunk/backends/platform/PalmOS/Src/os5_gfx.cpp	2009-03-01 10:25:33 UTC (rev 39028)
@@ -67,7 +67,7 @@
 
 	UInt32 depth = 16;
 	WinScreenMode(winScreenModeSet, NULL, NULL, &depth, NULL);
-	clearScreen();
+	clear_screen();
 
 	if (OPTIONS_TST(kOptModeRotatable)) {
 		_sysOldOrientation = __68K(SysGetOrientation());
@@ -77,8 +77,8 @@
 		__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 @@
 	}
 
 	_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 @@
 
 	UInt32 depth = 8;
 	WinScreenMode(winScreenModeSet, NULL, NULL, &depth, NULL);
-	clearScreen();
+	clear_screen();
 
 	if (OPTIONS_TST(kOptModeRotatable)) {
 		__68K(PINSetInputTriggerState(_sysOldTriggerState));
@@ -251,7 +251,7 @@
 	undraw_mouse();
 }
 
-void OSystem_PalmOS5::clearScreen() {
+void OSystem_PalmOS5::clear_screen() {
 	RGBColorType rgb = { 0,0,0,0 };
 	WinSetDrawWindow(WinGetDisplayWindow());
 	WinSetBackColorRGB(&rgb, 0);

Modified: scummvm/trunk/backends/platform/PalmOS/Src/os5_mouse.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/os5_mouse.cpp	2009-03-01 10:16:28 UTC (rev 39027)
+++ scummvm/trunk/backends/platform/PalmOS/Src/os5_mouse.cpp	2009-03-01 10:25:33 UTC (rev 39028)
@@ -81,9 +81,9 @@
 	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 @@
 
 	// 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);

Modified: scummvm/trunk/backends/platform/PalmOS/Src/os5_overlay.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/os5_overlay.cpp	2009-03-01 10:16:28 UTC (rev 39027)
+++ scummvm/trunk/backends/platform/PalmOS/Src/os5_overlay.cpp	2009-03-01 10:25:33 UTC (rev 39028)
@@ -46,7 +46,7 @@
 		return;
 
 	byte *src = _offScreenP;
-	int16 *dst =  _overlayP;
+	uint16 *dst =  _overlayP;
 	int cnt = _screenWidth * _screenHeight;
 	do {
 		*dst++ = _nativePal[*src++];

Modified: scummvm/trunk/backends/platform/PalmOS/Src/os5_renderer.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/os5_renderer.cpp	2009-03-01 10:16:28 UTC (rev 39027)
+++ scummvm/trunk/backends/platform/PalmOS/Src/os5_renderer.cpp	2009-03-01 10:25:33 UTC (rev 39028)
@@ -29,13 +29,13 @@
 	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_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_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

Modified: scummvm/trunk/backends/platform/PalmOS/Src/os5_sound.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/os5_sound.cpp	2009-03-01 10:16:28 UTC (rev 39027)
+++ scummvm/trunk/backends/platform/PalmOS/Src/os5_sound.cpp	2009-03-01 10:25:33 UTC (rev 39028)
@@ -25,7 +25,9 @@
 
 #include "be_os5.h"
 #include "common/config-manager.h"
+#include "sound/mixer_intern.h"
 
+
 #ifdef PALMOS_ARM
 #	ifdef COMPILE_ZODIAC
 #		define SAMPLES_PER_SEC 44100
@@ -63,7 +65,8 @@
 			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 @@
 		}
 	}
 	// if not true some scenes (indy3 256,...) may freeze (ESC to skip)
+
+	_mixerMgr->setOutputRate(_samplesPerSec);
+	_mixerMgr->setReady(true);
+
 	return true;
 }
 

Modified: scummvm/trunk/backends/platform/PalmOS/Src/os5ex_sound.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/os5ex_sound.cpp	2009-03-01 10:16:28 UTC (rev 39027)
+++ scummvm/trunk/backends/platform/PalmOS/Src/os5ex_sound.cpp	2009-03-01 10:25:33 UTC (rev 39028)
@@ -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;
 }

Modified: scummvm/trunk/backends/platform/PalmOS/Src/zodiac_gfx.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/zodiac_gfx.cpp	2009-03-01 10:16:28 UTC (rev 39027)
+++ scummvm/trunk/backends/platform/PalmOS/Src/zodiac_gfx.cpp	2009-03-01 10:25:33 UTC (rev 39028)
@@ -71,8 +71,8 @@
 	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 @@
 	_mode = mode;
 	_srcPos.x = _screenOffset.x;
 	_srcPos.y = _screenOffset.y;
-	clearScreen();
+	clear_screen();
 //	updateScreen();
 }
 
@@ -188,7 +188,7 @@
 
 	UInt32 depth = 8;
 	WinScreenMode(winScreenModeSet, NULL, NULL, &depth, NULL);
-	clearScreen();
+	clear_screen();
 
 	MemPtrFree(_offScreenP);
 

Modified: scummvm/trunk/backends/platform/PalmOS/Src/zodiac_mouse.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/zodiac_mouse.cpp	2009-03-01 10:16:28 UTC (rev 39027)
+++ scummvm/trunk/backends/platform/PalmOS/Src/zodiac_mouse.cpp	2009-03-01 10:25:33 UTC (rev 39028)
@@ -67,9 +67,9 @@
 	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;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list