[Scummvm-cvs-logs] scummvm master -> 28c5d298f592e14468b722a781024298c3c8fa7b

fingolfin max at quendi.de
Wed Jun 8 14:53:07 CEST 2011


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
fce7f90a94 BACKENDS: Shuffle backends class hierarchy and module initialization
28c5d298f5 COMMON: Fix OSystem docs


Commit: fce7f90a94165158ea93d5969d795ad5a565847c
    https://github.com/scummvm/scummvm/commit/fce7f90a94165158ea93d5969d795ad5a565847c
Author: Max Horn (max at quendi.de)
Date: 2011-06-08T05:29:22-07:00

Commit Message:
BACKENDS: Shuffle backends class hierarchy and module initialization

Changed paths:
    backends/base-backend.cpp
    backends/base-backend.h
    backends/modular-backend.h
    backends/platform/android/android.cpp
    backends/platform/android/android.h
    backends/platform/dc/dc.h
    backends/platform/dc/dcmain.cpp
    backends/platform/ds/arm9/source/osystem_ds.cpp
    backends/platform/ds/arm9/source/osystem_ds.h
    backends/platform/iphone/osys_main.cpp
    backends/platform/iphone/osys_main.h
    backends/platform/n64/osys_n64.h
    backends/platform/n64/osys_n64_base.cpp
    backends/platform/ps2/systemps2.h
    backends/platform/psp/osys_psp.cpp
    backends/platform/psp/osys_psp.h
    backends/platform/sdl/sdl.h
    backends/platform/wii/osystem.cpp
    backends/platform/wii/osystem.h
    common/system.cpp



diff --git a/backends/base-backend.cpp b/backends/base-backend.cpp
index b5c1852..8d22ab7 100644
--- a/backends/base-backend.cpp
+++ b/backends/base-backend.cpp
@@ -29,6 +29,11 @@
 #include "backends/events/default/default-events.h"
 #endif
 
