[Scummvm-cvs-logs] SF.net SVN: scummvm: [24444] scummvm/trunk/backends/platform/null/null.cpp
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Sun Oct 22 17:48:01 CEST 2006
Revision: 24444
http://svn.sourceforge.net/scummvm/?rev=24444&view=rev
Author: fingolfin
Date: 2006-10-22 08:47:57 -0700 (Sun, 22 Oct 2006)
Log Message:
-----------
Tweaked the NULL backend to match my recent backend changes
Modified Paths:
--------------
scummvm/trunk/backends/platform/null/null.cpp
Modified: scummvm/trunk/backends/platform/null/null.cpp
===================================================================
--- scummvm/trunk/backends/platform/null/null.cpp 2006-10-22 15:42:29 UTC (rev 24443)
+++ scummvm/trunk/backends/platform/null/null.cpp 2006-10-22 15:47:57 UTC (rev 24444)
@@ -27,17 +27,24 @@
#if defined(USE_NULL_DRIVER)
#include "common/rect.h"
-#include "common/savefile.h"
+#include "backends/saves/default/default-saves.h"
+#include "backends/timer/default/default-timer.h"
+#include "sound/mixer.h"
+
class OSystem_NULL : public OSystem {
-public:
- static OSystem *instance();
+protected:
+ Common::SaveFileManager *_savefile;
+ Audio::Mixer *_mixer;
+ Common::TimerManager *_timer;
public:
OSystem_NULL();
virtual ~OSystem_NULL();
+ virtual void initBackend();
+
virtual bool hasFeature(Feature f);
virtual void setFeatureState(Feature f, bool enable);
virtual bool getFeatureState(Feature f);
@@ -73,15 +80,11 @@
virtual uint32 getMillis();
virtual void delayMillis(uint msecs);
- virtual void setTimerCallback(TimerProc callback, int interval);
-
virtual MutexRef createMutex(void);
virtual void lockMutex(MutexRef mutex);
virtual void unlockMutex(MutexRef mutex);
virtual void deleteMutex(MutexRef mutex);
- virtual bool setSoundCallback(SoundProc proc, void *param);
- virtual void clearSoundCallback();
virtual int getOutputSampleRate() const;
virtual bool openCD(int drive);
@@ -94,6 +97,10 @@
virtual void quit();
virtual void setWindowCaption(const char *caption);
+
+ virtual Common::SaveFileManager *getSavefileManager();
+ virtual Audio::Mixer *getMixer();
+ virtual Common::TimerManager *getTimerManager();
};
static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
@@ -111,11 +118,29 @@
}
OSystem_NULL::OSystem_NULL() {
+ _savefile = 0;
+ _mixer = 0;
+ _timer = 0;
}
OSystem_NULL::~OSystem_NULL() {
+ delete _savefile;
+ delete _mixer;
+ delete _timer;
}
+void OSystem_NULL::initBackend() {
+ _savefile = new DefaultSaveFileManager();
+ _mixer = new Audio::Mixer();
+ _timer = new DefaultTimerManager();
+
+ // Note that both the mixer and the timer manager are useless
+ // this way; they need to be hooked into the system somehow to
+ // be functional. Of course, can't do that in a NULL backend :).
+
+ OSystem::initBackend();
+}
+
bool OSystem_NULL::hasFeature(Feature f) {
return false;
}
@@ -218,9 +243,6 @@
void OSystem_NULL::delayMillis(uint msecs) {
}
-void OSystem_NULL::setTimerCallback(TimerProc callback, int interval) {
-}
-
OSystem::MutexRef OSystem_NULL::createMutex(void) {
return NULL;
}
@@ -251,6 +273,21 @@
void OSystem_NULL::setWindowCaption(const char *caption) {
}
+Common::SaveFileManager *DefaulOSystem::getSavefileManager() {
+ assert(_savefile);
+ return _savefile;
+}
+
+Audio::Mixer *DefaulOSystem::getMixer() {
+ assert(_mixer);
+ return _mixer;
+}
+
+Common::TimerManager *DefaulOSystem::getTimerManager() {
+ assert(_timer);
+ return _timer;
+}
+
OSystem *OSystem_NULL_create() {
return new OSystem_NULL();
}
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