[Scummvm-cvs-logs] SF.net SVN: scummvm:[36135] scummvm/trunk

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Fri Jan 30 04:35:48 CET 2009


Revision: 36135
          http://scummvm.svn.sourceforge.net/scummvm/?rev=36135&view=rev
Author:   fingolfin
Date:     2009-01-30 03:35:47 +0000 (Fri, 30 Jan 2009)

Log Message:
-----------
Moved default implementations for various OSystem methods into a new class BaseBackend

Modified Paths:
--------------
    scummvm/trunk/Makefile.common
    scummvm/trunk/backends/events/default/default-events.cpp
    scummvm/trunk/backends/events/default/default-events.h
    scummvm/trunk/backends/module.mk
    scummvm/trunk/backends/platform/PalmOS/Src/be_base.h
    scummvm/trunk/backends/platform/dc/dc.h
    scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.h
    scummvm/trunk/backends/platform/gp2x/gp2x-common.h
    scummvm/trunk/backends/platform/iphone/osys_iphone.h
    scummvm/trunk/backends/platform/null/null.cpp
    scummvm/trunk/backends/platform/ps2/systemps2.h
    scummvm/trunk/backends/platform/psp/osys_psp.h
    scummvm/trunk/backends/platform/sdl/graphics.cpp
    scummvm/trunk/backends/platform/sdl/sdl.h
    scummvm/trunk/backends/platform/wii/osystem.h
    scummvm/trunk/common/mutex.h
    scummvm/trunk/common/system.cpp
    scummvm/trunk/common/system.h

Added Paths:
-----------
    scummvm/trunk/backends/base-backend.cpp
    scummvm/trunk/backends/base-backend.h

Modified: scummvm/trunk/Makefile.common
===================================================================
--- scummvm/trunk/Makefile.common	2009-01-30 01:17:12 UTC (rev 36134)
+++ scummvm/trunk/Makefile.common	2009-01-30 03:35:47 UTC (rev 36135)
@@ -25,8 +25,8 @@
 	gui \
 	graphics \
 	sound \
+	engines \
 	common \
-	engines \
 	backends
 
 ifdef USE_MT32EMU

Added: scummvm/trunk/backends/base-backend.cpp
===================================================================
--- scummvm/trunk/backends/base-backend.cpp	                        (rev 0)
+++ scummvm/trunk/backends/base-backend.cpp	2009-01-30 03:35:47 UTC (rev 36135)
@@ -0,0 +1,80 @@
+/* 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 "backends/base-backend.h"
+#include "backends/events/default/default-events.h"
+#include "gui/message.h"
+
+void BaseBackend::displayMessageOnOSD(const char *msg) {
+	// Display the message for 1.5 seconds
+	GUI::TimedMessageDialog dialog(msg, 1500);
+	dialog.runModal();
+}
+
+
+static Common::EventManager *s_eventManager = 0;
+
+Common::EventManager *BaseBackend::getEventManager() {
+	// FIXME/TODO: Eventually this method should be turned into an abstract one,
+	// to force backends to implement this conciously (even if they
+	// end up returning the default event manager anyway).
+	if (!s_eventManager)
+		s_eventManager = new DefaultEventManager(this);
+	return s_eventManager;
+}
+
+void BaseBackend::clearScreen() {
+	Graphics::Surface *screen = lockScreen();
+	if (screen && screen->pixels)
+		memset(screen->pixels, 0, screen->h * screen->pitch);
+	unlockScreen();
+}
+
+
+/*
+ FIXME: Maybe we should push the default config file loading/saving code below
+ out to all the backends?
+*/
+
+
+#if defined(UNIX)
+#define DEFAULT_CONFIG_FILE ".scummvmrc"
+#else
+#define DEFAULT_CONFIG_FILE "scummvm.ini"
+#endif
+
+Common::SeekableReadStream *BaseBackend::createConfigReadStream() {
+	Common::FSNode file(DEFAULT_CONFIG_FILE);
+	return file.createReadStream();
+}
+
+Common::WriteStream *BaseBackend::createConfigWriteStream() {
+#ifdef __DC__
+	return 0;
+#else
+	Common::FSNode file(DEFAULT_CONFIG_FILE);
+	return file.createWriteStream();
+#endif
+}


