aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorMax Horn2006-10-22 15:42:29 +0000
committerMax Horn2006-10-22 15:42:29 +0000
commit07f7761479eba5defdcfe0bd300bc438d9245551 (patch)
tree1d5d2ca4852369e9e5502b015926ab3e2ec4429f /common
parentdf24f1ef4ed2b8d0e6c5df6e1bfbbcb2fc86d2a8 (diff)
downloadscummvm-rg350-07f7761479eba5defdcfe0bd300bc438d9245551.tar.gz
scummvm-rg350-07f7761479eba5defdcfe0bd300bc438d9245551.tar.bz2
scummvm-rg350-07f7761479eba5defdcfe0bd300bc438d9245551.zip
Backend modularization: Create timer manager, savefile manager and audio mixer in the backends for increased flexibility
svn-id: r24443
Diffstat (limited to 'common')
-rw-r--r--common/system.cpp21
-rw-r--r--common/system.h58
-rw-r--r--common/timer.h2
3 files changed, 18 insertions, 63 deletions
diff --git a/common/system.cpp b/common/system.cpp
index d15f026df0..7231338a85 100644
--- a/common/system.cpp
+++ b/common/system.cpp
@@ -27,13 +27,13 @@
#include "gui/message.h"
-#include "backends/saves/default/default-saves.h"
-
#include "common/config-manager.h"
#include "common/system.h"
#include "common/timer.h"
#include "common/util.h"
+#include "sound/mixer.h"
+
OSystem *g_system = 0;
bool OSystem::setGraphicsMode(const char *name) {
@@ -63,23 +63,6 @@ void OSystem::displayMessageOnOSD(const char *msg) {
dialog.runModal();
}
-Common::SaveFileManager *OSystem::getSavefileManager() {
- // TODO: Change this to always return the same
- // instance, instead of a new one each time around...
- return new DefaultSaveFileManager();
-}
-
-Audio::Mixer *OSystem::getMixer() {
- // FIXME
- extern Audio::Mixer *g_mixer;
- return g_mixer;
-}
-
-Common::TimerManager *OSystem::getTimerManager() {
- // FIXME
- return Common::g_timer;
-}
-
bool OSystem::openCD(int drive) {
return false;
diff --git a/common/system.h b/common/system.h
index 1682426ab0..bd0caf4575 100644
--- a/common/system.h
+++ b/common/system.h
@@ -66,6 +66,10 @@ public:
/**
* The following method is called once, from main.cpp, after all
* config data (including command line params etc.) are fully loaded.
+ *
+ * @note Subclasses should always invoke the implementation of their
+ * parent class. They should so so near the end of their own
+ * implementation.
*/
virtual void initBackend() { }
@@ -675,8 +679,6 @@ public:
/** @name Events and Time */
//@{
- typedef int (*TimerProc)(int interval);
-
/**
* The types of events backends may generate.
* @see Event
@@ -798,24 +800,10 @@ public:
virtual void delayMillis(uint msecs) = 0;
/**
- * Set the timer callback, a function which is periodically invoked by the
- * backend. This can for example be done via a background thread.
- * There is at most one active timer; if this method is called while there
- * is already an active timer, then the new timer callback should replace
- * the previous one. In particular, passing a callback pointer value of 0
- * is legal and can be used to clear the current timer callback.
- * @see Common::Timer
- * @note The implementation of this method must be 'atomic' in the sense
- * that when the method returns, the previously set callback must
- * not be in use anymore (in particular, if timers are implemented
- * via threads, then it must be ensured that the timer thread is
- * not using the old callback function anymore).
- *
- * @param callback pointer to the callback. May be 0 to reset the timer
- * @param interval the interval (in milliseconds) between invocations
- * of the callback
+ * Returh the timer manager. For more information, refer to the
+ * TimerManager documentation.
*/
- virtual void setTimerCallback(TimerProc callback, int interval) = 0;
+ virtual Common::TimerManager *getTimerManager() = 0;
//@}
@@ -870,22 +858,12 @@ public:
/** @name Sound */
//@{
- typedef void (*SoundProc)(void *param, byte *buf, int len);
-
- /**
- * Set the audio callback which is invoked whenever samples need to be generated.
- * Currently, only the 16-bit signed mode is ever used for Simon & Scumm
- * @param proc pointer to the callback.
- * @param param an arbitrary parameter which is stored and passed to proc.
- */
- virtual bool setSoundCallback(SoundProc proc, void *param) = 0;
/**
- * Remove any audio callback previously set via setSoundCallback, thus effectively
- * stopping all audio output immediately.
- * @see setSoundCallback
+ * Returh the audio mixer. For more information, refer to the
+ * Audio::Mixer documentation.
*/
- virtual void clearSoundCallback() = 0;
+ virtual Audio::Mixer *getMixer() = 0;
/**
* Determine the output sample rate. Audio data provided by the sound
@@ -972,15 +950,12 @@ public:
*/
virtual void displayMessageOnOSD(const char *msg);
- /** Savefile management. */
- virtual Common::SaveFileManager *getSavefileManager();
-
-
- /** TODO */
- virtual Audio::Mixer *getMixer();
-
- /** TODO */
- virtual Common::TimerManager *getTimerManager();
+ /**
+ * Return the SaveFileManager, used to store and load savestates
+ * and other modifiable persistent game data. For more information,
+ * refer to the TimerManager documentation.
+ */
+ virtual Common::SaveFileManager *getSavefileManager() = 0;
//@}
};
@@ -989,5 +964,4 @@ public:
/** The global OSystem instance. Initialised in main(). */
extern OSystem *g_system;
-
#endif
diff --git a/common/timer.h b/common/timer.h
index a870784bf4..7f660e7742 100644
--- a/common/timer.h
+++ b/common/timer.h
@@ -52,8 +52,6 @@ public:
virtual void removeTimerProc(TimerProc proc) = 0;
};
-extern TimerManager *g_timer;
-
} // End of namespace Common
#endif