+#ifndef DISABLE_DEFAULT_AUDIOCD_MANAGER
+#include "backends/audiocd/default/default-audiocd.h"
+#endif
+
+
 #include "gui/message.h"
 
 void BaseBackend::displayMessageOnOSD(const char *msg) {
@@ -41,7 +46,13 @@ void BaseBackend::initBackend() {
 	// Init Event manager
 #ifndef DISABLE_DEFAULT_EVENT_MANAGER
 	if (!_eventManager)
-		_eventManager = new DefaultEventManager(this);
+		_eventManager = new DefaultEventManager(getDefaultEventSource());
+#endif
+
+	// Init audio CD manager
+#ifndef DISABLE_DEFAULT_AUDIOCD_MANAGER
+	if (!_audiocdManager)
+		_audiocdManager = new DefaultAudioCDManager();
 #endif
 
 	OSystem::initBackend();
diff --git a/backends/base-backend.h b/backends/base-backend.h
index b0dddf9..c797e83 100644
--- a/backends/base-backend.h
+++ b/backends/base-backend.h
@@ -26,7 +26,9 @@
 #include "common/system.h"
 #include "common/events.h"
 
-class BaseBackend : public OSystem, Common::EventSource {
+class BaseBackend : public OSystem {
+protected:
+	virtual Common::EventSource *getDefaultEventSource() = 0;
 public:
 	virtual void initBackend();
 
@@ -34,5 +36,11 @@ public:
 	virtual void fillScreen(uint32 col);
 };
 
+class EventsBaseBackend : public BaseBackend, Common::EventSource {
+protected:
+	virtual Common::EventSource *getDefaultEventSource() { return this; }
+public:
+};
+
 
 #endif
diff --git a/backends/modular-backend.h b/backends/modular-backend.h
index d2c3ce2..3593130 100644
--- a/backends/modular-backend.h
+++ b/backends/modular-backend.h
@@ -23,7 +23,7 @@
 #ifndef BACKENDS_MODULAR_BACKEND_H
 #define BACKENDS_MODULAR_BACKEND_H
 
-#include "common/system.h"
+#include "backends/base-backend.h"
 
 class GraphicsManager;
 class MutexManager;
@@ -44,7 +44,7 @@ class MutexManager;
  * And, it should also initialize all the managers variables
  * declared in this class, or override their related functions.
  */
-class ModularBackend : public OSystem {
+class ModularBackend : public BaseBackend {
 public:
 	ModularBackend();
 	virtual ~ModularBackend();
diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp
index 1acb080..90660cf 100644
--- a/backends/platform/android/android.cpp
+++ b/backends/platform/android/android.cpp
@@ -389,7 +389,7 @@ void OSystem_Android::initBackend() {
 
 	JNI::setReadyForEvents(true);
 
-	BaseBackend::initBackend();
+	EventsBaseBackend::initBackend();
 }
 
 void OSystem_Android::addPluginDirectories(Common::FSList &dirs) const {
diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h
index cd7ad5f..c2ada2a 100644
--- a/backends/platform/android/android.h
+++ b/backends/platform/android/android.h
@@ -103,7 +103,7 @@ protected:
 };
 #endif
 
-class OSystem_Android : public BaseBackend, public PaletteManager {
+class OSystem_Android : public EventsBaseBackend, public PaletteManager {
 private:
 	// passed from the dark side
 	int _audio_sample_rate;
diff --git a/backends/platform/dc/dc.h b/backends/platform/dc/dc.h
index 84fdd58..bde50da 100644
--- a/backends/platform/dc/dc.h
+++ b/backends/platform/dc/dc.h
@@ -70,7 +70,7 @@ class DCCDManager : public DefaultAudioCDManager {
   void updateCD();
 };
 
-class OSystem_Dreamcast : private DCHardware, public BaseBackend, public PaletteManager, public FilesystemFactory
+class OSystem_Dreamcast : private DCHardware, public EventsBaseBackend, public PaletteManager, public FilesystemFactory
 #ifdef DYNAMIC_MODULES
   , public FilePluginProvider
 #endif
diff --git a/backends/platform/dc/dcmain.cpp b/backends/platform/dc/dcmain.cpp
index d1fcdd4..3faf018 100644
--- a/backends/platform/dc/dcmain.cpp
+++ b/backends/platform/dc/dcmain.cpp
@@ -63,7 +63,7 @@ void OSystem_Dreamcast::initBackend()
 
   _audiocdManager = new DCCDManager();
 
-  BaseBackend::initBackend();
+  EventsBaseBackend::initBackend();
 }
 
 
diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp
index 47e93cf..b157a3a 100644
--- a/backends/platform/ds/arm9/source/osystem_ds.cpp
+++ b/backends/platform/ds/arm9/source/osystem_ds.cpp
@@ -134,7 +134,7 @@ void OSystem_DS::initBackend() {
 		_audiocdManager = new DSAudioCDManager();
 	*/
 
-	BaseBackend::initBackend();
+	EventsBaseBackend::initBackend();
 }
 
 bool OSystem_DS::hasFeature(Feature f) {
diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h
index b8a12a5..b1222a1 100644
--- a/backends/platform/ds/arm9/source/osystem_ds.h
+++ b/backends/platform/ds/arm9/source/osystem_ds.h
@@ -34,7 +34,7 @@
 #include "graphics/colormasks.h"
 #include "graphics/palette.h"
 
-class OSystem_DS : public BaseBackend, public PaletteManager {
+class OSystem_DS : public EventsBaseBackend, public PaletteManager {
 protected:
 
 	int eventNum;
diff --git a/backends/platform/iphone/osys_main.cpp b/backends/platform/iphone/osys_main.cpp
index 5f27091..9325ed5 100644
--- a/backends/platform/iphone/osys_main.cpp
+++ b/backends/platform/iphone/osys_main.cpp
@@ -98,7 +98,7 @@ void OSystem_IPHONE::initBackend() {
 
 	setTimerCallback(&OSystem_IPHONE::timerHandler, 10);
 
-	BaseBackend::initBackend();
+	EventsBaseBackend::initBackend();
 }
 
 bool OSystem_IPHONE::hasFeature(Feature f) {
diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h
index e5ec22f..14325f8 100644
--- a/backends/platform/iphone/osys_main.h
+++ b/backends/platform/iphone/osys_main.h
@@ -49,7 +49,7 @@ typedef struct AQCallbackStruct {
     AudioStreamBasicDescription dataFormat;
 } AQCallbackStruct;
 
-class OSystem_IPHONE : public BaseBackend, public PaletteManager {
+class OSystem_IPHONE : public EventsBaseBackend, public PaletteManager {
 protected:
 
 	static const OSystem::GraphicsMode s_supportedGraphicsModes[];
diff --git a/backends/platform/n64/osys_n64.h b/backends/platform/n64/osys_n64.h
index 2c908c7..dfa8f58 100644
--- a/backends/platform/n64/osys_n64.h
+++ b/backends/platform/n64/osys_n64.h
@@ -71,7 +71,7 @@ enum GraphicModeID {
 	OVERS_MPAL_340X240
 };
 
-class OSystem_N64 : public BaseBackend, public PaletteManager {
+class OSystem_N64 : public EventsBaseBackend, public PaletteManager {
 protected:
 	Audio::MixerImpl *_mixer;
 
diff --git a/backends/platform/n64/osys_n64_base.cpp b/backends/platform/n64/osys_n64_base.cpp
index 68a1a48..69e8da3 100644
--- a/backends/platform/n64/osys_n64_base.cpp
+++ b/backends/platform/n64/osys_n64_base.cpp
@@ -191,7 +191,7 @@ void OSystem_N64::initBackend() {
 
 	setupMixer();
 
-	BaseBackend::initBackend();
+	EventsBaseBackend::initBackend();
 }
 
 bool OSystem_N64::hasFeature(Feature f) {
diff --git a/backends/platform/ps2/systemps2.h b/backends/platform/ps2/systemps2.h
index d12d02b..35ceaf8 100644
--- a/backends/platform/ps2/systemps2.h
+++ b/backends/platform/ps2/systemps2.h
@@ -44,7 +44,7 @@ namespace Audio {
 class MixerImpl;
 };
 
-class OSystem_PS2 : public BaseBackend, public PaletteManager {
+class OSystem_PS2 : public EventsBaseBackend, public PaletteManager {
 public:
 	OSystem_PS2(const char *elfPath);
 	virtual ~OSystem_PS2(void);
diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp
index 12916f8..01124b4 100644
--- a/backends/platform/psp/osys_psp.cpp
+++ b/backends/platform/psp/osys_psp.cpp
@@ -100,7 +100,7 @@ void OSystem_PSP::initBackend() {
 
 	setupMixer();
 
-	BaseBackend::initBackend();
+	EventsBaseBackend::initBackend();
 }
 
 // Let's us know an engine
@@ -422,7 +422,7 @@ void OSystem_PSP::quit() {
 }
 
 void OSystem_PSP::logMessage(LogMessageType::Type type, const char *message) {
-	BaseBackend::logMessage(type, message);
+	EventsBaseBackend::logMessage(type, message);
 
 	if (type == LogMessageType::kError)
 		PspDebugTrace(false, "%s", message);	// write to file
diff --git a/backends/platform/psp/osys_psp.h b/backends/platform/psp/osys_psp.h
index 8ca0992..e6b445e 100644
--- a/backends/platform/psp/osys_psp.h
+++ b/backends/platform/psp/osys_psp.h
@@ -42,7 +42,7 @@
 #include "backends/timer/psp/timer.h"
 #include "backends/platform/psp/thread.h"
 
-class OSystem_PSP : public BaseBackend, public PaletteManager {
+class OSystem_PSP : public EventsBaseBackend, public PaletteManager {
 private:
 
 	Audio::MixerImpl *_mixer;
diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h
index 917fac5..9c08752 100644
--- a/backends/platform/sdl/sdl.h
+++ b/backends/platform/sdl/sdl.h
@@ -91,6 +91,8 @@ protected:
 	 */
 	SdlEventSource *_eventSource;
 
+	virtual Common::EventSource *getDefaultEventSource() { return _eventSource; }
+
 	/**
 	 * Initialze the SDL library.
 	 */
diff --git a/backends/platform/wii/osystem.cpp b/backends/platform/wii/osystem.cpp
index a981c61..c6b2378 100644
--- a/backends/platform/wii/osystem.cpp
+++ b/backends/platform/wii/osystem.cpp
@@ -144,7 +144,7 @@ void OSystem_Wii::initBackend() {
 	initSfx();
 	initEvents();
 
-	BaseBackend::initBackend();
+	EventsBaseBackend::initBackend();
 }
 
 void OSystem_Wii::quit() {
@@ -361,7 +361,7 @@ Common::String OSystem_Wii::getSystemLanguage() const {
 	} else {
 		// This will only happen when new languages are added to the API.
 		warning("WII: Unknown system language: %d", langID);
-		return BaseBackend::getSystemLanguage();
+		return EventsBaseBackend::getSystemLanguage();
 	}
 }
 #endif // !GAMECUBE
diff --git a/backends/platform/wii/osystem.h b/backends/platform/wii/osystem.h
index fe214a9..6863a68 100644
--- a/backends/platform/wii/osystem.h
+++ b/backends/platform/wii/osystem.h
@@ -52,7 +52,7 @@ extern void wii_memstats(void);
 }
 #endif
 
-class OSystem_Wii : public BaseBackend, public PaletteManager {
+class OSystem_Wii : public EventsBaseBackend, public PaletteManager {
 private:
 	s64 _startup_time;
 
diff --git a/common/system.cpp b/common/system.cpp
index 286ec41..fae7a3e 100644
--- a/common/system.cpp
+++ b/common/system.cpp
@@ -66,12 +66,6 @@ OSystem::~OSystem() {
 }
 
 void OSystem::initBackend() {
-	// Init audio CD manager
-#ifndef DISABLE_DEFAULT_AUDIOCD_MANAGER
-	if (!_audiocdManager)
-		_audiocdManager = new DefaultAudioCDManager();
-#endif
-
 	// Verify all managers has been set
 	if (!_audiocdManager)
 		error("Backend failed to instantiate audio CD manager");


Commit: 28c5d298f592e14468b722a781024298c3c8fa7b
    https://github.com/scummvm/scummvm/commit/28c5d298f592e14468b722a781024298c3c8fa7b
Author: Max Horn (max at quendi.de)
Date: 2011-06-08T05:39:30-07:00

Commit Message:
COMMON: Fix OSystem docs

Changed paths:
    common/system.h



diff --git a/common/system.h b/common/system.h
index bea4634..d26bc59 100644
--- a/common/system.h
+++ b/common/system.h
@@ -118,8 +118,9 @@ protected:
 	//@{
 
 	/**
-	 * If no value is provided for this slot, then OSystem::initBackend()
-	 * will populate it with a DefaultAudioCDManager instance.
+	 * No default value is provided for _audiocdManager by OSystem.
+	 * However, BaseBackend::initBackend() does set a default value
+	 * if none has been set before.
 	 *
 	 * @note _audiocdManager is deleted by the OSystem destructor.
 	 */






More information about the Scummvm-git-logs mailing list