diff options
author | Max Horn | 2006-10-22 15:47:57 +0000 |
---|---|---|
committer | Max Horn | 2006-10-22 15:47:57 +0000 |
commit | 23ed856a38f20732c4b04ffd4bf2f42bb696d18f (patch) | |
tree | 1af6a173ff803580908d9224c24e4b4a3142565c /backends/platform/null | |
parent | 07f7761479eba5defdcfe0bd300bc438d9245551 (diff) | |
download | scummvm-rg350-23ed856a38f20732c4b04ffd4bf2f42bb696d18f.tar.gz scummvm-rg350-23ed856a38f20732c4b04ffd4bf2f42bb696d18f.tar.bz2 scummvm-rg350-23ed856a38f20732c4b04ffd4bf2f42bb696d18f.zip |
Tweaked the NULL backend to match my recent backend changes
svn-id: r24444
Diffstat (limited to 'backends/platform/null')
-rw-r--r-- | backends/platform/null/null.cpp | 57 |
1 files changed, 47 insertions, 10 deletions
diff --git a/backends/platform/null/null.cpp b/backends/platform/null/null.cpp index f9943ef448..0aa6a5d978 100644 --- a/backends/platform/null/null.cpp +++ b/backends/platform/null/null.cpp @@ -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 @@ public: 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 @@ public: 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,9 +118,27 @@ int main(int argc, char *argv[]) { } 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) { @@ -218,9 +243,6 @@ uint32 OSystem_NULL::getMillis() { 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::quit() { 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(); } |