diff options
Diffstat (limited to 'backends/platform/ds')
-rw-r--r-- | backends/platform/ds/arm9/source/gbampsave.cpp | 4 | ||||
-rw-r--r-- | backends/platform/ds/arm9/source/osystem_ds.cpp | 27 | ||||
-rw-r--r-- | backends/platform/ds/arm9/source/osystem_ds.h | 7 |
3 files changed, 17 insertions, 21 deletions
diff --git a/backends/platform/ds/arm9/source/gbampsave.cpp b/backends/platform/ds/arm9/source/gbampsave.cpp index db9b1c2609..03729c5e6e 100644 --- a/backends/platform/ds/arm9/source/gbampsave.cpp +++ b/backends/platform/ds/arm9/source/gbampsave.cpp @@ -52,7 +52,7 @@ Common::OutSaveFile *GBAMPSaveFileManager::openForSaving(const Common::String &f fileSpec += filename; // consolePrintf("Opening the file: %s\n", fileSpec.c_str()); - + Common::WriteStream *stream = DS::DSFileStream::makeFromPath(fileSpec, true); // Use a write buffer stream = Common::wrapBufferedWriteStream(stream, SAVE_BUFFER_SIZE); @@ -66,7 +66,7 @@ Common::InSaveFile *GBAMPSaveFileManager::openForLoading(const Common::String &f fileSpec += filename; // consolePrintf("Opening the file: %s\n", fileSpec.c_str()); - + return DS::DSFileStream::makeFromPath(fileSpec, false); } diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp index eab9fd6a33..b157a3a87a 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.cpp +++ b/backends/platform/ds/arm9/source/osystem_ds.cpp @@ -42,6 +42,7 @@ #include "backends/fs/ds/ds-fs-factory.h" #include "backends/audiocd/default/default-audiocd.h" +#include "backends/timer/default/default-timer.h" #ifdef ENABLE_AGI #include "wordcompletion.h" @@ -81,7 +82,7 @@ OSystem_DS *OSystem_DS::_instance = NULL; OSystem_DS::OSystem_DS() - : eventNum(0), lastPenFrame(0), queuePos(0), _mixer(NULL), _timer(NULL), _frameBufferExists(false), + : eventNum(0), lastPenFrame(0), queuePos(0), _mixer(NULL), _frameBufferExists(false), _disableCursorPalette(true), _graphicsEnable(true), _gammaValue(0) { // eventNum = 0; @@ -89,13 +90,17 @@ OSystem_DS::OSystem_DS() // queuePos = 0; _instance = this; // _mixer = NULL; - // _timer = NULL; //_frameBufferExists = false; } OSystem_DS::~OSystem_DS() { delete _mixer; - delete _timer; + _mixer = 0; + + // If _savefileManager is not 0, then it points to the OSystem_DS + // member variable mpSaveManager. Hence we set _savefileManager to + // 0, to prevent the OSystem destructor from trying to delete it. + _savefileManager = 0; } int OSystem_DS::timerHandler(int t) { @@ -108,7 +113,11 @@ void OSystem_DS::initBackend() { ConfMan.setInt("autosave_period", 0); ConfMan.setBool("FM_medium_quality", true); - _timer = new DefaultTimerManager(); + if (DS::isGBAMPAvailable()) { + _savefileManager = &mpSaveManager; + } + + _timerManager = new DefaultTimerManager(); DS::setTimerCallback(&OSystem_DS::timerHandler, 10); if (ConfMan.hasKey("22khzaudio", "ds") && ConfMan.getBool("22khzaudio", "ds")) { @@ -125,7 +134,7 @@ void OSystem_DS::initBackend() { _audiocdManager = new DSAudioCDManager(); */ - BaseBackend::initBackend(); + EventsBaseBackend::initBackend(); } bool OSystem_DS::hasFeature(Feature f) { @@ -747,14 +756,6 @@ void OSystem_DS::quit() { swiSoftReset();*/ } -Common::SaveFileManager *OSystem_DS::getSavefileManager() { - if (DS::isGBAMPAvailable()) { - return &mpSaveManager; - } - return NULL; -} - - Graphics::Surface *OSystem_DS::createTempFrameBuffer() { // Ensure we copy using 16 bit quantities due to limitation of VRAM addressing diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h index 1e032ba2cf..b1222a152d 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.h +++ b/backends/platform/ds/arm9/source/osystem_ds.h @@ -29,13 +29,12 @@ #include "nds.h" #include "gbampsave.h" #include "backends/saves/default/default-saves.h" -#include "backends/timer/default/default-timer.h" #include "audio/mixer_intern.h" #include "graphics/surface.h" #include "graphics/colormasks.h" #include "graphics/palette.h" -class OSystem_DS : public BaseBackend, public PaletteManager { +class OSystem_DS : public EventsBaseBackend, public PaletteManager { protected: int eventNum; @@ -46,7 +45,6 @@ protected: GBAMPSaveFileManager mpSaveManager; Audio::MixerImpl *_mixer; - DefaultTimerManager *_timer; Graphics::Surface _framebuffer; bool _frameBufferExists; bool _graphicsEnable; @@ -140,8 +138,6 @@ public: virtual void quit(); - virtual Common::SaveFileManager *getSavefileManager(); - void addEvent(const Common::Event& e); bool isEventQueueEmpty() const { return queuePos == 0; } @@ -159,7 +155,6 @@ public: virtual Audio::Mixer *getMixer() { return _mixer; } Audio::MixerImpl *getMixerImpl() { return _mixer; } - virtual Common::TimerManager *getTimerManager() { return _timer; } static int timerHandler(int t); |