aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorMax Horn2006-04-02 14:16:31 +0000
committerMax Horn2006-04-02 14:16:31 +0000
commit9217472f0e4e801659c0a448dcbf57c28fd36ee2 (patch)
treeb880dfbd4a18f93f78931749004c3a4e128f2f59 /common
parent72f4a1c76cb8aedf6f953e57090134320d7291b8 (diff)
downloadscummvm-rg350-9217472f0e4e801659c0a448dcbf57c28fd36ee2.tar.gz
scummvm-rg350-9217472f0e4e801659c0a448dcbf57c28fd36ee2.tar.bz2
scummvm-rg350-9217472f0e4e801659c0a448dcbf57c28fd36ee2.zip
With this change, backends are now responsible for instantiating their OSystem class before calling scummvm_main (Note: PalmOS and Symbian are not yet converted, and won't work currently)
svn-id: r21557
Diffstat (limited to 'common')
-rw-r--r--common/system.cpp39
-rw-r--r--common/system.h16
2 files changed, 11 insertions, 44 deletions
diff --git a/common/system.cpp b/common/system.cpp
index 7b3a8064e8..642012badc 100644
--- a/common/system.cpp
+++ b/common/system.cpp
@@ -34,44 +34,7 @@
#include "common/system.h"
#include "common/util.h"
-DECLARE_SINGLETON(OSystem);
-
-OSystem *OSystem::makeInstance() {
- // Attention: Do not call parseGraphicsMode() here, nor any other function
- // which needs to access the OSystem instance, else you get stuck in an
- // endless loop.
-
-#if defined(USE_NULL_DRIVER)
- return OSystem_NULL_create();
-#elif defined(__DC__)
- return OSystem_Dreamcast_create();
-#elif defined(X11_BACKEND)
- return OSystem_X11_create();
-#elif defined(__MORPHOS__)
- return OSystem_MorphOS_create();
-#elif defined(_WIN32_WCE)
- return OSystem_WINCE3_create();
-#elif defined(__GP32__) // ph0x
- return OSystem_GP32_create();
-#elif defined(PALMOS_MODE) //chrilith
-# if defined(COMPILE_OS5)
- return OSystem_PalmOS5_create();
-# elif defined(COMPILE_ZODIAC)
- return OSystem_PalmZodiac_create();
-# else
- return OSystem_PALMOS_create(); // old backend
-# endif
-#elif defined(__PLAYSTATION2__)
- return OSystem_PS2_create();
-#elif defined(__PSP__)
- return OSystem_PSP_create();
-#elif defined(__SYMBIAN32__) // SumthinWicked / Sprawl
- return OSystem_SymbianOS_create();
-#else
- /* SDL is the default driver for now */
- return OSystem_SDL_create();
-#endif
-}
+OSystem *g_system = 0;
bool OSystem::setGraphicsMode(const char *name) {
if (!name)
diff --git a/common/system.h b/common/system.h
index 115b9e7afa..2c22fb4132 100644
--- a/common/system.h
+++ b/common/system.h
@@ -27,7 +27,6 @@
#include "common/scummsys.h"
#include "common/mutex.h"
#include "common/rect.h"
-#include "common/singleton.h"
namespace Graphics {
struct Surface;
@@ -47,10 +46,15 @@ namespace Common {
* methods to create timers, to handle user input events,
* control audio CD playback, and sound output.
*/
-class OSystem : public Common::Singleton<OSystem> {
+class OSystem {
+private:
+ // Prevent copying OSystem objects by accident.
+ OSystem(const OSystem&);
+ OSystem& operator= (const OSystem&);
+
protected:
- static OSystem *makeInstance();
- friend class Common::Singleton<SingletonBaseType>;
+ OSystem() { }
+ virtual ~OSystem() { }
public:
@@ -926,8 +930,8 @@ public:
};
-/** The global OSystem instance. Inited in main(). */
-#define g_system (&OSystem::instance())
+/** The global OSystem instance. Initialised in main(). */
+extern OSystem *g_system;
#endif