diff options
| author | Marcus Comstedt | 2006-10-22 17:58:38 +0000 | 
|---|---|---|
| committer | Marcus Comstedt | 2006-10-22 17:58:38 +0000 | 
| commit | fbb5a2d7730ff34bd558b8e4a8aa0b68d41318b5 (patch) | |
| tree | 824fabd9ab13692e3a268ab693e553b8691f633b /backends/platform | |
| parent | 43fac9ab3da947e502e7abfeff74b5e4d536c219 (diff) | |
| download | scummvm-rg350-fbb5a2d7730ff34bd558b8e4a8aa0b68d41318b5.tar.gz scummvm-rg350-fbb5a2d7730ff34bd558b8e4a8aa0b68d41318b5.tar.bz2 scummvm-rg350-fbb5a2d7730ff34bd558b8e4a8aa0b68d41318b5.zip | |
Modularization.
svn-id: r24453
Diffstat (limited to 'backends/platform')
| -rw-r--r-- | backends/platform/dc/dc.h | 31 | ||||
| -rw-r--r-- | backends/platform/dc/dcmain.cpp | 17 | ||||
| -rw-r--r-- | backends/platform/dc/vmsave.cpp | 2 | 
3 files changed, 39 insertions, 11 deletions
| diff --git a/backends/platform/dc/dc.h b/backends/platform/dc/dc.h index aaf505bd64..0178a99567 100644 --- a/backends/platform/dc/dc.h +++ b/backends/platform/dc/dc.h @@ -38,9 +38,23 @@ class Interactive  class OSystem_Dreamcast : public OSystem { + private: + +  // Set function that generates samples +  typedef void (*SoundProc)(void *param, byte *buf, int len); +  bool setSoundCallback(SoundProc proc, void *param); +  void clearSoundCallback(); + +  // Add a callback timer +  typedef int (*TimerProc)(int interval); +  void setTimerCallback(TimerProc callback, int timer); + +  Common::SaveFileManager *createSavefileManager(); +   public:    OSystem_Dreamcast(); +  virtual void initBackend();    // Determine whether the backend supports the specified feature.    bool hasFeature(Feature f); @@ -114,10 +128,6 @@ class OSystem_Dreamcast : public OSystem {    // Returns true if an event was retrieved.    bool pollEvent(Event &event); -  // Set function that generates samples -  bool setSoundCallback(SoundProc proc, void *param); -  void clearSoundCallback(); -    // Determine the output sample rate. Audio data provided by the sound    // callback will be played using this rate.    int getOutputSampleRate() const; @@ -167,9 +177,6 @@ class OSystem_Dreamcast : public OSystem {      b = ((color<<4)&0xf0)|(color&0x0f);    } -  // Add a callback timer -  void setTimerCallback(TimerProc callback, int timer); -    // Mutex handling    MutexRef createMutex();    void lockMutex(MutexRef mutex); @@ -180,9 +187,10 @@ class OSystem_Dreamcast : public OSystem {    // given value.    void setWindowCaption(const char *caption); -  // Savefile handling -  Common::SaveFileManager *getSavefileManager(); - +  // 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; @@ -190,6 +198,9 @@ class OSystem_Dreamcast : public OSystem {   private: +  Common::SaveFileManager *_savefile; +  Audio::Mixer *_mixer; +  Common::TimerManager *_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 916262a421..aecb61759d 100644 --- a/backends/platform/dc/dcmain.cpp +++ b/backends/platform/dc/dcmain.cpp @@ -32,6 +32,8 @@  #include <common/config-manager.h>  #include "backends/plugins/dc/dc-provider.h" +#include "backends/timer/default/default-timer.h" +#include "sound/mixer.h"  Icon icon; @@ -49,6 +51,21 @@ OSystem_Dreamcast::OSystem_Dreamcast()    memset(ovl_tx, 0, sizeof(ovl_tx));  } +static int timer_handler(int t) { +  DefaultTimerManager *tm = (DefaultTimerManager *)g_system->getTimerManager(); +  tm->handler(); +  return t; +} + +void OSystem_Dreamcast::initBackend() +{ +  _savefile = createSavefileManager(); +  _mixer = new Audio::Mixer(); +  _timer = new DefaultTimerManager(); +  setSoundCallback(Audio::Mixer::mixCallback, _mixer); +  setTimerCallback(&timer_handler, 10); +} +  /* CD Audio */  static bool find_track(int track, int &first_sec, int &last_sec) diff --git a/backends/platform/dc/vmsave.cpp b/backends/platform/dc/vmsave.cpp index bd5542f878..b16e1a38df 100644 --- a/backends/platform/dc/vmsave.cpp +++ b/backends/platform/dc/vmsave.cpp @@ -401,7 +401,7 @@ void VMSaveManager::listSavefiles(const char *prefix, bool *marks, int num)      tryList(prefix, marks, num, i);  } -Common::SaveFileManager *OSystem_Dreamcast::getSavefileManager() +Common::SaveFileManager *OSystem_Dreamcast::createSavefileManager()  {    return new VMSaveManager();  } | 
