From c30018ef37140a4f638b83b7aedeade6f367c61e Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 6 Jun 2011 23:26:09 +0200 Subject: DC: Use OSystem's 'slots' for timer/savefile manager & fsFactory --- backends/platform/dc/dc.h | 5 ----- backends/platform/dc/dcmain.cpp | 7 ++++--- backends/platform/dc/input.cpp | 4 ++-- backends/platform/dc/time.cpp | 4 ++-- 4 files changed, 8 insertions(+), 12 deletions(-) (limited to 'backends/platform/dc') diff --git a/backends/platform/dc/dc.h b/backends/platform/dc/dc.h index c7659e8292..84fdd58168 100644 --- a/backends/platform/dc/dc.h +++ b/backends/platform/dc/dc.h @@ -185,24 +185,19 @@ public: void setWindowCaption(const char *caption); // Modulatized backend - Common::SaveFileManager *getSavefileManager() { return _savefile; } Audio::Mixer *getMixer() { return _mixer; } - Common::TimerManager *getTimerManager() { return _timer; } // Extra SoftKbd support void mouseToSoftKbd(int x, int y, int &rx, int &ry) const; // Filesystem - FilesystemFactory *getFilesystemFactory() { return this; } AbstractFSNode *makeRootFileNode() const; AbstractFSNode *makeCurrentDirectoryFileNode() const; AbstractFSNode *makeFileNodePath(const Common::String &path) const; private: - Common::SaveFileManager *_savefile; Audio::MixerImpl *_mixer; - DefaultTimerManager *_timer; SoftKeyboard _softkbd; int _ms_cur_x, _ms_cur_y, _ms_cur_w, _ms_cur_h, _ms_old_x, _ms_old_y; diff --git a/backends/platform/dc/dcmain.cpp b/backends/platform/dc/dcmain.cpp index 47bfb0c15d..d1fcdd4a05 100644 --- a/backends/platform/dc/dcmain.cpp +++ b/backends/platform/dc/dcmain.cpp @@ -41,20 +41,21 @@ const char *gGameName; OSystem_Dreamcast::OSystem_Dreamcast() : _devpoll(0), screen(NULL), mouse(NULL), overlay(NULL), _softkbd(this), - _ms_buf(NULL), _timer(NULL), _mixer(NULL), _savefile(NULL), + _ms_buf(NULL), _mixer(NULL), _current_shake_pos(0), _aspect_stretch(false), _softkbd_on(false), _softkbd_motion(0), _enable_cursor_palette(false), _screenFormat(0) { memset(screen_tx, 0, sizeof(screen_tx)); memset(mouse_tx, 0, sizeof(mouse_tx)); memset(ovl_tx, 0, sizeof(ovl_tx)); + _fsFactory = this; } void OSystem_Dreamcast::initBackend() { ConfMan.setInt("autosave_period", 0); - _savefile = createSavefileManager(); - _timer = new DefaultTimerManager(); + _savefileManager = createSavefileManager(); + _timerManager = new DefaultTimerManager(); uint sampleRate = initSound(); _mixer = new Audio::MixerImpl(this, sampleRate); diff --git a/backends/platform/dc/input.cpp b/backends/platform/dc/input.cpp index 7054ad196e..3759eec6df 100644 --- a/backends/platform/dc/input.cpp +++ b/backends/platform/dc/input.cpp @@ -192,8 +192,8 @@ bool OSystem_Dreamcast::pollEvent(Common::Event &event) { unsigned int t = Timer(); - if (_timer != NULL) - _timer->handler(); + if (_timerManager != NULL) + ((DefaultTimerManager *)_timerManager)->handler(); if (((int)(t-_devpoll))<0) return false; diff --git a/backends/platform/dc/time.cpp b/backends/platform/dc/time.cpp index c343852321..8cc3a71e8d 100644 --- a/backends/platform/dc/time.cpp +++ b/backends/platform/dc/time.cpp @@ -48,8 +48,8 @@ void OSystem_Dreamcast::delayMillis(uint msecs) unsigned int t, start = Timer(); int time = (((unsigned int)msecs)*3125U)>>6; while (((int)((t = Timer())-start))handler(); + if (_timerManager != NULL) + ((DefaultTimerManager *)_timerManager)->handler(); checkSound(); } getMillis(); -- cgit v1.2.3