[Scummvm-cvs-logs] SF.net SVN: scummvm: [24405] scummvm/trunk
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Sat Oct 21 14:03:56 CEST 2006
Revision: 24405
http://svn.sourceforge.net/scummvm/?rev=24405&view=rev
Author: fingolfin
Date: 2006-10-21 05:03:43 -0700 (Sat, 21 Oct 2006)
Log Message:
-----------
Added OSystem::getTimerManager and OSystem::getMixer methods (wip)
Modified Paths:
--------------
scummvm/trunk/base/main.cpp
scummvm/trunk/common/system.cpp
scummvm/trunk/common/system.h
scummvm/trunk/engines/engine.cpp
scummvm/trunk/engines/engine.h
Modified: scummvm/trunk/base/main.cpp
===================================================================
--- scummvm/trunk/base/main.cpp 2006-10-21 11:14:41 UTC (rev 24404)
+++ scummvm/trunk/base/main.cpp 2006-10-21 12:03:43 UTC (rev 24405)
@@ -44,6 +44,7 @@
#include "gui/newgui.h"
#include "gui/message.h"
#include "sound/mididrv.h"
+#include "sound/mixer.h"
#if defined(_WIN32_WCE)
#include "backends/platform/wince/CELauncherDialog.h"
@@ -225,6 +226,11 @@
return result;
}
+
+// FIXME: Temporary hack, to be removed soon
+Audio::Mixer *g_mixer = 0;
+
+
extern "C" int scummvm_main(int argc, char *argv[]) {
Common::String specialDebug;
Common::String command;
@@ -284,6 +290,8 @@
// Create the timer services
Common::g_timer = new DefaultTimerManager(&system);
+
+ g_mixer = new Audio::Mixer();
// Set initial window caption
system.setWindowCaption(gScummVMFullVersion);
@@ -328,6 +336,9 @@
launcherDialog(system);
}
+ // Deinit the mixer
+ delete g_mixer;
+
// Deinit the timer
delete Common::g_timer;
Modified: scummvm/trunk/common/system.cpp
===================================================================
--- scummvm/trunk/common/system.cpp 2006-10-21 11:14:41 UTC (rev 24404)
+++ scummvm/trunk/common/system.cpp 2006-10-21 12:03:43 UTC (rev 24405)
@@ -31,6 +31,7 @@
#include "common/config-manager.h"
#include "common/system.h"
+#include "common/timer.h"
#include "common/util.h"
OSystem *g_system = 0;
@@ -63,10 +64,23 @@
}
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;
}
Modified: scummvm/trunk/common/system.h
===================================================================
--- scummvm/trunk/common/system.h 2006-10-21 11:14:41 UTC (rev 24404)
+++ scummvm/trunk/common/system.h 2006-10-21 12:03:43 UTC (rev 24405)
@@ -28,12 +28,17 @@
#include "common/mutex.h"
#include "common/rect.h"
+namespace Audio {
+ class Mixer;
+}
+
namespace Graphics {
struct Surface;
}
namespace Common {
class SaveFileManager;
+ class TimerManager;
}
/**
@@ -970,6 +975,13 @@
/** Savefile management. */
virtual Common::SaveFileManager *getSavefileManager();
+
+ /** TODO */
+ virtual Audio::Mixer *getMixer();
+
+ /** TODO */
+ virtual Common::TimerManager *getTimerManager();
+
//@}
};
Modified: scummvm/trunk/engines/engine.cpp
===================================================================
--- scummvm/trunk/engines/engine.cpp 2006-10-21 11:14:41 UTC (rev 24404)
+++ scummvm/trunk/engines/engine.cpp 2006-10-21 12:03:43 UTC (rev 24405)
@@ -26,32 +26,31 @@
#include "common/timer.h"
#include "common/savefile.h"
#include "common/system.h"
-#include "sound/mixer.h"
#include "gui/message.h"
+#include "sound/mixer.h"
#ifdef _WIN32_WCE
extern bool isSmartphone(void);
#endif
-/* FIXME - BIG HACK for MidiEmu */
+// FIXME - BIG HACK for MidiEmu & error()
Engine *g_engine = 0;
+
Engine::Engine(OSystem *syst)
: _system(syst),
+ _mixer(_system->getMixer()),
+ _timer(_system->getTimerManager()),
+ _saveFileMan(_system->getSavefileManager()),
_gameDataPath(ConfMan.get("path")),
- _targetName(ConfMan.getActiveDomainName()){
- g_engine = this;
- _mixer = new Audio::Mixer();
+ _targetName(ConfMan.getActiveDomainName()) {
- _timer = Common::g_timer;
-
- _saveFileMan = _system->getSavefileManager();
-
+ g_engine = this;
_autosavePeriod = ConfMan.getInt("autosave_period");
}
Engine::~Engine() {
- delete _mixer;
+ _mixer->stopAll(true);
delete _saveFileMan;
g_engine = NULL;
Modified: scummvm/trunk/engines/engine.h
===================================================================
--- scummvm/trunk/engines/engine.h 2006-10-21 11:14:41 UTC (rev 24404)
+++ scummvm/trunk/engines/engine.h 2006-10-21 12:03:43 UTC (rev 24405)
@@ -45,9 +45,10 @@
Common::TimerManager * _timer;
protected:
+ Common::SaveFileManager *_saveFileMan;
+
const Common::String _targetName; // target name for saves
const Common::String _gameDataPath;
- Common::SaveFileManager *_saveFileMan;
private:
int _autosavePeriod;
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