Property changes on: scummvm/trunk/backends/base-backend.cpp
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native

Added: scummvm/trunk/backends/base-backend.h
===================================================================
--- scummvm/trunk/backends/base-backend.h	                        (rev 0)
+++ scummvm/trunk/backends/base-backend.h	2009-01-30 03:35:47 UTC (rev 36135)
@@ -0,0 +1,43 @@
+/* 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 BACKENDS_BASE_BACKEND_H
+#define BACKENDS_BASE_BACKEND_H
+
+#include "common/system.h"
+#include "backends/events/default/default-events.h"
+
+class BaseBackend : public OSystem, EventProvider {
+public:
+	virtual Common::EventManager *getEventManager();
+	virtual void displayMessageOnOSD(const char *msg);
+	virtual void clearScreen();
+
+	virtual Common::SeekableReadStream *createConfigReadStream();
+	virtual Common::WriteStream *createConfigWriteStream();
+};
+
+
+#endif


Property changes on: scummvm/trunk/backends/base-backend.h
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native

Modified: scummvm/trunk/backends/events/default/default-events.cpp
===================================================================
--- scummvm/trunk/backends/events/default/default-events.cpp	2009-01-30 01:17:12 UTC (rev 36134)
+++ scummvm/trunk/backends/events/default/default-events.cpp	2009-01-30 03:35:47 UTC (rev 36135)
@@ -92,7 +92,7 @@
 	}
 }
 
-DefaultEventManager::DefaultEventManager(OSystem *boss) :
+DefaultEventManager::DefaultEventManager(EventProvider *boss) :
 	_boss(boss),
 	_buttonState(0),
 	_modifierState(0),
@@ -106,8 +106,8 @@
 	_recordTimeFile = NULL;
 	_playbackFile = NULL;
 	_playbackTimeFile = NULL;
-	_timeMutex = _boss->createMutex();
-	_recorderMutex = _boss->createMutex();
+	_timeMutex = g_system->createMutex();
+	_recorderMutex = g_system->createMutex();
 
 	_eventCount = 0;
 	_lastEventCount = 0;
@@ -144,8 +144,8 @@
 	if (_recordMode == kRecorderRecord) {
 		_recordCount = 0;
 		_recordTimeCount = 0;
-		_recordFile = _boss->getSavefileManager()->openForSaving(_recordTempFileName.c_str());
-		_recordTimeFile = _boss->getSavefileManager()->openForSaving(_recordTimeFileName.c_str());
+		_recordFile = g_system->getSavefileManager()->openForSaving(_recordTempFileName.c_str());
+		_recordTimeFile = g_system->getSavefileManager()->openForSaving(_recordTimeFileName.c_str());
 		_recordSubtitles = ConfMan.getBool("subtitles");
 	}
 
@@ -155,8 +155,8 @@
 	if (_recordMode == kRecorderPlayback) {
 		_playbackCount = 0;
 		_playbackTimeCount = 0;
-		_playbackFile = _boss->getSavefileManager()->openForLoading(_recordFileName.c_str());
-		_playbackTimeFile = _boss->getSavefileManager()->openForLoading(_recordTimeFileName.c_str());
+		_playbackFile = g_system->getSavefileManager()->openForLoading(_recordFileName.c_str());
+		_playbackTimeFile = g_system->getSavefileManager()->openForLoading(_recordTimeFileName.c_str());
 
 		if (!_playbackFile) {
 			warning("Cannot open playback file %s. Playback was switched off", _recordFileName.c_str());
@@ -213,11 +213,11 @@
 #ifdef ENABLE_VKEYBD
 	delete _vk;
 #endif
-	_boss->lockMutex(_timeMutex);
-	_boss->lockMutex(_recorderMutex);
+	g_system->lockMutex(_timeMutex);
+	g_system->lockMutex(_recorderMutex);
 	_recordMode = kPassthrough;
-	_boss->unlockMutex(_timeMutex);
-	_boss->unlockMutex(_recorderMutex);
+	g_system->unlockMutex(_timeMutex);
+	g_system->unlockMutex(_recorderMutex);
 
 	if (!artificialEventQueue.empty())
 		artificialEventQueue.clear();
@@ -235,9 +235,9 @@
 		_recordTimeFile->finalize();
 		delete _recordTimeFile;
 
-		_playbackFile = _boss->getSavefileManager()->openForLoading(_recordTempFileName.c_str());
+		_playbackFile = g_system->getSavefileManager()->openForLoading(_recordTempFileName.c_str());
 
-		_recordFile = _boss->getSavefileManager()->openForSaving(_recordFileName.c_str());
+		_recordFile = g_system->getSavefileManager()->openForSaving(_recordFileName.c_str());
 		_recordFile->writeUint32LE(RECORD_SIGNATURE);
 		_recordFile->writeUint32LE(RECORD_VERSION);
 
@@ -267,8 +267,8 @@
 
 		//TODO: remove recordTempFileName'ed file
 	}
-	_boss->deleteMutex(_timeMutex);
-	_boss->deleteMutex(_recorderMutex);
+	g_system->deleteMutex(_timeMutex);
+	g_system->deleteMutex(_recorderMutex);
 }
 
 void DefaultEventManager::init() {
@@ -301,7 +301,7 @@
 			case Common::EVENT_RBUTTONUP:
 			case Common::EVENT_WHEELUP:
 			case Common::EVENT_WHEELDOWN:
-				_boss->warpMouse(_playbackEvent.mouse.x, _playbackEvent.mouse.y);
+				g_system->warpMouse(_playbackEvent.mouse.x, _playbackEvent.mouse.y);
 				break;
 			default:
 				break;
@@ -349,7 +349,7 @@
 		return;
 	}
 
-	_boss->lockMutex(_timeMutex);
+	g_system->lockMutex(_timeMutex);
 	if (_recordMode == kRecorderRecord) {
 		//Simple RLE compression
 		d = millis - _lastMillis;
@@ -374,11 +374,11 @@
 	}
 
 	_lastMillis = millis;
-	_boss->unlockMutex(_timeMutex);
+	g_system->unlockMutex(_timeMutex);
 }
 
 bool DefaultEventManager::pollEvent(Common::Event &event) {
-	uint32 time = _boss->getMillis();
+	uint32 time = g_system->getMillis();
 	bool result;
 
 	if (!artificialEventQueue.empty()) {
@@ -405,7 +405,7 @@
 
 	if (_recordMode != kPassthrough)  {
 
-		_boss->lockMutex(_recorderMutex);
+		g_system->lockMutex(_recorderMutex);
 		_eventCount++;
 
 		if (_recordMode == kRecorderPlayback)  {
@@ -419,7 +419,7 @@
 				}
 			}
 		}
-		_boss->unlockMutex(_recorderMutex);
+		g_system->unlockMutex(_recorderMutex);
 	}
 
 	if (result) {

Modified: scummvm/trunk/backends/events/default/default-events.h
===================================================================
--- scummvm/trunk/backends/events/default/default-events.h	2009-01-30 01:17:12 UTC (rev 36134)
+++ scummvm/trunk/backends/events/default/default-events.h	2009-01-30 03:35:47 UTC (rev 36135)
@@ -31,8 +31,6 @@
 #include "common/mutex.h"
 #include "common/queue.h"
 
-class OSystem;
-
 namespace Common {
 #ifdef ENABLE_KEYMAPPER
 	class Keymapper;
@@ -43,20 +41,20 @@
 }
 
 
-/*
-At some point we will remove pollEvent from OSystem and change
-DefaultEventManager to use a "boss" derived from this class:
 class EventProvider {
-public
+public:
+	virtual ~EventProvider() {}
+	/**
+	 * Get the next event in the event queue.
+	 * @param event	point to an Common::Event struct, which will be filled with the event data.
+	 * @return true if an event was retrieved.
+	 */
 	virtual bool pollEvent(Common::Event &event) = 0;
 };
 
