[Scummvm-cvs-logs] SF.net SVN: scummvm:[50224] scummvm/branches/gsoc2010-opengl/backends/ platform/sdl
vgvgf at users.sourceforge.net
vgvgf at users.sourceforge.net
Thu Jun 24 19:37:10 CEST 2010
Revision: 50224
http://scummvm.svn.sourceforge.net/scummvm/?rev=50224&view=rev
Author: vgvgf
Date: 2010-06-24 17:37:09 +0000 (Thu, 24 Jun 2010)
Log Message:
-----------
Added a init function to OSystem_SDL for early backend setup, and so allowing better sub classing.
Modified Paths:
--------------
scummvm/branches/gsoc2010-opengl/backends/platform/sdl/main.cpp
scummvm/branches/gsoc2010-opengl/backends/platform/sdl/posix/main.cpp
scummvm/branches/gsoc2010-opengl/backends/platform/sdl/posix/posix.cpp
scummvm/branches/gsoc2010-opengl/backends/platform/sdl/posix/posix.h
scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.cpp
scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.h
scummvm/branches/gsoc2010-opengl/backends/platform/sdl/win32/main.cpp
scummvm/branches/gsoc2010-opengl/backends/platform/sdl/win32/win32.cpp
scummvm/branches/gsoc2010-opengl/backends/platform/sdl/win32/win32.h
Modified: scummvm/branches/gsoc2010-opengl/backends/platform/sdl/main.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/sdl/main.cpp 2010-06-24 17:13:32 UTC (rev 50223)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/sdl/main.cpp 2010-06-24 17:37:09 UTC (rev 50224)
@@ -40,13 +40,19 @@
g_system = new OSystem_SDL();
assert(g_system);
+ // Pre initialize the backend
+ ((OSystem_SDL *)g_system)->init();
+
#ifdef DYNAMIC_MODULES
PluginManager::instance().addPluginProvider(new SDLPluginProvider());
#endif
// Invoke the actual ScummVM main entry point:
int res = scummvm_main(argc, argv);
+
+ // Free OSystem
delete (OSystem_SDL *)g_system;
+
return res;
}
Modified: scummvm/branches/gsoc2010-opengl/backends/platform/sdl/posix/main.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/sdl/posix/main.cpp 2010-06-24 17:13:32 UTC (rev 50223)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/sdl/posix/main.cpp 2010-06-24 17:37:09 UTC (rev 50224)
@@ -37,13 +37,19 @@
g_system = new OSystem_POSIX();
assert(g_system);
+ // Pre initialize the backend
+ ((OSystem_POSIX *)g_system)->init();
+
#ifdef DYNAMIC_MODULES
PluginManager::instance().addPluginProvider(new SDLPluginProvider());
#endif
// Invoke the actual ScummVM main entry point:
int res = scummvm_main(argc, argv);
+
+ // Free OSystem
delete (OSystem_POSIX *)g_system;
+
return res;
}
Modified: scummvm/branches/gsoc2010-opengl/backends/platform/sdl/posix/posix.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/sdl/posix/posix.cpp 2010-06-24 17:13:32 UTC (rev 50223)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/sdl/posix/posix.cpp 2010-06-24 17:37:09 UTC (rev 50224)
@@ -44,8 +44,14 @@
#define DEFAULT_CONFIG_FILE ".scummvmrc"
OSystem_POSIX::OSystem_POSIX() {
+}
+
+void OSystem_Win32::init() {
// Initialze File System Factory
_fsFactory = new POSIXFilesystemFactory();
+
+ // Invoke parent implementation of this method
+ OSystem_SDL::init();
}
void OSystem_POSIX::initBackend() {
Modified: scummvm/branches/gsoc2010-opengl/backends/platform/sdl/posix/posix.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/sdl/posix/posix.h 2010-06-24 17:13:32 UTC (rev 50223)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/sdl/posix/posix.h 2010-06-24 17:37:09 UTC (rev 50224)
@@ -33,6 +33,8 @@
OSystem_POSIX();
virtual ~OSystem_POSIX() {}
+ virtual void init();
+
virtual void initBackend();
protected:
Modified: scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.cpp 2010-06-24 17:13:32 UTC (rev 50223)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.cpp 2010-06-24 17:37:09 UTC (rev 50224)
@@ -54,18 +54,25 @@
deinit();
}
+void OSystem_SDL::init() {
+ // Initialize SDL
+ initSDL();
+
+ // Creates the early needed managers, if they don't exist yet
+ // (we check for this to allow subclasses to provide their own).
+ if (_mutexManager == 0)
+ _mutexManager = new SdlMutexManager();
+
+ if (_timerManager == 0)
+ _timerManager = new SdlTimerManager();
+}
+
void OSystem_SDL::initBackend() {
// Check if backend has not been initialized
assert(!_inited);
- // Initialize SDL
- initSDL();
-
// Creates the backend managers, if they don't exist yet (we check
// for this to allow subclasses to provide their own).
- if (_mutexManager == 0)
- _mutexManager = new SdlMutexManager();
-
if (_eventManager == 0)
_eventManager = new SdlEventManager(this);
@@ -79,9 +86,6 @@
_mixerManager->init();
}
- if (_timerManager == 0)
- _timerManager = new SdlTimerManager();
-
if (_graphicsManager == 0)
_graphicsManager = new SdlGraphicsManager();
Modified: scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.h 2010-06-24 17:13:32 UTC (rev 50223)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.h 2010-06-24 17:37:09 UTC (rev 50224)
@@ -41,6 +41,12 @@
OSystem_SDL();
virtual ~OSystem_SDL();
+ /** Pre-initialize backend, it should be called after
+ * instantiating the backend. Early needed managers
+ * are created here.
+ */
+ virtual void init();
+
virtual void initBackend();
virtual Common::HardwareKeySet *getHardwareKeySet();
Modified: scummvm/branches/gsoc2010-opengl/backends/platform/sdl/win32/main.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/sdl/win32/main.cpp 2010-06-24 17:13:32 UTC (rev 50223)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/sdl/win32/main.cpp 2010-06-24 17:37:09 UTC (rev 50224)
@@ -50,13 +50,19 @@
g_system = new OSystem_Win32();
assert(g_system);
+ // Pre initialize the backend
+ ((OSystem_Win32 *)g_system)->init();
+
#ifdef DYNAMIC_MODULES
PluginManager::instance().addPluginProvider(new SDLPluginProvider());
#endif
// Invoke the actual ScummVM main entry point:
int res = scummvm_main(argc, argv);
+
+ // Free OSystem
delete (OSystem_Win32 *)g_system;
+
return res;
}
Modified: scummvm/branches/gsoc2010-opengl/backends/platform/sdl/win32/win32.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/sdl/win32/win32.cpp 2010-06-24 17:13:32 UTC (rev 50223)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/sdl/win32/win32.cpp 2010-06-24 17:37:09 UTC (rev 50224)
@@ -47,8 +47,14 @@
#define DEFAULT_CONFIG_FILE "scummvm.ini"
OSystem_Win32::OSystem_Win32() {
+}
+
+void OSystem_Win32::init() {
// Initialze File System Factory
_fsFactory = new WindowsFilesystemFactory();
+
+ // Invoke parent implementation of this method
+ OSystem_SDL::init();
}
Common::String OSystem_Win32::getDefaultConfigFileName() {
Modified: scummvm/branches/gsoc2010-opengl/backends/platform/sdl/win32/win32.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/sdl/win32/win32.h 2010-06-24 17:13:32 UTC (rev 50223)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/sdl/win32/win32.h 2010-06-24 17:37:09 UTC (rev 50224)
@@ -33,6 +33,8 @@
OSystem_Win32();
~OSystem_Win32() {}
+ void init();
+
protected:
Common::String getDefaultConfigFileName();
};
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