[Scummvm-cvs-logs] SF.net SVN: scummvm: [24453] scummvm/trunk/backends/platform/dc

marcus_c at users.sourceforge.net marcus_c at users.sourceforge.net
Sun Oct 22 19:58:45 CEST 2006


Revision: 24453
          http://svn.sourceforge.net/scummvm/?rev=24453&view=rev
Author:   marcus_c
Date:     2006-10-22 10:58:38 -0700 (Sun, 22 Oct 2006)

Log Message:
-----------
Modularization.

Modified Paths:
--------------
    scummvm/trunk/backends/platform/dc/dc.h
    scummvm/trunk/backends/platform/dc/dcmain.cpp
    scummvm/trunk/backends/platform/dc/vmsave.cpp

Modified: scummvm/trunk/backends/platform/dc/dc.h
===================================================================
--- scummvm/trunk/backends/platform/dc/dc.h	2006-10-22 17:32:04 UTC (rev 24452)
+++ scummvm/trunk/backends/platform/dc/dc.h	2006-10-22 17:58:38 UTC (rev 24453)
@@ -38,9 +38,23 @@
 
 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 @@
   // 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 @@
     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,16 +187,20 @@
   // 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;
 
 
  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;

Modified: scummvm/trunk/backends/platform/dc/dcmain.cpp
===================================================================
--- scummvm/trunk/backends/platform/dc/dcmain.cpp	2006-10-22 17:32:04 UTC (rev 24452)
+++ scummvm/trunk/backends/platform/dc/dcmain.cpp	2006-10-22 17:58:38 UTC (rev 24453)
@@ -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,7 +51,22 @@
   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)
 {

Modified: scummvm/trunk/backends/platform/dc/vmsave.cpp
===================================================================
--- scummvm/trunk/backends/platform/dc/vmsave.cpp	2006-10-22 17:32:04 UTC (rev 24452)
+++ scummvm/trunk/backends/platform/dc/vmsave.cpp	2006-10-22 17:58:38 UTC (rev 24453)
@@ -401,7 +401,7 @@
     tryList(prefix, marks, num, i);
 }
 
-Common::SaveFileManager *OSystem_Dreamcast::getSavefileManager()
+Common::SaveFileManager *OSystem_Dreamcast::createSavefileManager()
 {
   return new VMSaveManager();
 }


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