-Backends which wish to use the DefaultEventManager then simply can
-use a subclass of EventProvider.
-*/
 
 class DefaultEventManager : public Common::EventManager {
-	OSystem *_boss;
+	EventProvider *_boss;
 
 #ifdef ENABLE_VKEYBD
 	Common::VirtualKeyboard *_vk;
@@ -130,7 +128,7 @@
 	void record(Common::Event &event);
 	bool playback(Common::Event &event);
 public:
-	DefaultEventManager(OSystem *boss);
+	DefaultEventManager(EventProvider *boss);
 	~DefaultEventManager();
 
 	virtual void init();

Modified: scummvm/trunk/backends/module.mk
===================================================================
--- scummvm/trunk/backends/module.mk	2009-01-30 01:17:12 UTC (rev 36134)
+++ scummvm/trunk/backends/module.mk	2009-01-30 03:35:47 UTC (rev 36135)
@@ -1,6 +1,7 @@
 MODULE := backends
 
 MODULE_OBJS := \
+	base-backend.o \
 	events/default/default-events.o \
 	fs/abstract-fs.o \
 	fs/stdiostream.o \

Modified: scummvm/trunk/backends/platform/PalmOS/Src/be_base.h
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/be_base.h	2009-01-30 01:17:12 UTC (rev 36134)
+++ scummvm/trunk/backends/platform/PalmOS/Src/be_base.h	2009-01-30 03:35:47 UTC (rev 36135)
@@ -31,8 +31,7 @@
 #include "PalmVersion.h"
 #include "globals.h"
 
-#include "common/scummsys.h"
-#include "common/system.h"
+#include "backends/base-backend.h"
 #include "common/events.h"
 #include "graphics/surface.h"
 
@@ -89,7 +88,7 @@
 	void *param;
 } SoundType, *SoundPtr;
 
-class OSystem_PalmBase : public OSystem {
+class OSystem_PalmBase : public BaseBackend {
 private:
 	virtual void int_initBackend() { }
 

Modified: scummvm/trunk/backends/platform/dc/dc.h
===================================================================
--- scummvm/trunk/backends/platform/dc/dc.h	2009-01-30 01:17:12 UTC (rev 36134)
+++ scummvm/trunk/backends/platform/dc/dc.h	2009-01-30 03:35:47 UTC (rev 36135)
@@ -23,7 +23,7 @@
  *
  */
 
-#include <common/system.h>
+#include "backends/base-backend.h"
 #include <graphics/surface.h>
 #include <graphics/colormasks.h>
 #include <ronin/soundcommon.h>
@@ -43,7 +43,7 @@
 
 #include "softkbd.h"
 
-class OSystem_Dreamcast : public OSystem, public FilesystemFactory {
+class OSystem_Dreamcast : public BaseBackend, public FilesystemFactory {
 
  public:
   OSystem_Dreamcast();

Modified: scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.h
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.h	2009-01-30 01:17:12 UTC (rev 36134)
+++ scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.h	2009-01-30 03:35:47 UTC (rev 36135)
@@ -23,7 +23,8 @@
 
 #ifndef _OSYSTEM_DS_H_
 #define _OSYSTEM_DS_H_
-#include "common/system.h"
+
+#include "backends/base-backend.h"
 #include "common/events.h"
 #include "nds.h"
 #include "ramsave.h"
@@ -34,7 +35,7 @@
 #include "graphics/surface.h"
 #include "graphics/colormasks.h"
 
-class OSystem_DS : public OSystem {
+class OSystem_DS : public BaseBackend {
 protected:
 
 	int eventNum;

Modified: scummvm/trunk/backends/platform/gp2x/gp2x-common.h
===================================================================
--- scummvm/trunk/backends/platform/gp2x/gp2x-common.h	2009-01-30 01:17:12 UTC (rev 36134)
+++ scummvm/trunk/backends/platform/gp2x/gp2x-common.h	2009-01-30 03:35:47 UTC (rev 36135)
@@ -29,8 +29,7 @@
 #define __GP2X__
 #define USE_OSD
 
-#include "common/scummsys.h"
-#include "common/system.h"
+#include "backends/base-backend.h"
 #include "graphics/scaler.h"
 
 #include <SDL.h>
@@ -58,7 +57,7 @@
 };
 
 
-class OSystem_GP2X : public OSystem {
+class OSystem_GP2X : public BaseBackend {
 public:
 	OSystem_GP2X();
 	virtual ~OSystem_GP2X();

Modified: scummvm/trunk/backends/platform/iphone/osys_iphone.h
===================================================================
--- scummvm/trunk/backends/platform/iphone/osys_iphone.h	2009-01-30 01:17:12 UTC (rev 36134)
+++ scummvm/trunk/backends/platform/iphone/osys_iphone.h	2009-01-30 03:35:47 UTC (rev 36135)
@@ -27,7 +27,7 @@
 
 #include "graphics/surface.h"
 #include "iphone_common.h"
-#include "common/system.h"
+#include "backends/base-backend.h"
 #include "common/events.h"
 #include "sound/mixer_intern.h"
 #include "backends/fs/posix/posix-fs-factory.h"
@@ -52,7 +52,7 @@
     AudioStreamBasicDescription dataFormat;
 } AQCallbackStruct;
 
-class OSystem_IPHONE : public OSystem {
+class OSystem_IPHONE : public BaseBackend {
 protected:
 
 	static const OSystem::GraphicsMode s_supportedGraphicsModes[];

Modified: scummvm/trunk/backends/platform/null/null.cpp
===================================================================
--- scummvm/trunk/backends/platform/null/null.cpp	2009-01-30 01:17:12 UTC (rev 36134)
+++ scummvm/trunk/backends/platform/null/null.cpp	2009-01-30 03:35:47 UTC (rev 36135)
@@ -23,7 +23,7 @@
  *
  */
 
-#include "common/system.h"
+#include "backends/base-backend.h"
 #include "base/main.h"
 
 #if defined(USE_NULL_DRIVER)
@@ -51,7 +51,7 @@
 	#include "backends/fs/windows/windows-fs-factory.h"
 #endif
 
-class OSystem_NULL : public OSystem {
+class OSystem_NULL : public BaseBackend {
 protected:
 	Common::SaveFileManager *_savefile;
 	Audio::MixerImpl *_mixer;

Modified: scummvm/trunk/backends/platform/ps2/systemps2.h
===================================================================
--- scummvm/trunk/backends/platform/ps2/systemps2.h	2009-01-30 01:17:12 UTC (rev 36134)
+++ scummvm/trunk/backends/platform/ps2/systemps2.h	2009-01-30 03:35:47 UTC (rev 36135)
@@ -26,7 +26,7 @@
 #ifndef SYSTEMPS2_H
 #define SYSTEMPS2_H
 
-#include "common/system.h"
+#include "backends/base-backend.h"
 
 class DefaultTimerManager;
 
@@ -52,7 +52,7 @@
 	class MixerImpl;
 };
 
-class OSystem_PS2 : public OSystem {
+class OSystem_PS2 : public BaseBackend {
 public:
 	OSystem_PS2(const char *elfPath);
 	virtual ~OSystem_PS2(void);

Modified: scummvm/trunk/backends/platform/psp/osys_psp.h
===================================================================
--- scummvm/trunk/backends/platform/psp/osys_psp.h	2009-01-30 01:17:12 UTC (rev 36134)
+++ scummvm/trunk/backends/platform/psp/osys_psp.h	2009-01-30 03:35:47 UTC (rev 36135)
@@ -24,10 +24,10 @@
  */
 
 #include "common/scummsys.h"
-#include "common/system.h"
 #include "graphics/surface.h"
 #include "graphics/colormasks.h"
 #include "sound/mixer_intern.h"
+#include "backends/base-backend.h"
 #include "backends/fs/psp/psp-fs-factory.h"
 
 
@@ -40,7 +40,7 @@
 	CENTERED_362X272
 };
 
-class OSystem_PSP : public OSystem {
+class OSystem_PSP : public BaseBackend {
 public:
 	static const OSystem::GraphicsMode s_supportedGraphicsModes[];
 	static OSystem *instance();

Modified: scummvm/trunk/backends/platform/sdl/graphics.cpp
===================================================================
--- scummvm/trunk/backends/platform/sdl/graphics.cpp	2009-01-30 01:17:12 UTC (rev 36134)
+++ scummvm/trunk/backends/platform/sdl/graphics.cpp	2009-01-30 03:35:47 UTC (rev 36135)
@@ -24,6 +24,7 @@
  */
 
 #include "backends/platform/sdl/sdl.h"
+#include "common/mutex.h"
 #include "common/util.h"
 #include "graphics/font.h"
 #include "graphics/fontman.h"

Modified: scummvm/trunk/backends/platform/sdl/sdl.h
===================================================================
--- scummvm/trunk/backends/platform/sdl/sdl.h	2009-01-30 01:17:12 UTC (rev 36134)
+++ scummvm/trunk/backends/platform/sdl/sdl.h	2009-01-30 03:35:47 UTC (rev 36135)
@@ -32,8 +32,7 @@
 #include <SDL.h>
 #endif
 
-#include "common/scummsys.h"
-#include "common/system.h"
+#include "backends/base-backend.h"
 #include "graphics/scaler.h"
 
 
@@ -72,7 +71,7 @@
 };
 
 
-class OSystem_SDL : public OSystem {
+class OSystem_SDL : public BaseBackend {
 public:
 	OSystem_SDL();
 	virtual ~OSystem_SDL();

Modified: scummvm/trunk/backends/platform/wii/osystem.h
===================================================================
--- scummvm/trunk/backends/platform/wii/osystem.h	2009-01-30 01:17:12 UTC (rev 36134)
+++ scummvm/trunk/backends/platform/wii/osystem.h	2009-01-30 03:35:47 UTC (rev 36135)
@@ -23,11 +23,11 @@
 #define _WII_OSYSTEM_H_
 
 #include "base/main.h"
-#include "common/system.h"
 #include "common/fs.h"
 #include "common/rect.h"
 #include "common/events.h"
 
+#include "backends/base-backend.h"
 #include "backends/saves/default/default-saves.h"
 #include "backends/timer/default/default-timer.h"
 #include "graphics/colormasks.h"
@@ -53,7 +53,7 @@
 }
 #endif
 
-class OSystem_Wii : public OSystem {
+class OSystem_Wii : public BaseBackend {
 private:
 	s64 _startup_time;
 	syswd_t _alarm;

Modified: scummvm/trunk/common/mutex.h
===================================================================
--- scummvm/trunk/common/mutex.h	2009-01-30 01:17:12 UTC (rev 36134)
+++ scummvm/trunk/common/mutex.h	2009-01-30 03:35:47 UTC (rev 36135)
@@ -27,6 +27,7 @@
 #define COMMON_MUTEX_H
 
 #include "common/scummsys.h"
+#include "common/system.h"
 
 namespace Common {
 
@@ -35,7 +36,7 @@
 /**
  * An pseudo-opaque mutex type. See OSystem::createMutex etc. for more details.
  */
-typedef struct OpaqueMutex *MutexRef;
+typedef OSystem::MutexRef MutexRef;
 
 
 /**

Modified: scummvm/trunk/common/system.cpp
===================================================================
--- scummvm/trunk/common/system.cpp	2009-01-30 01:17:12 UTC (rev 36134)
+++ scummvm/trunk/common/system.cpp	2009-01-30 03:35:47 UTC (rev 36135)
@@ -23,9 +23,7 @@
  *
  */
 
-#include "backends/events/default/default-events.h"
 #include "common/system.h"
-#include "gui/message.h"
 
 OSystem *g_system = 0;
 
@@ -56,13 +54,6 @@
 	return false;
 }
 
-void OSystem::displayMessageOnOSD(const char *msg) {
-	// Display the message for 1.5 seconds
-	GUI::TimedMessageDialog dialog(msg, 1500);
-	dialog.runModal();
-}
-
-
 bool OSystem::openCD(int drive) {
 	return false;
 }
@@ -70,57 +61,3 @@
 bool OSystem::pollCD() {
 	return false;
 }
-
-void OSystem::playCD(int track, int num_loops, int start_frame, int duration) {
-}
-
-void OSystem::stopCD() {
-}
-
-void OSystem::updateCD() {
-}
-
-static Common::EventManager *s_eventManager = 0;
-
-Common::EventManager *OSystem::getEventManager() {
-	// FIXME/TODO: Eventually this method should be turned into an abstract one,
-	// to force backends to implement this conciously (even if they
-	// end up returning the default event manager anyway).
-	if (!s_eventManager)
-		s_eventManager = new DefaultEventManager(this);
-	return s_eventManager;
-}
-
-void OSystem::clearScreen() {
-	Graphics::Surface *screen = lockScreen();
-	if (screen && screen->pixels)
-		memset(screen->pixels, 0, screen->h * screen->pitch);
-	unlockScreen();
-}
-
-
-/*
- FIXME: Maybe we should push the default config file loading/saving code below
- out to all the backends?
-*/
-
-
-#if defined(UNIX)
-#define DEFAULT_CONFIG_FILE ".scummvmrc"
-#else
-#define DEFAULT_CONFIG_FILE "scummvm.ini"
-#endif
-
-Common::SeekableReadStream *OSystem::createConfigReadStream() {
-	Common::FSNode file(DEFAULT_CONFIG_FILE);
-	return file.createReadStream();
-}
-
-Common::WriteStream *OSystem::createConfigWriteStream() {
-#ifdef __DC__
-	return 0;
-#else
-	Common::FSNode file(DEFAULT_CONFIG_FILE);
-	return file.createWriteStream();
-#endif
-}

Modified: scummvm/trunk/common/system.h
===================================================================
--- scummvm/trunk/common/system.h	2009-01-30 01:17:12 UTC (rev 36134)
+++ scummvm/trunk/common/system.h	2009-01-30 03:35:47 UTC (rev 36135)
@@ -27,7 +27,6 @@
 #define COMMON_SYSTEM_H
 
 #include "common/scummsys.h"
-#include "common/mutex.h"
 #include "common/noncopyable.h"
 #include "common/rect.h"
 
@@ -515,7 +514,7 @@
 	/**
 	 * Clear the screen to black.
 	 */
-	virtual void clearScreen();
+	virtual void clearScreen() = 0;
 
 	/**
 	 * Flush the whole screen, that is render the current content of the screen
@@ -697,17 +696,6 @@
 	/** @name Events and Time */
 	//@{
 
-protected:
-	friend class DefaultEventManager;
-
-	/**
-	 * Get the next event in the event queue.
-	 * @param event	point to an Common::Event struct, which will be filled with the event data.
-	 * @return true if an event was retrieved.
-	 */
-	virtual bool pollEvent(Common::Event &event) = 0;
-
-public:
 	/** Get the number of milliseconds since the program was started. */
 	virtual uint32 getMillis() = 0;
 
@@ -731,7 +719,7 @@
 	 * Return the event manager singleton. For more information, refer
 	 * to the EventManager documentation.
 	 */
-	virtual Common::EventManager *getEventManager();
+	virtual Common::EventManager *getEventManager() = 0;
 
 	//@}
 
@@ -754,7 +742,7 @@
 	 */
 	//@{
 
-	typedef Common::MutexRef	MutexRef;
+	typedef struct OpaqueMutex *MutexRef;
 
 	/**
 	 * Create a new mutex.
@@ -831,17 +819,17 @@
 	 * @param start_frame	the frame at which playback should start (75 frames = 1 second).
 	 * @param duration		the number of frames to play.
 	 */
-	virtual void playCD(int track, int num_loops, int start_frame, int duration);
+	virtual void playCD(int track, int num_loops, int start_frame, int duration) {}
 
 	/**
 	 * Stop audio CD playback.
 	 */
-	virtual void stopCD();
+	virtual void stopCD() {}
 
 	/**
 	 * Update cdrom audio status.
 	 */
-	virtual void updateCD();
+	virtual void updateCD() {}
 
 	//@}
 
@@ -875,7 +863,7 @@
 	 *
 	 * @param msg	the message to display on screen
 	 */
-	virtual void displayMessageOnOSD(const char *msg);
+	virtual void displayMessageOnOSD(const char *msg) = 0;
 
 	/**
 	 * Return the SaveFileManager, used to store and load savestates
@@ -908,7 +896,7 @@
 	 * ReadStream instance. It is the callers responsiblity to delete
 	 * the stream after use.
 	 */
-	virtual Common::SeekableReadStream *createConfigReadStream();
+	virtual Common::SeekableReadStream *createConfigReadStream() = 0;
 
 	/**
 	 * Open the default config file for writing, by returning a suitable
@@ -917,7 +905,7 @@
 	 *
 	 * May return 0 to indicate that writing to config file is not possible.
 	 */
-	virtual Common::WriteStream *createConfigWriteStream();
+	virtual Common::WriteStream *createConfigWriteStream() = 0;
 
 	//@}
 };


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